Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OpenAPI] Add "type" property with value "object" response schema to …
…fix Infragistics AppBuilder tooling (#2283) ## Why make this change? - Closes #2212 which describes how the missing `"type":"object"` key/value pair on the response child object schema breaks certain client tooling. in this case: Infragistics AppBuilder. ### Background I found a relevant thread that discusses whether type is a required property. Consensus is that type isn't required: OAI/OpenAPI-Specification#1657 OpenAPI-Specification discussion PaloAltoNetworks/docusaurus-openapi-docs#430 Example of how different tooling handles type or missing type differently. Ultimately, different tooling handles the presence of the type property differently. Some may try to guess the type when not present: The fact that the type isn't required means that https://github.com/microsoft/OpenAPI.NET didn't complain about missing type. An error if type were required would have helped prevent this becoming an issue in the first place. ## What is this change? - Adds `"type": "object"` to the openapi document for describing the response schema: ```json "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", // <--- This property/value "properties": { "value": { "type": "array", "items": { "$ref": "#/components/schemas/Book" } }, "nextLink": { "type": "string" } } } } } } ``` ## How was this tested? - [x] Integration Tests - [ ] Unit Tests ## Sample Request(s) View generated schema at ```https GET localhost:5001/api/openapi ``` Co-authored-by: Abhishek Kumar <[email protected]>
- Loading branch information