-
-
Notifications
You must be signed in to change notification settings - Fork 435
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
Use goccy/go-yaml instead of invopop/yaml? #849
Comments
@renom if I use If I do: b, err := json.Marshal(&base)
if err != nil {
return fmt.Errorf("marshalling base: %w", err)
}
b, err = yaml.JSONToYAML(b)
if err != nil {
return fmt.Errorf("converting to yaml: %w", err)
} I get paths but order is lost. Am I using it wrong? |
I'm not sure if I understand your question correctly. I'll write what I've found out since I opened the issue.
For example: struct {
Map map[string]string
} Should become: struct {
Map yaml.MapSlice
}
|
I can't use a map, I'm trying to convert an openapi type struct. // T is the root of an OpenAPI v3 document
// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-object
type T struct {
Extensions map[string]interface{} `json:"-" yaml:"-"`
OpenAPI string `json:"openapi" yaml:"openapi"` // Required
Components *Components `json:"components,omitempty" yaml:"components,omitempty"`
Info *Info `json:"info" yaml:"info"` // Required
Paths *Paths `json:"paths" yaml:"paths"` // Required
Security SecurityRequirements `json:"security,omitempty" yaml:"security,omitempty"`
Servers Servers `json:"servers,omitempty" yaml:"servers,omitempty"`
Tags Tags `json:"tags,omitempty" yaml:"tags,omitempty"`
ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
visited visitedComponent
} Which has it's own |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/goccy/go-yaml
The library preserves the order of fields when converting from YAML
It should fix oapi-codegen/oapi-codegen#458
The text was updated successfully, but these errors were encountered: