You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a yaml definition such as the one provided above, the rendered example value for the request doesn't display all of the example values. In the example yaml with issue, note that the schema HolidayEmployee uses the allOf keyword and then also has a property employee that uses allOf, which in turn is referencing Employee, which uses the allOf keyword to reference Person.
When HolidayEmployee is defined in this order, in the example value for the POST /holidays/holidayEmployees endpoint, firstName and lastName properties from the Person schema are missing. If HolidayEmployee is instead defined like in the yaml work workaround example, with the properties defined before using the allOf keyword, then the example value shown by SwaggerUI shows all of the values.
Expand the POST /holidays/holidayEmployees endpoint
Observe the example request value shown
Paste the example yaml with workaround from above
Expand the POST /holidays/holidayEmployees endpoint
Observe the example request value shonw
Expected behavior
Expect the displayed example request value to look the same regardless of the order in which allOf and properties are defined.
Screenshots
Example request value using spec with issue
Example request value using spec with workaround
Additional context or thoughts
Although I've shown a workaround by reordering how the schema is defined, this isn't a viable workaround in our actual application because the spec we're displaying is generated in a way that we do not have control over. Since the definition is valid either way, we would expect the displayed example value to be the same in both cases.
The text was updated successfully, but these errors were encountered:
Q&A (please complete the following information)
Content & configuration
Example Swagger/OpenAPI definition:
Example yaml with issue:
Example yaml with workaround:
Swagger-UI configuration options: nothing special in particular, it's reproducible at https://editor-next.swagger.io/
Describe the bug you're encountering
When using a yaml definition such as the one provided above, the rendered example value for the request doesn't display all of the example values. In the example yaml with issue, note that the schema
HolidayEmployee
uses theallOf
keyword and then also has a propertyemployee
that usesallOf
, which in turn is referencingEmployee
, which uses theallOf
keyword to referencePerson
.When
HolidayEmployee
is defined in this order, in the example value for thePOST /holidays/holidayEmployees
endpoint,firstName
andlastName
properties from thePerson
schema are missing. IfHolidayEmployee
is instead defined like in the yaml work workaround example, with the properties defined before using theallOf
keyword, then the example value shown by SwaggerUI shows all of the values.To reproduce...
Steps to reproduce the behavior:
POST /holidays/holidayEmployees
endpointPOST /holidays/holidayEmployees
endpointExpected behavior
Expect the displayed example request value to look the same regardless of the order in which
allOf
andproperties
are defined.Screenshots
Example request value using spec with issue
Example request value using spec with workaround
Additional context or thoughts
Although I've shown a workaround by reordering how the schema is defined, this isn't a viable workaround in our actual application because the spec we're displaying is generated in a way that we do not have control over. Since the definition is valid either way, we would expect the displayed example value to be the same in both cases.
The text was updated successfully, but these errors were encountered: