go.mod: bump github.com/getkin/kin-openapi to v0.131.0
As deepmap/oapi-codegen didn't work with this newer version, upgrade to oapi-codegen/oapi-codegen v2. Mitigating CVE-2025-30153
This commit is contained in:
parent
c5cb0d0618
commit
b2700903ae
403 changed files with 44758 additions and 16347 deletions
69
vendor/github.com/getkin/kin-openapi/openapi3/xml.go
generated
vendored
69
vendor/github.com/getkin/kin-openapi/openapi3/xml.go
generated
vendored
|
|
@ -2,14 +2,14 @@ package openapi3
|
|||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/getkin/kin-openapi/jsoninfo"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// XML is specified by OpenAPI/Swagger standard version 3.
|
||||
// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#xmlObject
|
||||
// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#xml-object
|
||||
type XML struct {
|
||||
ExtensionProps
|
||||
Extensions map[string]any `json:"-" yaml:"-"`
|
||||
Origin *Origin `json:"__origin__,omitempty" yaml:"__origin__,omitempty"`
|
||||
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
||||
|
|
@ -18,14 +18,63 @@ type XML struct {
|
|||
Wrapped bool `json:"wrapped,omitempty" yaml:"wrapped,omitempty"`
|
||||
}
|
||||
|
||||
func (value *XML) MarshalJSON() ([]byte, error) {
|
||||
return jsoninfo.MarshalStrictStruct(value)
|
||||
// MarshalJSON returns the JSON encoding of XML.
|
||||
func (xml XML) MarshalJSON() ([]byte, error) {
|
||||
x, err := xml.MarshalYAML()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return json.Marshal(x)
|
||||
}
|
||||
|
||||
func (value *XML) UnmarshalJSON(data []byte) error {
|
||||
return jsoninfo.UnmarshalStrictStruct(data, value)
|
||||
// MarshalYAML returns the YAML encoding of XML.
|
||||
func (xml XML) MarshalYAML() (any, error) {
|
||||
m := make(map[string]any, 5+len(xml.Extensions))
|
||||
for k, v := range xml.Extensions {
|
||||
m[k] = v
|
||||
}
|
||||
if x := xml.Name; x != "" {
|
||||
m["name"] = x
|
||||
}
|
||||
if x := xml.Namespace; x != "" {
|
||||
m["namespace"] = x
|
||||
}
|
||||
if x := xml.Prefix; x != "" {
|
||||
m["prefix"] = x
|
||||
}
|
||||
if x := xml.Attribute; x {
|
||||
m["attribute"] = x
|
||||
}
|
||||
if x := xml.Wrapped; x {
|
||||
m["wrapped"] = x
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (value *XML) Validate(ctx context.Context) error {
|
||||
return nil // TODO
|
||||
// UnmarshalJSON sets XML to a copy of data.
|
||||
func (xml *XML) UnmarshalJSON(data []byte) error {
|
||||
type XMLBis XML
|
||||
var x XMLBis
|
||||
if err := json.Unmarshal(data, &x); err != nil {
|
||||
return unmarshalError(err)
|
||||
}
|
||||
_ = json.Unmarshal(data, &x.Extensions)
|
||||
delete(x.Extensions, originKey)
|
||||
delete(x.Extensions, "name")
|
||||
delete(x.Extensions, "namespace")
|
||||
delete(x.Extensions, "prefix")
|
||||
delete(x.Extensions, "attribute")
|
||||
delete(x.Extensions, "wrapped")
|
||||
if len(x.Extensions) == 0 {
|
||||
x.Extensions = nil
|
||||
}
|
||||
*xml = XML(x)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate returns an error if XML does not comply with the OpenAPI spec.
|
||||
func (xml *XML) Validate(ctx context.Context, opts ...ValidationOption) error {
|
||||
ctx = WithValidationOptions(ctx, opts...)
|
||||
|
||||
return validateExtensions(ctx, xml.Extensions)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue