-
Notifications
You must be signed in to change notification settings - Fork 12
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
nullable + allOf does this work? #333
Comments
Yeah, the hell of "nullable"... I'm also not 100% sure. The reason is that nullable is just not clearly defined by the implements spec version 3.0.2, so everybody can argue differently. They have clarified in 3.0.3, but that was just recently and is not included in our API yet. The way forward is likely to just add the types to the "standalone" nullables and change the OpenAPI version to 3.0.3. We can surely do this in a backward compatible manner and thus just have it in openEO API version 1.0.1. Long-term the issue will go away anyway with OpenAPI version 3.1.0, but that still needs time for tooling to adopt. To solve the issue quickly for you in the validator and to check what really works, could you please try whether replacing your code snippet above with one of the alternatives below works?
or (what OpenAPI suggests):
|
Okay, from https://github.com/OAI/OpenAPI-Specification/blob/master/proposals/003_Clarify-Nullable.md:
and
So that means I need to invert the process schema. Currently it doesn't allow null and then I add it. That's not possible, I need to allow null first and then disallow it. |
I have tried to implement it in compliance with OpenAPI 3.0.3, but redoc doesn't render it nicely. It actually now claims false things and that makes the rendered documentation really bad. As I assume most people consult the rendered version, it would confuse people and lead to broken implementations. Thus I'm not sure whether our change really helps or makes things worse, although the new version is formally better. Could you try the new OpenAPI file, @bgoesswe? See the nullable branch (or the commit above). |
I'll move this to later, I can't find a good solution supported by tooling yet. Also, I don't think our definitions are incorrect as I thought they would be. In most cases there's no type specified in the "base" schema thus I should be able to extend it as we do it now. Maybe OpenAPI 3.1. will solve this. Related issues: |
I don't think there's anything wrong (or unsatisfiable) with the first comment's schema. |
It seems that with OpenAPI 3.0.3 it is in fact wrong, but with previous versions it is somewhat okay (or at least undefined in the OpenAPI spec). Thanks for working on a bug fix, @fenollp ! Highly appreciated and also good work on the validation library. |
I doubt that I'll fix this before migrating to OpenAPI 3.1 (see reasons above), but migrating to OpenAPI 3.1 will also not take place any time soon (due to tooling support). So don't expect any changes here. #299 |
This is not an urgent issue, but just to have this documented:
I recently came to an issue regarding the GET /process_graphs/{process_graph_id} endpoint and the used response schema *user_defined_process_meta` using the openEO validator:
Since
description
andsummary
is not nullable in the'#/components/schemas/process
schema, the validator does not take thenullable: true
in the properties into account and assumes that it is not nullable. I am actually not sure what happens if the properties and the properties in an allOf reference are named the same, but I found a very long issue at the OpenAPI Github page regarding the nullable issue and also some similar issues from other projects.Even after reading these issues, I am not completely sure if the validator or the API is wrong here.
The text was updated successfully, but these errors were encountered: