-
Notifications
You must be signed in to change notification settings - Fork 572
fix openapi spec import for specific urls #907
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
base: main
Are you sure you want to change the base?
Conversation
Added a workaround in |
@Udhay-Adithya Can you add links to more real world openAPI spec URLs for which our parser works or doesn't works? |
APIDash - Works without any fix |
It’s not our parser that causes the issue. The failures come from the documents themselves and how the openapi_spec package (correctly) enforces OpenAPI shapes. Valid security fields work fine as per the package docs; the broken cases are due to invalid spec content. Findings per document
Steps to reproduce failures from local files,
How to run
Expected outcomes
|
@Udhay-Adithya these comments are insightful. I will create a dev doc adding your comments and merge this PR. THank you. |
PR Description
The OpenAPI import feature was failing when trying to import specifications from URLs like
https://catfact.ninja/docs?api-docs.json
. The error "The fetched content does not look like a valid OpenAPI spec (JSON or YAML)" was shown even though the content was a valid OpenAPI 3.0 specification. This was caused by a bug in theopenapi_spec
package (v0.15.0) that cannot parse OpenAPI specs containing"security": [[]]
(empty security arrays), which is valid according to the OpenAPI 3.0 specification.Related Issues
Checklist
main
branch before making this PRflutter upgrade
and verify)flutter test
) and all tests are passingAdded/updated tests?
OS on which you have developed and tested the feature?