-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Hello,
Issue
The ToRawInfo method on openapiv3.Strings return an empty node without writing actual content.
type: array
items:
discriminator:
propertyName: type
mapping: {} # <------ Empty node
anyOf:
- $ref: '...'Current implementation:
gnostic-models/openapiv3/OpenAPIv3.go
Lines 8557 to 8565 in 289d7b4
| // ToRawInfo returns a description of Strings suitable for JSON or YAML export. | |
| func (m *Strings) ToRawInfo() *yaml.Node { | |
| info := compiler.NewMappingNode() | |
| if m == nil { | |
| return info | |
| } | |
| // &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:} | |
| return info | |
| } |
Fix:
// ToRawInfo returns a description of Strings suitable for JSON or YAML export.
func (m *Strings) ToRawInfo() *yaml.Node {
info := compiler.NewMappingNode()
if m == nil {
return info
}
// &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:}
for _, p := range m.AdditionalProperties {
info.Content = append(info.Content, compiler.NewScalarNodeForString(p.Name))
info.Content = append(info.Content, compiler.NewScalarNodeForString(p.Value))
}
return info
}Produces:
discriminator:
propertyName: type
mapping:
name_example: 'value_example'
# ...
anyOf:
- $ref: '...'Made this PR to fix it
Hope you see this soon !
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels