Closed jurgenf closed 3 years ago
Given the following OpenApi property defintion:
PropertyName: type: array items: allOf: - $ref: [basic implementation].yaml - anyOf: - $ref: [concrete implementation 1].yaml - $ref: [concrete implementation 2].yaml
I expect this to mean: all items have to adhere to definition [basic implementation] and any of the referenced concrete implementations.
[basic implementation]
The generated model has the following typehint:
PropertyName: Array<BasicImplementation & ConcreteImplementation1 | ConcreteImplementation2>;
Given that the & operator precedes the | operator this is interpreted as:
&
|
PropertyName: Array<(BasicImplementation & ConcreteImplementation1) | ConcreteImplementation2>;
But I would expect this to be:
PropertyName: Array<BasicImplementation & (ConcreteImplementation1 | ConcreteImplementation2)>;
I suspect the generated code is incorrect and the or parts should be parenthesized. Or is my understanding of the usage of the allOf/anyOf incorrect?
or
allOf
anyOf
This is a duplicate of #111. The mentioned PR includes tentative fix for #109, which is way more complex. That's why it wasn't merged. Any help is welcome.
Given the following OpenApi property defintion:
I expect this to mean: all items have to adhere to definition
[basic implementation]
and any of the referenced concrete implementations.The generated model has the following typehint:
Given that the
&
operator precedes the|
operator this is interpreted as:But I would expect this to be:
I suspect the generated code is incorrect and the
or
parts should be parenthesized. Or is my understanding of the usage of theallOf
/anyOf
incorrect?