openapi-codegen-ts icon indicating copy to clipboard operation
openapi-codegen-ts copied to clipboard

Support referencing a property

Open balanza opened this issue 3 years ago • 0 comments

We have examples of specifications using reference not only to a definition but to one specific property. Is it allowed? Reading OpenAPI docs I found neither confirmation nor disprove, and online validators don't complaint.

We should support such case in our generator.

Example

definitions:
  Item:
    type: object
    properties:
      status:
        type: string
      revocation_date:
        $ref: '#/definitions/Otp/properties/expires_at'
      revocation_reason:
        type: string
        minLength: 1
  Otp:
    type: object
    properties:
      code:
        type: string
      expires_at:
        type: string
        format: UTCISODateFromString
        description: A date-time field in ISO-8601 format and UTC timezone.
      ttl:
        type: number
    required:
      - code
      - expires_at
      - ttl

balanza avatar Jan 04 '23 10:01 balanza