You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although OpenAPI 3.0 is its own fork of JSON Schema, with distinct
semantics (new and removed keywords, different semantics for other
keywords), `encoding/jsonschema` does not currently have any way of
choosing OpenAPI-specific behaviour.
Fix that by adding an OpenAPI version. As it's not in the linear
progression of other JSON Schema versions (OpenAPI moved to using
exactly JSON Schema 2020-12 in 3.1), we treat it distinctly, requiring
all keywords to opt into it explicitly. This in turn means that almost
all keywords require their version set to be specified explicitly, so it
seems like there's no longer much benefit to having the vanilla `p0`,
`p1` etc constraint functions, so we change to passing the version set
for all constraints. While we're about it, remove `todo` and use the
regular `p1` function so that all the constraint names line up nicely.
Finally we change `encoding/openapi` to choose the correct version based
on the value of the `openapi` field.
For #3375
Signed-off-by: Roger Peppe <[email protected]>
Change-Id: I0070f8c02a9b403e2018b84919b886b0bc5f29d8
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1200578
Reviewed-by: Daniel Martí <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
I think we can treat this as closed by https://cuelang.org/cl/1200578. Further work will be required to implement the OpenAPI variations correctly, but that can be tracked in individual issues.
What version of CUE are you using (
cue version
)?Does this issue reproduce with the latest stable release?
Yes
What did you do?
What did you expect to see?
A passing test.
What did you see instead?
This schema should not be valid as OpenAPI 3.0 (
oneOf
is not supported) or JSON Schema (nullable
is not supported).We should have version-specific behaviour for OpenAPI.
The text was updated successfully, but these errors were encountered: