Skip to content
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

Relative References in URLs #5

Closed
jtv8 opened this issue Sep 27, 2021 · 1 comment · Fixed by #10
Closed

Relative References in URLs #5

jtv8 opened this issue Sep 27, 2021 · 1 comment · Fixed by #10

Comments

@jtv8
Copy link
Contributor

jtv8 commented Sep 27, 2021

See 3.1.0 OpenAPI specification:

Relative References in URLs

Unless specified otherwise, all properties that are URLs MAY be relative references as defined by RFC3986. Unless specified otherwise, relative references are resolved using the URLs defined in the Server Object as a Base URL. Note that these themselves MAY be relative to the referring document.

Because the required types for URLs in the Pydanic models are AnyURL, setting them to a relative URL (e.g. setting components -> securitySchemes -> OAuth2PasswordBearer -> flows -> password -> tokenUrl to auth/token) causes the following:

pydantic.error_wrappers.ValidationError:
invalid or missing URL scheme (type=value_error.url.scheme)

For example, this will fail to validate the OpenAPI specs generated by FastAPI when following the OAuth2 security tutorial.

kuimono added a commit that referenced this issue Feb 3, 2022
kuimono added a commit that referenced this issue Feb 3, 2022
Fix issue #5 for url types in `SecurityScheme`, `OAuthFlow`
@kuimono kuimono linked a pull request Feb 3, 2022 that will close this issue
@kuimono kuimono closed this as completed Feb 3, 2022
@jtv8
Copy link
Contributor Author

jtv8 commented Feb 7, 2022

Thanks for the fix! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants