-
Notifications
You must be signed in to change notification settings - Fork 102
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
Rework update_openapi function. #523
Rework update_openapi function. #523
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good -- I left one inline comment requesting more documentation so I can feel better about my knowledge of how the patching is working.
I requested changes b/c I think it would be more appropriate to deprecate, rather than than remove, the unused functions and classes. While we don't have a published deprecation strategy for stac-fastapi (note to self: TODO), there's enough implementations of this repo in the wild that I'm cautious about any breaking changes, however small. IMO deprecating both VndOaiRespone
and config_openapi
, with a plan to remove in v3.0, would be appropriate.
Thanks for the contribution!
@gadomski Added the functions back and added some deprecation warnings to them. It seems unlikely to be necessary, but being cautious is reasonable. It doesn't prevent private repos from using them, but there are no repos outside of I also made some minor tweaks to the patch to hopefully make it more clear. There are potentially other options, like a hybrid of the old implementation of this one. Still create a new route, but with this patched endpoint function. I am certainly biased, but I prefer this way because it requires the least changes and code so there are less things to go wrong. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Related Issue(s):
Description:
The current implementation of
update_openapi
duplicates code from fastapi/applications.py#L216 without context and could end up out of sync with the source. Rather than duplicating code this implementation just wraps it and modifies the response's content-type header.While there are tests for the content-type header in other portions of the repo, there was not one in
stac_fastapi/api/tests
. To ease debugging I added a test to have one closer to the code that implements it.I also removed the code that was marked with a
TODO
to remove or fix it. It was not being utilized and it seems like stac_fastapi/api/app.py#L311 would be the place to do any changes in the future. While I did just notice #499 would remove that function for now, I still believe that would be the appropriate location if modifications to the schema are necessary in the future.PR Checklist:
pre-commit run --all-files
)make test
)make docs
)