| cue def foo.cue -o openapi:- |
| cmp stdout expect-json-out |
| |
| cue def foo.cue -o openapi+cue:- |
| cmp stdout expect-cue-out |
| |
| cue def foo.cue -o openapi+yaml:- |
| cmp stdout expect-yaml-out |
| |
| cue def -p foo openapi: expect-json-out |
| cmp stdout expect-cue |
| |
| -- foo.cue -- |
| Foo :: { |
| a: int |
| b: uint & <10 |
| } |
| |
| Bar :: { |
| foo: Foo |
| } |
| |
| -- expect-json-out -- |
| { |
| "openapi": "3.0.0", |
| "info": {}, |
| "paths": {}, |
| "components": { |
| "schemas": { |
| "Foo": { |
| "type": "object", |
| "required": [ |
| "a", |
| "b" |
| ], |
| "properties": { |
| "a": { |
| "type": "integer" |
| }, |
| "b": { |
| "type": "integer", |
| "minimum": 0, |
| "exclusiveMaximum": 10 |
| } |
| } |
| }, |
| "Bar": { |
| "type": "object", |
| "required": [ |
| "foo" |
| ], |
| "properties": { |
| "foo": { |
| "$ref": "#/components/schemas/Foo" |
| } |
| } |
| } |
| } |
| } |
| } |
| -- expect-yaml-out -- |
| openapi: 3.0.0 |
| info: {} |
| paths: {} |
| components: |
| schemas: |
| Foo: |
| type: object |
| required: |
| - a |
| - b |
| properties: |
| a: |
| type: integer |
| b: |
| type: integer |
| minimum: 0 |
| exclusiveMaximum: 10 |
| Bar: |
| type: object |
| required: |
| - foo |
| properties: |
| foo: |
| $ref: '#/components/schemas/Foo' |
| -- expect-cue-out -- |
| openapi: "3.0.0" |
| info: {} |
| paths: {} |
| components: schemas: { |
| Foo: { |
| type: "object" |
| required: ["a", "b"] |
| properties: { |
| a: type: "integer" |
| b: { |
| type: "integer" |
| minimum: 0 |
| exclusiveMaximum: 10 |
| } |
| } |
| } |
| Bar: { |
| type: "object" |
| required: ["foo"] |
| properties: foo: $ref: "#/components/schemas/Foo" |
| } |
| } |
| -- expect-cue -- |
| package foo |
| |
| Foo :: { |
| a: int |
| b: >=0 & <10 |
| ... |
| } |
| Bar :: { |
| foo: Foo |
| ... |
| } |