-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting a type error when using an OpenAPI spec with a header that's missing schema.type #430
Comments
🎉 Thanks for opening your first issue here! Welcome to the community! |
Hi @benlei, can you share a link to of copy of the full OpenAPI spec? |
@sserrata Sure I created a repo: https://github.com/benlei/docusaurus-openapi-docs-failed-to-gen Specifically added this from the template repo: https://github.com/benlei/docusaurus-openapi-docs-failed-to-gen/blob/master/examples/petstore.yaml#L857 And when I run
|
I probably should setup a linter some time later... but besides that, It would be convenient for it to fallback, or at the very least have a more descriptive message about what what field/line/etc has the issue so that it can be quickly addressed. |
Hi @benlei, I agree the logging could be improved. It's on our roadmap to improve logging/error-handling. I did a bit more research and came across this thread: OAI/OpenAPI-Specification#1657 After skimming through some of the responses/opinions, I think there's a strong case/consensus around interpreting no |
Available to test in |
…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]>
Describe the bug
I would get an error with the following message:
Here's how a part of my OpenAPI spec looks like:
With other generators it seems to be less strict.
Expected behavior
It'd be nice if there was a way to be less strict / default to string.
Current behavior
When running
yarn docusaurus gen-api-docs all
you get the following:Possible solution
Make it less strict, or default to a string type if type property is undefined.
Context
Currently the Swagger docs for some projects are kind of hand written and aren't perfect - but the Swagger UI page for those projects still render just fine. It would be nice if the strictness could be toned down / default to string if type isn't present.
Your Environment
The text was updated successfully, but these errors were encountered: