Validate incoming requests with openapi3. Remove unsupported uuid format from the openapi spec. Similarly, change url to uri as uri is a supported format and url is not. Co-authored-by: Ondřej Budai <obudai@redhat.com> Signed-off-by: Ondřej Budai <ondrej@budai.cz>
28 lines
764 B
Go
28 lines
764 B
Go
package openapi3
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/getkin/kin-openapi/jsoninfo"
|
|
)
|
|
|
|
// Discriminator is specified by OpenAPI/Swagger standard version 3.
|
|
// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#discriminatorObject
|
|
type Discriminator struct {
|
|
ExtensionProps
|
|
|
|
PropertyName string `json:"propertyName" yaml:"propertyName"`
|
|
Mapping map[string]string `json:"mapping,omitempty" yaml:"mapping,omitempty"`
|
|
}
|
|
|
|
func (value *Discriminator) MarshalJSON() ([]byte, error) {
|
|
return jsoninfo.MarshalStrictStruct(value)
|
|
}
|
|
|
|
func (value *Discriminator) UnmarshalJSON(data []byte) error {
|
|
return jsoninfo.UnmarshalStrictStruct(data, value)
|
|
}
|
|
|
|
func (value *Discriminator) Validate(ctx context.Context) error {
|
|
return nil
|
|
}
|