Skip to content

[Schema Inaccuracy] Fields not marked as required #118

Open
@cipriancaba

Description

Schema Inaccuracy

The response fields are not marked as required thus creating | undefined types in code generation tools

Expected

For example, the tag definition:

 tag:
      title: Tag
      type: object
      x-tags:
      - Tags
      description: A tag allows you to label your contacts, companies, and conversations
        and list them using that tag.
      properties:
        type:
          type: string
          description: value is "tag"
          example: tag
        id:
          type: string
          description: The id of the tag
          example: '123456'
        name:
          type: string
          description: The name of the tag
          example: Test tag
        applied_at:
          type: integer
          format: date-time
          description: The time when the tag was applied to the object
          example: 1663597223
        applied_by:
          "$ref": "#/components/schemas/reference"

should be:

tag:
      title: Tag
      type: object
      x-tags:
      - Tags
      description: A tag allows you to label your contacts, companies, and conversations
        and list them using that tag.
      properties:
        type:
          type: string
          required: true
          description: value is "tag"
          example: tag
        id:
          type: string
          required: true
          description: The id of the tag
          example: '123456'
        name:
          type: string
          required: true
          description: The name of the tag
          example: Test tag
        applied_at:
          required: true
          type: integer
          format: date-time
          description: The time when the tag was applied to the object
          example: 1663597223
        applied_by:
          required: true
          "$ref": "#/components/schemas/reference"

Reproduction Steps

Please see attached conversation
openapi-ts/openapi-typescript#1422 (comment)

And repro repo
https://github.com/cipriancaba/openapi-typescript

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions