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
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:
Expected
This would create a model in the OpenAPI specification such as:
Note that
OldField
is marked as deprecated.Actual
The model is created without any deprecation flag i.e.: