Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist deprecation of fields to TS models #9

Closed
RichardInnocent opened this issue Oct 23, 2023 · 0 comments · Fixed by #10
Closed

Persist deprecation of fields to TS models #9

RichardInnocent opened this issue Oct 23, 2023 · 0 comments · Fixed by #10

Comments

@RichardInnocent
Copy link
Contributor

Background

If I deprecate a field in Go, I would like the field to marked as deprecated in the OpenAPI specification. This will allow users of my OpenAPI spec to be aware of which fields they should avoid.

Scenario

I have the following struct defined in Go:

type ExampleStruct struct {
    // NewField is the field that should be used.
    NewField string

    // OldField is the field that used to be used.
    // Deprecated: Use NewField instead.
    OldField string
}

Expected

This would create a model in the OpenAPI specification such as:

ExampleStruct:
  type: object
  properties:
    NewField:
      description: NewField is the field that should be used.
      type: string
    OldField:
      deprecated: true
      description: |-
        OldField is the field that used to be used.
        Deprecated: Use NewField instead.
      type: string
  required:
  - NewField
  - OldField

Note that OldField is marked as deprecated.

Actual

The model is created without any deprecation flag i.e.:

ExampleStruct:
  type: object
  properties:
    NewField:
      description: NewField is the field that should be used.
      type: string
    OldField:
      description: |-
        OldField is the field that used to be used.
        Deprecated: Use NewField instead.
      type: string
  required:
  - NewField
  - OldField
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant