Skip to content

Abstract Class Data Loss With SDK Generation with AllOf Tag #18

@mmmasent

Description

@mmmasent

Yardarm will generate an interface with a discriminator property for abstract classes, given that there is a discriminator property associated with the class spec. Inheriting classes will reference the parent class with the allOf tag. Yardarm fails to correctly parse the allOf tag. Inheriting classes that do not explicitly define the properties from the parent will fail to have the properties added to them after sdk generation. For abstract classes, this means that any property desired for the subclasses must be defined abstractly rather than concretely.

A spec generated with the all of tag from the following Example:

AbstractA
 public FakeEnum Discriminator { get; set; }
 public int TestInt { get; set; }

ImplementationA: AbstractA
 public string TestString { get; set; }

will result in the following sdk generation:

IAbstractA

ImplementationA: IAbstractA
 public string TestString { get; set; }

This is due to the properties not being explicitly defined in the open api spec but inferred with the all of tag.
To get around this, implementing classes will need to override abstract properties.

Yardarm should successfully parse all of tags without the need for overriding abstract properties

Note: Nesting inheritance hierarchies should work as well

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions