Skip to content

bug: oneOf union type is not handled correctly #10

@tmeckel

Description

@tmeckel
model A {
  value: string;
}

model B {
  value: integer;
}

@oneOf
union MyType {
   a: A,
   b: B
}

model UseOne {
   data: MyType;
};

Code generation creates the correct base type class MyType with

[JsonSubtypes.KnownSubType(typeof(A), "a")]
[JsonSubtypes.KnownSubType(typeof(B), "b")]

but adds properties from the union types instead of

[JsonPolymorphic(TypeDiscriminatorPropertyName = "kind")]
[JsonSubtypes.KnownSubType(typeof(A), "a")]
[JsonSubtypes.KnownSubType(typeof(B), "b")]
public abstract class MyType {
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions