cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/txtar/crd_intorstring_with_anyof.txtar (about)

     1  x-kubernetes-int-or-string can be combined with an anyOf
     2  TODO the CUE for this, though technically correct, could use improvement.
     3  
     4  #version: k8sCRD
     5  
     6  -- schema.yaml --
     7  apiVersion: apiextensions.k8s.io/v1
     8  kind: CustomResourceDefinition
     9  metadata:
    10    # name must be in the form: <plural>.<group>
    11    name: myapps.example.com
    12  spec:
    13    # group name to use for REST API: /apis/<group>/<version>
    14    group: example.com
    15    scope: Namespaced
    16    names:
    17      # kind is normally the CamelCased singular type.
    18      kind: MyApp
    19      # singular name to be used as an alias on the CLI
    20      singular: myapp
    21      # plural name in the URL: /apis/<group>/<version>/<plural>
    22      plural: myapps
    23    versions:
    24    - name: v1
    25      served: true
    26      storage: true
    27      schema:
    28        openAPIV3Schema:
    29          type: object
    30          properties:
    31            spec:
    32              x-kubernetes-int-or-string: true
    33              anyOf:
    34                - type: integer
    35                - type: string
    36  
    37  -- out/decode/extract --
    38  _embeddedResource
    39  spec?: matchN(>=1, [int, string]) & (int | string)
    40  
    41  _embeddedResource: {
    42  	apiVersion!: string
    43  	kind!:       string
    44  	metadata?: {
    45  		...
    46  	}
    47  }