Closed
Description
What version of CUE are you using (cue version
)?
$ cue version v0.10.0
Does this issue reproduce with the latest stable release?
Yes
What did you do?
! exec cue def cue+openapi: openapi.cue
stderr 'constraint "oneOf" is not supported'
! exec cue def cue+jsonschema: jsonschema.cue
stderr 'constraint "nullable" is not supported'
-- openapi.cue --
openapi: "3.0.0"
info: {
version: "1.0.0"
title: "Sample API"
description: "Some description"
}
components: schemas: Example: {
type: "object"
properties: {
foo: {
type: "string"
nullable: true
}
bar: {
oneOf: [{
type: "string"
}, {
const: null
}]
}
}
}
-- jsonschema.cue --
$schema: "http://json-schema.org/draft-07/schema#"
type: "object"
properties: {
foo: {
type: "string"
nullable: true
}
bar: {
oneOf: [{
type: "string"
}, {
const: null
}]
}
}
What did you expect to see?
A passing test.
What did you see instead?
> ! exec cue def cue+openapi: openapi.cue
[stdout]
info: {
version: *"1.0.0" | string
title: *"Sample API" | string
description: "Some description"
}
#Example: {
foo?: null | string
bar?: string | null
...
}
FAIL: /tmp/testscript662380999/x.txtar/script.txtar:1: unexpected command success
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.