...

Text file src/cuelang.org/go/encoding/openapi/testdata/script/basics.txtar

Documentation: cuelang.org/go/encoding/openapi/testdata/script

     1-- type.yaml --
     2openapi: 3.0.0
     3info:
     4  title: Users schema
     5  version: v1beta1
     6  contact:
     7    name: The CUE Authors
     8    url: https://cuelang.org
     9
    10components:
    11  schemas:
    12    User:
    13      description: "A User uses something."
    14      type: object
    15      properties:
    16        id:
    17          type: integer
    18        name:
    19          type: string
    20        address:
    21          $ref: "#/components/schemas/PhoneNumber"
    22    PhoneNumber:
    23      description: "The number to dial."
    24      type: string
    25
    26-- out.cue --
    27// Users schema
    28package foo
    29
    30info: {
    31	title:   *"Users schema" | string
    32	version: *"v1beta1" | string
    33	contact: {
    34		name: "The CUE Authors"
    35		url:  "https://cuelang.org"
    36	}
    37}
    38// A User uses something.
    39#User: {
    40	id?:      int
    41	name?:    string
    42	address?: #PhoneNumber
    43	...
    44}
    45
    46// The number to dial.
    47#PhoneNumber: string

View as plain text