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
Improvements/fixes for openapi.json #332
Comments
Thanks for the report and considerations @giovannipizzi. Point 2 is remedied by pydantic validators, but we could instead move to |
Leaving this here for reference of updated behaviour of |
FastAPI also has extensive documentation on customizing and extending the OpenAPI schemas. |
It would be good to fix some of these things in parallel to updating the models, so that we can provide our best OpenAPI schema ASAP for Materials-Consortia/OPTIMADE#286 |
For sure - also, several of the models updates can be fixed by a single PR. |
#350 implements |
After the issue that @CasperWA found in #306, I gave a look to the openapi.json file.
I admit I'm not 100% sure of understanding it, so some comments here are wrong.
Shouldn't
type
still be required for links? It has been removed hereProbably the error @CasperWA was finding is that the correct way to specify possible values is via an
enum
? Here in Update links resources #306 there was an attempt of using anyOf, then reverted. Maybe @CasperWA you can try to use enums and check if it works (and maybe check if there are other points were we should use enum as well?By looking at the way you tried to use
anyOf
, and then check the docs of swagger, I got the impression you actually meanoneOf
, at least in that case. Here are the docs explaining the difference (oneOf
means exactly one of the two,anyOf
means any combination of the two schemas). This raises a doubt: are we usinganyOf/oneOf
correctly in the openapi.json and index_openapi.json files? Just to make an example:https://github.com/Materials-Consortia/optimade-python-tools/blob/master/openapi/index_openapi.json#L23
Should this be either a response or an error, or a combination of them is also OK? I don't remember the specs, but this is just to raise awareness and trigger a careful check of the schema.
The text was updated successfully, but these errors were encountered: