Skip to content

CUE export openapi+yaml format not resolving references correctly #3944

Open
@bojandjukic1

Description

@bojandjukic1

What version of CUE are you using (cue version)?

0.11.0

Does this issue reproduce with the latest stable release?

Yes

What did you do?

Tried to export the following minimal CUE file as an example

// test.cue
#TestBaseComponent : {
    propABase: string
}
#TestParentComponent: {
    propAParent: string
    testChild: #TestBaseComponent & {
        propABase: propAParent
    }
}

using command cue export .\test.cue --out openapi+yaml

What did you expect to see?

I expected that the propABase in the definition would be a string not a ref type

What did you see instead?

See the invalid syntax $ref: '#/components/schemas/TestParentComponent.propAParent' below

openapi: 3.0.0
info:
  title: Generated by cue.
  version: no version
paths: {}
components:
  schemas:
    TestBaseComponent:
      type: object
      required:
        - propABase
      properties:
        propABase:
          type: string
    TestParentComponent:
      type: object
      required:
        - propAParent
        - testChild
      properties:
        propAParent:
          type: string
        testChild:
          type: object
          properties:
            propABase:
              $ref: '#/components/schemas/TestParentComponent.propAParent'
          allOf:
            - $ref: '#/components/schemas/TestBaseComponent'
            - required:
                - propABase

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions