Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nullable properties are lost #39

Open
Atulin opened this issue Oct 10, 2020 · 0 comments
Open

Nullable properties are lost #39

Atulin opened this issue Oct 10, 2020 · 0 comments

Comments

@Atulin
Copy link

Atulin commented Oct 10, 2020

Source classes:

public class CommentDto
{
    public long Id { get; set; }
    public UserSimpleDto? Author { get; set; }
    public DateTime DateTime { get; set; }
    public DateTime? LastEdit { get; set; }
    public ushort EditCount { get; set; }
    public bool Owned { get; set; }
    public string Body { get; set; }
    public EDeletedBy? DeletedBy { get; set; }
}
public class UserSimpleDto
{
    public string UserName { get; set; }
    public string Avatar { get; set; }
    public string Title { get; set; }
    public IEnumerable<RoleDto> Roles { get; set; }
}
public class RoleDto
{
    public long Id { get; set; }
    public string Name { get; set; }
    public string? Color { get; set; }
    public bool IsStaff { get; set; }
    public int Order { get; set; }
}

Generated classes:

export interface CommentDto {
    id: number;
    author?: any;
    dateTime: Date;
    lastEdit?: Date;
    editCount: number;
    owned: boolean;
    body: string;
    deletedBy?: any;
}
import { RoleDto } from "./roleDto";

export interface UserSimpleDTO {
    userName: string;
    avatar: string;
    title: string;
    roles: RoleDto[];
}
export interface RoleDto {
    id: number;
    name: string;
    color?: string;
    isStaff: boolean;
    order: number;
}

While the userSimpleDTO references RoleDto properly, CommentDto does not reference UserSimpleDTO, instead opting for any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant