From 20a9abdc73bbc288d30c9a071adc4087f2961ddc Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Mon, 19 Aug 2024 23:15:19 +0200 Subject: [PATCH 01/31] add origin - step 1 --- go.mod | 6 +++++- go.sum | 14 +++++++++----- maps.sh | 11 +++++++++++ openapi3/callback.go | 1 + openapi3/info.go | 2 ++ openapi3/maplike.go | 33 +++++++++++++++++++++++++++++++++ openapi3/marsh.go | 2 +- openapi3/media_type.go | 2 ++ openapi3/openapi3_test.go | 8 ++++++++ openapi3/operation.go | 2 ++ openapi3/origin.go | 11 +++++++++++ openapi3/parameter.go | 2 ++ openapi3/path_item.go | 2 ++ openapi3/paths.go | 1 + openapi3/ref.go | 3 ++- openapi3/refs.go | 18 ++++++++++++++++++ openapi3/refs.tmpl | 2 ++ openapi3/request_body.go | 2 ++ openapi3/response.go | 3 +++ openapi3/schema.go | 6 ++++-- 20 files changed, 121 insertions(+), 10 deletions(-) create mode 100644 openapi3/origin.go diff --git a/go.mod b/go.mod index 11bc6d02b..ca9c75a79 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,10 @@ module github.com/getkin/kin-openapi -go 1.20 +go 1.22.5 + +replace gopkg.in/yaml.v3 => github.com/oasdiff/yaml3 v0.0.0-20240819204501-233901bce7fe + +replace github.com/invopop/yaml => github.com/oasdiff/yaml v0.0.0-20240819205339-a96ddf1b7c90 require ( github.com/go-openapi/jsonpointer v0.21.0 diff --git a/go.sum b/go.sum index 6b91d0dc9..6a9a6d374 100644 --- a/go.sum +++ b/go.sum @@ -5,18 +5,23 @@ github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kO github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= +github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/invopop/yaml v0.3.1 h1:f0+ZpmhfBSS4MhG+4HYseMdJhoeeopbSKbq5Rpeelso= -github.com/invopop/yaml v0.3.1/go.mod h1:PMOp3nn4/12yEZUFfmOuNHJsZToEEOwoWsT+D81KkeA= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= +github.com/oasdiff/yaml v0.0.0-20240819205339-a96ddf1b7c90 h1:dYgjgPTLWXWVTaqJeu8Bp8litWVQ2iQs9r8rus7mMs4= +github.com/oasdiff/yaml v0.0.0-20240819205339-a96ddf1b7c90/go.mod h1:/hkd7qQO7Qp3G9ytouXHWapZeeq18qNBkyNAHDpqR1U= +github.com/oasdiff/yaml3 v0.0.0-20240819204501-233901bce7fe h1:sHb5QDQFoFYvM+Ebq0Bo2JC27+U8oHM8Mm50oBwBtnQ= +github.com/oasdiff/yaml3 v0.0.0-20240819204501-233901bce7fe/go.mod h1:lqlOfJRrYpgeWHQj+ky2tf7UJ3PzgHTHRQEpc90nbp0= github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -26,7 +31,6 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99 github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/maps.sh b/maps.sh index 9cfd0ffdc..0f1fa2526 100755 --- a/maps.sh +++ b/maps.sh @@ -209,6 +209,17 @@ func (${name} ${type}) UnmarshalJSON(data []byte) (err error) { continue } + if k == "origin" { + var data []byte + if data, err = json.Marshal(v); err != nil { + return + } + if err = json.Unmarshal(data, &x.Origin); err != nil { + return + } + continue + } + var data []byte if data, err = json.Marshal(v); err != nil { return diff --git a/openapi3/callback.go b/openapi3/callback.go index 34a6bea35..9d67b5be7 100644 --- a/openapi3/callback.go +++ b/openapi3/callback.go @@ -9,6 +9,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callback-object type Callback struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin Origin `json:"-" yaml:"-"` m map[string]*PathItem } diff --git a/openapi3/info.go b/openapi3/info.go index e2468285c..3b883acf0 100644 --- a/openapi3/info.go +++ b/openapi3/info.go @@ -10,6 +10,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#info-object type Info struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Title string `json:"title" yaml:"title"` // Required Description string `json:"description,omitempty" yaml:"description,omitempty"` @@ -62,6 +63,7 @@ func (info *Info) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "title") delete(x.Extensions, "description") delete(x.Extensions, "termsOfService") diff --git a/openapi3/maplike.go b/openapi3/maplike.go index 7b8045c67..c51c43927 100644 --- a/openapi3/maplike.go +++ b/openapi3/maplike.go @@ -125,6 +125,17 @@ func (responses *Responses) UnmarshalJSON(data []byte) (err error) { continue } + if k == "origin" { + var data []byte + if data, err = json.Marshal(v); err != nil { + return + } + if err = json.Unmarshal(data, &x.Origin); err != nil { + return + } + continue + } + var data []byte if data, err = json.Marshal(v); err != nil { return @@ -256,6 +267,17 @@ func (callback *Callback) UnmarshalJSON(data []byte) (err error) { continue } + if k == "origin" { + var data []byte + if data, err = json.Marshal(v); err != nil { + return + } + if err = json.Unmarshal(data, &x.Origin); err != nil { + return + } + continue + } + var data []byte if data, err = json.Marshal(v); err != nil { return @@ -387,6 +409,17 @@ func (paths *Paths) UnmarshalJSON(data []byte) (err error) { continue } + if k == "origin" { + var data []byte + if data, err = json.Marshal(v); err != nil { + return + } + if err = json.Unmarshal(data, &x.Origin); err != nil { + return + } + continue + } + var data []byte if data, err = json.Marshal(v); err != nil { return diff --git a/openapi3/marsh.go b/openapi3/marsh.go index daa937551..e9cfdf5f4 100644 --- a/openapi3/marsh.go +++ b/openapi3/marsh.go @@ -25,7 +25,7 @@ func unmarshal(data []byte, v any) error { } // UnmarshalStrict(data, v) TODO: investigate how ymlv3 handles duplicate map keys - if yamlErr = yaml.Unmarshal(data, v); yamlErr == nil { + if yamlErr = yaml.UnmarshalWithOrigin(data, v); yamlErr == nil { return nil } diff --git a/openapi3/media_type.go b/openapi3/media_type.go index d4466bcf5..abc353d67 100644 --- a/openapi3/media_type.go +++ b/openapi3/media_type.go @@ -14,6 +14,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#media-type-object type MediaType struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Schema *SchemaRef `json:"schema,omitempty" yaml:"schema,omitempty"` Example any `json:"example,omitempty" yaml:"example,omitempty"` @@ -101,6 +102,7 @@ func (mediaType *MediaType) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "schema") delete(x.Extensions, "example") delete(x.Extensions, "examples") diff --git a/openapi3/openapi3_test.go b/openapi3/openapi3_test.go index 3b68c1693..34e72d28f 100644 --- a/openapi3/openapi3_test.go +++ b/openapi3/openapi3_test.go @@ -476,3 +476,11 @@ func TestAddRemoveServer(t *testing.T) { doc3.Servers = Servers{} } + +func TestLocation(t *testing.T) { + loader := NewLoader() + loader.Context = context.Background() + doc, err := loader.LoadFromFile("testdata/testpath.yaml") + require.NoError(t, err) + require.NotEmpty(t, doc) +} diff --git a/openapi3/operation.go b/openapi3/operation.go index 40abf73c0..7aeeb1ca6 100644 --- a/openapi3/operation.go +++ b/openapi3/operation.go @@ -14,6 +14,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operation-object type Operation struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` // Optional tags for documentation. Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"` @@ -116,6 +117,7 @@ func (operation *Operation) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "tags") delete(x.Extensions, "summary") delete(x.Extensions, "description") diff --git a/openapi3/origin.go b/openapi3/origin.go new file mode 100644 index 000000000..2a1267a2e --- /dev/null +++ b/openapi3/origin.go @@ -0,0 +1,11 @@ +package openapi3 + +type Origin struct { + Key Location `json:"key,omitempty" yaml:"key,omitempty"` + Fields map[string]Location `json:"fields,omitempty" yaml:"fields,omitempty"` +} + +type Location struct { + Line int `json:"line,omitempty" yaml:"line,omitempty"` + Column int `json:"column,omitempty" yaml:"column,omitempty"` +} diff --git a/openapi3/parameter.go b/openapi3/parameter.go index 34fe29118..da319eeab 100644 --- a/openapi3/parameter.go +++ b/openapi3/parameter.go @@ -73,6 +73,7 @@ func (parameters Parameters) Validate(ctx context.Context, opts ...ValidationOpt // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameter-object type Parameter struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` In string `json:"in,omitempty" yaml:"in,omitempty"` @@ -216,6 +217,7 @@ func (parameter *Parameter) UnmarshalJSON(data []byte) error { } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "name") delete(x.Extensions, "in") delete(x.Extensions, "description") diff --git a/openapi3/path_item.go b/openapi3/path_item.go index 859634fe6..d22b2c7e2 100644 --- a/openapi3/path_item.go +++ b/openapi3/path_item.go @@ -12,6 +12,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#path-item-object type PathItem struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"` Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` @@ -98,6 +99,7 @@ func (pathItem *PathItem) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "$ref") delete(x.Extensions, "summary") delete(x.Extensions, "description") diff --git a/openapi3/paths.go b/openapi3/paths.go index 76747412b..dff158317 100644 --- a/openapi3/paths.go +++ b/openapi3/paths.go @@ -11,6 +11,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#paths-object type Paths struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin Origin `json:"-" yaml:"-"` m map[string]*PathItem } diff --git a/openapi3/ref.go b/openapi3/ref.go index 07060731f..01d3b946f 100644 --- a/openapi3/ref.go +++ b/openapi3/ref.go @@ -5,5 +5,6 @@ package openapi3 // Ref is specified by OpenAPI/Swagger 3.0 standard. // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#reference-object type Ref struct { - Ref string `json:"$ref" yaml:"$ref"` + Ref string `json:"$ref" yaml:"$ref"` + Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` } diff --git a/openapi3/refs.go b/openapi3/refs.go index d337b0e3d..d6011fccb 100644 --- a/openapi3/refs.go +++ b/openapi3/refs.go @@ -19,6 +19,7 @@ type CallbackRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin Origin Ref string Value *Callback @@ -72,6 +73,7 @@ func (x *CallbackRef) UnmarshalJSON(data []byte) error { var refOnly Ref if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { x.Ref = refOnly.Ref + x.Origin = refOnly.Origin if len(extra) != 0 { x.extra = make([]string, 0, len(extra)) for key := range extra { @@ -155,6 +157,7 @@ type ExampleRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin Origin Ref string Value *Example @@ -208,6 +211,7 @@ func (x *ExampleRef) UnmarshalJSON(data []byte) error { var refOnly Ref if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { x.Ref = refOnly.Ref + x.Origin = refOnly.Origin if len(extra) != 0 { x.extra = make([]string, 0, len(extra)) for key := range extra { @@ -291,6 +295,7 @@ type HeaderRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin Origin Ref string Value *Header @@ -344,6 +349,7 @@ func (x *HeaderRef) UnmarshalJSON(data []byte) error { var refOnly Ref if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { x.Ref = refOnly.Ref + x.Origin = refOnly.Origin if len(extra) != 0 { x.extra = make([]string, 0, len(extra)) for key := range extra { @@ -427,6 +433,7 @@ type LinkRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin Origin Ref string Value *Link @@ -480,6 +487,7 @@ func (x *LinkRef) UnmarshalJSON(data []byte) error { var refOnly Ref if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { x.Ref = refOnly.Ref + x.Origin = refOnly.Origin if len(extra) != 0 { x.extra = make([]string, 0, len(extra)) for key := range extra { @@ -563,6 +571,7 @@ type ParameterRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin Origin Ref string Value *Parameter @@ -616,6 +625,7 @@ func (x *ParameterRef) UnmarshalJSON(data []byte) error { var refOnly Ref if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { x.Ref = refOnly.Ref + x.Origin = refOnly.Origin if len(extra) != 0 { x.extra = make([]string, 0, len(extra)) for key := range extra { @@ -699,6 +709,7 @@ type RequestBodyRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin Origin Ref string Value *RequestBody @@ -752,6 +763,7 @@ func (x *RequestBodyRef) UnmarshalJSON(data []byte) error { var refOnly Ref if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { x.Ref = refOnly.Ref + x.Origin = refOnly.Origin if len(extra) != 0 { x.extra = make([]string, 0, len(extra)) for key := range extra { @@ -835,6 +847,7 @@ type ResponseRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin Origin Ref string Value *Response @@ -888,6 +901,7 @@ func (x *ResponseRef) UnmarshalJSON(data []byte) error { var refOnly Ref if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { x.Ref = refOnly.Ref + x.Origin = refOnly.Origin if len(extra) != 0 { x.extra = make([]string, 0, len(extra)) for key := range extra { @@ -971,6 +985,7 @@ type SchemaRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin Origin Ref string Value *Schema @@ -1024,6 +1039,7 @@ func (x *SchemaRef) UnmarshalJSON(data []byte) error { var refOnly Ref if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { x.Ref = refOnly.Ref + x.Origin = refOnly.Origin if len(extra) != 0 { x.extra = make([]string, 0, len(extra)) for key := range extra { @@ -1107,6 +1123,7 @@ type SecuritySchemeRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin Origin Ref string Value *SecurityScheme @@ -1160,6 +1177,7 @@ func (x *SecuritySchemeRef) UnmarshalJSON(data []byte) error { var refOnly Ref if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { x.Ref = refOnly.Ref + x.Origin = refOnly.Origin if len(extra) != 0 { x.extra = make([]string, 0, len(extra)) for key := range extra { diff --git a/openapi3/refs.tmpl b/openapi3/refs.tmpl index a3f5bdab7..16b5f7010 100644 --- a/openapi3/refs.tmpl +++ b/openapi3/refs.tmpl @@ -19,6 +19,7 @@ type {{ $type.Name }}Ref struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin Origin Ref string Value *{{ $type.Name }} @@ -72,6 +73,7 @@ func (x *{{ $type.Name }}Ref) UnmarshalJSON(data []byte) error { var refOnly Ref if extra, err := marshmallow.Unmarshal(data, &refOnly, marshmallow.WithExcludeKnownFieldsFromMap(true)); err == nil && refOnly.Ref != "" { x.Ref = refOnly.Ref + x.Origin = refOnly.Origin if len(extra) != 0 { x.extra = make([]string, 0, len(extra)) for key := range extra { diff --git a/openapi3/request_body.go b/openapi3/request_body.go index 6d4b8185e..741ca5328 100644 --- a/openapi3/request_body.go +++ b/openapi3/request_body.go @@ -10,6 +10,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#request-body-object type RequestBody struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Required bool `json:"required,omitempty" yaml:"required,omitempty"` @@ -108,6 +109,7 @@ func (requestBody *RequestBody) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "description") delete(x.Extensions, "required") delete(x.Extensions, "content") diff --git a/openapi3/response.go b/openapi3/response.go index af8fda6f7..802b84288 100644 --- a/openapi3/response.go +++ b/openapi3/response.go @@ -12,6 +12,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#responses-object type Responses struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin Origin `json:"-" yaml:"-"` m map[string]*ResponseRef } @@ -102,6 +103,7 @@ func (responses *Responses) Validate(ctx context.Context, opts ...ValidationOpti // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#response-object type Response struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Description *string `json:"description,omitempty" yaml:"description,omitempty"` Headers Headers `json:"headers,omitempty" yaml:"headers,omitempty"` @@ -171,6 +173,7 @@ func (response *Response) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "description") delete(x.Extensions, "headers") delete(x.Extensions, "content") diff --git a/openapi3/schema.go b/openapi3/schema.go index 7be6bd38e..da5b0eb4c 100644 --- a/openapi3/schema.go +++ b/openapi3/schema.go @@ -82,6 +82,7 @@ func (s SchemaRefs) JSONLookup(token string) (any, error) { // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object type Schema struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` OneOf SchemaRefs `json:"oneOf,omitempty" yaml:"oneOf,omitempty"` AnyOf SchemaRefs `json:"anyOf,omitempty" yaml:"anyOf,omitempty"` @@ -412,6 +413,7 @@ func (schema *Schema) UnmarshalJSON(data []byte) error { } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "oneOf") delete(x.Extensions, "anyOf") delete(x.Extensions, "allOf") @@ -468,7 +470,7 @@ func (schema *Schema) UnmarshalJSON(data []byte) error { *schema = Schema(x) if schema.Format == "date" { - // This is a fix for: https://github.com/getkin/kin-openapi/issues/697 + // This is a fix for: https://github.com/oasdiff/kin-openapi/issues/697 if eg, ok := schema.Example.(string); ok { schema.Example = strings.TrimSuffix(eg, "T00:00:00Z") } @@ -1203,7 +1205,7 @@ func (schema *Schema) visitJSON(settings *schemaValidationSettings, value any) ( return schema.visitJSONArray(settings, value) case map[string]any: return schema.visitJSONObject(settings, value) - case map[any]any: // for YAML cf. issue https://github.com/getkin/kin-openapi/issues/444 + case map[any]any: // for YAML cf. issue https://github.com/oasdiff/kin-openapi/issues/444 values := make(map[string]any, len(value)) for key, v := range value { if k, ok := key.(string); ok { From f90371ae67dc7e6789512b71655d99d2bd1a3fbb Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 20 Aug 2024 11:07:25 +0200 Subject: [PATCH 02/31] delete origin from content --- openapi3/content.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/openapi3/content.go b/openapi3/content.go index 81b070eec..f63463d4e 100644 --- a/openapi3/content.go +++ b/openapi3/content.go @@ -2,6 +2,7 @@ package openapi3 import ( "context" + "encoding/json" "sort" "strings" ) @@ -122,3 +123,15 @@ func (content Content) Validate(ctx context.Context, opts ...ValidationOption) e } return nil } + +// UnmarshalJSON sets Content to a copy of data. +func (content *Content) UnmarshalJSON(data []byte) error { + type ContentBis Content + var x ContentBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + delete(x, "origin") + *content = Content(x) + return nil +} From 7d41bd043950dffdb888a53d2b38f2a592876e6b Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Wed, 21 Aug 2024 21:14:15 +0200 Subject: [PATCH 03/31] point to Origin --- openapi3/callback.go | 2 +- openapi3/components.go | 102 +++++++++++++++++++++++++++++++++++++++ openapi3/info.go | 2 +- openapi3/license.go | 2 + openapi3/media_type.go | 2 +- openapi3/operation.go | 2 +- openapi3/origin.go | 2 +- openapi3/parameter.go | 2 +- openapi3/path_item.go | 2 +- openapi3/paths.go | 2 +- openapi3/ref.go | 4 +- openapi3/refs.go | 18 +++---- openapi3/refs.tmpl | 2 +- openapi3/request_body.go | 2 +- openapi3/response.go | 4 +- openapi3/schema.go | 2 +- 16 files changed, 128 insertions(+), 24 deletions(-) diff --git a/openapi3/callback.go b/openapi3/callback.go index 9d67b5be7..6c21706ff 100644 --- a/openapi3/callback.go +++ b/openapi3/callback.go @@ -9,7 +9,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callback-object type Callback struct { Extensions map[string]any `json:"-" yaml:"-"` - Origin Origin `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` m map[string]*PathItem } diff --git a/openapi3/components.go b/openapi3/components.go index 98c4b96c1..b4962ddcd 100644 --- a/openapi3/components.go +++ b/openapi3/components.go @@ -25,6 +25,7 @@ type ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#components-object type Components struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Schemas Schemas `json:"schemas,omitempty" yaml:"schemas,omitempty"` Parameters ParametersMap `json:"parameters,omitempty" yaml:"parameters,omitempty"` @@ -94,6 +95,7 @@ func (components *Components) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "schemas") delete(x.Extensions, "parameters") delete(x.Extensions, "headers") @@ -110,6 +112,106 @@ func (components *Components) UnmarshalJSON(data []byte) error { return nil } +// TODO: replace these unmarshallers with a generic one +func (callbacks *Callbacks) UnmarshalJSON(data []byte) error { + type CallbacksBis Callbacks + var x CallbacksBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + delete(x, "origin") + *callbacks = Callbacks(x) + return nil +} + +func (examples *Examples) UnmarshalJSON(data []byte) error { + type ExamplesBis Examples + var x ExamplesBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + delete(x, "origin") + *examples = Examples(x) + return nil +} + +func (headers *Headers) UnmarshalJSON(data []byte) error { + type HeadersBis Headers + var x HeadersBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + delete(x, "origin") + *headers = Headers(x) + return nil +} + +func (links *Links) UnmarshalJSON(data []byte) error { + type LinksBis Links + var x LinksBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + delete(x, "origin") + *links = Links(x) + return nil +} + +func (parametersMap *ParametersMap) UnmarshalJSON(data []byte) error { + type ParametersMapBis ParametersMap + var x ParametersMapBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + delete(x, "origin") + *parametersMap = ParametersMap(x) + return nil +} + +func (requestBodies *RequestBodies) UnmarshalJSON(data []byte) error { + type RequestBodiesBis RequestBodies + var x RequestBodiesBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + delete(x, "origin") + *requestBodies = RequestBodies(x) + return nil +} + +func (responseBodies *ResponseBodies) UnmarshalJSON(data []byte) error { + type ResponseBodiesBis ResponseBodies + var x ResponseBodiesBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + delete(x, "origin") + *responseBodies = ResponseBodies(x) + return nil +} + +func (schemas *Schemas) UnmarshalJSON(data []byte) error { + type SchemasBis Schemas + var x SchemasBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + delete(x, "origin") + *schemas = Schemas(x) + return nil +} + +func (securitySchemes *SecuritySchemes) UnmarshalJSON(data []byte) error { + type SecuritySchemesBis SecuritySchemes + var x SecuritySchemesBis + if err := json.Unmarshal(data, &x); err != nil { + return unmarshalError(err) + } + delete(x, "origin") + *securitySchemes = SecuritySchemes(x) + return nil +} + // Validate returns an error if Components does not comply with the OpenAPI spec. func (components *Components) Validate(ctx context.Context, opts ...ValidationOption) (err error) { ctx = WithValidationOptions(ctx, opts...) diff --git a/openapi3/info.go b/openapi3/info.go index 3b883acf0..c44ca4fe1 100644 --- a/openapi3/info.go +++ b/openapi3/info.go @@ -10,7 +10,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#info-object type Info struct { Extensions map[string]any `json:"-" yaml:"-"` - Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Title string `json:"title" yaml:"title"` // Required Description string `json:"description,omitempty" yaml:"description,omitempty"` diff --git a/openapi3/license.go b/openapi3/license.go index c4f6c8dc3..68bfc4bfc 100644 --- a/openapi3/license.go +++ b/openapi3/license.go @@ -10,6 +10,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#license-object type License struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Name string `json:"name" yaml:"name"` // Required URL string `json:"url,omitempty" yaml:"url,omitempty"` @@ -45,6 +46,7 @@ func (license *License) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "name") delete(x.Extensions, "url") if len(x.Extensions) == 0 { diff --git a/openapi3/media_type.go b/openapi3/media_type.go index abc353d67..29f0f673b 100644 --- a/openapi3/media_type.go +++ b/openapi3/media_type.go @@ -14,7 +14,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#media-type-object type MediaType struct { Extensions map[string]any `json:"-" yaml:"-"` - Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Schema *SchemaRef `json:"schema,omitempty" yaml:"schema,omitempty"` Example any `json:"example,omitempty" yaml:"example,omitempty"` diff --git a/openapi3/operation.go b/openapi3/operation.go index 7aeeb1ca6..b55ad9f8b 100644 --- a/openapi3/operation.go +++ b/openapi3/operation.go @@ -14,7 +14,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operation-object type Operation struct { Extensions map[string]any `json:"-" yaml:"-"` - Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` // Optional tags for documentation. Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"` diff --git a/openapi3/origin.go b/openapi3/origin.go index 2a1267a2e..1c6da4638 100644 --- a/openapi3/origin.go +++ b/openapi3/origin.go @@ -1,7 +1,7 @@ package openapi3 type Origin struct { - Key Location `json:"key,omitempty" yaml:"key,omitempty"` + Key *Location `json:"key,omitempty" yaml:"key,omitempty"` Fields map[string]Location `json:"fields,omitempty" yaml:"fields,omitempty"` } diff --git a/openapi3/parameter.go b/openapi3/parameter.go index da319eeab..855c1a4f1 100644 --- a/openapi3/parameter.go +++ b/openapi3/parameter.go @@ -73,7 +73,7 @@ func (parameters Parameters) Validate(ctx context.Context, opts ...ValidationOpt // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameter-object type Parameter struct { Extensions map[string]any `json:"-" yaml:"-"` - Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` In string `json:"in,omitempty" yaml:"in,omitempty"` diff --git a/openapi3/path_item.go b/openapi3/path_item.go index d22b2c7e2..00eb6bfd5 100644 --- a/openapi3/path_item.go +++ b/openapi3/path_item.go @@ -12,7 +12,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#path-item-object type PathItem struct { Extensions map[string]any `json:"-" yaml:"-"` - Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"` Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` diff --git a/openapi3/paths.go b/openapi3/paths.go index dff158317..806750474 100644 --- a/openapi3/paths.go +++ b/openapi3/paths.go @@ -11,7 +11,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#paths-object type Paths struct { Extensions map[string]any `json:"-" yaml:"-"` - Origin Origin `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` m map[string]*PathItem } diff --git a/openapi3/ref.go b/openapi3/ref.go index 01d3b946f..d24f4c9b1 100644 --- a/openapi3/ref.go +++ b/openapi3/ref.go @@ -5,6 +5,6 @@ package openapi3 // Ref is specified by OpenAPI/Swagger 3.0 standard. // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#reference-object type Ref struct { - Ref string `json:"$ref" yaml:"$ref"` - Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` + Ref string `json:"$ref" yaml:"$ref"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` } diff --git a/openapi3/refs.go b/openapi3/refs.go index d6011fccb..fc11164a5 100644 --- a/openapi3/refs.go +++ b/openapi3/refs.go @@ -19,7 +19,7 @@ type CallbackRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any - Origin Origin + Origin *Origin Ref string Value *Callback @@ -157,7 +157,7 @@ type ExampleRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any - Origin Origin + Origin *Origin Ref string Value *Example @@ -295,7 +295,7 @@ type HeaderRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any - Origin Origin + Origin *Origin Ref string Value *Header @@ -433,7 +433,7 @@ type LinkRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any - Origin Origin + Origin *Origin Ref string Value *Link @@ -571,7 +571,7 @@ type ParameterRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any - Origin Origin + Origin *Origin Ref string Value *Parameter @@ -709,7 +709,7 @@ type RequestBodyRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any - Origin Origin + Origin *Origin Ref string Value *RequestBody @@ -847,7 +847,7 @@ type ResponseRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any - Origin Origin + Origin *Origin Ref string Value *Response @@ -985,7 +985,7 @@ type SchemaRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any - Origin Origin + Origin *Origin Ref string Value *Schema @@ -1123,7 +1123,7 @@ type SecuritySchemeRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any - Origin Origin + Origin *Origin Ref string Value *SecurityScheme diff --git a/openapi3/refs.tmpl b/openapi3/refs.tmpl index 16b5f7010..028deba7d 100644 --- a/openapi3/refs.tmpl +++ b/openapi3/refs.tmpl @@ -19,7 +19,7 @@ type {{ $type.Name }}Ref struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any - Origin Origin + Origin *Origin Ref string Value *{{ $type.Name }} diff --git a/openapi3/request_body.go b/openapi3/request_body.go index 741ca5328..a753db8b7 100644 --- a/openapi3/request_body.go +++ b/openapi3/request_body.go @@ -10,7 +10,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#request-body-object type RequestBody struct { Extensions map[string]any `json:"-" yaml:"-"` - Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Required bool `json:"required,omitempty" yaml:"required,omitempty"` diff --git a/openapi3/response.go b/openapi3/response.go index 802b84288..1b782523d 100644 --- a/openapi3/response.go +++ b/openapi3/response.go @@ -12,7 +12,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#responses-object type Responses struct { Extensions map[string]any `json:"-" yaml:"-"` - Origin Origin `json:"-" yaml:"-"` + Origin *Origin `json:"-" yaml:"-"` m map[string]*ResponseRef } @@ -103,7 +103,7 @@ func (responses *Responses) Validate(ctx context.Context, opts ...ValidationOpti // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#response-object type Response struct { Extensions map[string]any `json:"-" yaml:"-"` - Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Description *string `json:"description,omitempty" yaml:"description,omitempty"` Headers Headers `json:"headers,omitempty" yaml:"headers,omitempty"` diff --git a/openapi3/schema.go b/openapi3/schema.go index da5b0eb4c..05e755582 100644 --- a/openapi3/schema.go +++ b/openapi3/schema.go @@ -82,7 +82,7 @@ func (s SchemaRefs) JSONLookup(token string) (any, error) { // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object type Schema struct { Extensions map[string]any `json:"-" yaml:"-"` - Origin Origin `json:"origin,omitempty" yaml:"origin,omitempty"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` OneOf SchemaRefs `json:"oneOf,omitempty" yaml:"oneOf,omitempty"` AnyOf SchemaRefs `json:"anyOf,omitempty" yaml:"anyOf,omitempty"` From 77f909bcefa1b446a9e10b7414aa25654a874708 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 22 Aug 2024 13:43:40 +0200 Subject: [PATCH 04/31] make include origin configurable --- go.mod | 2 +- go.sum | 4 ++-- openapi3/loader.go | 11 +++++++---- openapi3/marsh.go | 4 ++-- openapi3/openapi3_test.go | 3 ++- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index ca9c75a79..abdf0ff9f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22.5 replace gopkg.in/yaml.v3 => github.com/oasdiff/yaml3 v0.0.0-20240819204501-233901bce7fe -replace github.com/invopop/yaml => github.com/oasdiff/yaml v0.0.0-20240819205339-a96ddf1b7c90 +replace github.com/invopop/yaml => github.com/oasdiff/yaml v0.0.0-20240822113848-2830227c9671 require ( github.com/go-openapi/jsonpointer v0.21.0 diff --git a/go.sum b/go.sum index 6a9a6d374..c7798590a 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= -github.com/oasdiff/yaml v0.0.0-20240819205339-a96ddf1b7c90 h1:dYgjgPTLWXWVTaqJeu8Bp8litWVQ2iQs9r8rus7mMs4= -github.com/oasdiff/yaml v0.0.0-20240819205339-a96ddf1b7c90/go.mod h1:/hkd7qQO7Qp3G9ytouXHWapZeeq18qNBkyNAHDpqR1U= +github.com/oasdiff/yaml v0.0.0-20240822113848-2830227c9671 h1:qM2AH1Js3b+0wWCE5SrfSwa/rIXtqMyQZyXx3YaIb5Q= +github.com/oasdiff/yaml v0.0.0-20240822113848-2830227c9671/go.mod h1:/hkd7qQO7Qp3G9ytouXHWapZeeq18qNBkyNAHDpqR1U= github.com/oasdiff/yaml3 v0.0.0-20240819204501-233901bce7fe h1:sHb5QDQFoFYvM+Ebq0Bo2JC27+U8oHM8Mm50oBwBtnQ= github.com/oasdiff/yaml3 v0.0.0-20240819204501-233901bce7fe/go.mod h1:lqlOfJRrYpgeWHQj+ky2tf7UJ3PzgHTHRQEpc90nbp0= github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= diff --git a/openapi3/loader.go b/openapi3/loader.go index 31c340761..0f3b8cbd3 100644 --- a/openapi3/loader.go +++ b/openapi3/loader.go @@ -28,6 +28,9 @@ type Loader struct { // IsExternalRefsAllowed enables visiting other files IsExternalRefsAllowed bool + // IncludeOrigin specifies whether to include the origin of the OpenAPI elements + IncludeOrigin bool + // ReadFromURIFunc allows overriding the any file/URL reading func ReadFromURIFunc ReadFromURIFunc @@ -103,7 +106,7 @@ func (loader *Loader) loadSingleElementFromURI(ref string, rootPath *url.URL, el if err != nil { return nil, err } - if err := unmarshal(data, element); err != nil { + if err := unmarshal(data, element, loader.IncludeOrigin); err != nil { return nil, err } @@ -139,7 +142,7 @@ func (loader *Loader) LoadFromIoReader(reader io.Reader) (*T, error) { func (loader *Loader) LoadFromData(data []byte) (*T, error) { loader.resetVisitedPathItemRefs() doc := &T{} - if err := unmarshal(data, doc); err != nil { + if err := unmarshal(data, doc, loader.IncludeOrigin); err != nil { return nil, err } if err := loader.ResolveRefsIn(doc, nil); err != nil { @@ -168,7 +171,7 @@ func (loader *Loader) loadFromDataWithPathInternal(data []byte, location *url.UR doc := &T{} loader.visitedDocuments[uri] = doc - if err := unmarshal(data, doc); err != nil { + if err := unmarshal(data, doc, loader.IncludeOrigin); err != nil { return nil, err } @@ -422,7 +425,7 @@ func (loader *Loader) resolveComponent(doc *T, ref string, path *url.URL, resolv if err2 != nil { return nil, nil, err } - if err2 = unmarshal(data, &cursor); err2 != nil { + if err2 = unmarshal(data, &cursor, loader.IncludeOrigin); err2 != nil { return nil, nil, err } if cursor, err2 = drill(cursor); err2 != nil || cursor == nil { diff --git a/openapi3/marsh.go b/openapi3/marsh.go index e9cfdf5f4..9fdc6dffb 100644 --- a/openapi3/marsh.go +++ b/openapi3/marsh.go @@ -16,7 +16,7 @@ func unmarshalError(jsonUnmarshalErr error) error { return jsonUnmarshalErr } -func unmarshal(data []byte, v any) error { +func unmarshal(data []byte, v any, includeOrigin bool) error { var jsonErr, yamlErr error // See https://github.com/getkin/kin-openapi/issues/680 @@ -25,7 +25,7 @@ func unmarshal(data []byte, v any) error { } // UnmarshalStrict(data, v) TODO: investigate how ymlv3 handles duplicate map keys - if yamlErr = yaml.UnmarshalWithOrigin(data, v); yamlErr == nil { + if yamlErr = yaml.UnmarshalWithOrigin(data, v, includeOrigin); yamlErr == nil { return nil } diff --git a/openapi3/openapi3_test.go b/openapi3/openapi3_test.go index 34e72d28f..8db50ec56 100644 --- a/openapi3/openapi3_test.go +++ b/openapi3/openapi3_test.go @@ -477,8 +477,9 @@ func TestAddRemoveServer(t *testing.T) { doc3.Servers = Servers{} } -func TestLocation(t *testing.T) { +func TestOrigin(t *testing.T) { loader := NewLoader() + loader.IncludeOrigin = true loader.Context = context.Background() doc, err := loader.LoadFromFile("testdata/testpath.yaml") require.NoError(t, err) From 15e7cab1c02fa26f9e46aeb37bf4772d73a303d7 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Fri, 23 Aug 2024 13:17:52 +0200 Subject: [PATCH 05/31] generic unmarshalStringMap --- openapi3/components.go | 135 +++++++++++++++++------------------------ openapi3/content.go | 13 +--- 2 files changed, 57 insertions(+), 91 deletions(-) diff --git a/openapi3/components.go b/openapi3/components.go index b4962ddcd..905a4a22a 100644 --- a/openapi3/components.go +++ b/openapi3/components.go @@ -112,104 +112,77 @@ func (components *Components) UnmarshalJSON(data []byte) error { return nil } -// TODO: replace these unmarshallers with a generic one -func (callbacks *Callbacks) UnmarshalJSON(data []byte) error { - type CallbacksBis Callbacks - var x CallbacksBis - if err := json.Unmarshal(data, &x); err != nil { - return unmarshalError(err) - } - delete(x, "origin") - *callbacks = Callbacks(x) - return nil +type MapValue interface { + CallbackRef | ExampleRef | HeaderRef | LinkRef | ParameterRef | RequestBodyRef | ResponseRef | SchemaRef | SecuritySchemeRef | + MediaType } -func (examples *Examples) UnmarshalJSON(data []byte) error { - type ExamplesBis Examples - var x ExamplesBis - if err := json.Unmarshal(data, &x); err != nil { - return unmarshalError(err) +// TODO: add origin to all components +func unmarshalStringMap[V MapValue](data []byte) (map[string]*V, error) { + var m map[string]any + if err := json.Unmarshal(data, &m); err != nil { + return nil, unmarshalError(err) + } + delete(m, "origin") + result := make(map[string]*V, len(m)) + for k, v := range m { + if data, err := json.Marshal(v); err != nil { + return nil, err + } else { + var v V + if err = json.Unmarshal(data, &v); err != nil { + return nil, err + } + result[k] = &v + } } - delete(x, "origin") - *examples = Examples(x) - return nil + + return result, nil } -func (headers *Headers) UnmarshalJSON(data []byte) error { - type HeadersBis Headers - var x HeadersBis - if err := json.Unmarshal(data, &x); err != nil { - return unmarshalError(err) - } - delete(x, "origin") - *headers = Headers(x) - return nil +func (callbacks *Callbacks) UnmarshalJSON(data []byte) (err error) { + *callbacks, err = unmarshalStringMap[CallbackRef](data) + return } -func (links *Links) UnmarshalJSON(data []byte) error { - type LinksBis Links - var x LinksBis - if err := json.Unmarshal(data, &x); err != nil { - return unmarshalError(err) - } - delete(x, "origin") - *links = Links(x) - return nil +func (examples *Examples) UnmarshalJSON(data []byte) (err error) { + *examples, err = unmarshalStringMap[ExampleRef](data) + return } -func (parametersMap *ParametersMap) UnmarshalJSON(data []byte) error { - type ParametersMapBis ParametersMap - var x ParametersMapBis - if err := json.Unmarshal(data, &x); err != nil { - return unmarshalError(err) - } - delete(x, "origin") - *parametersMap = ParametersMap(x) - return nil +func (headers *Headers) UnmarshalJSON(data []byte) (err error) { + *headers, err = unmarshalStringMap[HeaderRef](data) + return } -func (requestBodies *RequestBodies) UnmarshalJSON(data []byte) error { - type RequestBodiesBis RequestBodies - var x RequestBodiesBis - if err := json.Unmarshal(data, &x); err != nil { - return unmarshalError(err) - } - delete(x, "origin") - *requestBodies = RequestBodies(x) - return nil +func (links *Links) UnmarshalJSON(data []byte) (err error) { + *links, err = unmarshalStringMap[LinkRef](data) + return } -func (responseBodies *ResponseBodies) UnmarshalJSON(data []byte) error { - type ResponseBodiesBis ResponseBodies - var x ResponseBodiesBis - if err := json.Unmarshal(data, &x); err != nil { - return unmarshalError(err) - } - delete(x, "origin") - *responseBodies = ResponseBodies(x) - return nil +func (parametersMap *ParametersMap) UnmarshalJSON(data []byte) (err error) { + *parametersMap, err = unmarshalStringMap[ParameterRef](data) + return } -func (schemas *Schemas) UnmarshalJSON(data []byte) error { - type SchemasBis Schemas - var x SchemasBis - if err := json.Unmarshal(data, &x); err != nil { - return unmarshalError(err) - } - delete(x, "origin") - *schemas = Schemas(x) - return nil +func (requestBodies *RequestBodies) UnmarshalJSON(data []byte) (err error) { + *requestBodies, err = unmarshalStringMap[RequestBodyRef](data) + return } -func (securitySchemes *SecuritySchemes) UnmarshalJSON(data []byte) error { - type SecuritySchemesBis SecuritySchemes - var x SecuritySchemesBis - if err := json.Unmarshal(data, &x); err != nil { - return unmarshalError(err) - } - delete(x, "origin") - *securitySchemes = SecuritySchemes(x) - return nil +func (responseBodies *ResponseBodies) UnmarshalJSON(data []byte) (err error) { + *responseBodies, err = unmarshalStringMap[ResponseRef](data) + return +} + +func (schemas *Schemas) UnmarshalJSON(data []byte) (err error) { + *schemas, err = unmarshalStringMap[SchemaRef](data) + return +} + +func (securitySchemes *SecuritySchemes) UnmarshalJSON(data []byte) (err error) { + *securitySchemes, err = unmarshalStringMap[SecuritySchemeRef](data) + return } // Validate returns an error if Components does not comply with the OpenAPI spec. diff --git a/openapi3/content.go b/openapi3/content.go index f63463d4e..ac8494907 100644 --- a/openapi3/content.go +++ b/openapi3/content.go @@ -2,7 +2,6 @@ package openapi3 import ( "context" - "encoding/json" "sort" "strings" ) @@ -125,13 +124,7 @@ func (content Content) Validate(ctx context.Context, opts ...ValidationOption) e } // UnmarshalJSON sets Content to a copy of data. -func (content *Content) UnmarshalJSON(data []byte) error { - type ContentBis Content - var x ContentBis - if err := json.Unmarshal(data, &x); err != nil { - return unmarshalError(err) - } - delete(x, "origin") - *content = Content(x) - return nil +func (content *Content) UnmarshalJSON(data []byte) (err error) { + *content, err = unmarshalStringMap[MediaType](data) + return } From 450e4d03a6a526c5c1312d64fe0bb38618f8d4c9 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sun, 25 Aug 2024 12:30:40 +0200 Subject: [PATCH 06/31] add origin to more components --- openapi3/components.go | 67 +++++++++++++++++++++++-------- openapi3/contact.go | 2 + openapi3/content.go | 2 +- openapi3/discriminator.go | 2 + openapi3/encoding.go | 2 + openapi3/link.go | 2 + openapi3/operation.go | 2 +- openapi3/security_requirements.go | 6 +++ openapi3/security_scheme.go | 22 ++++++++-- openapi3/server.go | 4 ++ openapi3/tag.go | 2 + 11 files changed, 90 insertions(+), 23 deletions(-) diff --git a/openapi3/components.go b/openapi3/components.go index 905a4a22a..cea6bc95a 100644 --- a/openapi3/components.go +++ b/openapi3/components.go @@ -112,18 +112,16 @@ func (components *Components) UnmarshalJSON(data []byte) error { return nil } -type MapValue interface { - CallbackRef | ExampleRef | HeaderRef | LinkRef | ParameterRef | RequestBodyRef | ResponseRef | SchemaRef | SecuritySchemeRef | - MediaType -} - -// TODO: add origin to all components -func unmarshalStringMap[V MapValue](data []byte) (map[string]*V, error) { +// unmarshalStringMapP unmarshals given json into a map[string]*V +func unmarshalStringMapP[V any](data []byte) (map[string]*V, error) { var m map[string]any if err := json.Unmarshal(data, &m); err != nil { - return nil, unmarshalError(err) + return nil, err } + + // TODO: add origin to the result delete(m, "origin") + result := make(map[string]*V, len(m)) for k, v := range m { if data, err := json.Marshal(v); err != nil { @@ -140,48 +138,83 @@ func unmarshalStringMap[V MapValue](data []byte) (map[string]*V, error) { return result, nil } +// unmarshalStringMap unmarshals given json into a map[string]V +func unmarshalStringMap[V any](data []byte) (map[string]V, error) { + var m map[string]any + if err := json.Unmarshal(data, &m); err != nil { + return nil, err + } + + // TODO: add origin to the result + delete(m, "origin") + + result := make(map[string]V, len(m)) + for k, v := range m { + if data, err := json.Marshal(v); err != nil { + return nil, err + } else { + var v V + if err = json.Unmarshal(data, &v); err != nil { + return nil, err + } + result[k] = v + } + } + + return result, nil +} + +// UnmarshalJSON sets Callbacks to a copy of data. func (callbacks *Callbacks) UnmarshalJSON(data []byte) (err error) { - *callbacks, err = unmarshalStringMap[CallbackRef](data) + *callbacks, err = unmarshalStringMapP[CallbackRef](data) return } +// UnmarshalJSON sets Examples to a copy of data. func (examples *Examples) UnmarshalJSON(data []byte) (err error) { - *examples, err = unmarshalStringMap[ExampleRef](data) + *examples, err = unmarshalStringMapP[ExampleRef](data) return } +// UnmarshalJSON sets Headers to a copy of data. func (headers *Headers) UnmarshalJSON(data []byte) (err error) { - *headers, err = unmarshalStringMap[HeaderRef](data) + *headers, err = unmarshalStringMapP[HeaderRef](data) return } +// UnmarshalJSON sets Links to a copy of data. func (links *Links) UnmarshalJSON(data []byte) (err error) { - *links, err = unmarshalStringMap[LinkRef](data) + *links, err = unmarshalStringMapP[LinkRef](data) return } +// UnmarshalJSON sets ParametersMap to a copy of data. func (parametersMap *ParametersMap) UnmarshalJSON(data []byte) (err error) { - *parametersMap, err = unmarshalStringMap[ParameterRef](data) + *parametersMap, err = unmarshalStringMapP[ParameterRef](data) return } +// UnmarshalJSON sets RequestBodies to a copy of data. func (requestBodies *RequestBodies) UnmarshalJSON(data []byte) (err error) { - *requestBodies, err = unmarshalStringMap[RequestBodyRef](data) + *requestBodies, err = unmarshalStringMapP[RequestBodyRef](data) return } +// UnmarshalJSON sets ResponseBodies to a copy of data. func (responseBodies *ResponseBodies) UnmarshalJSON(data []byte) (err error) { - *responseBodies, err = unmarshalStringMap[ResponseRef](data) + *responseBodies, err = unmarshalStringMapP[ResponseRef](data) return } +// UnmarshalJSON sets Schemas to a copy of data. func (schemas *Schemas) UnmarshalJSON(data []byte) (err error) { - *schemas, err = unmarshalStringMap[SchemaRef](data) + *schemas, err = unmarshalStringMapP[SchemaRef](data) return } +// UnmarshalJSON sets SecuritySchemes to a copy of data. func (securitySchemes *SecuritySchemes) UnmarshalJSON(data []byte) (err error) { - *securitySchemes, err = unmarshalStringMap[SecuritySchemeRef](data) + *securitySchemes, err = unmarshalStringMapP[SecuritySchemeRef](data) return } diff --git a/openapi3/contact.go b/openapi3/contact.go index 6c76a6fb6..cf011648c 100644 --- a/openapi3/contact.go +++ b/openapi3/contact.go @@ -9,6 +9,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#contact-object type Contact struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` URL string `json:"url,omitempty" yaml:"url,omitempty"` @@ -50,6 +51,7 @@ func (contact *Contact) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "name") delete(x.Extensions, "url") delete(x.Extensions, "email") diff --git a/openapi3/content.go b/openapi3/content.go index ac8494907..64db65f65 100644 --- a/openapi3/content.go +++ b/openapi3/content.go @@ -125,6 +125,6 @@ func (content Content) Validate(ctx context.Context, opts ...ValidationOption) e // UnmarshalJSON sets Content to a copy of data. func (content *Content) UnmarshalJSON(data []byte) (err error) { - *content, err = unmarshalStringMap[MediaType](data) + *content, err = unmarshalStringMapP[MediaType](data) return } diff --git a/openapi3/discriminator.go b/openapi3/discriminator.go index e8193bd90..ff7a6e126 100644 --- a/openapi3/discriminator.go +++ b/openapi3/discriminator.go @@ -9,6 +9,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#discriminator-object type Discriminator struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` PropertyName string `json:"propertyName" yaml:"propertyName"` // required Mapping map[string]string `json:"mapping,omitempty" yaml:"mapping,omitempty"` @@ -44,6 +45,7 @@ func (discriminator *Discriminator) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "propertyName") delete(x.Extensions, "mapping") if len(x.Extensions) == 0 { diff --git a/openapi3/encoding.go b/openapi3/encoding.go index 1bcdaea5e..3c3f35d7b 100644 --- a/openapi3/encoding.go +++ b/openapi3/encoding.go @@ -11,6 +11,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#encoding-object type Encoding struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` ContentType string `json:"contentType,omitempty" yaml:"contentType,omitempty"` Headers Headers `json:"headers,omitempty" yaml:"headers,omitempty"` @@ -80,6 +81,7 @@ func (encoding *Encoding) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "contentType") delete(x.Extensions, "headers") delete(x.Extensions, "style") diff --git a/openapi3/link.go b/openapi3/link.go index 132f67803..498b74692 100644 --- a/openapi3/link.go +++ b/openapi3/link.go @@ -11,6 +11,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#link-object type Link struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` OperationRef string `json:"operationRef,omitempty" yaml:"operationRef,omitempty"` OperationID string `json:"operationId,omitempty" yaml:"operationId,omitempty"` @@ -66,6 +67,7 @@ func (link *Link) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "operationRef") delete(x.Extensions, "operationId") delete(x.Extensions, "description") diff --git a/openapi3/operation.go b/openapi3/operation.go index b55ad9f8b..4d2277443 100644 --- a/openapi3/operation.go +++ b/openapi3/operation.go @@ -14,7 +14,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operation-object type Operation struct { Extensions map[string]any `json:"-" yaml:"-"` - Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` // Optional tags for documentation. Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"` diff --git a/openapi3/security_requirements.go b/openapi3/security_requirements.go index 87891c954..d5310d87a 100644 --- a/openapi3/security_requirements.go +++ b/openapi3/security_requirements.go @@ -49,3 +49,9 @@ func (security *SecurityRequirement) Validate(ctx context.Context, opts ...Valid return nil } + +// UnmarshalJSON sets SecurityRequirement to a copy of data. +func (security *SecurityRequirement) UnmarshalJSON(data []byte) (err error) { + *security, err = unmarshalStringMap[[]string](data) + return +} diff --git a/openapi3/security_scheme.go b/openapi3/security_scheme.go index b5c94b618..68388be8d 100644 --- a/openapi3/security_scheme.go +++ b/openapi3/security_scheme.go @@ -12,6 +12,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-scheme-object type SecurityScheme struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Type string `json:"type,omitempty" yaml:"type,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` @@ -100,6 +101,7 @@ func (ss *SecurityScheme) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "type") delete(x.Extensions, "description") delete(x.Extensions, "name") @@ -216,6 +218,7 @@ func (ss *SecurityScheme) Validate(ctx context.Context, opts ...ValidationOption // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauth-flows-object type OAuthFlows struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Implicit *OAuthFlow `json:"implicit,omitempty" yaml:"implicit,omitempty"` Password *OAuthFlow `json:"password,omitempty" yaml:"password,omitempty"` @@ -270,6 +273,7 @@ func (flows *OAuthFlows) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "implicit") delete(x.Extensions, "password") delete(x.Extensions, "clientCredentials") @@ -312,15 +316,18 @@ func (flows *OAuthFlows) Validate(ctx context.Context, opts ...ValidationOption) return validateExtensions(ctx, flows.Extensions) } +type Scopes map[string]string + // OAuthFlow is specified by OpenAPI/Swagger standard version 3. // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauth-flow-object type OAuthFlow struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` - AuthorizationURL string `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"` - TokenURL string `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"` - RefreshURL string `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty"` - Scopes map[string]string `json:"scopes" yaml:"scopes"` // required + AuthorizationURL string `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"` + TokenURL string `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"` + RefreshURL string `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty"` + Scopes Scopes `json:"scopes" yaml:"scopes"` // required } // MarshalJSON returns the JSON encoding of OAuthFlow. @@ -359,6 +366,7 @@ func (flow *OAuthFlow) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "authorizationUrl") delete(x.Extensions, "tokenUrl") delete(x.Extensions, "refreshUrl") @@ -427,3 +435,9 @@ func (flow *OAuthFlow) validate(ctx context.Context, typ oAuthFlowType, opts ... return flow.Validate(ctx, opts...) } + +// UnmarshalJSON sets Scopes to a copy of data. +func (scopes *Scopes) UnmarshalJSON(data []byte) (err error) { + *scopes, err = unmarshalStringMap[string](data) + return +} diff --git a/openapi3/server.go b/openapi3/server.go index 7a2007f20..262935720 100644 --- a/openapi3/server.go +++ b/openapi3/server.go @@ -52,6 +52,7 @@ func (servers Servers) MatchURL(parsedURL *url.URL) (*Server, []string, string) // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#server-object type Server struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` URL string `json:"url" yaml:"url"` // Required Description string `json:"description,omitempty" yaml:"description,omitempty"` @@ -115,6 +116,7 @@ func (server *Server) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "url") delete(x.Extensions, "description") delete(x.Extensions, "variables") @@ -235,6 +237,7 @@ func (server *Server) Validate(ctx context.Context, opts ...ValidationOption) (e // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#server-variable-object type ServerVariable struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Enum []string `json:"enum,omitempty" yaml:"enum,omitempty"` Default string `json:"default,omitempty" yaml:"default,omitempty"` @@ -276,6 +279,7 @@ func (serverVariable *ServerVariable) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "enum") delete(x.Extensions, "default") delete(x.Extensions, "description") diff --git a/openapi3/tag.go b/openapi3/tag.go index 182d0502a..cffd807ff 100644 --- a/openapi3/tag.go +++ b/openapi3/tag.go @@ -34,6 +34,7 @@ func (tags Tags) Validate(ctx context.Context, opts ...ValidationOption) error { // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#tag-object type Tag struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` @@ -75,6 +76,7 @@ func (t *Tag) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, "origin") delete(x.Extensions, "name") delete(x.Extensions, "description") delete(x.Extensions, "externalDocs") From 6b52b19bb1a3b7bab5c62f4c9630a613d0c188fe Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sun, 25 Aug 2024 12:57:01 +0200 Subject: [PATCH 07/31] revert comments --- openapi3/schema.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openapi3/schema.go b/openapi3/schema.go index 05e755582..81a15aec6 100644 --- a/openapi3/schema.go +++ b/openapi3/schema.go @@ -470,7 +470,7 @@ func (schema *Schema) UnmarshalJSON(data []byte) error { *schema = Schema(x) if schema.Format == "date" { - // This is a fix for: https://github.com/oasdiff/kin-openapi/issues/697 + // This is a fix for: https://github.com/getkin/kin-openapi/issues/697 if eg, ok := schema.Example.(string); ok { schema.Example = strings.TrimSuffix(eg, "T00:00:00Z") } @@ -1205,7 +1205,7 @@ func (schema *Schema) visitJSON(settings *schemaValidationSettings, value any) ( return schema.visitJSONArray(settings, value) case map[string]any: return schema.visitJSONObject(settings, value) - case map[any]any: // for YAML cf. issue https://github.com/oasdiff/kin-openapi/issues/444 + case map[any]any: // for YAML cf. issue https://github.com/getkin/kin-openapi/issues/444 values := make(map[string]any, len(value)) for key, v := range value { if k, ok := key.(string); ok { From 775ab17f4f9fcd7a059858c1051d07c22ae6782a Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sun, 25 Aug 2024 13:13:38 +0200 Subject: [PATCH 08/31] use const originKey --- maps.sh | 2 +- openapi3/components.go | 54 +---------------------------------- openapi3/contact.go | 2 +- openapi3/discriminator.go | 2 +- openapi3/encoding.go | 2 +- openapi3/info.go | 2 +- openapi3/license.go | 2 +- openapi3/link.go | 2 +- openapi3/maplike.go | 6 ++-- openapi3/media_type.go | 2 +- openapi3/operation.go | 2 +- openapi3/origin.go | 56 +++++++++++++++++++++++++++++++++++++ openapi3/parameter.go | 2 +- openapi3/path_item.go | 2 +- openapi3/request_body.go | 2 +- openapi3/response.go | 2 +- openapi3/schema.go | 2 +- openapi3/security_scheme.go | 6 ++-- openapi3/server.go | 4 +-- openapi3/tag.go | 2 +- 20 files changed, 80 insertions(+), 76 deletions(-) diff --git a/maps.sh b/maps.sh index 0f1fa2526..e2915bf41 100755 --- a/maps.sh +++ b/maps.sh @@ -209,7 +209,7 @@ func (${name} ${type}) UnmarshalJSON(data []byte) (err error) { continue } - if k == "origin" { + if k == originKey { var data []byte if data, err = json.Marshal(v); err != nil { return diff --git a/openapi3/components.go b/openapi3/components.go index cea6bc95a..ca2ed8286 100644 --- a/openapi3/components.go +++ b/openapi3/components.go @@ -95,7 +95,7 @@ func (components *Components) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "schemas") delete(x.Extensions, "parameters") delete(x.Extensions, "headers") @@ -112,58 +112,6 @@ func (components *Components) UnmarshalJSON(data []byte) error { return nil } -// unmarshalStringMapP unmarshals given json into a map[string]*V -func unmarshalStringMapP[V any](data []byte) (map[string]*V, error) { - var m map[string]any - if err := json.Unmarshal(data, &m); err != nil { - return nil, err - } - - // TODO: add origin to the result - delete(m, "origin") - - result := make(map[string]*V, len(m)) - for k, v := range m { - if data, err := json.Marshal(v); err != nil { - return nil, err - } else { - var v V - if err = json.Unmarshal(data, &v); err != nil { - return nil, err - } - result[k] = &v - } - } - - return result, nil -} - -// unmarshalStringMap unmarshals given json into a map[string]V -func unmarshalStringMap[V any](data []byte) (map[string]V, error) { - var m map[string]any - if err := json.Unmarshal(data, &m); err != nil { - return nil, err - } - - // TODO: add origin to the result - delete(m, "origin") - - result := make(map[string]V, len(m)) - for k, v := range m { - if data, err := json.Marshal(v); err != nil { - return nil, err - } else { - var v V - if err = json.Unmarshal(data, &v); err != nil { - return nil, err - } - result[k] = v - } - } - - return result, nil -} - // UnmarshalJSON sets Callbacks to a copy of data. func (callbacks *Callbacks) UnmarshalJSON(data []byte) (err error) { *callbacks, err = unmarshalStringMapP[CallbackRef](data) diff --git a/openapi3/contact.go b/openapi3/contact.go index cf011648c..5b95139e7 100644 --- a/openapi3/contact.go +++ b/openapi3/contact.go @@ -51,7 +51,7 @@ func (contact *Contact) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "name") delete(x.Extensions, "url") delete(x.Extensions, "email") diff --git a/openapi3/discriminator.go b/openapi3/discriminator.go index ff7a6e126..6fe8532fa 100644 --- a/openapi3/discriminator.go +++ b/openapi3/discriminator.go @@ -45,7 +45,7 @@ func (discriminator *Discriminator) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "propertyName") delete(x.Extensions, "mapping") if len(x.Extensions) == 0 { diff --git a/openapi3/encoding.go b/openapi3/encoding.go index 3c3f35d7b..b96ebbc06 100644 --- a/openapi3/encoding.go +++ b/openapi3/encoding.go @@ -81,7 +81,7 @@ func (encoding *Encoding) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "contentType") delete(x.Extensions, "headers") delete(x.Extensions, "style") diff --git a/openapi3/info.go b/openapi3/info.go index c44ca4fe1..acca2f4d4 100644 --- a/openapi3/info.go +++ b/openapi3/info.go @@ -63,7 +63,7 @@ func (info *Info) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "title") delete(x.Extensions, "description") delete(x.Extensions, "termsOfService") diff --git a/openapi3/license.go b/openapi3/license.go index 68bfc4bfc..df9d6c446 100644 --- a/openapi3/license.go +++ b/openapi3/license.go @@ -46,7 +46,7 @@ func (license *License) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "name") delete(x.Extensions, "url") if len(x.Extensions) == 0 { diff --git a/openapi3/link.go b/openapi3/link.go index 498b74692..6e5c27796 100644 --- a/openapi3/link.go +++ b/openapi3/link.go @@ -67,7 +67,7 @@ func (link *Link) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "operationRef") delete(x.Extensions, "operationId") delete(x.Extensions, "description") diff --git a/openapi3/maplike.go b/openapi3/maplike.go index c51c43927..35b336571 100644 --- a/openapi3/maplike.go +++ b/openapi3/maplike.go @@ -125,7 +125,7 @@ func (responses *Responses) UnmarshalJSON(data []byte) (err error) { continue } - if k == "origin" { + if k == originKey { var data []byte if data, err = json.Marshal(v); err != nil { return @@ -267,7 +267,7 @@ func (callback *Callback) UnmarshalJSON(data []byte) (err error) { continue } - if k == "origin" { + if k == originKey { var data []byte if data, err = json.Marshal(v); err != nil { return @@ -409,7 +409,7 @@ func (paths *Paths) UnmarshalJSON(data []byte) (err error) { continue } - if k == "origin" { + if k == originKey { var data []byte if data, err = json.Marshal(v); err != nil { return diff --git a/openapi3/media_type.go b/openapi3/media_type.go index 29f0f673b..d6edaf4d2 100644 --- a/openapi3/media_type.go +++ b/openapi3/media_type.go @@ -102,7 +102,7 @@ func (mediaType *MediaType) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "schema") delete(x.Extensions, "example") delete(x.Extensions, "examples") diff --git a/openapi3/operation.go b/openapi3/operation.go index 4d2277443..7b57e847c 100644 --- a/openapi3/operation.go +++ b/openapi3/operation.go @@ -117,7 +117,7 @@ func (operation *Operation) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "tags") delete(x.Extensions, "summary") delete(x.Extensions, "description") diff --git a/openapi3/origin.go b/openapi3/origin.go index 1c6da4638..bef39ca3b 100644 --- a/openapi3/origin.go +++ b/openapi3/origin.go @@ -1,5 +1,9 @@ package openapi3 +import "encoding/json" + +const originKey = "origin" + type Origin struct { Key *Location `json:"key,omitempty" yaml:"key,omitempty"` Fields map[string]Location `json:"fields,omitempty" yaml:"fields,omitempty"` @@ -9,3 +13,55 @@ type Location struct { Line int `json:"line,omitempty" yaml:"line,omitempty"` Column int `json:"column,omitempty" yaml:"column,omitempty"` } + +// unmarshalStringMapP unmarshals given json into a map[string]*V +func unmarshalStringMapP[V any](data []byte) (map[string]*V, error) { + var m map[string]any + if err := json.Unmarshal(data, &m); err != nil { + return nil, err + } + + // TODO: add origin to the result + delete(m, originKey) + + result := make(map[string]*V, len(m)) + for k, v := range m { + if data, err := json.Marshal(v); err != nil { + return nil, err + } else { + var v V + if err = json.Unmarshal(data, &v); err != nil { + return nil, err + } + result[k] = &v + } + } + + return result, nil +} + +// unmarshalStringMap unmarshals given json into a map[string]V +func unmarshalStringMap[V any](data []byte) (map[string]V, error) { + var m map[string]any + if err := json.Unmarshal(data, &m); err != nil { + return nil, err + } + + // TODO: add origin to the result + delete(m, originKey) + + result := make(map[string]V, len(m)) + for k, v := range m { + if data, err := json.Marshal(v); err != nil { + return nil, err + } else { + var v V + if err = json.Unmarshal(data, &v); err != nil { + return nil, err + } + result[k] = v + } + } + + return result, nil +} diff --git a/openapi3/parameter.go b/openapi3/parameter.go index 855c1a4f1..133c865c1 100644 --- a/openapi3/parameter.go +++ b/openapi3/parameter.go @@ -217,7 +217,7 @@ func (parameter *Parameter) UnmarshalJSON(data []byte) error { } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "name") delete(x.Extensions, "in") delete(x.Extensions, "description") diff --git a/openapi3/path_item.go b/openapi3/path_item.go index 00eb6bfd5..2c60472a4 100644 --- a/openapi3/path_item.go +++ b/openapi3/path_item.go @@ -99,7 +99,7 @@ func (pathItem *PathItem) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "$ref") delete(x.Extensions, "summary") delete(x.Extensions, "description") diff --git a/openapi3/request_body.go b/openapi3/request_body.go index a753db8b7..03d91e6da 100644 --- a/openapi3/request_body.go +++ b/openapi3/request_body.go @@ -109,7 +109,7 @@ func (requestBody *RequestBody) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "description") delete(x.Extensions, "required") delete(x.Extensions, "content") diff --git a/openapi3/response.go b/openapi3/response.go index 1b782523d..3103c3f60 100644 --- a/openapi3/response.go +++ b/openapi3/response.go @@ -173,7 +173,7 @@ func (response *Response) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "description") delete(x.Extensions, "headers") delete(x.Extensions, "content") diff --git a/openapi3/schema.go b/openapi3/schema.go index 81a15aec6..b62da5211 100644 --- a/openapi3/schema.go +++ b/openapi3/schema.go @@ -413,7 +413,7 @@ func (schema *Schema) UnmarshalJSON(data []byte) error { } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "oneOf") delete(x.Extensions, "anyOf") delete(x.Extensions, "allOf") diff --git a/openapi3/security_scheme.go b/openapi3/security_scheme.go index 68388be8d..43f2fcb7d 100644 --- a/openapi3/security_scheme.go +++ b/openapi3/security_scheme.go @@ -101,7 +101,7 @@ func (ss *SecurityScheme) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "type") delete(x.Extensions, "description") delete(x.Extensions, "name") @@ -273,7 +273,7 @@ func (flows *OAuthFlows) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "implicit") delete(x.Extensions, "password") delete(x.Extensions, "clientCredentials") @@ -366,7 +366,7 @@ func (flow *OAuthFlow) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "authorizationUrl") delete(x.Extensions, "tokenUrl") delete(x.Extensions, "refreshUrl") diff --git a/openapi3/server.go b/openapi3/server.go index 262935720..5a817e511 100644 --- a/openapi3/server.go +++ b/openapi3/server.go @@ -116,7 +116,7 @@ func (server *Server) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "url") delete(x.Extensions, "description") delete(x.Extensions, "variables") @@ -279,7 +279,7 @@ func (serverVariable *ServerVariable) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "enum") delete(x.Extensions, "default") delete(x.Extensions, "description") diff --git a/openapi3/tag.go b/openapi3/tag.go index cffd807ff..5e4086fef 100644 --- a/openapi3/tag.go +++ b/openapi3/tag.go @@ -76,7 +76,7 @@ func (t *Tag) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) - delete(x.Extensions, "origin") + delete(x.Extensions, originKey) delete(x.Extensions, "name") delete(x.Extensions, "description") delete(x.Extensions, "externalDocs") From d241445810aa1970905ae244a46213c9232299a5 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Mon, 26 Aug 2024 22:18:00 +0300 Subject: [PATCH 09/31] comment to Scopes --- openapi3/security_scheme.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openapi3/security_scheme.go b/openapi3/security_scheme.go index 43f2fcb7d..2e227cdd2 100644 --- a/openapi3/security_scheme.go +++ b/openapi3/security_scheme.go @@ -316,8 +316,6 @@ func (flows *OAuthFlows) Validate(ctx context.Context, opts ...ValidationOption) return validateExtensions(ctx, flows.Extensions) } -type Scopes map[string]string - // OAuthFlow is specified by OpenAPI/Swagger standard version 3. // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauth-flow-object type OAuthFlow struct { @@ -436,6 +434,10 @@ func (flow *OAuthFlow) validate(ctx context.Context, typ oAuthFlowType, opts ... return flow.Validate(ctx, opts...) } +// Scopes is specified by OpenAPI/Swagger standard version 3. +// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauth-flow-object +type Scopes map[string]string + // UnmarshalJSON sets Scopes to a copy of data. func (scopes *Scopes) UnmarshalJSON(data []byte) (err error) { *scopes, err = unmarshalStringMap[string](data) From 206c1be54c5ad51baadd3d4da0ef2b6207ec2a4d Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Mon, 26 Aug 2024 23:02:55 +0300 Subject: [PATCH 10/31] test more specs --- openapi3/openapi3_test.go | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/openapi3/openapi3_test.go b/openapi3/openapi3_test.go index 8db50ec56..3e7e57924 100644 --- a/openapi3/openapi3_test.go +++ b/openapi3/openapi3_test.go @@ -3,6 +3,8 @@ package openapi3 import ( "context" "encoding/json" + "fmt" + "os" "strings" "testing" @@ -479,9 +481,32 @@ func TestAddRemoveServer(t *testing.T) { func TestOrigin(t *testing.T) { loader := NewLoader() + loader.IsExternalRefsAllowed = true loader.IncludeOrigin = true loader.Context = context.Background() - doc, err := loader.LoadFromFile("testdata/testpath.yaml") - require.NoError(t, err) - require.NotEmpty(t, doc) + + const dir = "testdata" + items, _ := os.ReadDir(dir) + for _, item := range items { + if item.IsDir() { + continue + } + if strings.HasSuffix(item.Name(), ".json") { + continue + } + if item.Name() == "issue235.spec0-typo.yml" || + item.Name() == "callbacks.yml.internalized.yml" || + item.Name() == "spec.yaml.internalized.yml" || + item.Name() == "testref.openapi.yml.internalized.yml" { + continue + } + t.Run(item.Name(), func(t *testing.T) { + doc, err := loader.LoadFromFile(fmt.Sprintf("%s/%s", dir, item.Name())) + require.NoError(t, err) + if doc.Paths == nil { + t.Skip("no paths") + } + require.NotEmpty(t, doc.Paths.Origin) + }) + } } From 032ff7641af5d2e4b4e91e9ffab4d13fb2e46b7a Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 17 Sep 2024 12:02:35 +0300 Subject: [PATCH 11/31] Fix Discriminator --- openapi3/discriminator.go | 4 ++-- openapi3/origin.go | 9 +++++++++ openapi3/security_scheme.go | 18 ++++-------------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/openapi3/discriminator.go b/openapi3/discriminator.go index 6fe8532fa..2a1370557 100644 --- a/openapi3/discriminator.go +++ b/openapi3/discriminator.go @@ -11,8 +11,8 @@ type Discriminator struct { Extensions map[string]any `json:"-" yaml:"-"` Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` - PropertyName string `json:"propertyName" yaml:"propertyName"` // required - Mapping map[string]string `json:"mapping,omitempty" yaml:"mapping,omitempty"` + PropertyName string `json:"propertyName" yaml:"propertyName"` // required + Mapping StringMap `json:"mapping,omitempty" yaml:"mapping,omitempty"` } // MarshalJSON returns the JSON encoding of Discriminator. diff --git a/openapi3/origin.go b/openapi3/origin.go index bef39ca3b..2e8d60ece 100644 --- a/openapi3/origin.go +++ b/openapi3/origin.go @@ -65,3 +65,12 @@ func unmarshalStringMap[V any](data []byte) (map[string]V, error) { return result, nil } + +// StringMap allows us to customize the unmarshalling of a map[string]string in order to support the `origin` field. +type StringMap map[string]string + +// UnmarshalJSON sets StringMap to a copy of data. +func (stringMap *StringMap) UnmarshalJSON(data []byte) (err error) { + *stringMap, err = unmarshalStringMap[string](data) + return +} diff --git a/openapi3/security_scheme.go b/openapi3/security_scheme.go index 2e227cdd2..02a058720 100644 --- a/openapi3/security_scheme.go +++ b/openapi3/security_scheme.go @@ -322,10 +322,10 @@ type OAuthFlow struct { Extensions map[string]any `json:"-" yaml:"-"` Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` - AuthorizationURL string `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"` - TokenURL string `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"` - RefreshURL string `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty"` - Scopes Scopes `json:"scopes" yaml:"scopes"` // required + AuthorizationURL string `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"` + TokenURL string `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"` + RefreshURL string `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty"` + Scopes StringMap `json:"scopes" yaml:"scopes"` // required } // MarshalJSON returns the JSON encoding of OAuthFlow. @@ -433,13 +433,3 @@ func (flow *OAuthFlow) validate(ctx context.Context, typ oAuthFlowType, opts ... return flow.Validate(ctx, opts...) } - -// Scopes is specified by OpenAPI/Swagger standard version 3. -// See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauth-flow-object -type Scopes map[string]string - -// UnmarshalJSON sets Scopes to a copy of data. -func (scopes *Scopes) UnmarshalJSON(data []byte) (err error) { - *scopes, err = unmarshalStringMap[string](data) - return -} From 4304772f168492e3d8d5c0e004aac5e54e6637a7 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 17 Sep 2024 12:05:21 +0300 Subject: [PATCH 12/31] update docs --- .github/docs/openapi3.txt | 100 +++++++++++++++++++++++++++++++++++--- 1 file changed, 93 insertions(+), 7 deletions(-) diff --git a/.github/docs/openapi3.txt b/.github/docs/openapi3.txt index 09f1192ab..25b66e32c 100644 --- a/.github/docs/openapi3.txt +++ b/.github/docs/openapi3.txt @@ -226,6 +226,7 @@ func (addProps *AdditionalProperties) UnmarshalJSON(data []byte) error type Callback struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` // Has unexported fields. } @@ -274,6 +275,7 @@ type CallbackRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin *Origin Ref string Value *Callback @@ -316,6 +318,9 @@ func (m Callbacks) JSONLookup(token string) (any, error) JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (callbacks *Callbacks) UnmarshalJSON(data []byte) (err error) + UnmarshalJSON sets Callbacks to a copy of data. + type ComponentRef interface { RefString() string RefPath() *url.URL @@ -324,6 +329,7 @@ type ComponentRef interface { type Components struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Schemas Schemas `json:"schemas,omitempty" yaml:"schemas,omitempty"` Parameters ParametersMap `json:"parameters,omitempty" yaml:"parameters,omitempty"` @@ -355,6 +361,7 @@ func (components *Components) Validate(ctx context.Context, opts ...ValidationOp type Contact struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` URL string `json:"url,omitempty" yaml:"url,omitempty"` @@ -394,14 +401,18 @@ func NewContentWithSchemaRef(schema *SchemaRef, consumes []string) Content func (content Content) Get(mime string) *MediaType +func (content *Content) UnmarshalJSON(data []byte) (err error) + UnmarshalJSON sets Content to a copy of data. + func (content Content) Validate(ctx context.Context, opts ...ValidationOption) error Validate returns an error if Content does not comply with the OpenAPI spec. type Discriminator struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` - PropertyName string `json:"propertyName" yaml:"propertyName"` // required - Mapping map[string]string `json:"mapping,omitempty" yaml:"mapping,omitempty"` + PropertyName string `json:"propertyName" yaml:"propertyName"` // required + Mapping StringMap `json:"mapping,omitempty" yaml:"mapping,omitempty"` } Discriminator is specified by OpenAPI/Swagger standard version 3. See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#discriminator-object @@ -421,6 +432,7 @@ func (discriminator *Discriminator) Validate(ctx context.Context, opts ...Valida type Encoding struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` ContentType string `json:"contentType,omitempty" yaml:"contentType,omitempty"` Headers Headers `json:"headers,omitempty" yaml:"headers,omitempty"` @@ -483,6 +495,7 @@ type ExampleRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin *Origin Ref string Value *Example @@ -525,6 +538,9 @@ func (m Examples) JSONLookup(token string) (any, error) JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (examples *Examples) UnmarshalJSON(data []byte) (err error) + UnmarshalJSON sets Examples to a copy of data. + type ExternalDocs struct { Extensions map[string]any `json:"-" yaml:"-"` @@ -593,6 +609,7 @@ type HeaderRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin *Origin Ref string Value *Header @@ -635,8 +652,12 @@ func (m Headers) JSONLookup(token string) (any, error) JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (headers *Headers) UnmarshalJSON(data []byte) (err error) + UnmarshalJSON sets Headers to a copy of data. + type Info struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Title string `json:"title" yaml:"title"` // Required Description string `json:"description,omitempty" yaml:"description,omitempty"` @@ -665,6 +686,7 @@ type IntegerFormatValidator = FormatValidator[int64] type License struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Name string `json:"name" yaml:"name"` // Required URL string `json:"url,omitempty" yaml:"url,omitempty"` @@ -686,6 +708,7 @@ func (license *License) Validate(ctx context.Context, opts ...ValidationOption) type Link struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` OperationRef string `json:"operationRef,omitempty" yaml:"operationRef,omitempty"` OperationID string `json:"operationId,omitempty" yaml:"operationId,omitempty"` @@ -713,6 +736,7 @@ type LinkRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin *Origin Ref string Value *Link @@ -754,10 +778,16 @@ func (m Links) JSONLookup(token string) (any, error) JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (links *Links) UnmarshalJSON(data []byte) (err error) + UnmarshalJSON sets Links to a copy of data. + type Loader struct { // IsExternalRefsAllowed enables visiting other files IsExternalRefsAllowed bool + // IncludeOrigin specifies whether to include the origin of the OpenAPI elements + IncludeOrigin bool + // ReadFromURIFunc allows overriding the any file/URL reading func ReadFromURIFunc ReadFromURIFunc @@ -793,8 +823,14 @@ func (loader *Loader) LoadFromURI(location *url.URL) (*T, error) func (loader *Loader) ResolveRefsIn(doc *T, location *url.URL) (err error) ResolveRefsIn expands references if for instance spec was just unmarshaled +type Location struct { + Line int `json:"line,omitempty" yaml:"line,omitempty"` + Column int `json:"column,omitempty" yaml:"column,omitempty"` +} + type MediaType struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Schema *SchemaRef `json:"schema,omitempty" yaml:"schema,omitempty"` Example any `json:"example,omitempty" yaml:"example,omitempty"` @@ -872,11 +908,12 @@ type NumberFormatValidator = FormatValidator[float64] type OAuthFlow struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` - AuthorizationURL string `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"` - TokenURL string `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"` - RefreshURL string `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty"` - Scopes map[string]string `json:"scopes" yaml:"scopes"` // required + AuthorizationURL string `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"` + TokenURL string `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"` + RefreshURL string `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty"` + Scopes StringMap `json:"scopes" yaml:"scopes"` // required } OAuthFlow is specified by OpenAPI/Swagger standard version 3. See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauth-flow-object @@ -896,6 +933,7 @@ func (flow *OAuthFlow) Validate(ctx context.Context, opts ...ValidationOption) e type OAuthFlows struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Implicit *OAuthFlow `json:"implicit,omitempty" yaml:"implicit,omitempty"` Password *OAuthFlow `json:"password,omitempty" yaml:"password,omitempty"` @@ -920,6 +958,7 @@ func (flows *OAuthFlows) Validate(ctx context.Context, opts ...ValidationOption) type Operation struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` // Optional tags for documentation. Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"` @@ -982,8 +1021,14 @@ func (operation *Operation) Validate(ctx context.Context, opts ...ValidationOpti Validate returns an error if Operation does not comply with the OpenAPI spec. +type Origin struct { + Key *Location `json:"key,omitempty" yaml:"key,omitempty"` + Fields map[string]Location `json:"fields,omitempty" yaml:"fields,omitempty"` +} + type Parameter struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` In string `json:"in,omitempty" yaml:"in,omitempty"` @@ -1042,6 +1087,7 @@ type ParameterRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin *Origin Ref string Value *Parameter @@ -1099,8 +1145,12 @@ func (m ParametersMap) JSONLookup(token string) (any, error) JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (parametersMap *ParametersMap) UnmarshalJSON(data []byte) (err error) + UnmarshalJSON sets ParametersMap to a copy of data. + type PathItem struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"` Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` @@ -1140,6 +1190,7 @@ func (pathItem *PathItem) Validate(ctx context.Context, opts ...ValidationOption type Paths struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` // Has unexported fields. } @@ -1228,7 +1279,8 @@ func URIMapCache(reader ReadFromURIFunc) ReadFromURIFunc documents. type Ref struct { - Ref string `json:"$ref" yaml:"$ref"` + Ref string `json:"$ref" yaml:"$ref"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` } Ref is specified by OpenAPI/Swagger 3.0 standard. See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#reference-object @@ -1246,8 +1298,12 @@ func (m RequestBodies) JSONLookup(token string) (any, error) JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (requestBodies *RequestBodies) UnmarshalJSON(data []byte) (err error) + UnmarshalJSON sets RequestBodies to a copy of data. + type RequestBody struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Required bool `json:"required,omitempty" yaml:"required,omitempty"` @@ -1295,6 +1351,7 @@ type RequestBodyRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin *Origin Ref string Value *RequestBody @@ -1333,6 +1390,7 @@ func (x *RequestBodyRef) Validate(ctx context.Context, opts ...ValidationOption) type Response struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Description *string `json:"description,omitempty" yaml:"description,omitempty"` Headers Headers `json:"headers,omitempty" yaml:"headers,omitempty"` @@ -1370,10 +1428,14 @@ func (m ResponseBodies) JSONLookup(token string) (any, error) JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (responseBodies *ResponseBodies) UnmarshalJSON(data []byte) (err error) + UnmarshalJSON sets ResponseBodies to a copy of data. + type ResponseRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin *Origin Ref string Value *Response @@ -1412,6 +1474,7 @@ func (x *ResponseRef) Validate(ctx context.Context, opts ...ValidationOption) er type Responses struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"-" yaml:"-"` // Has unexported fields. } @@ -1470,6 +1533,7 @@ func (responses *Responses) Value(key string) *ResponseRef type Schema struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` OneOf SchemaRefs `json:"oneOf,omitempty" yaml:"oneOf,omitempty"` AnyOf SchemaRefs `json:"anyOf,omitempty" yaml:"anyOf,omitempty"` @@ -1684,6 +1748,7 @@ type SchemaRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin *Origin Ref string Value *Schema @@ -1774,6 +1839,9 @@ func (m Schemas) JSONLookup(token string) (any, error) JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (schemas *Schemas) UnmarshalJSON(data []byte) (err error) + UnmarshalJSON sets Schemas to a copy of data. + type SecurityRequirement map[string][]string SecurityRequirement is specified by OpenAPI/Swagger standard version 3. See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-requirement-object @@ -1782,6 +1850,9 @@ func NewSecurityRequirement() SecurityRequirement func (security SecurityRequirement) Authenticate(provider string, scopes ...string) SecurityRequirement +func (security *SecurityRequirement) UnmarshalJSON(data []byte) (err error) + UnmarshalJSON sets SecurityRequirement to a copy of data. + func (security *SecurityRequirement) Validate(ctx context.Context, opts ...ValidationOption) error Validate returns an error if SecurityRequirement does not comply with the OpenAPI spec. @@ -1798,6 +1869,7 @@ func (srs *SecurityRequirements) With(securityRequirement SecurityRequirement) * type SecurityScheme struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Type string `json:"type,omitempty" yaml:"type,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` @@ -1848,6 +1920,7 @@ type SecuritySchemeRef struct { // Extensions only captures fields starting with 'x-' as no other fields // are allowed by the openapi spec. Extensions map[string]any + Origin *Origin Ref string Value *SecurityScheme @@ -1891,6 +1964,9 @@ func (m SecuritySchemes) JSONLookup(token string) (any, error) JSONLookup implements https://pkg.go.dev/github.com/go-openapi/jsonpointer#JSONPointable +func (securitySchemes *SecuritySchemes) UnmarshalJSON(data []byte) (err error) + UnmarshalJSON sets SecuritySchemes to a copy of data. + type SerializationMethod struct { Style string Explode bool @@ -1900,6 +1976,7 @@ type SerializationMethod struct { type Server struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` URL string `json:"url" yaml:"url"` // Required Description string `json:"description,omitempty" yaml:"description,omitempty"` @@ -1930,6 +2007,7 @@ func (server *Server) Validate(ctx context.Context, opts ...ValidationOption) (e type ServerVariable struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Enum []string `json:"enum,omitempty" yaml:"enum,omitempty"` Default string `json:"default,omitempty" yaml:"default,omitempty"` @@ -1973,6 +2051,13 @@ func NewRegexpFormatValidator(pattern string) StringFormatValidator NewRegexpFormatValidator creates a new FormatValidator that uses a regular expression to validate the value. +type StringMap map[string]string + StringMap allows us to customize the unmarshalling of a map[string]string in + order to support the `origin` field. + +func (stringMap *StringMap) UnmarshalJSON(data []byte) (err error) + UnmarshalJSON sets StringMap to a copy of data. + type T struct { Extensions map[string]any `json:"-" yaml:"-"` @@ -2028,6 +2113,7 @@ func (doc *T) Validate(ctx context.Context, opts ...ValidationOption) error type Tag struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` From 67ee9fa7a743ca4a50b1aafac09ee4c56d33b3b1 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 17 Sep 2024 12:13:24 +0300 Subject: [PATCH 13/31] test on a decent set of dedicated specs --- openapi3/openapi3_test.go | 14 +- .../origin/add_new_media_type_base.yaml | 58 ++ .../origin/add_new_media_type_revision.yaml | 68 +++ .../origin/api_security_added_base.yaml | 33 + .../origin/api_security_added_revision.yaml | 37 ++ .../api_security_global_added_base.yaml | 33 + .../api_security_global_added_revision.yaml | 37 ++ .../origin/api_security_updated_base.yaml | 46 ++ .../origin/api_security_updated_revision.yaml | 43 ++ openapi3/testdata/origin/circular1.yaml | 40 ++ openapi3/testdata/origin/circular2.yaml | 40 ++ openapi3/testdata/origin/circular3.yaml | 25 + .../component_security_updated_base.yaml | 37 ++ .../component_security_updated_revision.yaml | 40 ++ ...ifferent_component_modified_parameter.yaml | 25 + .../different_component_same_header.yaml | 20 + .../different_component_same_parameter.yaml | 25 + .../different_component_same_schema.yaml | 10 + openapi3/testdata/origin/empty.yaml | 5 + openapi3/testdata/origin/home-iot-api-1.yaml | 573 ++++++++++++++++++ openapi3/testdata/origin/home-iot-api-2.yaml | 573 ++++++++++++++++++ openapi3/testdata/origin/openapi-test1.yaml | 312 ++++++++++ openapi3/testdata/origin/openapi-test2.yaml | 72 +++ openapi3/testdata/origin/openapi-test3.yaml | 269 ++++++++ openapi3/testdata/origin/openapi-test4.yaml | 56 ++ openapi3/testdata/origin/openapi-test5.yaml | 181 ++++++ openapi3/testdata/origin/openapi-test6.yaml | 23 + openapi3/testdata/origin/openapi-test7.yaml | 5 + openapi3/testdata/origin/openapi-test701.yaml | 253 ++++++++ openapi3/testdata/origin/openapi-test702.yaml | 313 ++++++++++ openapi3/testdata/origin/openapi-test703.yaml | 330 ++++++++++ openapi3/testdata/origin/openapi-test704.yaml | 332 ++++++++++ openapi3/testdata/origin/openapi-test8.yaml | 17 + openapi3/testdata/origin/openapi31-test1.yaml | 34 ++ openapi3/testdata/origin/openapi31-test2.yaml | 35 ++ .../origin/operation_id_added_base.yaml | 59 ++ .../origin/operation_id_removed_base.yaml | 60 ++ .../origin/pattern-base-recursive.yaml | 65 ++ openapi3/testdata/origin/pattern-base.yaml | 62 ++ .../pattern-modified-not-anystring.yaml | 62 ++ .../testdata/origin/pattern-modified.yaml | 62 ++ .../origin/pattern-parameter-base.yaml | 63 ++ ...tern-parameter-modified-not-anystring.yaml | 63 ++ .../origin/pattern-parameter-revision.yaml | 62 ++ .../origin/pattern-revision-recursive.yaml | 64 ++ .../testdata/origin/pattern-revision.yaml | 61 ++ .../request_body_became_optional_base.yaml | 60 ++ .../request_body_became_required_base.yaml | 60 ++ ...quest_body_default_value_changed_base.yaml | 25 + ...t_body_default_value_changed_revision.yaml | 16 + ...equest_body_max_length_decreased_base.yaml | 29 + .../request_body_max_length_set_base.yaml | 16 + .../request_body_max_length_set_revision.yaml | 17 + .../origin/request_body_max_set_base.yaml | 16 + .../origin/request_body_max_set_revision.yaml | 17 + .../request_body_media_type_updated_base.yaml | 59 ++ ...uest_body_media_type_updated_revision.yaml | 63 ++ ...al_property_write_only_read_only_base.yaml | 23 + .../request_parameter_became_enum_base.yaml | 57 ++ ...equest_parameter_became_enum_revision.yaml | 60 ++ ..._parameter_default_value_changed_base.yaml | 62 ++ ...ameter_default_value_changed_revision.yaml | 62 ++ ...est_parameter_enum_value_updated_base.yaml | 20 + ...parameter_enum_value_updated_revision.yaml | 19 + ...equest_parameter_extensible_enum_base.yaml | 60 ++ ...st_parameter_extensible_enum_revision.yaml | 59 ++ ...uest_parameter_max_items_updated_base.yaml | 61 ++ ..._parameter_max_items_updated_revision.yaml | 61 ++ ...request_parameter_max_length_set_base.yaml | 15 + ...est_parameter_max_length_set_revision.yaml | 16 + ...est_parameter_max_length_updated_base.yaml | 16 + ...parameter_max_length_updated_revision.yaml | 16 + .../request_parameter_max_updated_base.yaml | 60 ++ ...equest_parameter_max_updated_revision.yaml | 60 ++ .../request_parameter_min_increased_base.yaml | 58 ++ ...uest_parameter_min_increased_revision.yaml | 58 ++ ...st_parameter_min_items_increased_base.yaml | 60 ++ ...arameter_min_items_increased_revision.yaml | 60 ++ ...t_parameter_min_length_increased_base.yaml | 17 + ...rameter_min_length_increased_revision.yaml | 17 + ...rameter_pattern_added_or_changed_base.yaml | 17 + ...ter_pattern_added_or_changed_revision.yaml | 16 + ...ameter_property_type_changed_base_int.yaml | 80 +++ ...ameter_property_type_changed_base_num.yaml | 80 +++ ...ameter_property_type_changed_revision.yaml | 80 +++ .../request_parameter_type_changed_base.yaml | 72 +++ .../origin/request_property_added_base.yaml | 21 + .../request_property_added_revision.yaml | 24 + .../request_property_added_revision2.yaml | 26 + .../request_property_added_with_default.yaml | 25 + .../request_property_all_of_added_base.yaml | 49 ++ ...equest_property_all_of_added_revision.yaml | 62 ++ .../request_property_all_of_removed_base.yaml | 62 ++ ...uest_property_all_of_removed_revision.yaml | 49 ++ .../request_property_any_of_added_base.yaml | 49 ++ ...equest_property_any_of_added_revision.yaml | 62 ++ .../request_property_any_of_removed_base.yaml | 62 ++ ...uest_property_any_of_removed_revision.yaml | 49 ++ ...request_property_became_nullable_base.yaml | 21 + ...est_property_became_nullable_revision.yaml | 22 + ...request_property_became_required_base.yaml | 23 + ...t_property_default_value_changed_base.yaml | 21 + ...est_property_discriminator_added_base.yaml | 51 ++ ...riminator_added_property_name_changed.yaml | 61 ++ ...property_discriminator_added_revision.yaml | 61 ++ ...roperty_discriminator_mapping_changed.yaml | 67 ++ ...uest_property_enum_value_updated_base.yaml | 43 ++ ...request_property_extensible_enum_base.yaml | 24 + ...est_property_extensible_enum_revision.yaml | 23 + .../request_property_max_decreased_base.yaml | 23 + .../request_property_max_length_set_base.yaml | 22 + ...uest_property_max_length_set_revision.yaml | 23 + .../origin/request_property_max_set_base.yaml | 22 + .../request_property_max_set_revision.yaml | 23 + .../request_property_min_increased_base.yaml | 23 + ...quest_property_min_increased_revision.yaml | 23 + ...est_property_min_items_increased_base.yaml | 21 + ...property_min_items_increased_revision.yaml | 21 + ...st_property_min_length_decreased_base.yaml | 31 + .../request_property_one_of_added_base.yaml | 49 ++ ...equest_property_one_of_added_revision.yaml | 62 ++ .../request_property_one_of_removed_base.yaml | 62 ++ ...uest_property_one_of_removed_revision.yaml | 49 ++ ...roperty_pattern_added_or_changed_base.yaml | 25 + ...rty_pattern_added_or_changed_revision.yaml | 25 + .../request_property_type_changed_base.yaml | 24 + ...rty_type_changed_base_array_to_object.yaml | 46 ++ ...equest_property_type_changed_revision.yaml | 24 + ...type_changed_revision_array_to_object.yaml | 61 ++ .../origin/response-media-type-base.yaml | 490 +++++++++++++++ .../origin/response-media-type-revision.yaml | 487 +++++++++++++++ ...sponse_optional_property_removed_base.yaml | 45 ++ ...se_optional_property_removed_revision.yaml | 42 ++ ...al_property_write_only_read_only_base.yaml | 46 ++ ...esponse_pattern_added_or_changed_base.yaml | 51 ++ ...nse_pattern_added_or_changed_revision.yaml | 51 ++ .../response_property_all_of_added_base.yaml | 47 ++ ...sponse_property_all_of_added_revision.yaml | 60 ++ ...response_property_all_of_removed_base.yaml | 60 ++ ...onse_property_all_of_removed_revision.yaml | 47 ++ .../response_property_any_of_added_base.yaml | 47 ++ ...sponse_property_any_of_added_revision.yaml | 60 ++ ...response_property_any_of_complex_base.yaml | 50 ++ ...onse_property_any_of_complex_revision.yaml | 57 ++ ...response_property_any_of_removed_base.yaml | 60 ++ ...onse_property_any_of_removed_revision.yaml | 47 ++ ...esponse_property_became_optional_base.yaml | 49 ++ ...nse_property_became_optional_revision.yaml | 43 ++ ...e_property_default_value_changed_base.yaml | 56 ++ ...operty_default_value_changed_revision.yaml | 56 ++ ...nse_property_discriminator_added_base.yaml | 52 ++ ...riminator_added_property_name_changed.yaml | 62 ++ ...property_discriminator_added_revision.yaml | 62 ++ ...roperty_discriminator_mapping_changed.yaml | 68 +++ .../response_property_enum_added_base.yaml | 56 ++ .../response_property_one_of_added_base.yaml | 61 ++ ...sponse_property_one_of_added_revision.yaml | 79 +++ ...response_property_one_of_removed_base.yaml | 79 +++ ...onse_property_one_of_removed_revision.yaml | 61 ++ ...response_required_property_added_base.yaml | 45 ++ ...onse_required_property_added_revision.yaml | 49 ++ ...ed_property_write_only_read_only_base.yaml | 51 ++ .../response_schema_format_changed_base.yaml | 46 ++ .../response_schema_type_changed_base.yaml | 29 + ...response_schema_type_changed_revision.yaml | 45 ++ .../testdata/origin/response_status_base.yaml | 58 ++ openapi3/testdata/origin/simple.yaml | 19 + openapi3/testdata/origin/simple1.yaml | 10 + openapi3/testdata/origin/simple2.yaml | 10 + openapi3/testdata/origin/simple3.yaml | 14 + openapi3/testdata/origin/simple4.yaml | 19 + openapi3/testdata/origin/simple5.yaml | 19 + openapi3/testdata/origin/tag_added_base.yaml | 58 ++ .../testdata/origin/tag_removed_base.yaml | 60 ++ 174 files changed, 11083 insertions(+), 13 deletions(-) create mode 100644 openapi3/testdata/origin/add_new_media_type_base.yaml create mode 100644 openapi3/testdata/origin/add_new_media_type_revision.yaml create mode 100644 openapi3/testdata/origin/api_security_added_base.yaml create mode 100644 openapi3/testdata/origin/api_security_added_revision.yaml create mode 100644 openapi3/testdata/origin/api_security_global_added_base.yaml create mode 100644 openapi3/testdata/origin/api_security_global_added_revision.yaml create mode 100644 openapi3/testdata/origin/api_security_updated_base.yaml create mode 100644 openapi3/testdata/origin/api_security_updated_revision.yaml create mode 100644 openapi3/testdata/origin/circular1.yaml create mode 100644 openapi3/testdata/origin/circular2.yaml create mode 100644 openapi3/testdata/origin/circular3.yaml create mode 100644 openapi3/testdata/origin/component_security_updated_base.yaml create mode 100644 openapi3/testdata/origin/component_security_updated_revision.yaml create mode 100755 openapi3/testdata/origin/different_component_modified_parameter.yaml create mode 100755 openapi3/testdata/origin/different_component_same_header.yaml create mode 100755 openapi3/testdata/origin/different_component_same_parameter.yaml create mode 100755 openapi3/testdata/origin/different_component_same_schema.yaml create mode 100644 openapi3/testdata/origin/empty.yaml create mode 100644 openapi3/testdata/origin/home-iot-api-1.yaml create mode 100644 openapi3/testdata/origin/home-iot-api-2.yaml create mode 100644 openapi3/testdata/origin/openapi-test1.yaml create mode 100644 openapi3/testdata/origin/openapi-test2.yaml create mode 100644 openapi3/testdata/origin/openapi-test3.yaml create mode 100644 openapi3/testdata/origin/openapi-test4.yaml create mode 100644 openapi3/testdata/origin/openapi-test5.yaml create mode 100644 openapi3/testdata/origin/openapi-test6.yaml create mode 100644 openapi3/testdata/origin/openapi-test7.yaml create mode 100644 openapi3/testdata/origin/openapi-test701.yaml create mode 100644 openapi3/testdata/origin/openapi-test702.yaml create mode 100644 openapi3/testdata/origin/openapi-test703.yaml create mode 100644 openapi3/testdata/origin/openapi-test704.yaml create mode 100644 openapi3/testdata/origin/openapi-test8.yaml create mode 100644 openapi3/testdata/origin/openapi31-test1.yaml create mode 100644 openapi3/testdata/origin/openapi31-test2.yaml create mode 100644 openapi3/testdata/origin/operation_id_added_base.yaml create mode 100644 openapi3/testdata/origin/operation_id_removed_base.yaml create mode 100644 openapi3/testdata/origin/pattern-base-recursive.yaml create mode 100644 openapi3/testdata/origin/pattern-base.yaml create mode 100644 openapi3/testdata/origin/pattern-modified-not-anystring.yaml create mode 100644 openapi3/testdata/origin/pattern-modified.yaml create mode 100644 openapi3/testdata/origin/pattern-parameter-base.yaml create mode 100644 openapi3/testdata/origin/pattern-parameter-modified-not-anystring.yaml create mode 100644 openapi3/testdata/origin/pattern-parameter-revision.yaml create mode 100644 openapi3/testdata/origin/pattern-revision-recursive.yaml create mode 100644 openapi3/testdata/origin/pattern-revision.yaml create mode 100644 openapi3/testdata/origin/request_body_became_optional_base.yaml create mode 100644 openapi3/testdata/origin/request_body_became_required_base.yaml create mode 100644 openapi3/testdata/origin/request_body_default_value_changed_base.yaml create mode 100644 openapi3/testdata/origin/request_body_default_value_changed_revision.yaml create mode 100644 openapi3/testdata/origin/request_body_max_length_decreased_base.yaml create mode 100644 openapi3/testdata/origin/request_body_max_length_set_base.yaml create mode 100644 openapi3/testdata/origin/request_body_max_length_set_revision.yaml create mode 100644 openapi3/testdata/origin/request_body_max_set_base.yaml create mode 100644 openapi3/testdata/origin/request_body_max_set_revision.yaml create mode 100644 openapi3/testdata/origin/request_body_media_type_updated_base.yaml create mode 100644 openapi3/testdata/origin/request_body_media_type_updated_revision.yaml create mode 100644 openapi3/testdata/origin/request_optional_property_write_only_read_only_base.yaml create mode 100644 openapi3/testdata/origin/request_parameter_became_enum_base.yaml create mode 100644 openapi3/testdata/origin/request_parameter_became_enum_revision.yaml create mode 100644 openapi3/testdata/origin/request_parameter_default_value_changed_base.yaml create mode 100644 openapi3/testdata/origin/request_parameter_default_value_changed_revision.yaml create mode 100644 openapi3/testdata/origin/request_parameter_enum_value_updated_base.yaml create mode 100644 openapi3/testdata/origin/request_parameter_enum_value_updated_revision.yaml create mode 100644 openapi3/testdata/origin/request_parameter_extensible_enum_base.yaml create mode 100644 openapi3/testdata/origin/request_parameter_extensible_enum_revision.yaml create mode 100644 openapi3/testdata/origin/request_parameter_max_items_updated_base.yaml create mode 100644 openapi3/testdata/origin/request_parameter_max_items_updated_revision.yaml create mode 100644 openapi3/testdata/origin/request_parameter_max_length_set_base.yaml create mode 100644 openapi3/testdata/origin/request_parameter_max_length_set_revision.yaml create mode 100644 openapi3/testdata/origin/request_parameter_max_length_updated_base.yaml create mode 100644 openapi3/testdata/origin/request_parameter_max_length_updated_revision.yaml create mode 100644 openapi3/testdata/origin/request_parameter_max_updated_base.yaml create mode 100644 openapi3/testdata/origin/request_parameter_max_updated_revision.yaml create mode 100644 openapi3/testdata/origin/request_parameter_min_increased_base.yaml create mode 100644 openapi3/testdata/origin/request_parameter_min_increased_revision.yaml create mode 100644 openapi3/testdata/origin/request_parameter_min_items_increased_base.yaml create mode 100644 openapi3/testdata/origin/request_parameter_min_items_increased_revision.yaml create mode 100644 openapi3/testdata/origin/request_parameter_min_length_increased_base.yaml create mode 100644 openapi3/testdata/origin/request_parameter_min_length_increased_revision.yaml create mode 100644 openapi3/testdata/origin/request_parameter_pattern_added_or_changed_base.yaml create mode 100644 openapi3/testdata/origin/request_parameter_pattern_added_or_changed_revision.yaml create mode 100644 openapi3/testdata/origin/request_parameter_property_type_changed_base_int.yaml create mode 100644 openapi3/testdata/origin/request_parameter_property_type_changed_base_num.yaml create mode 100644 openapi3/testdata/origin/request_parameter_property_type_changed_revision.yaml create mode 100644 openapi3/testdata/origin/request_parameter_type_changed_base.yaml create mode 100644 openapi3/testdata/origin/request_property_added_base.yaml create mode 100644 openapi3/testdata/origin/request_property_added_revision.yaml create mode 100644 openapi3/testdata/origin/request_property_added_revision2.yaml create mode 100644 openapi3/testdata/origin/request_property_added_with_default.yaml create mode 100644 openapi3/testdata/origin/request_property_all_of_added_base.yaml create mode 100644 openapi3/testdata/origin/request_property_all_of_added_revision.yaml create mode 100644 openapi3/testdata/origin/request_property_all_of_removed_base.yaml create mode 100644 openapi3/testdata/origin/request_property_all_of_removed_revision.yaml create mode 100644 openapi3/testdata/origin/request_property_any_of_added_base.yaml create mode 100644 openapi3/testdata/origin/request_property_any_of_added_revision.yaml create mode 100644 openapi3/testdata/origin/request_property_any_of_removed_base.yaml create mode 100644 openapi3/testdata/origin/request_property_any_of_removed_revision.yaml create mode 100644 openapi3/testdata/origin/request_property_became_nullable_base.yaml create mode 100644 openapi3/testdata/origin/request_property_became_nullable_revision.yaml create mode 100644 openapi3/testdata/origin/request_property_became_required_base.yaml create mode 100644 openapi3/testdata/origin/request_property_default_value_changed_base.yaml create mode 100644 openapi3/testdata/origin/request_property_discriminator_added_base.yaml create mode 100644 openapi3/testdata/origin/request_property_discriminator_added_property_name_changed.yaml create mode 100644 openapi3/testdata/origin/request_property_discriminator_added_revision.yaml create mode 100644 openapi3/testdata/origin/request_property_discriminator_mapping_changed.yaml create mode 100644 openapi3/testdata/origin/request_property_enum_value_updated_base.yaml create mode 100644 openapi3/testdata/origin/request_property_extensible_enum_base.yaml create mode 100644 openapi3/testdata/origin/request_property_extensible_enum_revision.yaml create mode 100644 openapi3/testdata/origin/request_property_max_decreased_base.yaml create mode 100644 openapi3/testdata/origin/request_property_max_length_set_base.yaml create mode 100644 openapi3/testdata/origin/request_property_max_length_set_revision.yaml create mode 100644 openapi3/testdata/origin/request_property_max_set_base.yaml create mode 100644 openapi3/testdata/origin/request_property_max_set_revision.yaml create mode 100644 openapi3/testdata/origin/request_property_min_increased_base.yaml create mode 100644 openapi3/testdata/origin/request_property_min_increased_revision.yaml create mode 100644 openapi3/testdata/origin/request_property_min_items_increased_base.yaml create mode 100644 openapi3/testdata/origin/request_property_min_items_increased_revision.yaml create mode 100644 openapi3/testdata/origin/request_property_min_length_decreased_base.yaml create mode 100644 openapi3/testdata/origin/request_property_one_of_added_base.yaml create mode 100644 openapi3/testdata/origin/request_property_one_of_added_revision.yaml create mode 100644 openapi3/testdata/origin/request_property_one_of_removed_base.yaml create mode 100644 openapi3/testdata/origin/request_property_one_of_removed_revision.yaml create mode 100644 openapi3/testdata/origin/request_property_pattern_added_or_changed_base.yaml create mode 100644 openapi3/testdata/origin/request_property_pattern_added_or_changed_revision.yaml create mode 100644 openapi3/testdata/origin/request_property_type_changed_base.yaml create mode 100644 openapi3/testdata/origin/request_property_type_changed_base_array_to_object.yaml create mode 100644 openapi3/testdata/origin/request_property_type_changed_revision.yaml create mode 100644 openapi3/testdata/origin/request_property_type_changed_revision_array_to_object.yaml create mode 100644 openapi3/testdata/origin/response-media-type-base.yaml create mode 100644 openapi3/testdata/origin/response-media-type-revision.yaml create mode 100644 openapi3/testdata/origin/response_optional_property_removed_base.yaml create mode 100644 openapi3/testdata/origin/response_optional_property_removed_revision.yaml create mode 100644 openapi3/testdata/origin/response_optional_property_write_only_read_only_base.yaml create mode 100644 openapi3/testdata/origin/response_pattern_added_or_changed_base.yaml create mode 100644 openapi3/testdata/origin/response_pattern_added_or_changed_revision.yaml create mode 100644 openapi3/testdata/origin/response_property_all_of_added_base.yaml create mode 100644 openapi3/testdata/origin/response_property_all_of_added_revision.yaml create mode 100644 openapi3/testdata/origin/response_property_all_of_removed_base.yaml create mode 100644 openapi3/testdata/origin/response_property_all_of_removed_revision.yaml create mode 100644 openapi3/testdata/origin/response_property_any_of_added_base.yaml create mode 100644 openapi3/testdata/origin/response_property_any_of_added_revision.yaml create mode 100644 openapi3/testdata/origin/response_property_any_of_complex_base.yaml create mode 100644 openapi3/testdata/origin/response_property_any_of_complex_revision.yaml create mode 100644 openapi3/testdata/origin/response_property_any_of_removed_base.yaml create mode 100644 openapi3/testdata/origin/response_property_any_of_removed_revision.yaml create mode 100644 openapi3/testdata/origin/response_property_became_optional_base.yaml create mode 100644 openapi3/testdata/origin/response_property_became_optional_revision.yaml create mode 100644 openapi3/testdata/origin/response_property_default_value_changed_base.yaml create mode 100644 openapi3/testdata/origin/response_property_default_value_changed_revision.yaml create mode 100644 openapi3/testdata/origin/response_property_discriminator_added_base.yaml create mode 100644 openapi3/testdata/origin/response_property_discriminator_added_property_name_changed.yaml create mode 100644 openapi3/testdata/origin/response_property_discriminator_added_revision.yaml create mode 100644 openapi3/testdata/origin/response_property_discriminator_mapping_changed.yaml create mode 100644 openapi3/testdata/origin/response_property_enum_added_base.yaml create mode 100644 openapi3/testdata/origin/response_property_one_of_added_base.yaml create mode 100644 openapi3/testdata/origin/response_property_one_of_added_revision.yaml create mode 100644 openapi3/testdata/origin/response_property_one_of_removed_base.yaml create mode 100644 openapi3/testdata/origin/response_property_one_of_removed_revision.yaml create mode 100644 openapi3/testdata/origin/response_required_property_added_base.yaml create mode 100644 openapi3/testdata/origin/response_required_property_added_revision.yaml create mode 100644 openapi3/testdata/origin/response_required_property_write_only_read_only_base.yaml create mode 100644 openapi3/testdata/origin/response_schema_format_changed_base.yaml create mode 100644 openapi3/testdata/origin/response_schema_type_changed_base.yaml create mode 100644 openapi3/testdata/origin/response_schema_type_changed_revision.yaml create mode 100644 openapi3/testdata/origin/response_status_base.yaml create mode 100644 openapi3/testdata/origin/simple.yaml create mode 100644 openapi3/testdata/origin/simple1.yaml create mode 100644 openapi3/testdata/origin/simple2.yaml create mode 100644 openapi3/testdata/origin/simple3.yaml create mode 100644 openapi3/testdata/origin/simple4.yaml create mode 100644 openapi3/testdata/origin/simple5.yaml create mode 100644 openapi3/testdata/origin/tag_added_base.yaml create mode 100644 openapi3/testdata/origin/tag_removed_base.yaml diff --git a/openapi3/openapi3_test.go b/openapi3/openapi3_test.go index 3e7e57924..d1e7d8689 100644 --- a/openapi3/openapi3_test.go +++ b/openapi3/openapi3_test.go @@ -485,21 +485,9 @@ func TestOrigin(t *testing.T) { loader.IncludeOrigin = true loader.Context = context.Background() - const dir = "testdata" + const dir = "testdata/origin" items, _ := os.ReadDir(dir) for _, item := range items { - if item.IsDir() { - continue - } - if strings.HasSuffix(item.Name(), ".json") { - continue - } - if item.Name() == "issue235.spec0-typo.yml" || - item.Name() == "callbacks.yml.internalized.yml" || - item.Name() == "spec.yaml.internalized.yml" || - item.Name() == "testref.openapi.yml.internalized.yml" { - continue - } t.Run(item.Name(), func(t *testing.T) { doc, err := loader.LoadFromFile(fmt.Sprintf("%s/%s", dir, item.Name())) require.NoError(t, err) diff --git a/openapi3/testdata/origin/add_new_media_type_base.yaml b/openapi3/testdata/origin/add_new_media_type_base.yaml new file mode 100644 index 000000000..2740e8a2b --- /dev/null +++ b/openapi3/testdata/origin/add_new_media_type_base.yaml @@ -0,0 +1,58 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/add_new_media_type_revision.yaml b/openapi3/testdata/origin/add_new_media_type_revision.yaml new file mode 100644 index 000000000..d2987a1fb --- /dev/null +++ b/openapi3/testdata/origin/add_new_media_type_revision.yaml @@ -0,0 +1,68 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + application/xml: # Another media type + schema: + type: object + properties: + id: + type: integer + name: + type: string + fullTime: + type: boolean + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_added_base.yaml b/openapi3/testdata/origin/api_security_added_base.yaml new file mode 100644 index 000000000..4cdf8bcbc --- /dev/null +++ b/openapi3/testdata/origin/api_security_added_base.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +info: + title: Security Requirement Example + version: 1.0.0 +paths: + /subscribe: + post: + requestBody: + content: + application/json: + schema: + type: object + properties: + inProgressUrl: + type: string + failedUrl: + type: string + successUrl: + type: string + responses: + "200": + description: OK +components: + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://example.org/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_added_revision.yaml b/openapi3/testdata/origin/api_security_added_revision.yaml new file mode 100644 index 000000000..a9e1084ce --- /dev/null +++ b/openapi3/testdata/origin/api_security_added_revision.yaml @@ -0,0 +1,37 @@ +openapi: 3.0.0 +info: + title: Security Requirement Example + version: 1.0.0 +paths: + /subscribe: + post: + requestBody: + content: + application/json: + schema: + type: object + properties: + inProgressUrl: + type: string + failedUrl: + type: string + successUrl: + type: string + responses: + "200": + description: OK + security: + - petstore_auth: + - write:pets + - read:pets +components: + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://example.org/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_global_added_base.yaml b/openapi3/testdata/origin/api_security_global_added_base.yaml new file mode 100644 index 000000000..4cdf8bcbc --- /dev/null +++ b/openapi3/testdata/origin/api_security_global_added_base.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +info: + title: Security Requirement Example + version: 1.0.0 +paths: + /subscribe: + post: + requestBody: + content: + application/json: + schema: + type: object + properties: + inProgressUrl: + type: string + failedUrl: + type: string + successUrl: + type: string + responses: + "200": + description: OK +components: + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://example.org/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_global_added_revision.yaml b/openapi3/testdata/origin/api_security_global_added_revision.yaml new file mode 100644 index 000000000..fed79d89d --- /dev/null +++ b/openapi3/testdata/origin/api_security_global_added_revision.yaml @@ -0,0 +1,37 @@ +openapi: 3.0.0 +info: + title: Security Requirement Example + version: 1.0.0 +security: +- petstore_auth: + - write:pets + - read:pets +paths: + /subscribe: + post: + requestBody: + content: + application/json: + schema: + type: object + properties: + inProgressUrl: + type: string + failedUrl: + type: string + successUrl: + type: string + responses: + "200": + description: OK +components: + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://example.org/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_updated_base.yaml b/openapi3/testdata/origin/api_security_updated_base.yaml new file mode 100644 index 000000000..f07543907 --- /dev/null +++ b/openapi3/testdata/origin/api_security_updated_base.yaml @@ -0,0 +1,46 @@ +openapi: 3.0.0 +info: + title: Security Requirement Example + version: 1.0.0 +paths: + /subscribe: + post: + requestBody: + content: + application/json: + schema: + type: object + properties: + inProgressUrl: + type: string + failedUrl: + type: string + successUrl: + type: string + responses: + "200": + description: OK + security: + - petstore_auth: + - write:pets + - read:pets +components: + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://example.org/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + catstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://example.org/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + + \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_updated_revision.yaml b/openapi3/testdata/origin/api_security_updated_revision.yaml new file mode 100644 index 000000000..93bd2530e --- /dev/null +++ b/openapi3/testdata/origin/api_security_updated_revision.yaml @@ -0,0 +1,43 @@ +openapi: 3.0.0 +info: + title: Security Requirement Example + version: 1.0.0 +paths: + /subscribe: + post: + requestBody: + content: + application/json: + schema: + type: object + properties: + inProgressUrl: + type: string + failedUrl: + type: string + successUrl: + type: string + responses: + "200": + description: OK + security: + - petstore_auth: + - write:pets +components: + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://example.org/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + catstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://example.org/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets diff --git a/openapi3/testdata/origin/circular1.yaml b/openapi3/testdata/origin/circular1.yaml new file mode 100644 index 000000000..228388d19 --- /dev/null +++ b/openapi3/testdata/origin/circular1.yaml @@ -0,0 +1,40 @@ +openapi: 3.0.1 +info: + title: Circular Schema + version: v1 +paths: + /test: + post: + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/circular1' +components: + schemas: + circular1: + type: object + properties: + children: + type: array + items: + type: object + circular2: + oneOf: + - $ref: '#/components/schemas/circular2' + circular3: + oneOf: + - $ref: '#/components/schemas/circular3' + circular4: + oneOf: + - oneOf: + - $ref: '#/components/schemas/circular4' + circular5: + oneOf: + - $ref: '#/components/schemas/circular1' + circular6: + oneOf: + - $ref: '#/components/schemas/circular6' + diff --git a/openapi3/testdata/origin/circular2.yaml b/openapi3/testdata/origin/circular2.yaml new file mode 100644 index 000000000..0a48bac52 --- /dev/null +++ b/openapi3/testdata/origin/circular2.yaml @@ -0,0 +1,40 @@ +openapi: 3.0.1 +info: + title: Circular Schema + version: v1 +paths: + /test: + post: + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/circular1' +components: + schemas: + circular1: + type: object + properties: + children: + type: array + items: + $ref: '#/components/schemas/circular1' + circular2: + oneOf: + - $ref: '#/components/schemas/circular2' + circular3: + oneOf: + - $ref: '#/components/schemas/circular2' + circular4: + oneOf: + - oneOf: + - $ref: '#/components/schemas/circular4' + circular5: + oneOf: + - $ref: '#/components/schemas/circular1' + circular6: + oneOf: + - $ref: '#/components/schemas/circular6' + - $ref: '#/components/schemas/circular1' diff --git a/openapi3/testdata/origin/circular3.yaml b/openapi3/testdata/origin/circular3.yaml new file mode 100644 index 000000000..c2d4a4acd --- /dev/null +++ b/openapi3/testdata/origin/circular3.yaml @@ -0,0 +1,25 @@ +openapi: 3.0.1 +info: + title: Circular Schema + version: v1 +paths: + /test: + post: + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/circular1' +components: + schemas: + circular1: + oneOf: + - $ref: '#/components/schemas/circular2' + circular2: + oneOf: + - $ref: '#/components/schemas/circular3' + circular3: + oneOf: + - $ref: '#/components/schemas/circular1' diff --git a/openapi3/testdata/origin/component_security_updated_base.yaml b/openapi3/testdata/origin/component_security_updated_base.yaml new file mode 100644 index 000000000..05785e38e --- /dev/null +++ b/openapi3/testdata/origin/component_security_updated_base.yaml @@ -0,0 +1,37 @@ +openapi: 3.0.0 +info: + title: Security Requirement Example + version: 1.0.0 +paths: + /subscribe: + post: + requestBody: + content: + application/json: + schema: + type: object + properties: + inProgressUrl: + type: string + failedUrl: + type: string + successUrl: + type: string + responses: + "200": + description: OK + security: + - petstore_auth: + - write:pets + - read:pets +components: + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://example.org/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + \ No newline at end of file diff --git a/openapi3/testdata/origin/component_security_updated_revision.yaml b/openapi3/testdata/origin/component_security_updated_revision.yaml new file mode 100644 index 000000000..8a370298d --- /dev/null +++ b/openapi3/testdata/origin/component_security_updated_revision.yaml @@ -0,0 +1,40 @@ +openapi: 3.0.0 +info: + title: Security Requirement Example + version: 1.0.0 +paths: + /subscribe: + post: + requestBody: + content: + application/json: + schema: + type: object + properties: + inProgressUrl: + type: string + failedUrl: + type: string + successUrl: + type: string + responses: + "200": + description: OK + security: + - petstore_auth: + - write:pets + - read:pets +components: + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://example.org/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + BasicAuth: + type: http + scheme: basic + \ No newline at end of file diff --git a/openapi3/testdata/origin/different_component_modified_parameter.yaml b/openapi3/testdata/origin/different_component_modified_parameter.yaml new file mode 100755 index 000000000..1fbb93e11 --- /dev/null +++ b/openapi3/testdata/origin/different_component_modified_parameter.yaml @@ -0,0 +1,25 @@ +openapi: 3.0.3 + +components: + parameters: + differentComponentName_A: + name: sameParamName + in: query + required: true + schema: + type: string + enum: + - option_1 + - option_2 + default: option_1 + description: Let's mention both options, option_1 and option_2. + differentComponentName_B: + name: sameParamName + in: query + required: false + schema: + type: string + enum: + - option_1 + default: option_1 + description: Let's mention the only option, option_1. diff --git a/openapi3/testdata/origin/different_component_same_header.yaml b/openapi3/testdata/origin/different_component_same_header.yaml new file mode 100755 index 000000000..3366bba49 --- /dev/null +++ b/openapi3/testdata/origin/different_component_same_header.yaml @@ -0,0 +1,20 @@ +openapi: 3.0.3 + +components: + headers: + differentComponentName_A: + schema: + type: string + enum: + - option_1 + - option_2 + default: option_1 + description: Let's mention both options, option_1 and option_2. + differentComponentName_B: + schema: + type: string + enum: + - option_1 + default: option_1 + description: Let's mention the only option, option_1. + \ No newline at end of file diff --git a/openapi3/testdata/origin/different_component_same_parameter.yaml b/openapi3/testdata/origin/different_component_same_parameter.yaml new file mode 100755 index 000000000..7d412b03e --- /dev/null +++ b/openapi3/testdata/origin/different_component_same_parameter.yaml @@ -0,0 +1,25 @@ +openapi: 3.0.3 + +components: + parameters: + differentComponentName_A: + name: sameParamName + in: header + required: true + schema: + type: string + enum: + - option_1 + - option_2 + default: option_1 + description: Let's mention both options, option_1 and option_2. + differentComponentName_B: + name: sameParamName + in: query + required: false + schema: + type: string + enum: + - option_1 + default: option_1 + description: Let's mention the only option, option_1. diff --git a/openapi3/testdata/origin/different_component_same_schema.yaml b/openapi3/testdata/origin/different_component_same_schema.yaml new file mode 100755 index 000000000..45f959da4 --- /dev/null +++ b/openapi3/testdata/origin/different_component_same_schema.yaml @@ -0,0 +1,10 @@ +openapi: 3.0.3 + +components: + schemas: + differentComponentName_A: + name: sameParamName + type: string + differentComponentName_B: + name: sameParamName + type: string diff --git a/openapi3/testdata/origin/empty.yaml b/openapi3/testdata/origin/empty.yaml new file mode 100644 index 000000000..acf144550 --- /dev/null +++ b/openapi3/testdata/origin/empty.yaml @@ -0,0 +1,5 @@ +openapi: 3.0.1 +info: + title: Test API + version: v1 +paths: diff --git a/openapi3/testdata/origin/home-iot-api-1.yaml b/openapi3/testdata/origin/home-iot-api-1.yaml new file mode 100644 index 000000000..87c40832a --- /dev/null +++ b/openapi3/testdata/origin/home-iot-api-1.yaml @@ -0,0 +1,573 @@ +openapi: 3.0.0 +servers: + # Added by API Auto Mocking Plugin + - description: SwaggerHub API Auto Mocking + url: https://virtserver.swaggerhub.com/home4984/API/1.0.0 +info: + version: "1.0.0" + title: home-iot-api + description: The API for the EatBacon IOT project +paths: + /devices: + get: + tags: + - Device + description: returns all registered devices + operationId: getDevices + parameters: + - in: query + name: skip + description: number of records to skip + schema: + type: integer + format: int32 + - in: query + name: limit + description: max number of records to return + schema: + type: integer + format: int32 + responses: + '200': + description: All the devices + content: + application/json: + schema: + type: array + items: + type: string + format: uri + example: 'http://10.0.0.225:8080' + post: + tags: + - Device + operationId: register + responses: + '200': + description: successfully registered device + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DeviceRegistrationInfo' + '/lighting/dimmers/{deviceId}/{value}': + post: + tags: + - Z-Wave + operationId: setDimmer + parameters: + - name: deviceId + in: path + required: true + schema: + type: string + - name: value + in: path + required: true + schema: + type: integer + format: int32 + minimum: 0 + maximum: 100 + responses: + '200': + description: response + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + x-swagger-router-controller: ZWave + '/lighting/dimmers/{deviceId}/{value}/timer/{timeunit}': + post: + tags: + - Z-Wave + description: sets a dimmer to a specific value on a timer + operationId: setDimmerTimer + parameters: + - name: deviceId + in: path + required: true + schema: + type: string + - name: value + in: path + required: true + schema: + type: integer + format: int32 + - name: timeunit + in: path + required: true + schema: + type: integer + format: int32 + - name: units + in: query + required: false + schema: + type: string + enum: + - seconds + - minutes + - milliseconds + default: milliseconds + responses: + '200': + description: response + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + x-swagger-router-controller: ZWave + '/lighting/switches/{deviceId}': + get: + tags: + - Z-Wave + operationId: getSwitchState + parameters: + - name: deviceId + in: path + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + $ref: '#/components/schemas/DeviceState' + x-swagger-router-controller: ZWave + '/lighting/switches/{deviceId}/{value}': + post: + tags: + - Z-Wave + operationId: setSwitch + parameters: + - name: deviceId + in: path + required: true + schema: + type: string + - name: value + in: path + required: true + schema: + type: string + enum: + - true + - false + responses: + '200': + description: response + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + x-swagger-router-controller: ZWave + '/lighting/switches/{deviceId}/{value}/timer/{minutes}': + post: + tags: + - Z-Wave + description: sets a switch to a specific value on a timer + operationId: setSwitchTimer + parameters: + - name: deviceId + in: path + required: true + schema: + type: string + - name: value + in: path + required: true + schema: + type: string + enum: + - true + - false + - name: minutes + in: path + required: true + schema: + type: integer + format: int32 + responses: + '200': + description: response + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + x-swagger-router-controller: ZWave + /lightingSummary: + get: + tags: + - Z-Wave + operationId: getLightingSummary + responses: + '200': + description: ok + content: + application/json: + schema: + $ref: '#/components/schemas/LightingSummary' + x-swagger-router-controller: ZWave + /temperature: + get: + tags: + - Environment + operationId: temperatureSummary + responses: + '200': + description: ok + content: + application/json: + schema: + $ref: '#/components/schemas/TemperatureSummary' + x-swagger-router-controller: Environment + '/temperature/forecast/{days}': + get: + tags: + - Environment + operationId: getForecast + parameters: + - name: days + in: path + required: true + schema: + type: integer + format: int32 + responses: + '200': + description: the forecast + content: + application/json: + schema: + $ref: '#/components/schemas/ForecastResponse' + x-swagger-router-controller: Environment + '/temperature/{zoneId}': + get: + tags: + - Environment + operationId: getZoneTemperature + parameters: + - name: zoneId + in: path + required: true + schema: + type: string + responses: + '200': + description: Zone temperature + content: + application/json: + schema: + $ref: '#/components/schemas/TemperatueZoneStatus' + x-swagger-router-controller: Environment + '/temperature/{zoneId}/heater': + get: + tags: + - Environment + description: gets the state of the heater + operationId: getHeaterState + parameters: + - name: zoneId + in: path + required: true + schema: + type: string + responses: + '200': + description: heater state + content: + application/json: + schema: + $ref: '#/components/schemas/HeaterState' + x-swagger-router-controller: Environment + '/temperature/{zoneId}/heater/{state}': + post: + tags: + - Environment + description: turns the heater on or off + operationId: setHeaterState + parameters: + - name: zoneId + in: path + required: true + schema: + type: string + - name: state + in: path + required: true + schema: + type: string + enum: + - false + - true + responses: + '200': + description: Status of the operation + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + x-swagger-router-controller: Environment + /zones: + get: + tags: + - Zones + operationId: getZones + responses: + '200': + description: ok + content: + application/json: + schema: + type: array + items: + type: string + x-swagger-router-controller: Zones + '/zones/{zoneId}/quiet': + get: + tags: + - Zones + operationId: quietZone + parameters: + - name: zoneId + in: path + required: true + schema: + type: string + enum: + - basement + - x: + reuven + - second-floor + responses: + '200': + description: ok + x-swagger-router-controller: Zones +components: + schemas: + LightingSummary: + type: object + properties: + zones: + type: array + items: + $ref: '#/components/schemas/LightingZone' + zoneStatus: + type: array + items: + $ref: '#/components/schemas/LightingZoneStatus' + description: ok + LightingZone: + type: object + properties: + id: + type: string + name: + type: string + deviceId: + type: integer + format: int32 + deviceType: + type: string + enum: + - dimmer + - switch + zone: + type: string + LightingZoneStatus: + type: object + properties: + id: + type: string + name: + type: string + lastUpdate: + type: string + format: date-time + level: + type: integer + format: int32 + description: the status of the lighting zone. + TemperatureSummary: + type: object + properties: + zones: + type: array + items: + $ref: '#/components/schemas/TemperatureZone' + zoneStatus: + type: array + items: + $ref: '#/components/schemas/TemperatueZoneStatus' + description: ok + TemperatureZone: + type: object + required: + - id + - name + properties: + id: + type: integer + format: int32 + description: the unique identifier for the zone + name: + type: string + inputPosition: + type: integer + format: int32 + outputPosition: + type: integer + format: int32 + zone: + type: string + description: a single temperature zone + TemperatueZoneStatus: + type: object + required: + - id + - timestamp + - value + properties: + id: + type: string + description: the unique identifier for the zone + name: + type: string + description: the name of the zone + value: + type: number + format: double + description: the temperature in the zone + units: + type: string + description: the temperature units + enum: + - celsius + - fahrenheit + default: fahrenheit + timestamp: + type: string + format: date-time + description: the timestamp when the temperature was measured + description: status of a single zone + ApiResponse: + type: object + properties: + code: + type: integer + format: int32 + message: + type: number + example: everything is ok + HeaterState: + type: object + properties: + id: + type: string + state: + type: string + DeviceState: + type: object + properties: + id: + type: string + name: + type: string + lastUpdate: + type: string + format: date-time + level: + type: integer + format: int32 + ForecastResponse: + type: object + properties: + city: + $ref: '#/components/schemas/City' + values: + type: array + items: + $ref: '#/components/schemas/Forecast' + Forecast: + type: object + properties: + date: + type: string + format: date-time + pressure: + type: number + format: double + humidity: + type: integer + format: int32 + windSpeed: + type: number + format: double + clouds: + type: integer + format: int32 + temperature: + $ref: '#/components/schemas/ForecastTemperature' + weather: + $ref: '#/components/schemas/WeatherForecast' + City: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + lat: + type: number + format: double + lon: + type: number + format: double + country: + type: string + ForecastTemperature: + type: object + properties: + low: + type: number + format: double + high: + type: number + format: double + morning: + type: number + format: double + day: + type: number + format: double + evening: + type: number + format: double + night: + type: number + format: double + WeatherForecast: + type: object + properties: + summary: + type: string + description: + type: string + icon: + type: string + DeviceRegistrationInfo: + type: object + properties: + uri: + type: string + format: uri + example: 'http://10.0.0.221:8080' + id: + type: string + format: uuid + example: 0729a580-2240-11e6-9eb5-0002a5d5c51b \ No newline at end of file diff --git a/openapi3/testdata/origin/home-iot-api-2.yaml b/openapi3/testdata/origin/home-iot-api-2.yaml new file mode 100644 index 000000000..87c40832a --- /dev/null +++ b/openapi3/testdata/origin/home-iot-api-2.yaml @@ -0,0 +1,573 @@ +openapi: 3.0.0 +servers: + # Added by API Auto Mocking Plugin + - description: SwaggerHub API Auto Mocking + url: https://virtserver.swaggerhub.com/home4984/API/1.0.0 +info: + version: "1.0.0" + title: home-iot-api + description: The API for the EatBacon IOT project +paths: + /devices: + get: + tags: + - Device + description: returns all registered devices + operationId: getDevices + parameters: + - in: query + name: skip + description: number of records to skip + schema: + type: integer + format: int32 + - in: query + name: limit + description: max number of records to return + schema: + type: integer + format: int32 + responses: + '200': + description: All the devices + content: + application/json: + schema: + type: array + items: + type: string + format: uri + example: 'http://10.0.0.225:8080' + post: + tags: + - Device + operationId: register + responses: + '200': + description: successfully registered device + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DeviceRegistrationInfo' + '/lighting/dimmers/{deviceId}/{value}': + post: + tags: + - Z-Wave + operationId: setDimmer + parameters: + - name: deviceId + in: path + required: true + schema: + type: string + - name: value + in: path + required: true + schema: + type: integer + format: int32 + minimum: 0 + maximum: 100 + responses: + '200': + description: response + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + x-swagger-router-controller: ZWave + '/lighting/dimmers/{deviceId}/{value}/timer/{timeunit}': + post: + tags: + - Z-Wave + description: sets a dimmer to a specific value on a timer + operationId: setDimmerTimer + parameters: + - name: deviceId + in: path + required: true + schema: + type: string + - name: value + in: path + required: true + schema: + type: integer + format: int32 + - name: timeunit + in: path + required: true + schema: + type: integer + format: int32 + - name: units + in: query + required: false + schema: + type: string + enum: + - seconds + - minutes + - milliseconds + default: milliseconds + responses: + '200': + description: response + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + x-swagger-router-controller: ZWave + '/lighting/switches/{deviceId}': + get: + tags: + - Z-Wave + operationId: getSwitchState + parameters: + - name: deviceId + in: path + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + $ref: '#/components/schemas/DeviceState' + x-swagger-router-controller: ZWave + '/lighting/switches/{deviceId}/{value}': + post: + tags: + - Z-Wave + operationId: setSwitch + parameters: + - name: deviceId + in: path + required: true + schema: + type: string + - name: value + in: path + required: true + schema: + type: string + enum: + - true + - false + responses: + '200': + description: response + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + x-swagger-router-controller: ZWave + '/lighting/switches/{deviceId}/{value}/timer/{minutes}': + post: + tags: + - Z-Wave + description: sets a switch to a specific value on a timer + operationId: setSwitchTimer + parameters: + - name: deviceId + in: path + required: true + schema: + type: string + - name: value + in: path + required: true + schema: + type: string + enum: + - true + - false + - name: minutes + in: path + required: true + schema: + type: integer + format: int32 + responses: + '200': + description: response + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + x-swagger-router-controller: ZWave + /lightingSummary: + get: + tags: + - Z-Wave + operationId: getLightingSummary + responses: + '200': + description: ok + content: + application/json: + schema: + $ref: '#/components/schemas/LightingSummary' + x-swagger-router-controller: ZWave + /temperature: + get: + tags: + - Environment + operationId: temperatureSummary + responses: + '200': + description: ok + content: + application/json: + schema: + $ref: '#/components/schemas/TemperatureSummary' + x-swagger-router-controller: Environment + '/temperature/forecast/{days}': + get: + tags: + - Environment + operationId: getForecast + parameters: + - name: days + in: path + required: true + schema: + type: integer + format: int32 + responses: + '200': + description: the forecast + content: + application/json: + schema: + $ref: '#/components/schemas/ForecastResponse' + x-swagger-router-controller: Environment + '/temperature/{zoneId}': + get: + tags: + - Environment + operationId: getZoneTemperature + parameters: + - name: zoneId + in: path + required: true + schema: + type: string + responses: + '200': + description: Zone temperature + content: + application/json: + schema: + $ref: '#/components/schemas/TemperatueZoneStatus' + x-swagger-router-controller: Environment + '/temperature/{zoneId}/heater': + get: + tags: + - Environment + description: gets the state of the heater + operationId: getHeaterState + parameters: + - name: zoneId + in: path + required: true + schema: + type: string + responses: + '200': + description: heater state + content: + application/json: + schema: + $ref: '#/components/schemas/HeaterState' + x-swagger-router-controller: Environment + '/temperature/{zoneId}/heater/{state}': + post: + tags: + - Environment + description: turns the heater on or off + operationId: setHeaterState + parameters: + - name: zoneId + in: path + required: true + schema: + type: string + - name: state + in: path + required: true + schema: + type: string + enum: + - false + - true + responses: + '200': + description: Status of the operation + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + x-swagger-router-controller: Environment + /zones: + get: + tags: + - Zones + operationId: getZones + responses: + '200': + description: ok + content: + application/json: + schema: + type: array + items: + type: string + x-swagger-router-controller: Zones + '/zones/{zoneId}/quiet': + get: + tags: + - Zones + operationId: quietZone + parameters: + - name: zoneId + in: path + required: true + schema: + type: string + enum: + - basement + - x: + reuven + - second-floor + responses: + '200': + description: ok + x-swagger-router-controller: Zones +components: + schemas: + LightingSummary: + type: object + properties: + zones: + type: array + items: + $ref: '#/components/schemas/LightingZone' + zoneStatus: + type: array + items: + $ref: '#/components/schemas/LightingZoneStatus' + description: ok + LightingZone: + type: object + properties: + id: + type: string + name: + type: string + deviceId: + type: integer + format: int32 + deviceType: + type: string + enum: + - dimmer + - switch + zone: + type: string + LightingZoneStatus: + type: object + properties: + id: + type: string + name: + type: string + lastUpdate: + type: string + format: date-time + level: + type: integer + format: int32 + description: the status of the lighting zone. + TemperatureSummary: + type: object + properties: + zones: + type: array + items: + $ref: '#/components/schemas/TemperatureZone' + zoneStatus: + type: array + items: + $ref: '#/components/schemas/TemperatueZoneStatus' + description: ok + TemperatureZone: + type: object + required: + - id + - name + properties: + id: + type: integer + format: int32 + description: the unique identifier for the zone + name: + type: string + inputPosition: + type: integer + format: int32 + outputPosition: + type: integer + format: int32 + zone: + type: string + description: a single temperature zone + TemperatueZoneStatus: + type: object + required: + - id + - timestamp + - value + properties: + id: + type: string + description: the unique identifier for the zone + name: + type: string + description: the name of the zone + value: + type: number + format: double + description: the temperature in the zone + units: + type: string + description: the temperature units + enum: + - celsius + - fahrenheit + default: fahrenheit + timestamp: + type: string + format: date-time + description: the timestamp when the temperature was measured + description: status of a single zone + ApiResponse: + type: object + properties: + code: + type: integer + format: int32 + message: + type: number + example: everything is ok + HeaterState: + type: object + properties: + id: + type: string + state: + type: string + DeviceState: + type: object + properties: + id: + type: string + name: + type: string + lastUpdate: + type: string + format: date-time + level: + type: integer + format: int32 + ForecastResponse: + type: object + properties: + city: + $ref: '#/components/schemas/City' + values: + type: array + items: + $ref: '#/components/schemas/Forecast' + Forecast: + type: object + properties: + date: + type: string + format: date-time + pressure: + type: number + format: double + humidity: + type: integer + format: int32 + windSpeed: + type: number + format: double + clouds: + type: integer + format: int32 + temperature: + $ref: '#/components/schemas/ForecastTemperature' + weather: + $ref: '#/components/schemas/WeatherForecast' + City: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + lat: + type: number + format: double + lon: + type: number + format: double + country: + type: string + ForecastTemperature: + type: object + properties: + low: + type: number + format: double + high: + type: number + format: double + morning: + type: number + format: double + day: + type: number + format: double + evening: + type: number + format: double + night: + type: number + format: double + WeatherForecast: + type: object + properties: + summary: + type: string + description: + type: string + icon: + type: string + DeviceRegistrationInfo: + type: object + properties: + uri: + type: string + format: uri + example: 'http://10.0.0.221:8080' + id: + type: string + format: uuid + example: 0729a580-2240-11e6-9eb5-0002a5d5c51b \ No newline at end of file diff --git a/openapi3/testdata/origin/openapi-test1.yaml b/openapi3/testdata/origin/openapi-test1.yaml new file mode 100644 index 000000000..28cbb5942 --- /dev/null +++ b/openapi3/testdata/origin/openapi-test1.yaml @@ -0,0 +1,312 @@ +info: + title: Tufin + version: 1.0.0 +openapi: 3.0.3 +x-extension-test: +x-extension-test2: go +externalDocs: + url: https://tufin.com +tags: +- name: security + description: control security + x-extension-test: +- name: reuven + description: Harrison +servers: +- url: tufin.com + x-extension-test: +security: +- bearerAuth: [] +paths: + /api/{domain}/{project}/badges/security-score: + x-extension-test: + parameters: + - in: path + name: domain + required: true + schema: + description: Hyphen-separated list of lowercase string + example: generic-bank + format: hyphen-separated list + pattern: ^(?:([a-z]+-)*([a-z]+)?)$ + type: string + get: + operationId: GetSecurityScores + x-extension-test: + x-beta: true + tags: + - security + parameters: + - in: query + name: filter + x-extension-test: + content: + application/json: + x-extension-test: + schema: + type: object + properties: + type: + type: string + color: + type: string + - in: header + name: user + content: + application/json: + schema: + type: object + properties: + name: + type: string + - in: cookie + name: test + content: + application/json: + schema: + type: object + - in: query + name: image + examples: + 0: + value: 'reuven' + schema: + x-extension-test: + description: alphanumeric + example: tufinim/generic-bank:cia-latest + format: general string + pattern: ^(?:[\w-./:]+)$ + type: string + - in: query + name: token + schema: + description: RFC 4122 UUID + example: 26734565-dbcc-449a-a370-0beaaf04b0e8 + format: uuid + pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ + type: string + maxLength: 29 + - in: header + name: X-Auth-Name + required: true + schema: + description: empty string + format: empty string + pattern: ^(?:)$ + type: string + - in: path + name: domain + required: true + schema: + description: Hyphen-separated list of lowercase string + example: generic-bank + format: hyphen-separated list + pattern: ^(?:([a-z]+-)*([a-z]+)?)$ + type: string + - in: path + name: project + required: true + schema: + description: Lowercase string + example: retail + format: lowercase string + pattern: ^(?:[a-z]+)$ + type: string + responses: + '200': + description: OK + '201': + description: none + content: + application/xml: + schema: + type: string + '400': + description: "bad request" + content: + application/json: + schema: + type: string + servers: [] + /api/{domain}/{project}/install-command: + get: + parameters: + - in: header + name: X-Auth-Name + required: true + schema: + description: any string + example: Joe + format: any string + pattern: ^(?:.*)$ + type: string + - in: path + name: domain + required: true + schema: + enum: + - generic-bank + - tufin + type: string + - in: path + name: project + required: true + schema: + enum: + - retail + - my-project + - test + - eks + type: string + - in: header + name: network-policies + schema: + $ref: '#/components/schemas/network-policies' + responses: + default: + description: Tufin1 + headers: + X-RateLimit-Limit: + schema: + type: integer + description: Request limit per hour. + servers: [] + /subscribe: + post: + summary: Subscribe to a webhook + callbacks: # Callback definition + myEvent: # Event name + 'hi': + post: + requestBody: # Contents of the callback message + required: true + content: + application/json: + schema: + type: object + properties: + message: + type: number + example: Some event happened + required: + - message + encoding: + historyMetadata: + # require XML Content-Type in utf-8 encoding + contentType: application/xml; charset=utf-8 + style: spaceDelimited + profileImage: + # only accept png/jpeg + contentType: image/png, image/jpeg + headers: + i: + schema: + type: integer + description: integer + responses: # Expected responses to the callback message + '200': + description: Your server returns this code if it accepts the callback + links: + "test": + operationId: "reuven" + description: "test" + "test1": + operationId: "reuven" + description: "test" + "test2": + operationId: "GetSecurityScores" + + 'bye': + post: + requestBody: # Contents of the callback message + required: true + content: + application/json: + schema: + type: object + responses: # Expected responses to the callback message + '200': + description: Your server returns this code if it accepts the callback + responses: + default: + description: Tufin + /register: + post: + security: + - bearerAuth: [] + - OAuth: [] + summary: Subscribe to a webhook + responses: + default: + description: Tufin +components: + schemas: + network-policies: + additionalProperties: true + properties: + netpols: + type: string + type: object + rules: + properties: + netpols: + type: string + type: object + parameters: + network-policies: + name: network-policies + in: header + schema: + $ref: '#/components/schemas/network-policies' + headers: + test: + schema: + $ref: '#/components/schemas/network-policies' + new: + schema: + $ref: '#/components/schemas/network-policies' + testc: + content: + application/json: + schema: + type: object + requestBodies: + reuven: + content: + application/json: + schema: + type: object + discriminator: + propertyName: meter_name + properties: + meter_name: + type: string + tenant: + type: string + meter_value: + type: number + time: + type: integer + dimensions: + type: object + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT + AccessToken: + type: http + scheme: bearer + OAuth: + x-extension-test: + type: oauth2 + flows: + authorizationCode: + authorizationUrl: https://tufin.io/auth + tokenUrl: https://tufin.io/token + scopes: + accountRead: Allows account data to be read + accountWrite: Allows account data to be written + responses: + OK: + description: 200 OK diff --git a/openapi3/testdata/origin/openapi-test2.yaml b/openapi3/testdata/origin/openapi-test2.yaml new file mode 100644 index 000000000..b8a15d6ee --- /dev/null +++ b/openapi3/testdata/origin/openapi-test2.yaml @@ -0,0 +1,72 @@ +info: + title: Tufin + version: 1.0.1 + contact: + email: support@tufin.com +openapi: 3.0.3 +paths: + /api/{domain}/{project}/badges/security-score: + get: + parameters: + - in: query + name: filter + content: + application/json: + schema: + type: object + properties: + type: + type: string + color: + type: number + - in: query + name: image + explode: true + schema: + description: alphanumeric with underscore, dash, period, slash and colon + example: tufinim/generic-bank:cia-latest + format: general string + pattern: ^(?:[\w-./:]+)$ + type: string + - in: query + name: token + schema: + anyOf: + - description: RFC 4122 UUID + example: 26734565-dbcc-449a-a370-0beaaf04b0e8 + format: uuid + pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ + type: string + - description: UUID + example: 26734565-dbcc-449a-a370-0beaaf04b0e8 + format: uuid + pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ + type: string + - in: path + name: domain + required: true + schema: + description: Non-negative integers (including zero) + example: "100" + format: non-negative integer + pattern: ^(?:\d+)$ + type: integer + minimum: 7 + - in: path + name: project + required: true + schema: + description: Lowercase string + example: retail + format: lowercase string + pattern: ^(?:[a-z]+)$ + type: string + responses: + default: + description: Tufin + servers: [] + post: + responses: + default: + description: Tufin + servers: [] diff --git a/openapi3/testdata/origin/openapi-test3.yaml b/openapi3/testdata/origin/openapi-test3.yaml new file mode 100644 index 000000000..b495a2ffc --- /dev/null +++ b/openapi3/testdata/origin/openapi-test3.yaml @@ -0,0 +1,269 @@ +info: + title: Tufin1 + version: 1.0.1 + contact: + email: support@tufin.com + url: www.tufin.com + license: + name: apache +openapi: 3.0.3 +x-extension-test2: nogo +externalDocs: + url: https://tufin.io +tags: +- name: reuven + description: harrison +paths: + /api/{domain}/{project}/badges/security-score: + get: + operationId: GetSecurityScore + x-beta: true + parameters: + - in: query + name: image + examples: + 0: + value: 'reuven1' + 1: + value: 'test' + x-extension-test: + schema: + not: + description: alphanumeric with underscore, dash, period, slash and colon + example: tufinim/generic-bank:cia-latest + format: general string + pattern: ^(?:[\w-./:]+)$ + type: string + - in: query + name: token + schema: + description: RFC 4122 UUID + example: 26734565-dbcc-449a-a370-0beaaf04b0e7 + format: uuid + pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ + type: string + maxLength: 30 + - in: header + name: X-Auth-Name + required: true + schema: + description: empty string + format: empty string + pattern: ^(?:)$ + type: string + - in: path + name: domain + required: true + schema: + description: Hyphen-separated list of lowercase string + example: generic-bank + format: hyphen-separated list + pattern: ^(?:([a-z]+-)*([a-z]+)?)$ + type: string + - in: path + name: project + required: true + schema: + description: Lowercase string + example: retail + format: lowercase string + pattern: ^(?:[a-z]+)$ + type: string + responses: + default: + description: Tufin + servers: [] + /api/{domain}/{project}/install-command: + get: + parameters: + - in: header + name: X-Auth-Name + required: true + schema: + description: any string + example: Joe + format: any string + pattern: ^(?:.*)$ + type: string + - in: path + name: domain + required: true + schema: + enum: + - tufin + - generic-bank + type: string + - in: path + name: project + required: true + schema: + enum: + - retail + - my-project + - test + - eks + - test1 + type: string + responses: + default: + x-test: + description: Tufin + x-extension-test: + headers: + X-RateLimit-Limit: + schema: + type: integer + description: Request limit per min. + x-test: + servers: + - url: 'https://api.oasdiff.com' + - url: 'https://www.oasdiff.com' + description: "1" + variables: + title: + default: "CEO" + x-extension-test: + servers: + - url: 'https://api.oasdiff.com' + parameters: + - in: header + name: name + schema: + enum: + - tufin + /register: + post: + security: + - OAuth: + - write:pets + summary: Subscribe to a webhook + callbacks: # Callback definition + myEvent: # Event name + 'hi': + post: + requestBody: # Contents of the callback message + required: true + content: + application/json: + schema: + type: object + responses: # Expected responses to the callback message + '200': + description: Your server returns this code if it accepts the callback + responses: + default: + description: Tufin + /subscribe: + post: + summary: Subscribe to a webhook + callbacks: # Callback definition + myEvent: # Event name + 'hi': + post: + requestBody: # Contents of the callback message + required: true + content: + application/json: + x-extension-test: + schema: + type: object + properties: + message: + type: string + example: Some event happened + required: + - message + encoding: + profileImage: + # only accept png + contentType: image/png + headers: + i: + x-extension-test: + schema: + type: integer + description: number + responses: # Expected responses to the callback message + '200': + description: Your server returns this code if it accepts the callback + links: + "test": + operationId: "reuven" + "test2": + operationId: "GetSecurityScore" + '{$request.body#/callbackUrl}': # The callback URL, + # Refers to the passed URL + post: + requestBody: # Contents of the callback message + required: true + content: + application/json: + schema: + type: object + properties: + message: + type: string + example: Some event happened + required: + - message + responses: # Expected responses to the callback message + '200': + description: Your server returns this code if it accepts the callback + 'bye': + post: + responses: # Expected responses to the callback message + '200': + description: Your server returns this code if it accepts the callback + responses: + default: + description: Tufin +components: + callbacks: + test: + 'reuven': + post: + requestBody: + required: true + content: + application/json: + schema: + type: object + responses: + '200': + description: Your server returns this code if it accepts the callback + requestBodies: + reuven: + content: + application/json: + schema: + type: object + properties: + meter_name: + type: string + tenant: + type: string + meter_value: + type: integer + time: + type: integer + dimensions: + type: object + securitySchemes: + OAuth: + type: oauth2 + flows: + authorizationCode: + authorizationUrl: https://example.org/auth + tokenUrl: https://example.org/token + scopes: + accountRead: Allows account data to be read + accountWrite: Allows accounts data to be written + admin: read + clientCredentials: + tokenUrl: tufin.io/token + examples: + a: + description: reuven + links: + b: + description: reuven diff --git a/openapi3/testdata/origin/openapi-test4.yaml b/openapi3/testdata/origin/openapi-test4.yaml new file mode 100644 index 000000000..5611e1983 --- /dev/null +++ b/openapi3/testdata/origin/openapi-test4.yaml @@ -0,0 +1,56 @@ +info: + title: Tufin + version: 1.0.0 +openapi: 3.0.3 +paths: + /prefix/api/{domain}/{project}/badges/security-score: + get: + parameters: + - in: query + name: image + schema: + description: alphanumeric with underscore, dash, period, slash and colon + example: tufinim/generic-bank:cia-latest + format: general string + pattern: ^(?:[\w-./:]+)$ + type: string + - in: query + name: token + schema: + anyOf: + - description: RFC 4122 UUID + example: 26734565-dbcc-449a-a370-0beaaf04b0e8 + format: uuid + pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ + type: string + - description: RFC 4122 UUID + example: 26734565-dbcc-449a-a370-0beaaf04b0e8 + format: uuid + type: string + - in: path + name: domain + required: true + schema: + description: Non-negative integers (including zero) + example: "100" + format: non-negative integer + pattern: ^(?:\d+)$ + type: integer + - in: path + name: project + required: true + schema: + description: Lowercase string + example: retail + format: lowercase string + pattern: ^(?:[a-z]+)$ + type: string + responses: + default: + description: Tufin + servers: [] + post: + responses: + default: + description: Tufin + servers: [] diff --git a/openapi3/testdata/origin/openapi-test5.yaml b/openapi3/testdata/origin/openapi-test5.yaml new file mode 100644 index 000000000..96313812d --- /dev/null +++ b/openapi3/testdata/origin/openapi-test5.yaml @@ -0,0 +1,181 @@ +info: + title: Tufin1 + version: 1.0.1 + contact: + email: support@tufin.com + url: www.tufin.com + license: + name: apache +openapi: 3.0.3 +paths: + /api/{domain}/{project}/badges/security-score: + get: + parameters: + - in: query + name: filter + content: + application/json: + schema: + type: object + properties: + type: + type: string + color: + type: string + required: + - type + - in: header + name: user + schema: + type: string + - in: cookie + name: test + content: + application/json: + schema: + type: string + - in: query + name: image + schema: + description: alphanumeric + example: tufinim/generic-bank:cia-latest + format: general string + pattern: ^(?:[\w-./:]+)$ + type: string + - in: query + name: token + schema: + description: RFC 4122 UUID + example: 26734565-dbcc-449a-a370-0beaaf04b0e8 + format: uuid + pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ + type: string + - in: header + name: X-Auth-Name + required: true + schema: + description: empty string + format: empty string + pattern: ^(?:)$ + type: string + - in: path + name: domain + required: true + schema: + description: Hyphen-separated list of lowercase string + example: generic-bank + format: hyphen-separated list + pattern: ^(?:([a-z]+-)*([a-z]+)?)$ + type: string + - in: path + name: project + required: true + schema: + description: Lowercase string + example: retail + format: lowercase string + pattern: ^(?:[a-z]+)$ + type: string + responses: + default: + description: Tufin + '201': + description: none + content: + application/xml: + schema: + type: object + servers: [] + /api/{domain}/{project}/install-command: + get: + parameters: + - in: header + name: X-Auth-Name + required: true + schema: + description: any string + example: Joe + format: any string + pattern: ^(?:.*)$ + type: string + - in: path + name: domain + required: true + schema: + enum: + - generic-bank + - tufin + type: string + - in: path + name: project + required: true + schema: + enum: + - retail + - my-project + - test + - eks + type: string + responses: + default: + description: Tufin + servers: + - url: 'https://www.oasdiff.com' + description: "2" + variables: + name: + default: "joe" + enum: ["joe", "bill"] + title: + default: "developer" + x-test: +components: + schemas: + requests: + additionalProperties: false + properties: + email: + description: Email address + example: road.runner@acme.com + format: email + pattern: ^(?:[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$ + type: string + type: object + network-policies: + additionalProperties: false + properties: + netpols: + type: string + type: object + rules: + additionalProperties: false + properties: + netpols: + type: string + type: object + responses: + default: + description: Tufin + headers: + test: + schema: + $ref: '#/components/schemas/network-policies' + testc: + content: + application/json: + schema: + type: string + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT + AccessToken: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets": read your pets + diff --git a/openapi3/testdata/origin/openapi-test6.yaml b/openapi3/testdata/origin/openapi-test6.yaml new file mode 100644 index 000000000..9138911bd --- /dev/null +++ b/openapi3/testdata/origin/openapi-test6.yaml @@ -0,0 +1,23 @@ +openapi: "3.0.0" +info: + title: "Test API" + version: "1.0.0" +paths: + /health: + get: + summary: "Get health status" + responses: + 200: + description: "Success" + /health/live: + get: + summary: "Get live health status" + responses: + 200: + description: "Success" + /health/ready: + get: + summary: "Get readiness status" + responses: + 200: + description: "Success" \ No newline at end of file diff --git a/openapi3/testdata/origin/openapi-test7.yaml b/openapi3/testdata/origin/openapi-test7.yaml new file mode 100644 index 000000000..bcd08b620 --- /dev/null +++ b/openapi3/testdata/origin/openapi-test7.yaml @@ -0,0 +1,5 @@ +openapi: "3.0.0" +info: + title: "Test API" + version: "2.0.0" +paths: {} \ No newline at end of file diff --git a/openapi3/testdata/origin/openapi-test701.yaml b/openapi3/testdata/origin/openapi-test701.yaml new file mode 100644 index 000000000..6b1f02fac --- /dev/null +++ b/openapi3/testdata/origin/openapi-test701.yaml @@ -0,0 +1,253 @@ +info: + title: Tufin + version: 1.0.0 +openapi: 3.0.3 +x-extension-test: +x-extension-test2: go +externalDocs: + url: https://tufin.com +tags: +- name: security + description: control security + x-extension-test: +- name: reuven + description: Harrison +servers: +- url: tufin.com + x-extension-test: +security: +- bearerAuth: [] +paths: + /api/{domain}/{project}/badges/security-score: + x-extension-test: + parameters: + - in: path + name: domain + required: true + schema: + description: Hyphen-separated list of lowercase string + example: generic-bank + format: hyphen-separated list + pattern: ^(?:([a-z]+-)*([a-z]+)?)$ + type: string + get: + operationId: GetSecurityScores + x-extension-test: + x-beta: true + tags: + - security + parameters: + - in: query + name: filter + x-extension-test: + content: + application/json: + x-extension-test: + schema: + type: object + properties: + type: + type: string + color: + type: string + - in: header + name: user + content: + application/json: + schema: + type: object + properties: + name: + type: string + - in: cookie + name: test + content: + application/json: + schema: + type: object + - in: query + name: image + examples: + 0: + value: 'reuven' + schema: + x-extension-test: + description: alphanumeric + example: tufinim/generic-bank:cia-latest + format: general string + pattern: ^(?:[\w-./:]+)$ + type: string + - in: query + name: token + schema: + description: RFC 4122 UUID + example: 26734565-dbcc-449a-a370-0beaaf04b0e8 + format: uuid + pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ + type: string + maxLength: 29 + - in: header + name: X-Auth-Name + required: true + schema: + description: empty string + format: empty string + pattern: ^(?:)$ + type: string + - in: path + name: domain + required: true + schema: + description: Hyphen-separated list of lowercase string + example: generic-bank + format: hyphen-separated list + pattern: ^(?:([a-z]+-)*([a-z]+)?)$ + type: string + - in: path + name: project + required: true + schema: + description: Lowercase string + example: retail + format: lowercase string + pattern: ^(?:[a-z]+)$ + type: string + responses: + '200': + description: OK + '201': + description: none + content: + application/xml: + schema: + type: string + '400': + description: "bad request" + content: + application/json: + schema: + type: string + servers: [] + /api/{domain}/{project}/install-command: + get: + parameters: + - in: header + name: X-Auth-Name + required: true + schema: + description: any string + example: Joe + format: any string + pattern: ^(?:.*)$ + type: string + - in: path + name: domain + required: true + schema: + enum: + - generic-bank + - tufin + type: string + - in: path + name: project + required: true + schema: + enum: + - retail + - my-project + - test + - eks + type: string + - in: header + name: network-policies + schema: + $ref: '#/components/schemas/network-policies' + responses: + default: + description: Tufin1 + headers: + X-RateLimit-Limit: + schema: + type: integer + description: Request limit per hour. + servers: [] + /register: + post: + security: + - bearerAuth: [] + - OAuth: [] + summary: Subscribe to a webhook + responses: + default: + description: Tufin +components: + schemas: + network-policies: + additionalProperties: true + properties: + netpols: + type: string + type: object + rules: + properties: + netpols: + type: string + type: object + parameters: + network-policies: + name: network-policies + in: header + schema: + $ref: '#/components/schemas/network-policies' + headers: + test: + schema: + $ref: '#/components/schemas/network-policies' + new: + schema: + $ref: '#/components/schemas/network-policies' + testc: + content: + application/json: + schema: + type: object + requestBodies: + reuven: + content: + application/json: + schema: + type: object + discriminator: + propertyName: meter_name + properties: + meter_name: + type: string + tenant: + type: string + meter_value: + type: number + time: + type: integer + dimensions: + type: object + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT + AccessToken: + type: http + scheme: bearer + OAuth: + x-extension-test: + type: oauth2 + flows: + authorizationCode: + authorizationUrl: https://tufin.io/auth + tokenUrl: https://tufin.io/token + scopes: + accountRead: Allows account data to be read + accountWrite: Allows account data to be written + responses: + OK: + description: 200 OK diff --git a/openapi3/testdata/origin/openapi-test702.yaml b/openapi3/testdata/origin/openapi-test702.yaml new file mode 100644 index 000000000..ae917586e --- /dev/null +++ b/openapi3/testdata/origin/openapi-test702.yaml @@ -0,0 +1,313 @@ +info: + title: Tufin + version: 1.0.0 +openapi: 3.0.3 +x-extension-test: +x-extension-test2: go +externalDocs: + url: https://tufin.com +tags: +- name: security + description: control security + x-extension-test: +- name: reuven + description: Harrison +servers: +- url: tufin.com + x-extension-test: +security: +- bearerAuth: [] +paths: + /api/{domain}/{project}/badges/security-score: + x-extension-test: + parameters: + - in: path + name: domain + required: true + schema: + description: Hyphen-separated list of lowercase string + example: generic-bank + format: hyphen-separated list + pattern: ^(?:([a-z]+-)*([a-z]+)?)$ + type: string + get: + operationId: GetSecurityScores + x-extension-test: + x-beta: true + tags: + - security + parameters: + - in: query + name: filter + x-extension-test: + content: + application/json: + x-extension-test: + schema: + type: object + properties: + type: + type: string + color: + type: string + - in: header + name: user + content: + application/json: + schema: + type: object + properties: + name: + type: string + - in: cookie + name: test + content: + application/json: + schema: + type: object + - in: query + name: image + examples: + 0: + value: 'reuven' + schema: + x-extension-test: + description: alphanumeric + example: tufinim/generic-bank:cia-latest + format: general string + pattern: ^(?:[\w-./:]+)$ + type: string + - in: query + name: token + schema: + description: RFC 4122 UUID + example: 26734565-dbcc-449a-a370-0beaaf04b0e8 + format: uuid + pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ + type: string + maxLength: 29 + - in: header + name: X-Auth-Name + required: true + schema: + description: empty string + format: empty string + pattern: ^(?:)$ + type: string + - in: path + name: domain + required: true + schema: + description: Hyphen-separated list of lowercase string + example: generic-bank + format: hyphen-separated list + pattern: ^(?:([a-z]+-)*([a-z]+)?)$ + type: string + - in: path + name: project + required: true + schema: + description: Lowercase string + example: retail + format: lowercase string + pattern: ^(?:[a-z]+)$ + type: string + responses: + '200': + description: OK + '201': + description: none + content: + application/xml: + schema: + type: string + '400': + description: "bad request" + content: + application/json: + schema: + type: string + servers: [] + /api/{domain}/{project}/install-command: + get: + parameters: + - in: header + name: X-Auth-Name + required: true + schema: + description: any string + example: Joe + format: any string + pattern: ^(?:.*)$ + type: string + - in: path + name: domain + required: true + schema: + enum: + - generic-bank + - tufin + - removed-value + type: string + - in: path + name: project + required: true + schema: + enum: + - retail + - my-project + - test + - eks + type: string + - in: header + name: network-policies + schema: + $ref: '#/components/schemas/network-policies' + responses: + default: + description: Tufin1 + headers: + X-RateLimit-Limit: + schema: + type: integer + description: Request limit per hour. + servers: [] + /subscribe: + post: + summary: Subscribe to a webhook + callbacks: # Callback definition + myEvent: # Event name + 'hi': + post: + requestBody: # Contents of the callback message + required: true + content: + application/json: + schema: + type: object + properties: + message: + type: number + example: Some event happened + required: + - message + encoding: + historyMetadata: + # require XML Content-Type in utf-8 encoding + contentType: application/xml; charset=utf-8 + style: spaceDelimited + profileImage: + # only accept png/jpeg + contentType: image/png, image/jpeg + headers: + i: + schema: + type: integer + description: integer + responses: # Expected responses to the callback message + '200': + description: Your server returns this code if it accepts the callback + links: + "test": + operationId: "reuven" + description: "test" + "test1": + operationId: "reuven" + description: "test" + "test2": + operationId: "GetSecurityScores" + + 'bye': + post: + requestBody: # Contents of the callback message + required: true + content: + application/json: + schema: + type: object + responses: # Expected responses to the callback message + '200': + description: Your server returns this code if it accepts the callback + responses: + default: + description: Tufin + /register: + post: + security: + - bearerAuth: [] + - OAuth: [] + summary: Subscribe to a webhook + responses: + default: + description: Tufin +components: + schemas: + network-policies: + additionalProperties: true + properties: + netpols: + type: string + type: object + rules: + properties: + netpols: + type: string + type: object + parameters: + network-policies: + name: network-policies + in: header + schema: + $ref: '#/components/schemas/network-policies' + headers: + test: + schema: + $ref: '#/components/schemas/network-policies' + new: + schema: + $ref: '#/components/schemas/network-policies' + testc: + content: + application/json: + schema: + type: object + requestBodies: + reuven: + content: + application/json: + schema: + type: object + discriminator: + propertyName: meter_name + properties: + meter_name: + type: string + tenant: + type: string + meter_value: + type: number + time: + type: integer + dimensions: + type: object + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT + AccessToken: + type: http + scheme: bearer + OAuth: + x-extension-test: + type: oauth2 + flows: + authorizationCode: + authorizationUrl: https://tufin.io/auth + tokenUrl: https://tufin.io/token + scopes: + accountRead: Allows account data to be read + accountWrite: Allows account data to be written + responses: + OK: + description: 200 OK diff --git a/openapi3/testdata/origin/openapi-test703.yaml b/openapi3/testdata/origin/openapi-test703.yaml new file mode 100644 index 000000000..3c96cc32f --- /dev/null +++ b/openapi3/testdata/origin/openapi-test703.yaml @@ -0,0 +1,330 @@ +info: + title: Tufin + version: 1.0.0 +openapi: 3.0.3 +x-extension-test: +x-extension-test2: go +externalDocs: + url: https://tufin.com +tags: +- name: security + description: control security + x-extension-test: +- name: reuven + description: Harrison +servers: +- url: tufin.com + x-extension-test: +security: +- bearerAuth: [] +paths: + /api/{domain}/{project}/badges/security-score: + x-extension-test: + parameters: + - in: path + name: domain + required: true + schema: + description: Hyphen-separated list of lowercase string + example: generic-bank + format: hyphen-separated list + pattern: ^(?:([a-z]+-)*([a-z]+)?)$ + type: string + get: + operationId: GetSecurityScores + x-extension-test: + x-beta: true + tags: + - security + parameters: + - in: query + name: filter + x-extension-test: + content: + application/json: + x-extension-test: + schema: + type: object + properties: + type: + type: string + color: + type: string + - in: header + name: user + content: + application/json: + schema: + type: object + properties: + name: + type: string + - in: cookie + name: test + content: + application/json: + schema: + type: object + - in: query + name: image + examples: + 0: + value: 'reuven' + schema: + x-extension-test: + description: alphanumeric + example: tufinim/generic-bank:cia-latest + format: general string + pattern: ^(?:[\w-./:]+)$ + type: string + - in: query + name: token + schema: + description: RFC 4122 UUID + example: 26734565-dbcc-449a-a370-0beaaf04b0e8 + format: uuid + pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ + type: string + maxLength: 29 + - in: header + name: X-Auth-Name + required: true + schema: + description: empty string + format: empty string + pattern: ^(?:)$ + type: string + - in: path + name: domain + required: true + schema: + description: Hyphen-separated list of lowercase string + example: generic-bank + format: hyphen-separated list + pattern: ^(?:([a-z]+-)*([a-z]+)?)$ + type: string + - in: path + name: project + required: true + schema: + description: Lowercase string + example: retail + format: lowercase string + pattern: ^(?:[a-z]+)$ + type: string + responses: + '200': + description: OK + '201': + description: none + content: + application/xml: + schema: + type: string + '400': + description: "bad request" + content: + application/json: + schema: + type: string + servers: [] + /api/{domain}/{project}/install-command: + get: + parameters: + - in: header + name: X-Auth-Name + required: true + schema: + description: any string + example: Joe + format: any string + pattern: ^(?:.*)$ + type: string + - in: path + name: domain + required: true + schema: + enum: + - generic-bank + - tufin + type: string + - in: path + name: project + required: true + schema: + enum: + - retail + - my-project + - test + - eks + type: string + - in: header + name: network-policies + schema: + $ref: '#/components/schemas/network-policies' + responses: + default: + description: Tufin1 + headers: + X-RateLimit-Limit: + schema: + type: integer + description: Request limit per hour. + servers: [] + /subscribe: + post: + summary: Subscribe to a webhook + callbacks: # Callback definition + myEvent: # Event name + 'hi': + post: + requestBody: # Contents of the callback message + required: true + content: + application/json: + schema: + type: object + properties: + message: + type: number + example: Some event happened + required: + - message + encoding: + historyMetadata: + # require XML Content-Type in utf-8 encoding + contentType: application/xml; charset=utf-8 + style: spaceDelimited + profileImage: + # only accept png/jpeg + contentType: image/png, image/jpeg + headers: + i: + schema: + type: integer + description: integer + responses: # Expected responses to the callback message + '200': + description: Your server returns this code if it accepts the callback + links: + "test": + operationId: "reuven" + description: "test" + "test1": + operationId: "reuven" + description: "test" + "test2": + operationId: "GetSecurityScores" + + 'bye': + post: + requestBody: # Contents of the callback message + required: true + content: + application/json: + schema: + type: object + responses: # Expected responses to the callback message + '200': + description: Your server returns this code if it accepts the callback + responses: + default: + description: Tufin + /register: + post: + security: + - bearerAuth: [] + - OAuth: [] + summary: Subscribe to a webhook + responses: + default: + content: + application/json: + schema: + type: object + properties: + respenum: + type: string + enum: + - ASD + - TER + respenum2: + type: object + properties: + respenum3: + type: string + enum: + - ASD2 + - QWE2 + description: Tufin +components: + schemas: + network-policies: + additionalProperties: true + properties: + netpols: + type: string + type: object + rules: + properties: + netpols: + type: string + type: object + parameters: + network-policies: + name: network-policies + in: header + schema: + $ref: '#/components/schemas/network-policies' + headers: + test: + schema: + $ref: '#/components/schemas/network-policies' + new: + schema: + $ref: '#/components/schemas/network-policies' + testc: + content: + application/json: + schema: + type: object + requestBodies: + reuven: + content: + application/json: + schema: + type: object + discriminator: + propertyName: meter_name + properties: + meter_name: + type: string + tenant: + type: string + meter_value: + type: number + time: + type: integer + dimensions: + type: object + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT + AccessToken: + type: http + scheme: bearer + OAuth: + x-extension-test: + type: oauth2 + flows: + authorizationCode: + authorizationUrl: https://tufin.io/auth + tokenUrl: https://tufin.io/token + scopes: + accountRead: Allows account data to be read + accountWrite: Allows account data to be written + responses: + OK: + description: 200 OK diff --git a/openapi3/testdata/origin/openapi-test704.yaml b/openapi3/testdata/origin/openapi-test704.yaml new file mode 100644 index 000000000..97227356a --- /dev/null +++ b/openapi3/testdata/origin/openapi-test704.yaml @@ -0,0 +1,332 @@ +info: + title: Tufin + version: 1.0.0 +openapi: 3.0.3 +x-extension-test: +x-extension-test2: go +externalDocs: + url: https://tufin.com +tags: +- name: security + description: control security + x-extension-test: +- name: reuven + description: Harrison +servers: +- url: tufin.com + x-extension-test: +security: +- bearerAuth: [] +paths: + /api/{domain}/{project}/badges/security-score: + x-extension-test: + parameters: + - in: path + name: domain + required: true + schema: + description: Hyphen-separated list of lowercase string + example: generic-bank + format: hyphen-separated list + pattern: ^(?:([a-z]+-)*([a-z]+)?)$ + type: string + get: + operationId: GetSecurityScores + x-extension-test: + x-beta: true + tags: + - security + parameters: + - in: query + name: filter + x-extension-test: + content: + application/json: + x-extension-test: + schema: + type: object + properties: + type: + type: string + color: + type: string + - in: header + name: user + content: + application/json: + schema: + type: object + properties: + name: + type: string + - in: cookie + name: test + content: + application/json: + schema: + type: object + - in: query + name: image + examples: + 0: + value: 'reuven' + schema: + x-extension-test: + description: alphanumeric + example: tufinim/generic-bank:cia-latest + format: general string + pattern: ^(?:[\w-./:]+)$ + type: string + - in: query + name: token + schema: + description: RFC 4122 UUID + example: 26734565-dbcc-449a-a370-0beaaf04b0e8 + format: uuid + pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ + type: string + maxLength: 29 + - in: header + name: X-Auth-Name + required: true + schema: + description: empty string + format: empty string + pattern: ^(?:)$ + type: string + - in: path + name: domain + required: true + schema: + description: Hyphen-separated list of lowercase string + example: generic-bank + format: hyphen-separated list + pattern: ^(?:([a-z]+-)*([a-z]+)?)$ + type: string + - in: path + name: project + required: true + schema: + description: Lowercase string + example: retail + format: lowercase string + pattern: ^(?:[a-z]+)$ + type: string + responses: + '200': + description: OK + '201': + description: none + content: + application/xml: + schema: + type: string + '400': + description: "bad request" + content: + application/json: + schema: + type: string + servers: [] + /api/{domain}/{project}/install-command: + get: + parameters: + - in: header + name: X-Auth-Name + required: true + schema: + description: any string + example: Joe + format: any string + pattern: ^(?:.*)$ + type: string + - in: path + name: domain + required: true + schema: + enum: + - generic-bank + - tufin + type: string + - in: path + name: project + required: true + schema: + enum: + - retail + - my-project + - test + - eks + type: string + - in: header + name: network-policies + schema: + $ref: '#/components/schemas/network-policies' + responses: + default: + description: Tufin1 + headers: + X-RateLimit-Limit: + schema: + type: integer + description: Request limit per hour. + servers: [] + /subscribe: + post: + summary: Subscribe to a webhook + callbacks: # Callback definition + myEvent: # Event name + 'hi': + post: + requestBody: # Contents of the callback message + required: true + content: + application/json: + schema: + type: object + properties: + message: + type: number + example: Some event happened + required: + - message + encoding: + historyMetadata: + # require XML Content-Type in utf-8 encoding + contentType: application/xml; charset=utf-8 + style: spaceDelimited + profileImage: + # only accept png/jpeg + contentType: image/png, image/jpeg + headers: + i: + schema: + type: integer + description: integer + responses: # Expected responses to the callback message + '200': + description: Your server returns this code if it accepts the callback + links: + "test": + operationId: "reuven" + description: "test" + "test1": + operationId: "reuven" + description: "test" + "test2": + operationId: "GetSecurityScores" + + 'bye': + post: + requestBody: # Contents of the callback message + required: true + content: + application/json: + schema: + type: object + responses: # Expected responses to the callback message + '200': + description: Your server returns this code if it accepts the callback + responses: + default: + description: Tufin + /register: + post: + security: + - bearerAuth: [] + - OAuth: [] + summary: Subscribe to a webhook + responses: + default: + content: + application/json: + schema: + type: object + properties: + respenum: + type: string + enum: + - ASD + - QWE + - TER + respenum2: + type: object + properties: + respenum3: + type: string + enum: + - ASD2 + - QWE2 + - TER2 + description: Tufin +components: + schemas: + network-policies: + additionalProperties: true + properties: + netpols: + type: string + type: object + rules: + properties: + netpols: + type: string + type: object + parameters: + network-policies: + name: network-policies + in: header + schema: + $ref: '#/components/schemas/network-policies' + headers: + test: + schema: + $ref: '#/components/schemas/network-policies' + new: + schema: + $ref: '#/components/schemas/network-policies' + testc: + content: + application/json: + schema: + type: object + requestBodies: + reuven: + content: + application/json: + schema: + type: object + discriminator: + propertyName: meter_name + properties: + meter_name: + type: string + tenant: + type: string + meter_value: + type: number + time: + type: integer + dimensions: + type: object + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT + AccessToken: + type: http + scheme: bearer + OAuth: + x-extension-test: + type: oauth2 + flows: + authorizationCode: + authorizationUrl: https://tufin.io/auth + tokenUrl: https://tufin.io/token + scopes: + accountRead: Allows account data to be read + accountWrite: Allows account data to be written + responses: + OK: + description: 200 OK diff --git a/openapi3/testdata/origin/openapi-test8.yaml b/openapi3/testdata/origin/openapi-test8.yaml new file mode 100644 index 000000000..e47f2c96f --- /dev/null +++ b/openapi3/testdata/origin/openapi-test8.yaml @@ -0,0 +1,17 @@ +openapi: "3.0.0" +info: + title: "Test API" + version: "1.0.0" +paths: + /resource/new: + get: + summary: "Get new resource" + responses: + 200: + description: "Success" + /resource/newest: + get: + summary: "Get newest resource" + responses: + 200: + description: "Success" diff --git a/openapi3/testdata/origin/openapi31-test1.yaml b/openapi3/testdata/origin/openapi31-test1.yaml new file mode 100644 index 000000000..3a4783ae9 --- /dev/null +++ b/openapi3/testdata/origin/openapi31-test1.yaml @@ -0,0 +1,34 @@ +openapi: 3.1.0 +info: + title: Webhook Example + version: 1.0.0 +# Since OAS 3.1.0 the paths element isn't necessary. Now a valid OpenAPI Document can describe only paths, webhooks, or even only reusable components +webhooks: + # Each webhook needs a name + newPet: + # This is a Path Item Object, the only difference is that the request is initiated by the API provider + post: + requestBody: + description: Information about a new pet in the system + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + responses: + "200": + description: Return a 200 status to indicate that the data was received successfully + +components: + schemas: + Pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string \ No newline at end of file diff --git a/openapi3/testdata/origin/openapi31-test2.yaml b/openapi3/testdata/origin/openapi31-test2.yaml new file mode 100644 index 000000000..e948e028d --- /dev/null +++ b/openapi3/testdata/origin/openapi31-test2.yaml @@ -0,0 +1,35 @@ +openapi: 3.1.0 +info: + title: Webhook Example + version: 1.0.0 +# Since OAS 3.1.0 the paths element isn't necessary. Now a valid OpenAPI Document can describe only paths, webhooks, or even only reusable components +webhooks: + # Each webhook needs a name + newPet: + # This is a Path Item Object, the only difference is that the request is initiated by the API provider + post: + requestBody: + description: Information about a new pet in the system + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + responses: + "200": + description: Return a 200 status to indicate that the data was received successfully + +components: + schemas: + Pet: + required: + - id + - name + - tag + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string \ No newline at end of file diff --git a/openapi3/testdata/origin/operation_id_added_base.yaml b/openapi3/testdata/origin/operation_id_added_base.yaml new file mode 100644 index 000000000..207da4732 --- /dev/null +++ b/openapi3/testdata/origin/operation_id_added_base.yaml @@ -0,0 +1,59 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + tags: + - Group + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/operation_id_removed_base.yaml b/openapi3/testdata/origin/operation_id_removed_base.yaml new file mode 100644 index 000000000..5835dd48c --- /dev/null +++ b/openapi3/testdata/origin/operation_id_removed_base.yaml @@ -0,0 +1,60 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + tags: + - Group + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-base-recursive.yaml b/openapi3/testdata/origin/pattern-base-recursive.yaml new file mode 100644 index 000000000..e287d99cd --- /dev/null +++ b/openapi3/testdata/origin/pattern-base-recursive.yaml @@ -0,0 +1,65 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "1.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project + /api/v1.0/groups/{groupId}: + get: + operationId: returnOneGroup + parameters: + - $ref: '#/components/parameters/groupId' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Return One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-base.yaml b/openapi3/testdata/origin/pattern-base.yaml new file mode 100644 index 000000000..384ddde6d --- /dev/null +++ b/openapi3/testdata/origin/pattern-base.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "1.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project + /api/v1.0/groups/{groupId}: + get: + operationId: returnOneGroup + parameters: + - $ref: '#/components/parameters/groupId' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Return One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-modified-not-anystring.yaml b/openapi3/testdata/origin/pattern-modified-not-anystring.yaml new file mode 100644 index 000000000..7f0cd7fc9 --- /dev/null +++ b/openapi3/testdata/origin/pattern-modified-not-anystring.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "1.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project + /api/v1.0/groups/{groupId}: + get: + operationId: returnOneGroup + parameters: + - $ref: '#/components/parameters/groupId' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Return One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: ".+" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-modified.yaml b/openapi3/testdata/origin/pattern-modified.yaml new file mode 100644 index 000000000..959545745 --- /dev/null +++ b/openapi3/testdata/origin/pattern-modified.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "1.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project + /api/v1.0/groups/{groupId}: + get: + operationId: returnOneGroup + parameters: + - $ref: '#/components/parameters/groupId' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Return One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: ".*" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-parameter-base.yaml b/openapi3/testdata/origin/pattern-parameter-base.yaml new file mode 100644 index 000000000..0bc8252be --- /dev/null +++ b/openapi3/testdata/origin/pattern-parameter-base.yaml @@ -0,0 +1,63 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "1.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project + /api/v1.0/groups/{groupId}: + get: + operationId: returnOneGroup + parameters: + - $ref: '#/components/parameters/groupId' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Return One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + pattern: "[0-9a-f]+" + schemas: + GroupView: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-parameter-modified-not-anystring.yaml b/openapi3/testdata/origin/pattern-parameter-modified-not-anystring.yaml new file mode 100644 index 000000000..55ea0350d --- /dev/null +++ b/openapi3/testdata/origin/pattern-parameter-modified-not-anystring.yaml @@ -0,0 +1,63 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "1.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project + /api/v1.0/groups/{groupId}: + get: + operationId: returnOneGroup + parameters: + - $ref: '#/components/parameters/groupId' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Return One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + pattern: "[0-9]+" + schemas: + GroupView: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-parameter-revision.yaml b/openapi3/testdata/origin/pattern-parameter-revision.yaml new file mode 100644 index 000000000..384ddde6d --- /dev/null +++ b/openapi3/testdata/origin/pattern-parameter-revision.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "1.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project + /api/v1.0/groups/{groupId}: + get: + operationId: returnOneGroup + parameters: + - $ref: '#/components/parameters/groupId' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Return One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-revision-recursive.yaml b/openapi3/testdata/origin/pattern-revision-recursive.yaml new file mode 100644 index 000000000..53c4647c8 --- /dev/null +++ b/openapi3/testdata/origin/pattern-revision-recursive.yaml @@ -0,0 +1,64 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "1.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project + /api/v1.0/groups/{groupId}: + get: + operationId: returnOneGroup + parameters: + - $ref: '#/components/parameters/groupId' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Return One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-revision.yaml b/openapi3/testdata/origin/pattern-revision.yaml new file mode 100644 index 000000000..fb6efb8b1 --- /dev/null +++ b/openapi3/testdata/origin/pattern-revision.yaml @@ -0,0 +1,61 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "1.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project + /api/v1.0/groups/{groupId}: + get: + operationId: returnOneGroup + parameters: + - $ref: '#/components/parameters/groupId' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Return One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_body_became_optional_base.yaml b/openapi3/testdata/origin/request_body_became_optional_base.yaml new file mode 100644 index 000000000..5835dd48c --- /dev/null +++ b/openapi3/testdata/origin/request_body_became_optional_base.yaml @@ -0,0 +1,60 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + tags: + - Group + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_body_became_required_base.yaml b/openapi3/testdata/origin/request_body_became_required_base.yaml new file mode 100644 index 000000000..5dddd5edc --- /dev/null +++ b/openapi3/testdata/origin/request_body_became_required_base.yaml @@ -0,0 +1,60 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + tags: + - Group + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: false + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_body_default_value_changed_base.yaml b/openapi3/testdata/origin/request_body_default_value_changed_base.yaml new file mode 100644 index 000000000..ea98ca0f7 --- /dev/null +++ b/openapi3/testdata/origin/request_body_default_value_changed_base.yaml @@ -0,0 +1,25 @@ +openapi: 3.0.0 +info: + title: Sample API + version: 1.0.0 +paths: + /products: + post: + summary: Create a new product + operationId: createProduct + requestBody: + content: + text/plain: + schema: + type: string + default: "Default" + application/json: + schema: + type: object + properties: + name: + type: string + price: + type: number + default: 10.0 + description: RequestBody diff --git a/openapi3/testdata/origin/request_body_default_value_changed_revision.yaml b/openapi3/testdata/origin/request_body_default_value_changed_revision.yaml new file mode 100644 index 000000000..726a06307 --- /dev/null +++ b/openapi3/testdata/origin/request_body_default_value_changed_revision.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.0 +info: + title: Sample API + version: 1.0.0 +paths: + /products: + post: + summary: Create a new product + operationId: createProduct + requestBody: + content: + text/plain: + schema: + type: string + default: "NewDefault" + description: RequestBody \ No newline at end of file diff --git a/openapi3/testdata/origin/request_body_max_length_decreased_base.yaml b/openapi3/testdata/origin/request_body_max_length_decreased_base.yaml new file mode 100644 index 000000000..de412a5b3 --- /dev/null +++ b/openapi3/testdata/origin/request_body_max_length_decreased_base.yaml @@ -0,0 +1,29 @@ +openapi: 3.0.1 +info: + title: Pet Store API + version: "1.0" +servers: + - url: https://api.example.com/v1 +paths: + /pets: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + type: object + properties: + id: + type: integer + name: + type: string + maxLength: 100 + description: + type: string + maxLength: 100 + required: true + responses: + "200": + description: OK +components: {} diff --git a/openapi3/testdata/origin/request_body_max_length_set_base.yaml b/openapi3/testdata/origin/request_body_max_length_set_base.yaml new file mode 100644 index 000000000..1d8107885 --- /dev/null +++ b/openapi3/testdata/origin/request_body_max_length_set_base.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.1 +info: + title: Test API + version: 1.0.0 +paths: + /pets: + post: + operationId: addPet + requestBody: + content: + text/plain: + schema: + type: string + responses: + "200": + description: OK diff --git a/openapi3/testdata/origin/request_body_max_length_set_revision.yaml b/openapi3/testdata/origin/request_body_max_length_set_revision.yaml new file mode 100644 index 000000000..8c23a83e3 --- /dev/null +++ b/openapi3/testdata/origin/request_body_max_length_set_revision.yaml @@ -0,0 +1,17 @@ +openapi: 3.0.1 +info: + title: Test API + version: 1.0.0 +paths: + /pets: + post: + operationId: addPet + requestBody: + content: + text/plain: + schema: + type: string + maxLength: 15 + responses: + "200": + description: OK diff --git a/openapi3/testdata/origin/request_body_max_set_base.yaml b/openapi3/testdata/origin/request_body_max_set_base.yaml new file mode 100644 index 000000000..a51bb0c06 --- /dev/null +++ b/openapi3/testdata/origin/request_body_max_set_base.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.1 +info: + title: Test API + version: 1.0.0 +paths: + /pets: + post: + operationId: addPet + requestBody: + content: + text/plain: + schema: + type: number + responses: + "200": + description: OK diff --git a/openapi3/testdata/origin/request_body_max_set_revision.yaml b/openapi3/testdata/origin/request_body_max_set_revision.yaml new file mode 100644 index 000000000..65255d6c4 --- /dev/null +++ b/openapi3/testdata/origin/request_body_max_set_revision.yaml @@ -0,0 +1,17 @@ +openapi: 3.0.1 +info: + title: Test API + version: 1.0.0 +paths: + /pets: + post: + operationId: addPet + requestBody: + content: + text/plain: + schema: + type: number + maximum: 15 + responses: + "200": + description: OK diff --git a/openapi3/testdata/origin/request_body_media_type_updated_base.yaml b/openapi3/testdata/origin/request_body_media_type_updated_base.yaml new file mode 100644 index 000000000..7d4b88925 --- /dev/null +++ b/openapi3/testdata/origin/request_body_media_type_updated_base.yaml @@ -0,0 +1,59 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + tags: + - Group + operationId: createOneGroup + requestBody: + content: + text/plain: + schema: + type: string + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_body_media_type_updated_revision.yaml b/openapi3/testdata/origin/request_body_media_type_updated_revision.yaml new file mode 100644 index 000000000..4e2547dbc --- /dev/null +++ b/openapi3/testdata/origin/request_body_media_type_updated_revision.yaml @@ -0,0 +1,63 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + tags: + - Group + operationId: createOneGroup + requestBody: + content: + text/plain: + schema: + type: string + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_optional_property_write_only_read_only_base.yaml b/openapi3/testdata/origin/request_optional_property_write_only_read_only_base.yaml new file mode 100644 index 000000000..2afedbf1f --- /dev/null +++ b/openapi3/testdata/origin/request_optional_property_write_only_read_only_base.yaml @@ -0,0 +1,23 @@ +openapi: 3.0.0 +info: + title: Sample API + version: 1.0.0 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - id + properties: + id: + type: integer + writeOnly: false + name: + type: string + writeOnly: false # Set this to true in the next version for testing diff --git a/openapi3/testdata/origin/request_parameter_became_enum_base.yaml b/openapi3/testdata/origin/request_parameter_became_enum_base.yaml new file mode 100644 index 000000000..f19237091 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_became_enum_base.yaml @@ -0,0 +1,57 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + parameters: + - in: path + name: groupId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_parameter_became_enum_revision.yaml b/openapi3/testdata/origin/request_parameter_became_enum_revision.yaml new file mode 100644 index 000000000..fd908733d --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_became_enum_revision.yaml @@ -0,0 +1,60 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + parameters: + - in: path + name: groupId + required: true + schema: + type: integer + enum: + - 1 + - 2 + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_parameter_default_value_changed_base.yaml b/openapi3/testdata/origin/request_parameter_default_value_changed_base.yaml new file mode 100644 index 000000000..51d9901ee --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_default_value_changed_base.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + parameters: + - in: path + name: groupId + required: true + schema: + type: string + - in: query + name: category + schema: + type: string + default: "default_category" + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name diff --git a/openapi3/testdata/origin/request_parameter_default_value_changed_revision.yaml b/openapi3/testdata/origin/request_parameter_default_value_changed_revision.yaml new file mode 100644 index 000000000..646a42b09 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_default_value_changed_revision.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + parameters: + - in: path + name: groupId + required: true + schema: + type: string + - in: query + name: category + schema: + type: string + default: "updated_category" + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_parameter_enum_value_updated_base.yaml b/openapi3/testdata/origin/request_parameter_enum_value_updated_base.yaml new file mode 100644 index 000000000..6fd5b8a21 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_enum_value_updated_base.yaml @@ -0,0 +1,20 @@ +openapi: 3.0.0 +info: + title: Test API + version: 1.0.0 +paths: + /test: + get: + operationId: getTest + parameters: + - name: status + in: query + schema: + type: string + enum: + - available + - busy + - offline + responses: + '200': + description: OK diff --git a/openapi3/testdata/origin/request_parameter_enum_value_updated_revision.yaml b/openapi3/testdata/origin/request_parameter_enum_value_updated_revision.yaml new file mode 100644 index 000000000..144ad2c23 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_enum_value_updated_revision.yaml @@ -0,0 +1,19 @@ +openapi: 3.0.0 +info: + title: Test API + version: 1.0.0 +paths: + /test: + get: + operationId: getTest + parameters: + - name: status + in: query + schema: + type: string + enum: + - busy + - offline + responses: + '200': + description: OK diff --git a/openapi3/testdata/origin/request_parameter_extensible_enum_base.yaml b/openapi3/testdata/origin/request_parameter_extensible_enum_base.yaml new file mode 100644 index 000000000..39e802ade --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_extensible_enum_base.yaml @@ -0,0 +1,60 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + parameters: + - in: path + name: groupId + required: true + schema: + type: string + x-extensible-enum: + - "1" + - "2" + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_parameter_extensible_enum_revision.yaml b/openapi3/testdata/origin/request_parameter_extensible_enum_revision.yaml new file mode 100644 index 000000000..6405ba9ec --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_extensible_enum_revision.yaml @@ -0,0 +1,59 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + parameters: + - in: path + name: groupId + required: true + schema: + type: string + x-extensible-enum: + - "1" + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_parameter_max_items_updated_base.yaml b/openapi3/testdata/origin/request_parameter_max_items_updated_base.yaml new file mode 100644 index 000000000..a00c1250f --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_max_items_updated_base.yaml @@ -0,0 +1,61 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: + - url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + tags: + - Group + operationId: createOneGroup + parameters: + - in: query + name: category + schema: + type: array + items: + type: string + maxItems: 10 + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name diff --git a/openapi3/testdata/origin/request_parameter_max_items_updated_revision.yaml b/openapi3/testdata/origin/request_parameter_max_items_updated_revision.yaml new file mode 100644 index 000000000..01557d912 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_max_items_updated_revision.yaml @@ -0,0 +1,61 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: + - url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + tags: + - Group + operationId: createOneGroup + parameters: + - in: query + name: category + schema: + type: array + items: + type: string + maxItems: 20 + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name diff --git a/openapi3/testdata/origin/request_parameter_max_length_set_base.yaml b/openapi3/testdata/origin/request_parameter_max_length_set_base.yaml new file mode 100644 index 000000000..2266e1880 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_max_length_set_base.yaml @@ -0,0 +1,15 @@ +openapi: 3.0.1 +info: + title: Test API + version: "1.0" +paths: + /test: + post: + parameters: + - in: query + name: category + schema: + type: string + responses: + "200": + description: OK diff --git a/openapi3/testdata/origin/request_parameter_max_length_set_revision.yaml b/openapi3/testdata/origin/request_parameter_max_length_set_revision.yaml new file mode 100644 index 000000000..9a9a84499 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_max_length_set_revision.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.1 +info: + title: Test API + version: "2.0" +paths: + /test: + post: + parameters: + - in: query + name: category + schema: + type: string + maxLength: 15 + responses: + "200": + description: OK diff --git a/openapi3/testdata/origin/request_parameter_max_length_updated_base.yaml b/openapi3/testdata/origin/request_parameter_max_length_updated_base.yaml new file mode 100644 index 000000000..46e609b1a --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_max_length_updated_base.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.1 +info: + title: Test API + version: "1.0" +paths: + /test: + post: + parameters: + - in: query + name: category + schema: + type: string + maxLength: 10 + responses: + "200": + description: OK diff --git a/openapi3/testdata/origin/request_parameter_max_length_updated_revision.yaml b/openapi3/testdata/origin/request_parameter_max_length_updated_revision.yaml new file mode 100644 index 000000000..9a9a84499 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_max_length_updated_revision.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.1 +info: + title: Test API + version: "2.0" +paths: + /test: + post: + parameters: + - in: query + name: category + schema: + type: string + maxLength: 15 + responses: + "200": + description: OK diff --git a/openapi3/testdata/origin/request_parameter_max_updated_base.yaml b/openapi3/testdata/origin/request_parameter_max_updated_base.yaml new file mode 100644 index 000000000..24ee44825 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_max_updated_base.yaml @@ -0,0 +1,60 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: + - url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + parameters: + - in: query + name: category + required: true + schema: + type: array + items: + type: string + maximum: 5 + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name diff --git a/openapi3/testdata/origin/request_parameter_max_updated_revision.yaml b/openapi3/testdata/origin/request_parameter_max_updated_revision.yaml new file mode 100644 index 000000000..3c392e816 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_max_updated_revision.yaml @@ -0,0 +1,60 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: + - url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + parameters: + - in: query + name: category + required: true + schema: + type: array + items: + type: string + maximum: 10 + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name diff --git a/openapi3/testdata/origin/request_parameter_min_increased_base.yaml b/openapi3/testdata/origin/request_parameter_min_increased_base.yaml new file mode 100644 index 000000000..a3e763ab7 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_min_increased_base.yaml @@ -0,0 +1,58 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: + - url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + parameters: + - in: path + name: groupId + required: true + schema: + type: integer + minimum: 1 + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name diff --git a/openapi3/testdata/origin/request_parameter_min_increased_revision.yaml b/openapi3/testdata/origin/request_parameter_min_increased_revision.yaml new file mode 100644 index 000000000..59c9e3a42 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_min_increased_revision.yaml @@ -0,0 +1,58 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: + - url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + parameters: + - in: path + name: groupId + required: true + schema: + type: integer + minimum: 10 # Changed minimum value from 1 to 10 + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name diff --git a/openapi3/testdata/origin/request_parameter_min_items_increased_base.yaml b/openapi3/testdata/origin/request_parameter_min_items_increased_base.yaml new file mode 100644 index 000000000..bea1ee597 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_min_items_increased_base.yaml @@ -0,0 +1,60 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: + - url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + parameters: + - in: query + name: category + required: true + schema: + type: array + items: + type: string + minItems: 2 + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name diff --git a/openapi3/testdata/origin/request_parameter_min_items_increased_revision.yaml b/openapi3/testdata/origin/request_parameter_min_items_increased_revision.yaml new file mode 100644 index 000000000..ecf84fe67 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_min_items_increased_revision.yaml @@ -0,0 +1,60 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: + - url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + parameters: + - in: query + name: category + required: true + schema: + type: array + items: + type: string + minItems: 3 # Changed minItems value from 2 to 3 + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name diff --git a/openapi3/testdata/origin/request_parameter_min_length_increased_base.yaml b/openapi3/testdata/origin/request_parameter_min_length_increased_base.yaml new file mode 100644 index 000000000..71d97c0b9 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_min_length_increased_base.yaml @@ -0,0 +1,17 @@ +openapi: 3.0.1 +info: + title: Test Base API + version: 1.0.0 +paths: + /test: + post: + operationId: createTest + parameters: + - in: query + name: name + schema: + type: string + minLength: 3 + responses: + '200': + description: OK diff --git a/openapi3/testdata/origin/request_parameter_min_length_increased_revision.yaml b/openapi3/testdata/origin/request_parameter_min_length_increased_revision.yaml new file mode 100644 index 000000000..e3e977429 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_min_length_increased_revision.yaml @@ -0,0 +1,17 @@ +openapi: 3.0.1 +info: + title: Test Revision API + version: 1.0.0 +paths: + /test: + post: + operationId: createTest + parameters: + - in: query + name: name + schema: + type: string + minLength: 5 + responses: + '200': + description: OK diff --git a/openapi3/testdata/origin/request_parameter_pattern_added_or_changed_base.yaml b/openapi3/testdata/origin/request_parameter_pattern_added_or_changed_base.yaml new file mode 100644 index 000000000..43e2608bd --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_pattern_added_or_changed_base.yaml @@ -0,0 +1,17 @@ +openapi: 3.0.1 +info: + title: Test API + version: "1.0" +paths: + /test: + post: + parameters: + - in: query + name: category + required: true + schema: + type: string + pattern: '^\w+$' + responses: + '200': + description: OK diff --git a/openapi3/testdata/origin/request_parameter_pattern_added_or_changed_revision.yaml b/openapi3/testdata/origin/request_parameter_pattern_added_or_changed_revision.yaml new file mode 100644 index 000000000..20b752051 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_pattern_added_or_changed_revision.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.1 +info: + title: Test API + version: "1.0" +paths: + /test: + post: + parameters: + - in: query + name: category + required: true + schema: + type: string + responses: + '200': + description: OK diff --git a/openapi3/testdata/origin/request_parameter_property_type_changed_base_int.yaml b/openapi3/testdata/origin/request_parameter_property_type_changed_base_int.yaml new file mode 100644 index 000000000..062a0a0b2 --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_property_type_changed_base_int.yaml @@ -0,0 +1,80 @@ +openapi: 3.0.1 +paths: + /groups: + get: + operationId: getGroups + summary: Get groups + parameters: + - name: skip + required: false + in: query + schema: + type: string + - name: take + required: false + in: query + schema: + type: string + - name: filters + required: false + in: query + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/GroupFilters' + responses: + "200": + description: Successfully received results + content: + application/json: + schema: + type: object + title: BaseGroupListResponse + required: + - total + - skip + - take + - results + properties: + total: + type: integer + skip: + type: integer + take: + type: integer + results: + type: array + items: + $ref: '#/components/schemas/BaseGroup' +info: + title: Backend + description: "" + version: v1 + contact: {} +tags: [] +servers: [] +components: + schemas: + GroupFilters: + type: object + properties: + groupId: + # + # 👇🏻 Breaking change here + # + type: integer + nullable: true + name: + type: array + items: + type: string + BaseGroup: + type: object + properties: + groupId: + type: number + name: + type: string + required: + - groupId + - name diff --git a/openapi3/testdata/origin/request_parameter_property_type_changed_base_num.yaml b/openapi3/testdata/origin/request_parameter_property_type_changed_base_num.yaml new file mode 100644 index 000000000..7a827c55d --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_property_type_changed_base_num.yaml @@ -0,0 +1,80 @@ +openapi: 3.0.1 +paths: + /groups: + get: + operationId: getGroups + summary: Get groups + parameters: + - name: skip + required: false + in: query + schema: + type: string + - name: take + required: false + in: query + schema: + type: string + - name: filters + required: false + in: query + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/GroupFilters' + responses: + "200": + description: Successfully received results + content: + application/json: + schema: + type: object + title: BaseGroupListResponse + required: + - total + - skip + - take + - results + properties: + total: + type: integer + skip: + type: integer + take: + type: integer + results: + type: array + items: + $ref: '#/components/schemas/BaseGroup' +info: + title: Backend + description: "" + version: v1 + contact: {} +tags: [] +servers: [] +components: + schemas: + GroupFilters: + type: object + properties: + groupId: + # + # 👇🏻 Breaking change here + # + type: number + nullable: true + name: + type: array + items: + type: string + BaseGroup: + type: object + properties: + groupId: + type: number + name: + type: string + required: + - groupId + - name diff --git a/openapi3/testdata/origin/request_parameter_property_type_changed_revision.yaml b/openapi3/testdata/origin/request_parameter_property_type_changed_revision.yaml new file mode 100644 index 000000000..c6683cc0f --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_property_type_changed_revision.yaml @@ -0,0 +1,80 @@ +openapi: 3.0.1 +paths: + /groups: + get: + operationId: getGroups + summary: Get groups + parameters: + - name: skip + required: false + in: query + schema: + type: string + - name: take + required: false + in: query + schema: + type: string + - name: filters + required: false + in: query + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/GroupFilters' + responses: + "200": + description: Successfully received results + content: + application/json: + schema: + type: object + title: BaseGroupListResponse + required: + - total + - skip + - take + - results + properties: + total: + type: integer + skip: + type: integer + take: + type: integer + results: + type: array + items: + $ref: '#/components/schemas/BaseGroup' +info: + title: Backend + description: "" + version: v1 + contact: {} +tags: [] +servers: [] +components: + schemas: + GroupFilters: + type: object + properties: + groupId: + # + # 👇🏻 Breaking change here + # + type: string + nullable: true + name: + type: array + items: + type: string + BaseGroup: + type: object + properties: + groupId: + type: number + name: + type: string + required: + - groupId + - name diff --git a/openapi3/testdata/origin/request_parameter_type_changed_base.yaml b/openapi3/testdata/origin/request_parameter_type_changed_base.yaml new file mode 100644 index 000000000..c0333d48d --- /dev/null +++ b/openapi3/testdata/origin/request_parameter_type_changed_base.yaml @@ -0,0 +1,72 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + parameters: + - in: path + name: groupId + required: true + schema: + type: string + - in: query + name: token + schema: + description: RFC 4122 UUID + example: 26734565-dbcc-449a-a370-0beaaf04b0e8 + format: uuid + pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ + type: string + maxLength: 29 + - in: header + name: X-Request-ID + schema: + type: string + format: uuid + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_property_added_base.yaml b/openapi3/testdata/origin/request_property_added_base.yaml new file mode 100644 index 000000000..c252b7a39 --- /dev/null +++ b/openapi3/testdata/origin/request_property_added_base.yaml @@ -0,0 +1,21 @@ +openapi: 3.0.0 +info: + title: Sample API + version: 1.0.0 +paths: + /products: + post: + operationId: addProduct + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + required: + - name + responses: + '200': + description: OK diff --git a/openapi3/testdata/origin/request_property_added_revision.yaml b/openapi3/testdata/origin/request_property_added_revision.yaml new file mode 100644 index 000000000..223d3203a --- /dev/null +++ b/openapi3/testdata/origin/request_property_added_revision.yaml @@ -0,0 +1,24 @@ +openapi: 3.0.0 +info: + title: Sample API + version: 1.0.0 +paths: + /products: + post: + operationId: addProduct + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: + type: string + required: + - name + - description + responses: + '200': + description: OK diff --git a/openapi3/testdata/origin/request_property_added_revision2.yaml b/openapi3/testdata/origin/request_property_added_revision2.yaml new file mode 100644 index 000000000..a4fbdd4f7 --- /dev/null +++ b/openapi3/testdata/origin/request_property_added_revision2.yaml @@ -0,0 +1,26 @@ +openapi: 3.0.0 +info: + title: Sample API + version: 1.0.0 +paths: + /products: + post: + operationId: addProduct + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: + type: string + info: + type: string + required: + - name + - description + responses: + '200': + description: OK diff --git a/openapi3/testdata/origin/request_property_added_with_default.yaml b/openapi3/testdata/origin/request_property_added_with_default.yaml new file mode 100644 index 000000000..d6fd2c723 --- /dev/null +++ b/openapi3/testdata/origin/request_property_added_with_default.yaml @@ -0,0 +1,25 @@ +openapi: 3.0.0 +info: + title: Sample API + version: 1.0.0 +paths: + /products: + post: + operationId: addProduct + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: + type: string + default: "default description" + required: + - name + - description + responses: + '200': + description: OK diff --git a/openapi3/testdata/origin/request_property_all_of_added_base.yaml b/openapi3/testdata/origin/request_property_all_of_added_base.yaml new file mode 100644 index 000000000..039c5cce1 --- /dev/null +++ b/openapi3/testdata/origin/request_property_all_of_added_base.yaml @@ -0,0 +1,49 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + requestBody: + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + responses: + "200": + description: Updated + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + allOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/request_property_all_of_added_revision.yaml b/openapi3/testdata/origin/request_property_all_of_added_revision.yaml new file mode 100644 index 000000000..43da3d5f2 --- /dev/null +++ b/openapi3/testdata/origin/request_property_all_of_added_revision.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + requestBody: + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Rabbit" + responses: + "200": + description: Updated + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + allOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + - $ref: "#/components/schemas/Breed3" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + Breed3: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string + + Rabbit: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/request_property_all_of_removed_base.yaml b/openapi3/testdata/origin/request_property_all_of_removed_base.yaml new file mode 100644 index 000000000..43da3d5f2 --- /dev/null +++ b/openapi3/testdata/origin/request_property_all_of_removed_base.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + requestBody: + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Rabbit" + responses: + "200": + description: Updated + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + allOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + - $ref: "#/components/schemas/Breed3" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + Breed3: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string + + Rabbit: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/request_property_all_of_removed_revision.yaml b/openapi3/testdata/origin/request_property_all_of_removed_revision.yaml new file mode 100644 index 000000000..039c5cce1 --- /dev/null +++ b/openapi3/testdata/origin/request_property_all_of_removed_revision.yaml @@ -0,0 +1,49 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + requestBody: + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + responses: + "200": + description: Updated + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + allOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/request_property_any_of_added_base.yaml b/openapi3/testdata/origin/request_property_any_of_added_base.yaml new file mode 100644 index 000000000..2f1f16ee3 --- /dev/null +++ b/openapi3/testdata/origin/request_property_any_of_added_base.yaml @@ -0,0 +1,49 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + requestBody: + content: + application/json: + schema: + anyOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + responses: + "200": + description: Updated + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + anyOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/request_property_any_of_added_revision.yaml b/openapi3/testdata/origin/request_property_any_of_added_revision.yaml new file mode 100644 index 000000000..65b924b2a --- /dev/null +++ b/openapi3/testdata/origin/request_property_any_of_added_revision.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + requestBody: + content: + application/json: + schema: + anyOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Rabbit" + responses: + "200": + description: Updated + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + anyOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + - $ref: "#/components/schemas/Breed3" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + Breed3: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string + + Rabbit: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/request_property_any_of_removed_base.yaml b/openapi3/testdata/origin/request_property_any_of_removed_base.yaml new file mode 100644 index 000000000..65b924b2a --- /dev/null +++ b/openapi3/testdata/origin/request_property_any_of_removed_base.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + requestBody: + content: + application/json: + schema: + anyOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Rabbit" + responses: + "200": + description: Updated + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + anyOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + - $ref: "#/components/schemas/Breed3" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + Breed3: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string + + Rabbit: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/request_property_any_of_removed_revision.yaml b/openapi3/testdata/origin/request_property_any_of_removed_revision.yaml new file mode 100644 index 000000000..2f1f16ee3 --- /dev/null +++ b/openapi3/testdata/origin/request_property_any_of_removed_revision.yaml @@ -0,0 +1,49 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + requestBody: + content: + application/json: + schema: + anyOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + responses: + "200": + description: Updated + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + anyOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/request_property_became_nullable_base.yaml b/openapi3/testdata/origin/request_property_became_nullable_base.yaml new file mode 100644 index 000000000..c252b7a39 --- /dev/null +++ b/openapi3/testdata/origin/request_property_became_nullable_base.yaml @@ -0,0 +1,21 @@ +openapi: 3.0.0 +info: + title: Sample API + version: 1.0.0 +paths: + /products: + post: + operationId: addProduct + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + required: + - name + responses: + '200': + description: OK diff --git a/openapi3/testdata/origin/request_property_became_nullable_revision.yaml b/openapi3/testdata/origin/request_property_became_nullable_revision.yaml new file mode 100644 index 000000000..d1d6ccda3 --- /dev/null +++ b/openapi3/testdata/origin/request_property_became_nullable_revision.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.0 +info: + title: Sample API + version: 2.0.0 # Updated version +paths: + /products: + post: + operationId: addProduct + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + nullable: true + required: + - name + responses: + '200': + description: OK diff --git a/openapi3/testdata/origin/request_property_became_required_base.yaml b/openapi3/testdata/origin/request_property_became_required_base.yaml new file mode 100644 index 000000000..23693252e --- /dev/null +++ b/openapi3/testdata/origin/request_property_became_required_base.yaml @@ -0,0 +1,23 @@ +openapi: 3.0.0 +info: + title: Sample API + version: 1.0.0 +paths: + /products: + post: + operationId: addProduct + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: + type: string + required: + - name + responses: + '200': + description: OK diff --git a/openapi3/testdata/origin/request_property_default_value_changed_base.yaml b/openapi3/testdata/origin/request_property_default_value_changed_base.yaml new file mode 100644 index 000000000..739f2e0df --- /dev/null +++ b/openapi3/testdata/origin/request_property_default_value_changed_base.yaml @@ -0,0 +1,21 @@ +openapi: 3.0.0 +info: + title: Sample API + version: 1.0.0 +paths: + /products: + post: + summary: Create a new product + operationId: createProduct + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + price: + type: number + default: 10.0 \ No newline at end of file diff --git a/openapi3/testdata/origin/request_property_discriminator_added_base.yaml b/openapi3/testdata/origin/request_property_discriminator_added_base.yaml new file mode 100644 index 000000000..8a880a8e9 --- /dev/null +++ b/openapi3/testdata/origin/request_property_discriminator_added_base.yaml @@ -0,0 +1,51 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + requestBody: + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + +components: + schemas: + Dog: + type: object + properties: + petType: + type: string + name: + type: string + breed: + type: object + oneOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + petType: + type: string + name: + type: string diff --git a/openapi3/testdata/origin/request_property_discriminator_added_property_name_changed.yaml b/openapi3/testdata/origin/request_property_discriminator_added_property_name_changed.yaml new file mode 100644 index 000000000..c342174eb --- /dev/null +++ b/openapi3/testdata/origin/request_property_discriminator_added_property_name_changed.yaml @@ -0,0 +1,61 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + requestBody: + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + discriminator: + propertyName: petType2 + mapping: + cat: "#/components/schemas/Cat" + dog: "#/components/schemas/Dog" + +components: + schemas: + Dog: + type: object + properties: + petType2: + type: string + name: + type: string + breed: + type: object + oneOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + discriminator: + propertyName: name2 + mapping: + breed1: "#/components/schemas/Breed1" + breed2: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name2: + type: string + + Breed2: + type: object + properties: + name2: + type: string + + Cat: + type: object + properties: + petType2: + type: string + name: + type: string diff --git a/openapi3/testdata/origin/request_property_discriminator_added_revision.yaml b/openapi3/testdata/origin/request_property_discriminator_added_revision.yaml new file mode 100644 index 000000000..674d0c9e8 --- /dev/null +++ b/openapi3/testdata/origin/request_property_discriminator_added_revision.yaml @@ -0,0 +1,61 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + requestBody: + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + discriminator: + propertyName: petType + mapping: + cat: "#/components/schemas/Cat" + dog: "#/components/schemas/Dog" + +components: + schemas: + Dog: + type: object + properties: + petType: + type: string + name: + type: string + breed: + type: object + oneOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + discriminator: + propertyName: name + mapping: + breed1: "#/components/schemas/Breed1" + breed2: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + petType: + type: string + name: + type: string diff --git a/openapi3/testdata/origin/request_property_discriminator_mapping_changed.yaml b/openapi3/testdata/origin/request_property_discriminator_mapping_changed.yaml new file mode 100644 index 000000000..cb5051a3b --- /dev/null +++ b/openapi3/testdata/origin/request_property_discriminator_mapping_changed.yaml @@ -0,0 +1,67 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + requestBody: + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + discriminator: + propertyName: petType + mapping: + cats: "#/components/schemas/Cat" + dog: "#/components/schemas/Dog" + +components: + schemas: + Dog: + type: object + properties: + petType: + type: string + name: + type: string + breed: + type: object + oneOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + discriminator: + propertyName: name + mapping: + breed1Code: "#/components/schemas/Breed1" + breed2: "#/components/schemas/Breed3" + + Breed1: + type: object + properties: + name: + type: string + + Breed2: + type: object + properties: + name: + type: string + + Breed3: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + petType: + type: string + name: + type: string diff --git a/openapi3/testdata/origin/request_property_enum_value_updated_base.yaml b/openapi3/testdata/origin/request_property_enum_value_updated_base.yaml new file mode 100644 index 000000000..6345cbbc1 --- /dev/null +++ b/openapi3/testdata/origin/request_property_enum_value_updated_base.yaml @@ -0,0 +1,43 @@ +openapi: 3.0.1 +info: + title: Pet Store + version: 1.0.0 +paths: + /pets: + post: + operationId: updatePet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: Update an existing pet + responses: + "200": + description: OK +components: + schemas: + Pet: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + status: + type: string + enum: + - available + - pending + - sold + category: + type: string + enum: + - dog + - cat + - bird + required: + - name + - status + - category diff --git a/openapi3/testdata/origin/request_property_extensible_enum_base.yaml b/openapi3/testdata/origin/request_property_extensible_enum_base.yaml new file mode 100644 index 000000000..9b90bb98e --- /dev/null +++ b/openapi3/testdata/origin/request_property_extensible_enum_base.yaml @@ -0,0 +1,24 @@ +openapi: 3.0.1 +info: + title: Test API + version: 1.0.0 +paths: + /pets: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + x-extensible-enum: + - available + - pending + - sold + responses: + "200": + description: OK + diff --git a/openapi3/testdata/origin/request_property_extensible_enum_revision.yaml b/openapi3/testdata/origin/request_property_extensible_enum_revision.yaml new file mode 100644 index 000000000..3edefb38e --- /dev/null +++ b/openapi3/testdata/origin/request_property_extensible_enum_revision.yaml @@ -0,0 +1,23 @@ +openapi: 3.0.1 +info: + title: Test API + version: 1.0.0 +paths: + /pets: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + x-extensible-enum: + - available + - pending + responses: + "200": + description: OK + diff --git a/openapi3/testdata/origin/request_property_max_decreased_base.yaml b/openapi3/testdata/origin/request_property_max_decreased_base.yaml new file mode 100644 index 000000000..4b743bcc4 --- /dev/null +++ b/openapi3/testdata/origin/request_property_max_decreased_base.yaml @@ -0,0 +1,23 @@ +openapi: 3.0.1 +info: + title: Test API + version: 1.0.0 +paths: + /pets: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + maximum: 15 + required: + - name + responses: + "200": + description: OK + diff --git a/openapi3/testdata/origin/request_property_max_length_set_base.yaml b/openapi3/testdata/origin/request_property_max_length_set_base.yaml new file mode 100644 index 000000000..5d8ec950b --- /dev/null +++ b/openapi3/testdata/origin/request_property_max_length_set_base.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.1 +info: + title: Test API + version: 1.0.0 +paths: + /pets: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + type: object + properties: + age: + type: string + required: + - age + responses: + "200": + description: OK + diff --git a/openapi3/testdata/origin/request_property_max_length_set_revision.yaml b/openapi3/testdata/origin/request_property_max_length_set_revision.yaml new file mode 100644 index 000000000..687a264b4 --- /dev/null +++ b/openapi3/testdata/origin/request_property_max_length_set_revision.yaml @@ -0,0 +1,23 @@ +openapi: 3.0.1 +info: + title: Test API + version: 1.0.0 +paths: + /pets: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + type: object + properties: + age: + type: string + maxLength: 15 + required: + - age + responses: + "200": + description: OK + diff --git a/openapi3/testdata/origin/request_property_max_set_base.yaml b/openapi3/testdata/origin/request_property_max_set_base.yaml new file mode 100644 index 000000000..04a11be89 --- /dev/null +++ b/openapi3/testdata/origin/request_property_max_set_base.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.1 +info: + title: Test API + version: 1.0.0 +paths: + /pets: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + type: object + properties: + age: + type: integer + required: + - age + responses: + "200": + description: OK + diff --git a/openapi3/testdata/origin/request_property_max_set_revision.yaml b/openapi3/testdata/origin/request_property_max_set_revision.yaml new file mode 100644 index 000000000..0cbdc334b --- /dev/null +++ b/openapi3/testdata/origin/request_property_max_set_revision.yaml @@ -0,0 +1,23 @@ +openapi: 3.0.1 +info: + title: Test API + version: 1.0.0 +paths: + /pets: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + type: object + properties: + age: + type: integer + maximum: 15 + required: + - age + responses: + "200": + description: OK + diff --git a/openapi3/testdata/origin/request_property_min_increased_base.yaml b/openapi3/testdata/origin/request_property_min_increased_base.yaml new file mode 100644 index 000000000..a8c335b16 --- /dev/null +++ b/openapi3/testdata/origin/request_property_min_increased_base.yaml @@ -0,0 +1,23 @@ +openapi: 3.0.1 +info: + title: Test API + version: 1.0.0 +paths: + /pets: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + type: object + properties: + age: + type: integer + minimum: 10 + required: + - age + responses: + "200": + description: OK + diff --git a/openapi3/testdata/origin/request_property_min_increased_revision.yaml b/openapi3/testdata/origin/request_property_min_increased_revision.yaml new file mode 100644 index 000000000..ce064936a --- /dev/null +++ b/openapi3/testdata/origin/request_property_min_increased_revision.yaml @@ -0,0 +1,23 @@ +openapi: 3.0.1 +info: + title: Test API + version: 1.0.0 +paths: + /pets: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + type: object + properties: + age: + type: integer + minimum: 15 + required: + - age + responses: + "200": + description: OK + diff --git a/openapi3/testdata/origin/request_property_min_items_increased_base.yaml b/openapi3/testdata/origin/request_property_min_items_increased_base.yaml new file mode 100644 index 000000000..873e4eeb3 --- /dev/null +++ b/openapi3/testdata/origin/request_property_min_items_increased_base.yaml @@ -0,0 +1,21 @@ +openapi: 3.0.1 +info: + title: Product API + version: "1.0" +servers: + - url: https://api.example.com/v1 +paths: + /products: + post: + operationId: addProduct + requestBody: + content: + application/json: + schema: + type: array + items: + type: string + minItems: 10 + responses: + "200": + description: OK diff --git a/openapi3/testdata/origin/request_property_min_items_increased_revision.yaml b/openapi3/testdata/origin/request_property_min_items_increased_revision.yaml new file mode 100644 index 000000000..292781398 --- /dev/null +++ b/openapi3/testdata/origin/request_property_min_items_increased_revision.yaml @@ -0,0 +1,21 @@ +openapi: 3.0.1 +info: + title: Product API + version: "1.0" +servers: + - url: https://api.example.com/v1 +paths: + /products: + post: + operationId: addProduct + requestBody: + content: + application/json: + schema: + type: array + items: + type: string + minItems: 20 + responses: + "200": + description: OK diff --git a/openapi3/testdata/origin/request_property_min_length_decreased_base.yaml b/openapi3/testdata/origin/request_property_min_length_decreased_base.yaml new file mode 100644 index 000000000..b84faabd7 --- /dev/null +++ b/openapi3/testdata/origin/request_property_min_length_decreased_base.yaml @@ -0,0 +1,31 @@ +openapi: 3.0.1 +info: + title: Product API + version: "1.0" +servers: + - url: https://api.example.com/v1 +paths: + /products: + post: + operationId: addProduct + requestBody: + content: + application/json: + schema: + type: object + minLength: 10 + properties: + id: + type: integer + name: + type: string + minLength: 3 + description: + type: string + minLength: 10 + required: true + + responses: + "200": + description: OK +components: {} diff --git a/openapi3/testdata/origin/request_property_one_of_added_base.yaml b/openapi3/testdata/origin/request_property_one_of_added_base.yaml new file mode 100644 index 000000000..9997daf75 --- /dev/null +++ b/openapi3/testdata/origin/request_property_one_of_added_base.yaml @@ -0,0 +1,49 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + requestBody: + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + responses: + "200": + description: Updated + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + oneOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/request_property_one_of_added_revision.yaml b/openapi3/testdata/origin/request_property_one_of_added_revision.yaml new file mode 100644 index 000000000..d8c60a6d3 --- /dev/null +++ b/openapi3/testdata/origin/request_property_one_of_added_revision.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + requestBody: + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Rabbit" + responses: + "200": + description: Updated + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + oneOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + - $ref: "#/components/schemas/Breed3" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + Breed3: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string + + Rabbit: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/request_property_one_of_removed_base.yaml b/openapi3/testdata/origin/request_property_one_of_removed_base.yaml new file mode 100644 index 000000000..d8c60a6d3 --- /dev/null +++ b/openapi3/testdata/origin/request_property_one_of_removed_base.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + requestBody: + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Rabbit" + responses: + "200": + description: Updated + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + oneOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + - $ref: "#/components/schemas/Breed3" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + Breed3: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string + + Rabbit: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/request_property_one_of_removed_revision.yaml b/openapi3/testdata/origin/request_property_one_of_removed_revision.yaml new file mode 100644 index 000000000..9997daf75 --- /dev/null +++ b/openapi3/testdata/origin/request_property_one_of_removed_revision.yaml @@ -0,0 +1,49 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + requestBody: + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + responses: + "200": + description: Updated + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + oneOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/request_property_pattern_added_or_changed_base.yaml b/openapi3/testdata/origin/request_property_pattern_added_or_changed_base.yaml new file mode 100644 index 000000000..0ddc94456 --- /dev/null +++ b/openapi3/testdata/origin/request_property_pattern_added_or_changed_base.yaml @@ -0,0 +1,25 @@ +openapi: 3.0.1 +info: + title: Test API + version: "1.0" +paths: + /test: + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TestRequest' + responses: + '200': + description: OK +components: + schemas: + TestRequest: + type: object + properties: + name: + type: string + pattern: '^\w+$' + age: + type: integer diff --git a/openapi3/testdata/origin/request_property_pattern_added_or_changed_revision.yaml b/openapi3/testdata/origin/request_property_pattern_added_or_changed_revision.yaml new file mode 100644 index 000000000..897671ca6 --- /dev/null +++ b/openapi3/testdata/origin/request_property_pattern_added_or_changed_revision.yaml @@ -0,0 +1,25 @@ +openapi: 3.0.1 +info: + title: Test API + version: "1.0" +paths: + /test: + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TestRequest' + responses: + '200': + description: OK +components: + schemas: + TestRequest: + type: object + properties: + name: + type: string + pattern: '' + age: + type: integer diff --git a/openapi3/testdata/origin/request_property_type_changed_base.yaml b/openapi3/testdata/origin/request_property_type_changed_base.yaml new file mode 100644 index 000000000..7565cd4d5 --- /dev/null +++ b/openapi3/testdata/origin/request_property_type_changed_base.yaml @@ -0,0 +1,24 @@ +openapi: 3.0.1 +info: + title: Sample API + version: 1.0.0 +paths: + /pets: + post: + summary: Add a new pet + operationId: addPet + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + format: string + age: + type: integer + format: int32 + required: + - name diff --git a/openapi3/testdata/origin/request_property_type_changed_base_array_to_object.yaml b/openapi3/testdata/origin/request_property_type_changed_base_array_to_object.yaml new file mode 100644 index 000000000..4df9fda37 --- /dev/null +++ b/openapi3/testdata/origin/request_property_type_changed_base_array_to_object.yaml @@ -0,0 +1,46 @@ +openapi: 3.0.1 +info: + title: Sample API + version: 1.0.0 +paths: + /pets: + post: + summary: Add a new pet + operationId: addPet + requestBody: + required: true + content: + application/json: + schema: + type: array + items: + type: object + properties: + name: + type: string + format: string + age: + type: integer + format: int32 + required: + - name + /dogs: + post: + summary: Add a new dog + operationId: addDog + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + format: string + colors: + type: array + items: + type: integer + required: + - name diff --git a/openapi3/testdata/origin/request_property_type_changed_revision.yaml b/openapi3/testdata/origin/request_property_type_changed_revision.yaml new file mode 100644 index 000000000..452285d0f --- /dev/null +++ b/openapi3/testdata/origin/request_property_type_changed_revision.yaml @@ -0,0 +1,24 @@ +openapi: 3.0.1 +info: + title: Sample API + version: 1.0.0 +paths: + /pets: + post: + summary: Add a new pet + operationId: addPet + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + format: string + age: + type: string + format: string + required: + - name diff --git a/openapi3/testdata/origin/request_property_type_changed_revision_array_to_object.yaml b/openapi3/testdata/origin/request_property_type_changed_revision_array_to_object.yaml new file mode 100644 index 000000000..a85097a53 --- /dev/null +++ b/openapi3/testdata/origin/request_property_type_changed_revision_array_to_object.yaml @@ -0,0 +1,61 @@ +openapi: 3.0.1 +info: + title: Sample API + version: 1.0.0 +paths: + /pets: + post: + summary: Add a new pet + operationId: addPet + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + type: array + items: + type: object + properties: + name: + type: string + format: string + age: + type: integer + format: int32 + required: + - name + /dogs: + post: + summary: Add a new dog + operationId: addDog + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + format: string + colors: + type: object + properties: + red: + type: integer + green: + type: integer + blue: + type: integer + required: + - red + - blue + - green + required: + - name + diff --git a/openapi3/testdata/origin/response-media-type-base.yaml b/openapi3/testdata/origin/response-media-type-base.yaml new file mode 100644 index 000000000..c8a043d3d --- /dev/null +++ b/openapi3/testdata/origin/response-media-type-base.yaml @@ -0,0 +1,490 @@ +openapi: 3.0.0 +info: + title: SmartChef API + version: 1.0.0 + +paths: + /products: + get: + summary: Returns a list of all products + tags: + - Products + parameters: + - $ref: '#/components/parameters/takeParam' + - $ref: '#/components/parameters/skipParam' + - in: query + name: gtin + schema: + type: string + maxLength: 13 + - in: query + name: name + schema: + type: string + - in: query + name: beschreibung + schema: + type: string + responses: + '200': + description: JSON Array of products + content: + application/javascript: + schema: + type: string + application/json: + schema: + $ref: '#/components/schemas/ProductDto' + + post: + summary: Creates a new product + tags: + - Products + responses: + '201': + description: Returns the created product as JSON + content: + application/json: + schema: + $ref: '#/components/schemas/ProductDto' + '409': + description: GTIN already taken + + /products/{productId}: + get: + summary: Gets the product with the specified productId + parameters: + - in: path + name: productId + schema: + type: string + format: uuid + required: true + description: The UUID of the requested product + + tags: + - Products + responses: + '200': + description: Returns the requested product + content: + application/json: + schema: + $ref: '#/components/schemas/ProductDto' + '404': + description: Product with provided ID does not exist + + /products/{productId}/categories: + get: + summary: Gets the categories of the specified product + parameters: + - in: path + name: productId + schema: + type: string + format: uuid + required: true + description: The UUID of the requested product + + tags: + - Products + responses: + '200': + description: Returns the categories of the requested product + content: + application/json: + schema: + $ref: '#/components/schemas/ProductDto' + '404': + description: Product with provided ID does not exist + + '500': + description: Internal Server Error + '400': + description: Bad Request + + /users: + get: + tags: + - Users + summary: Gets all users + parameters: + - $ref: '#/components/parameters/takeParam' + - $ref: '#/components/parameters/skipParam' + - in: query + name: vorname + schema: + type: string + - in: query + name: nachname + schema: + type: string + responses: + '200': + description: Returns public users + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PublicUserDto' + + post: + tags: + - Users + summary: Creates a new user + requestBody: + description: Data for the new user + content: + application/json: + schema: + $ref: '#/components/schemas/CreateUserDto' + responses: + '201': + description: The created user + content: + application/json: + schema: + $ref: '#/components/schemas/PrivateUserDto' + '409': + description: Email already taken + + + /users/{userId}: + get: + tags: + - Users + summary: Gets the requested user + parameters: + - in: path + name: userId + schema: + type: string + format: uuid + required: true + description: The UUID of the requested user + responses: + '200': + description: Returns the requested user + content: + application/json: + schema: + $ref: '#/components/schemas/PublicUserDto' + + put: + tags: + - Users + summary: Updates a user + parameters: + - in: path + name: userId + schema: + type: string + format: uuid + required: true + description: The UUID of the user to be updated + requestBody: + description: User update data + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateUserDto' + responses: + '200': + description: Returns the updated user + content: + application/json: + schema: + $ref: '#/components/schemas/PublicUserDto' + + /auth/login: + post: + tags: + - Auth + summary: Logs in the user + requestBody: + description: User credentials + content: + application/json: + schema: + $ref: '#/components/schemas/LoginDto' + + responses: + '201': + description: Returns the created token pair + content: + application/json: + schema: + $ref: '#/components/schemas/TokenResponse' + '403': + description: Wrong email and/or password + + /auth/refresh: + post: + tags: + - Auth + summary: Gets a new access token using the provided refresh token + requestBody: + description: Refresh token + content: + application/json: + schema: + type: object + properties: + refreshToken: + type: string + format: jwt + responses: + '201': + description: Returns a new token pair + content: + application/json: + schema: + $ref: '#/components/schemas/TokenResponse' + + +components: + securitySchemes: + bearerAuth: # arbitrary name for the security scheme + type: http + scheme: bearer + bearerFormat: JWT + + + schemas: + ResourceDto: + type: object + properties: + id: + type: string + format: uuid + createdAt: + type: string + format: datetime + updatedAt: + type: string + format: datetime + + ProductDto: + type: object + allOf: + - $ref: '#/components/schemas/ResourceDto' + - type: object + properties: + gtin: + type: string + name: + type: string + beschreibung: + type: string + menge: + type: number + minimum: 0 + einheit: + type: string + kategorieId: + type: string + format: uuid + herstellerId: + type: string + format: uuid + + TokenResponse: + type: object + properties: + accessToken: + type: string + format: jwt + refreshToken: + type: string + format: jwt + + PublicUserDto: + type: object + properties: + id: + type: string + format: uuid + vorname: + type: string + maxLength: 255 + nachname: + type: string + maxLength: 255 + + PrivateUserDto: + type: object + allOf: + - $ref: '#/components/schemas/PublicUserDto' + - type: object + properties: + email: + type: string + format: email + maxLength: 255 + + LoginDto: + type: object + properties: + email: + type: string + format: email + maxLength: 255 + + password: + type: string + maxLength: 255 + + HaushaltDto: + type: object + allOf: + - $ref: '#/components/schemas/ResourceDto' + - type: object + properties: + name: + type: string + maxLength: 255 + + HaushaltProduktDto: + type: object + allOf: + - $ref: '#/components/schemas/ResourceDto' + - $ref: '#/components/schemas/ProductDto' + - type: object + properties: + haushaltId: + type: string + format: uuid + ist: + type: number + soll: + type: number + + HerstellerDto: + type: object + allOf: + - $ref: '#/components/schemas/ResourceDto' + - type: object + properties: + name: + type: string + + ProduktKategorieDto: + type: object + allOf: + - $ref: '#/components/schemas/ResourceDto' + - type: object + properties: + name: + type: string + maxLength: 255 + parentId: + type: string + format: uuid + + RezeptDto: + type: object + allOf: + - $ref: '#/components/schemas/ResourceDto' + - type: object + properties: + name: + type: string + maxLength: 255 + beschreibung: + type: string + maxLength: 255 + anleitungText: + type: string + maxLength: 4000 + url: + type: string + format: url + maxLength: 1024 + kategorieId: + type: string + format: string + + RezeptKategorieDto: + type: object + allOf: + - $ref: '#/components/schemas/ResourceDto' + - type: object + properties: + name: + type: string + parentId: + type: string + format: uuid + + ZutatenDto: + type: object + allOf: + - $ref: '#/components/schemas/ResourceDto' + - type: object + properties: + produktKategorieId: + type: string + maxLength: 255 + menge: + type: number + minimum: 0 + einheit: + type: string + maxLength: 255 + rezeptId: + type: string + format: uuid + + CreateUserDto: + type: object + required: + - password + - vorname + - nachname + properties: + password: + type: string + minLength: 8 + maxLength: 255 + vorname: + type: string + maxLength: 255 + nachname: + type: string + maxLength: 255 + + UpdateUserDto: + type: object + properties: + password: + type: string + maxLength: 255 + vorname: + type: string + maxLength: 255 + nachname: + type: string + maxLength: 255 + + parameters: + takeParam: + in: query + name: take + schema: + type: integer + minimum: 1 + maximum: 50 + description: The amount of users to return + skipParam: + in: query + name: skip + schema: + type: integer + minimum: 1 + maximum: 50 + description: The amount of users to skip + + +security: + - bearerAuth: [] \ No newline at end of file diff --git a/openapi3/testdata/origin/response-media-type-revision.yaml b/openapi3/testdata/origin/response-media-type-revision.yaml new file mode 100644 index 000000000..84e4e1fdb --- /dev/null +++ b/openapi3/testdata/origin/response-media-type-revision.yaml @@ -0,0 +1,487 @@ +openapi: 3.0.0 +info: + title: SmartChef API + version: 1.0.0 + +paths: + /products: + get: + summary: Returns a list of all products + tags: + - Products + parameters: + - $ref: '#/components/parameters/takeParam' + - $ref: '#/components/parameters/skipParam' + - in: query + name: gtin + schema: + type: string + maxLength: 13 + - in: query + name: name + schema: + type: string + - in: query + name: beschreibung + schema: + type: string + responses: + '200': + description: JSON Array of products + content: + application/javascript: + schema: + type: string + + post: + summary: Creates a new product + tags: + - Products + responses: + '201': + description: Returns the created product as JSON + content: + application/json: + schema: + $ref: '#/components/schemas/ProductDto' + '409': + description: GTIN already taken + + /products/{productId}: + get: + summary: Gets the product with the specified productId + parameters: + - in: path + name: productId + schema: + type: string + format: uuid + required: true + description: The UUID of the requested product + + tags: + - Products + responses: + '200': + description: Returns the requested product + content: + application/json: + schema: + $ref: '#/components/schemas/ProductDto' + '404': + description: Product with provided ID does not exist + + /products/{productId}/categories: + get: + summary: Gets the categories of the specified product + parameters: + - in: path + name: productId + schema: + type: string + format: uuid + required: true + description: The UUID of the requested product + + tags: + - Products + responses: + '200': + description: Returns the categories of the requested product + content: + application/json: + schema: + $ref: '#/components/schemas/ProductDto' + '404': + description: Product with provided ID does not exist + + '500': + description: Internal Server Error + '400': + description: Bad Request + + /users: + get: + tags: + - Users + summary: Gets all users + parameters: + - $ref: '#/components/parameters/takeParam' + - $ref: '#/components/parameters/skipParam' + - in: query + name: vorname + schema: + type: string + - in: query + name: nachname + schema: + type: string + responses: + '200': + description: Returns public users + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PublicUserDto' + + post: + tags: + - Users + summary: Creates a new user + requestBody: + description: Data for the new user + content: + application/json: + schema: + $ref: '#/components/schemas/CreateUserDto' + responses: + '201': + description: The created user + content: + application/json: + schema: + $ref: '#/components/schemas/PrivateUserDto' + '409': + description: Email already taken + + + /users/{userId}: + get: + tags: + - Users + summary: Gets the requested user + parameters: + - in: path + name: userId + schema: + type: string + format: uuid + required: true + description: The UUID of the requested user + responses: + '200': + description: Returns the requested user + content: + application/json: + schema: + $ref: '#/components/schemas/PublicUserDto' + + put: + tags: + - Users + summary: Updates a user + parameters: + - in: path + name: userId + schema: + type: string + format: uuid + required: true + description: The UUID of the user to be updated + requestBody: + description: User update data + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateUserDto' + responses: + '200': + description: Returns the updated user + content: + application/json: + schema: + $ref: '#/components/schemas/PublicUserDto' + + /auth/login: + post: + tags: + - Auth + summary: Logs in the user + requestBody: + description: User credentials + content: + application/json: + schema: + $ref: '#/components/schemas/LoginDto' + + responses: + '201': + description: Returns the created token pair + content: + application/json: + schema: + $ref: '#/components/schemas/TokenResponse' + '403': + description: Wrong email and/or password + + /auth/refresh: + post: + tags: + - Auth + summary: Gets a new access token using the provided refresh token + requestBody: + description: Refresh token + content: + application/json: + schema: + type: object + properties: + refreshToken: + type: string + format: jwt + responses: + '201': + description: Returns a new token pair + content: + application/json: + schema: + $ref: '#/components/schemas/TokenResponse' + + +components: + securitySchemes: + bearerAuth: # arbitrary name for the security scheme + type: http + scheme: bearer + bearerFormat: JWT + + + schemas: + ResourceDto: + type: object + properties: + id: + type: string + format: uuid + createdAt: + type: string + format: datetime + updatedAt: + type: string + format: datetime + + ProductDto: + type: object + allOf: + - $ref: '#/components/schemas/ResourceDto' + - type: object + properties: + gtin: + type: string + name: + type: string + beschreibung: + type: string + menge: + type: number + minimum: 0 + einheit: + type: string + kategorieId: + type: string + format: uuid + herstellerId: + type: string + format: uuid + + TokenResponse: + type: object + properties: + accessToken: + type: string + format: jwt + refreshToken: + type: string + format: jwt + + PublicUserDto: + type: object + properties: + id: + type: string + format: uuid + vorname: + type: string + maxLength: 255 + nachname: + type: string + maxLength: 255 + + PrivateUserDto: + type: object + allOf: + - $ref: '#/components/schemas/PublicUserDto' + - type: object + properties: + email: + type: string + format: email + maxLength: 255 + + LoginDto: + type: object + properties: + email: + type: string + format: email + maxLength: 255 + + password: + type: string + maxLength: 255 + + HaushaltDto: + type: object + allOf: + - $ref: '#/components/schemas/ResourceDto' + - type: object + properties: + name: + type: string + maxLength: 255 + + HaushaltProduktDto: + type: object + allOf: + - $ref: '#/components/schemas/ResourceDto' + - $ref: '#/components/schemas/ProductDto' + - type: object + properties: + haushaltId: + type: string + format: uuid + ist: + type: number + soll: + type: number + + HerstellerDto: + type: object + allOf: + - $ref: '#/components/schemas/ResourceDto' + - type: object + properties: + name: + type: string + + ProduktKategorieDto: + type: object + allOf: + - $ref: '#/components/schemas/ResourceDto' + - type: object + properties: + name: + type: string + maxLength: 255 + parentId: + type: string + format: uuid + + RezeptDto: + type: object + allOf: + - $ref: '#/components/schemas/ResourceDto' + - type: object + properties: + name: + type: string + maxLength: 255 + beschreibung: + type: string + maxLength: 255 + anleitungText: + type: string + maxLength: 4000 + url: + type: string + format: url + maxLength: 1024 + kategorieId: + type: string + format: string + + RezeptKategorieDto: + type: object + allOf: + - $ref: '#/components/schemas/ResourceDto' + - type: object + properties: + name: + type: string + parentId: + type: string + format: uuid + + ZutatenDto: + type: object + allOf: + - $ref: '#/components/schemas/ResourceDto' + - type: object + properties: + produktKategorieId: + type: string + maxLength: 255 + menge: + type: number + minimum: 0 + einheit: + type: string + maxLength: 255 + rezeptId: + type: string + format: uuid + + CreateUserDto: + type: object + required: + - password + - vorname + - nachname + properties: + password: + type: string + minLength: 8 + maxLength: 255 + vorname: + type: string + maxLength: 255 + nachname: + type: string + maxLength: 255 + + UpdateUserDto: + type: object + properties: + password: + type: string + maxLength: 255 + vorname: + type: string + maxLength: 255 + nachname: + type: string + maxLength: 255 + + parameters: + takeParam: + in: query + name: take + schema: + type: integer + minimum: 1 + maximum: 50 + description: The amount of users to return + skipParam: + in: query + name: skip + schema: + type: integer + minimum: 1 + maximum: 50 + description: The amount of users to skip + + +security: + - bearerAuth: [] \ No newline at end of file diff --git a/openapi3/testdata/origin/response_optional_property_removed_base.yaml b/openapi3/testdata/origin/response_optional_property_removed_base.yaml new file mode 100644 index 000000000..b4a511931 --- /dev/null +++ b/openapi3/testdata/origin/response_optional_property_removed_base.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/response_optional_property_removed_revision.yaml b/openapi3/testdata/origin/response_optional_property_removed_revision.yaml new file mode 100644 index 000000000..d53c03d65 --- /dev/null +++ b/openapi3/testdata/origin/response_optional_property_removed_revision.yaml @@ -0,0 +1,42 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/response_optional_property_write_only_read_only_base.yaml b/openapi3/testdata/origin/response_optional_property_write_only_read_only_base.yaml new file mode 100644 index 000000000..729af592d --- /dev/null +++ b/openapi3/testdata/origin/response_optional_property_write_only_read_only_base.yaml @@ -0,0 +1,46 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + writeOnlyName: + type: string + writeOnly: true diff --git a/openapi3/testdata/origin/response_pattern_added_or_changed_base.yaml b/openapi3/testdata/origin/response_pattern_added_or_changed_base.yaml new file mode 100644 index 000000000..287c074d5 --- /dev/null +++ b/openapi3/testdata/origin/response_pattern_added_or_changed_base.yaml @@ -0,0 +1,51 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + writeOnlyName: + type: string + writeOnly: true + required: + - name + - writeOnlyName + - id + diff --git a/openapi3/testdata/origin/response_pattern_added_or_changed_revision.yaml b/openapi3/testdata/origin/response_pattern_added_or_changed_revision.yaml new file mode 100644 index 000000000..b8aedc32b --- /dev/null +++ b/openapi3/testdata/origin/response_pattern_added_or_changed_revision.yaml @@ -0,0 +1,51 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: ^(?:([a-z]+-)*([a-z]+)?)$ + id: + type: string + readOnly: true + name: + type: string + writeOnlyName: + type: string + writeOnly: true + required: + - name + - writeOnlyName + - id + diff --git a/openapi3/testdata/origin/response_property_all_of_added_base.yaml b/openapi3/testdata/origin/response_property_all_of_added_base.yaml new file mode 100644 index 000000000..a825af4d3 --- /dev/null +++ b/openapi3/testdata/origin/response_property_all_of_added_base.yaml @@ -0,0 +1,47 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + get: + operationId: listPets + responses: + "200": + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + allOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/response_property_all_of_added_revision.yaml b/openapi3/testdata/origin/response_property_all_of_added_revision.yaml new file mode 100644 index 000000000..7d2821dfb --- /dev/null +++ b/openapi3/testdata/origin/response_property_all_of_added_revision.yaml @@ -0,0 +1,60 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + get: + operationId: listPets + responses: + "200": + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Rabbit" + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + allOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + - $ref: "#/components/schemas/Breed3" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + Breed3: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string + + Rabbit: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/response_property_all_of_removed_base.yaml b/openapi3/testdata/origin/response_property_all_of_removed_base.yaml new file mode 100644 index 000000000..7d2821dfb --- /dev/null +++ b/openapi3/testdata/origin/response_property_all_of_removed_base.yaml @@ -0,0 +1,60 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + get: + operationId: listPets + responses: + "200": + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Rabbit" + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + allOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + - $ref: "#/components/schemas/Breed3" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + Breed3: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string + + Rabbit: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/response_property_all_of_removed_revision.yaml b/openapi3/testdata/origin/response_property_all_of_removed_revision.yaml new file mode 100644 index 000000000..a825af4d3 --- /dev/null +++ b/openapi3/testdata/origin/response_property_all_of_removed_revision.yaml @@ -0,0 +1,47 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + get: + operationId: listPets + responses: + "200": + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + allOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/response_property_any_of_added_base.yaml b/openapi3/testdata/origin/response_property_any_of_added_base.yaml new file mode 100644 index 000000000..88a7b42a4 --- /dev/null +++ b/openapi3/testdata/origin/response_property_any_of_added_base.yaml @@ -0,0 +1,47 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + get: + operationId: listPets + responses: + "200": + content: + application/json: + schema: + anyOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + anyOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/response_property_any_of_added_revision.yaml b/openapi3/testdata/origin/response_property_any_of_added_revision.yaml new file mode 100644 index 000000000..994fab66e --- /dev/null +++ b/openapi3/testdata/origin/response_property_any_of_added_revision.yaml @@ -0,0 +1,60 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + get: + operationId: listPets + responses: + "200": + content: + application/json: + schema: + anyOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Rabbit" + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + anyOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + - $ref: "#/components/schemas/Breed3" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + Breed3: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string + + Rabbit: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/response_property_any_of_complex_base.yaml b/openapi3/testdata/origin/response_property_any_of_complex_base.yaml new file mode 100644 index 000000000..e51eb868f --- /dev/null +++ b/openapi3/testdata/origin/response_property_any_of_complex_base.yaml @@ -0,0 +1,50 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + get: + operationId: listPets + responses: + "200": + content: + application/json: + schema: + anyOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + - title: Rabbit + type: string + - title: + type: string +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + anyOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/response_property_any_of_complex_revision.yaml b/openapi3/testdata/origin/response_property_any_of_complex_revision.yaml new file mode 100644 index 000000000..e6e027208 --- /dev/null +++ b/openapi3/testdata/origin/response_property_any_of_complex_revision.yaml @@ -0,0 +1,57 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + get: + operationId: listPets + responses: + "200": + content: + application/json: + schema: + anyOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + - title: Rabbit + type: number + - $ref: "#/components/schemas/Fox" + - title: + type: number +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + anyOf: + - $ref: "#/components/schemas/Breed2" + - $ref: "#/components/schemas/Breed1" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: number + + Cat: + type: object + properties: + name: + type: string + Fox: + type: object + properties: + name: + type: string + \ No newline at end of file diff --git a/openapi3/testdata/origin/response_property_any_of_removed_base.yaml b/openapi3/testdata/origin/response_property_any_of_removed_base.yaml new file mode 100644 index 000000000..994fab66e --- /dev/null +++ b/openapi3/testdata/origin/response_property_any_of_removed_base.yaml @@ -0,0 +1,60 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + get: + operationId: listPets + responses: + "200": + content: + application/json: + schema: + anyOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Rabbit" + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + anyOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + - $ref: "#/components/schemas/Breed3" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + Breed3: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string + + Rabbit: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/response_property_any_of_removed_revision.yaml b/openapi3/testdata/origin/response_property_any_of_removed_revision.yaml new file mode 100644 index 000000000..88a7b42a4 --- /dev/null +++ b/openapi3/testdata/origin/response_property_any_of_removed_revision.yaml @@ -0,0 +1,47 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + get: + operationId: listPets + responses: + "200": + content: + application/json: + schema: + anyOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + anyOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string diff --git a/openapi3/testdata/origin/response_property_became_optional_base.yaml b/openapi3/testdata/origin/response_property_became_optional_base.yaml new file mode 100644 index 000000000..8720b98e3 --- /dev/null +++ b/openapi3/testdata/origin/response_property_became_optional_base.yaml @@ -0,0 +1,49 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name + location: + type: string + required: + - location \ No newline at end of file diff --git a/openapi3/testdata/origin/response_property_became_optional_revision.yaml b/openapi3/testdata/origin/response_property_became_optional_revision.yaml new file mode 100644 index 000000000..ef95b23ec --- /dev/null +++ b/openapi3/testdata/origin/response_property_became_optional_revision.yaml @@ -0,0 +1,43 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string \ No newline at end of file diff --git a/openapi3/testdata/origin/response_property_default_value_changed_base.yaml b/openapi3/testdata/origin/response_property_default_value_changed_base.yaml new file mode 100644 index 000000000..60ad88a51 --- /dev/null +++ b/openapi3/testdata/origin/response_property_default_value_changed_base.yaml @@ -0,0 +1,56 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: + - url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/GroupView" + description: OK + "404": + content: + text/plain: + schema: + type: string + default: "Error" + description: Error + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + default: "2020-01-01T00:00:00Z" + id: + type: string + readOnly: true + name: + type: string + enabled: + default: false + type: boolean + required: + - name diff --git a/openapi3/testdata/origin/response_property_default_value_changed_revision.yaml b/openapi3/testdata/origin/response_property_default_value_changed_revision.yaml new file mode 100644 index 000000000..3e10bf36d --- /dev/null +++ b/openapi3/testdata/origin/response_property_default_value_changed_revision.yaml @@ -0,0 +1,56 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: + - url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/GroupView" + description: OK + "404": + content: + text/plain: + schema: + type: string + default: "Error" + description: Error + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + default: "2020-02-01T00:00:00Z" + id: + type: string + readOnly: true + name: + type: string + enabled: + default: true + type: boolean + required: + - name diff --git a/openapi3/testdata/origin/response_property_discriminator_added_base.yaml b/openapi3/testdata/origin/response_property_discriminator_added_base.yaml new file mode 100644 index 000000000..8fcc380b0 --- /dev/null +++ b/openapi3/testdata/origin/response_property_discriminator_added_base.yaml @@ -0,0 +1,52 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + responses: + "200": + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + +components: + schemas: + Dog: + type: object + properties: + petType: + type: string + name: + type: string + breed: + type: object + oneOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + petType: + type: string + name: + type: string diff --git a/openapi3/testdata/origin/response_property_discriminator_added_property_name_changed.yaml b/openapi3/testdata/origin/response_property_discriminator_added_property_name_changed.yaml new file mode 100644 index 000000000..3794c87f6 --- /dev/null +++ b/openapi3/testdata/origin/response_property_discriminator_added_property_name_changed.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + responses: + "200": + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + discriminator: + propertyName: petType2 + mapping: + cat: "#/components/schemas/Cat" + dog: "#/components/schemas/Dog" + +components: + schemas: + Dog: + type: object + properties: + petType2: + type: string + name: + type: string + breed: + type: object + oneOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + discriminator: + propertyName: name2 + mapping: + breed1: "#/components/schemas/Breed1" + breed2: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name2: + type: string + + Breed2: + type: object + properties: + name2: + type: string + + Cat: + type: object + properties: + petType2: + type: string + name: + type: string diff --git a/openapi3/testdata/origin/response_property_discriminator_added_revision.yaml b/openapi3/testdata/origin/response_property_discriminator_added_revision.yaml new file mode 100644 index 000000000..b40b50abc --- /dev/null +++ b/openapi3/testdata/origin/response_property_discriminator_added_revision.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + responses: + "200": + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + discriminator: + propertyName: petType + mapping: + cat: "#/components/schemas/Cat" + dog: "#/components/schemas/Dog" + +components: + schemas: + Dog: + type: object + properties: + petType: + type: string + name: + type: string + breed: + type: object + oneOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + discriminator: + propertyName: name + mapping: + breed1: "#/components/schemas/Breed1" + breed2: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + petType: + type: string + name: + type: string diff --git a/openapi3/testdata/origin/response_property_discriminator_mapping_changed.yaml b/openapi3/testdata/origin/response_property_discriminator_mapping_changed.yaml new file mode 100644 index 000000000..c38832172 --- /dev/null +++ b/openapi3/testdata/origin/response_property_discriminator_mapping_changed.yaml @@ -0,0 +1,68 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + post: + operationId: updatePets + responses: + "200": + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + discriminator: + propertyName: petType + mapping: + cats: "#/components/schemas/Cat" + dog: "#/components/schemas/Dog" + +components: + schemas: + Dog: + type: object + properties: + petType: + type: string + name: + type: string + breed: + type: object + oneOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + discriminator: + propertyName: name + mapping: + breed1Code: "#/components/schemas/Breed1" + breed2: "#/components/schemas/Breed3" + + Breed1: + type: object + properties: + name: + type: string + + Breed2: + type: object + properties: + name: + type: string + + Breed3: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + petType: + type: string + name: + type: string diff --git a/openapi3/testdata/origin/response_property_enum_added_base.yaml b/openapi3/testdata/origin/response_property_enum_added_base.yaml new file mode 100644 index 000000000..e5786c69e --- /dev/null +++ b/openapi3/testdata/origin/response_property_enum_added_base.yaml @@ -0,0 +1,56 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + typeEnum: + type: string + enum: + - TYPE1 + - TYPE2 + writeOnlyEnum: + type: string + writeOnly: true + enum: + - TYPE1 + - TYPE2 + required: + - name diff --git a/openapi3/testdata/origin/response_property_one_of_added_base.yaml b/openapi3/testdata/origin/response_property_one_of_added_base.yaml new file mode 100644 index 000000000..1d566c454 --- /dev/null +++ b/openapi3/testdata/origin/response_property_one_of_added_base.yaml @@ -0,0 +1,61 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + get: + operationId: listPets + responses: + "200": + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Fox" + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + oneOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string + + Fox: + type: object + properties: + name: + type: string + breed: + oneOf: + - enum: + - BROWN_1 + - BROWN_2 + title: Brown types + type: string diff --git a/openapi3/testdata/origin/response_property_one_of_added_revision.yaml b/openapi3/testdata/origin/response_property_one_of_added_revision.yaml new file mode 100644 index 000000000..43ada40cb --- /dev/null +++ b/openapi3/testdata/origin/response_property_one_of_added_revision.yaml @@ -0,0 +1,79 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + get: + operationId: listPets + responses: + "200": + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Rabbit" + - $ref: "#/components/schemas/Fox" + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + oneOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + - $ref: "#/components/schemas/Breed3" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + Breed3: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string + + Rabbit: + type: object + properties: + name: + type: string + + Fox: + type: object + properties: + name: + type: string + breed: + oneOf: + - enum: + - BROWN_1 + - BROWN_2 + title: Brown types + type: string + - enum: + - DARK_BROWN_1 + - DARK_BROWN_2 + title: Dark brown types + type: string diff --git a/openapi3/testdata/origin/response_property_one_of_removed_base.yaml b/openapi3/testdata/origin/response_property_one_of_removed_base.yaml new file mode 100644 index 000000000..43ada40cb --- /dev/null +++ b/openapi3/testdata/origin/response_property_one_of_removed_base.yaml @@ -0,0 +1,79 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + get: + operationId: listPets + responses: + "200": + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Rabbit" + - $ref: "#/components/schemas/Fox" + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + oneOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + - $ref: "#/components/schemas/Breed3" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + Breed3: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string + + Rabbit: + type: object + properties: + name: + type: string + + Fox: + type: object + properties: + name: + type: string + breed: + oneOf: + - enum: + - BROWN_1 + - BROWN_2 + title: Brown types + type: string + - enum: + - DARK_BROWN_1 + - DARK_BROWN_2 + title: Dark brown types + type: string diff --git a/openapi3/testdata/origin/response_property_one_of_removed_revision.yaml b/openapi3/testdata/origin/response_property_one_of_removed_revision.yaml new file mode 100644 index 000000000..1d566c454 --- /dev/null +++ b/openapi3/testdata/origin/response_property_one_of_removed_revision.yaml @@ -0,0 +1,61 @@ +openapi: 3.0.0 +info: + title: ACME + version: 1.0.0 + +paths: + /pets: + get: + operationId: listPets + responses: + "200": + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/Dog" + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Fox" + +components: + schemas: + Dog: + type: object + properties: + name: + type: string + breed: + type: object + oneOf: + - $ref: "#/components/schemas/Breed1" + - $ref: "#/components/schemas/Breed2" + + Breed1: + type: object + properties: + name: + type: string + Breed2: + type: object + properties: + name: + type: string + + Cat: + type: object + properties: + name: + type: string + + Fox: + type: object + properties: + name: + type: string + breed: + oneOf: + - enum: + - BROWN_1 + - BROWN_2 + title: Brown types + type: string diff --git a/openapi3/testdata/origin/response_required_property_added_base.yaml b/openapi3/testdata/origin/response_required_property_added_base.yaml new file mode 100644 index 000000000..b4a511931 --- /dev/null +++ b/openapi3/testdata/origin/response_required_property_added_base.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/response_required_property_added_revision.yaml b/openapi3/testdata/origin/response_required_property_added_revision.yaml new file mode 100644 index 000000000..f66e7db23 --- /dev/null +++ b/openapi3/testdata/origin/response_required_property_added_revision.yaml @@ -0,0 +1,49 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + new: + type: string + required: + - name + - new + diff --git a/openapi3/testdata/origin/response_required_property_write_only_read_only_base.yaml b/openapi3/testdata/origin/response_required_property_write_only_read_only_base.yaml new file mode 100644 index 000000000..287c074d5 --- /dev/null +++ b/openapi3/testdata/origin/response_required_property_write_only_read_only_base.yaml @@ -0,0 +1,51 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + writeOnlyName: + type: string + writeOnly: true + required: + - name + - writeOnlyName + - id + diff --git a/openapi3/testdata/origin/response_schema_format_changed_base.yaml b/openapi3/testdata/origin/response_schema_format_changed_base.yaml new file mode 100644 index 000000000..c5204f994 --- /dev/null +++ b/openapi3/testdata/origin/response_schema_format_changed_base.yaml @@ -0,0 +1,46 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: string + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + format: hostname + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/response_schema_type_changed_base.yaml b/openapi3/testdata/origin/response_schema_type_changed_base.yaml new file mode 100644 index 000000000..ea4f910f7 --- /dev/null +++ b/openapi3/testdata/origin/response_schema_type_changed_base.yaml @@ -0,0 +1,29 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: string \ No newline at end of file diff --git a/openapi3/testdata/origin/response_schema_type_changed_revision.yaml b/openapi3/testdata/origin/response_schema_type_changed_revision.yaml new file mode 100644 index 000000000..0bce6d27e --- /dev/null +++ b/openapi3/testdata/origin/response_schema_type_changed_revision.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: string + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/response_status_base.yaml b/openapi3/testdata/origin/response_status_base.yaml new file mode 100644 index 000000000..2740e8a2b --- /dev/null +++ b/openapi3/testdata/origin/response_status_base.yaml @@ -0,0 +1,58 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/simple.yaml b/openapi3/testdata/origin/simple.yaml new file mode 100644 index 000000000..53f308052 --- /dev/null +++ b/openapi3/testdata/origin/simple.yaml @@ -0,0 +1,19 @@ +openapi: 3.0.1 +info: + title: Test API + version: v1 +paths: + /partner-api/test/some-method: + get: + tags: + - Test + responses: + "200": + description: Success + /partner-api/test/another-method: + get: + tags: + - Test + responses: + "200": + description: Success diff --git a/openapi3/testdata/origin/simple1.yaml b/openapi3/testdata/origin/simple1.yaml new file mode 100644 index 000000000..13ef5d0ca --- /dev/null +++ b/openapi3/testdata/origin/simple1.yaml @@ -0,0 +1,10 @@ +info: + title: Tufin + version: 1.0.0 +openapi: 3.0.3 +paths: + /api/test: + get: + responses: + 200: + description: OK diff --git a/openapi3/testdata/origin/simple2.yaml b/openapi3/testdata/origin/simple2.yaml new file mode 100644 index 000000000..dbfea1cbd --- /dev/null +++ b/openapi3/testdata/origin/simple2.yaml @@ -0,0 +1,10 @@ +info: + title: Tufin + version: 1.0.0 +openapi: 3.0.3 +paths: + /api/test: + post: + responses: + 200: + description: OK diff --git a/openapi3/testdata/origin/simple3.yaml b/openapi3/testdata/origin/simple3.yaml new file mode 100644 index 000000000..be67c478b --- /dev/null +++ b/openapi3/testdata/origin/simple3.yaml @@ -0,0 +1,14 @@ +info: + title: Tufin + version: 1.0.0 +openapi: 3.0.3 +paths: + /api/test: + get: + responses: + 200: + description: OK + post: + responses: + 201: + description: OK diff --git a/openapi3/testdata/origin/simple4.yaml b/openapi3/testdata/origin/simple4.yaml new file mode 100644 index 000000000..4d4299e2c --- /dev/null +++ b/openapi3/testdata/origin/simple4.yaml @@ -0,0 +1,19 @@ +info: + title: Tufin + version: 1.0.0 +openapi: 3.0.3 +paths: + /api/test: + get: + parameters: + - name: a + in: query + schema: + type: integer + responses: + 200: + description: OK + post: + responses: + 201: + description: OK diff --git a/openapi3/testdata/origin/simple5.yaml b/openapi3/testdata/origin/simple5.yaml new file mode 100644 index 000000000..3e3a33242 --- /dev/null +++ b/openapi3/testdata/origin/simple5.yaml @@ -0,0 +1,19 @@ +info: + title: Tufin + version: 1.0.0 +openapi: 3.0.3 +paths: + /api/test: + get: + parameters: + - name: a + in: query + schema: + type: string + responses: + 200: + description: OK + post: + responses: + 201: + description: OK diff --git a/openapi3/testdata/origin/tag_added_base.yaml b/openapi3/testdata/origin/tag_added_base.yaml new file mode 100644 index 000000000..2740e8a2b --- /dev/null +++ b/openapi3/testdata/origin/tag_added_base.yaml @@ -0,0 +1,58 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file diff --git a/openapi3/testdata/origin/tag_removed_base.yaml b/openapi3/testdata/origin/tag_removed_base.yaml new file mode 100644 index 000000000..d7af0ebe5 --- /dev/null +++ b/openapi3/testdata/origin/tag_removed_base.yaml @@ -0,0 +1,60 @@ +openapi: 3.0.1 +info: + title: Tufin + version: "2.0" +servers: +- url: https://localhost:9080 +paths: + /api/v1.0/groups: + post: + tags: + - Test + operationId: createOneGroup + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Creates one project. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: OK + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupView' + description: Conflict + summary: Create One Project +components: + parameters: + groupId: + in: path + name: groupId + required: true + schema: + type: string + schemas: + GroupView: + type: object + properties: + data: + type: object + properties: + created: + type: string + format: date-time + readOnly: true + pattern: "^[a-z]+$" + id: + type: string + readOnly: true + name: + type: string + required: + - name \ No newline at end of file From 809545989bdd88c2cc7ed622e07672f9ca5f77dd Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 17 Sep 2024 12:37:48 +0300 Subject: [PATCH 14/31] remove trainling spaces --- .../origin/add_new_media_type_revision.yaml | 2 +- .../origin/api_security_added_base.yaml | 1 - .../origin/api_security_added_revision.yaml | 1 - .../api_security_global_added_base.yaml | 1 - .../api_security_global_added_revision.yaml | 1 - .../origin/api_security_updated_base.yaml | 1 - .../component_security_updated_base.yaml | 3 +- .../component_security_updated_revision.yaml | 3 +- .../different_component_same_header.yaml | 1 - openapi3/testdata/origin/openapi-test1.yaml | 46 ++++---- openapi3/testdata/origin/openapi-test2.yaml | 2 +- openapi3/testdata/origin/openapi-test3.yaml | 12 +- openapi3/testdata/origin/openapi-test4.yaml | 2 +- openapi3/testdata/origin/openapi-test5.yaml | 14 +-- openapi3/testdata/origin/openapi-test701.yaml | 42 +++---- openapi3/testdata/origin/openapi-test702.yaml | 46 ++++---- openapi3/testdata/origin/openapi-test703.yaml | 46 ++++---- openapi3/testdata/origin/openapi-test704.yaml | 46 ++++---- ...t_body_default_value_changed_revision.yaml | 2 +- ...request_property_extensible_enum_base.yaml | 2 +- ...st_property_min_length_decreased_base.yaml | 2 +- .../origin/response-media-type-base.yaml | 104 +++++++++--------- .../origin/response-media-type-revision.yaml | 104 +++++++++--------- ...response_property_any_of_complex_base.yaml | 2 +- ...onse_property_any_of_complex_revision.yaml | 3 +- 25 files changed, 240 insertions(+), 249 deletions(-) diff --git a/openapi3/testdata/origin/add_new_media_type_revision.yaml b/openapi3/testdata/origin/add_new_media_type_revision.yaml index d2987a1fb..ec60a3bc1 100644 --- a/openapi3/testdata/origin/add_new_media_type_revision.yaml +++ b/openapi3/testdata/origin/add_new_media_type_revision.yaml @@ -29,7 +29,7 @@ paths: type: integer name: type: string - fullTime: + fullTime: type: boolean description: OK "409": diff --git a/openapi3/testdata/origin/api_security_added_base.yaml b/openapi3/testdata/origin/api_security_added_base.yaml index 4cdf8bcbc..c999e9531 100644 --- a/openapi3/testdata/origin/api_security_added_base.yaml +++ b/openapi3/testdata/origin/api_security_added_base.yaml @@ -30,4 +30,3 @@ components: scopes: write:pets: modify pets in your account read:pets: read your pets - \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_added_revision.yaml b/openapi3/testdata/origin/api_security_added_revision.yaml index a9e1084ce..f5199ada6 100644 --- a/openapi3/testdata/origin/api_security_added_revision.yaml +++ b/openapi3/testdata/origin/api_security_added_revision.yaml @@ -34,4 +34,3 @@ components: scopes: write:pets: modify pets in your account read:pets: read your pets - \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_global_added_base.yaml b/openapi3/testdata/origin/api_security_global_added_base.yaml index 4cdf8bcbc..c999e9531 100644 --- a/openapi3/testdata/origin/api_security_global_added_base.yaml +++ b/openapi3/testdata/origin/api_security_global_added_base.yaml @@ -30,4 +30,3 @@ components: scopes: write:pets: modify pets in your account read:pets: read your pets - \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_global_added_revision.yaml b/openapi3/testdata/origin/api_security_global_added_revision.yaml index fed79d89d..d4b9532f8 100644 --- a/openapi3/testdata/origin/api_security_global_added_revision.yaml +++ b/openapi3/testdata/origin/api_security_global_added_revision.yaml @@ -34,4 +34,3 @@ components: scopes: write:pets: modify pets in your account read:pets: read your pets - \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_updated_base.yaml b/openapi3/testdata/origin/api_security_updated_base.yaml index f07543907..dfd988981 100644 --- a/openapi3/testdata/origin/api_security_updated_base.yaml +++ b/openapi3/testdata/origin/api_security_updated_base.yaml @@ -43,4 +43,3 @@ components: write:pets: modify pets in your account read:pets: read your pets - \ No newline at end of file diff --git a/openapi3/testdata/origin/component_security_updated_base.yaml b/openapi3/testdata/origin/component_security_updated_base.yaml index 05785e38e..921116aa5 100644 --- a/openapi3/testdata/origin/component_security_updated_base.yaml +++ b/openapi3/testdata/origin/component_security_updated_base.yaml @@ -28,10 +28,9 @@ components: securitySchemes: petstore_auth: type: oauth2 - flows: + flows: implicit: authorizationUrl: http://example.org/api/oauth/dialog scopes: write:pets: modify pets in your account read:pets: read your pets - \ No newline at end of file diff --git a/openapi3/testdata/origin/component_security_updated_revision.yaml b/openapi3/testdata/origin/component_security_updated_revision.yaml index 8a370298d..63ca91b3b 100644 --- a/openapi3/testdata/origin/component_security_updated_revision.yaml +++ b/openapi3/testdata/origin/component_security_updated_revision.yaml @@ -28,7 +28,7 @@ components: securitySchemes: petstore_auth: type: oauth2 - flows: + flows: implicit: authorizationUrl: http://example.org/api/oauth/dialog scopes: @@ -37,4 +37,3 @@ components: BasicAuth: type: http scheme: basic - \ No newline at end of file diff --git a/openapi3/testdata/origin/different_component_same_header.yaml b/openapi3/testdata/origin/different_component_same_header.yaml index 3366bba49..9e0f9fb58 100755 --- a/openapi3/testdata/origin/different_component_same_header.yaml +++ b/openapi3/testdata/origin/different_component_same_header.yaml @@ -17,4 +17,3 @@ components: - option_1 default: option_1 description: Let's mention the only option, option_1. - \ No newline at end of file diff --git a/openapi3/testdata/origin/openapi-test1.yaml b/openapi3/testdata/origin/openapi-test1.yaml index 28cbb5942..1851c6d27 100644 --- a/openapi3/testdata/origin/openapi-test1.yaml +++ b/openapi3/testdata/origin/openapi-test1.yaml @@ -2,24 +2,24 @@ info: title: Tufin version: 1.0.0 openapi: 3.0.3 -x-extension-test: -x-extension-test2: go +x-extension-test: +x-extension-test2: go externalDocs: url: https://tufin.com tags: - name: security description: control security - x-extension-test: + x-extension-test: - name: reuven description: Harrison -servers: +servers: - url: tufin.com - x-extension-test: + x-extension-test: security: - bearerAuth: [] paths: /api/{domain}/{project}/badges/security-score: - x-extension-test: + x-extension-test: parameters: - in: path name: domain @@ -32,17 +32,17 @@ paths: type: string get: operationId: GetSecurityScores - x-extension-test: + x-extension-test: x-beta: true tags: - security parameters: - in: query name: filter - x-extension-test: + x-extension-test: content: application/json: - x-extension-test: + x-extension-test: schema: type: object properties: @@ -72,7 +72,7 @@ paths: value: 'reuven' schema: x-extension-test: - description: alphanumeric + description: alphanumeric example: tufinim/generic-bank:cia-latest format: general string pattern: ^(?:[\w-./:]+)$ @@ -160,7 +160,7 @@ paths: type: string - in: header name: network-policies - schema: + schema: $ref: '#/components/schemas/network-policies' responses: default: @@ -215,7 +215,7 @@ paths: description: "test" "test2": operationId: "GetSecurityScores" - + 'bye': post: requestBody: # Contents of the callback message @@ -223,7 +223,7 @@ paths: content: application/json: schema: - type: object + type: object responses: # Expected responses to the callback message '200': description: Your server returns this code if it accepts the callback @@ -251,22 +251,22 @@ components: properties: netpols: type: string - type: object + type: object parameters: network-policies: name: network-policies in: header - schema: + schema: $ref: '#/components/schemas/network-policies' headers: test: - schema: + schema: $ref: '#/components/schemas/network-policies' new: - schema: + schema: $ref: '#/components/schemas/network-policies' testc: - content: + content: application/json: schema: type: object @@ -278,7 +278,7 @@ components: type: object discriminator: propertyName: meter_name - properties: + properties: meter_name: type: string tenant: @@ -290,15 +290,15 @@ components: dimensions: type: object securitySchemes: - bearerAuth: + bearerAuth: type: http scheme: bearer - bearerFormat: JWT + bearerFormat: JWT AccessToken: type: http scheme: bearer OAuth: - x-extension-test: + x-extension-test: type: oauth2 flows: authorizationCode: @@ -306,7 +306,7 @@ components: tokenUrl: https://tufin.io/token scopes: accountRead: Allows account data to be read - accountWrite: Allows account data to be written + accountWrite: Allows account data to be written responses: OK: description: 200 OK diff --git a/openapi3/testdata/origin/openapi-test2.yaml b/openapi3/testdata/origin/openapi-test2.yaml index b8a15d6ee..c763828b5 100644 --- a/openapi3/testdata/origin/openapi-test2.yaml +++ b/openapi3/testdata/origin/openapi-test2.yaml @@ -63,7 +63,7 @@ paths: type: string responses: default: - description: Tufin + description: Tufin servers: [] post: responses: diff --git a/openapi3/testdata/origin/openapi-test3.yaml b/openapi3/testdata/origin/openapi-test3.yaml index b495a2ffc..36c5506bd 100644 --- a/openapi3/testdata/origin/openapi-test3.yaml +++ b/openapi3/testdata/origin/openapi-test3.yaml @@ -134,7 +134,7 @@ paths: /register: post: security: - - OAuth: + - OAuth: - write:pets summary: Subscribe to a webhook callbacks: # Callback definition @@ -219,16 +219,16 @@ paths: description: Tufin components: callbacks: - test: + test: 'reuven': post: - requestBody: + requestBody: required: true content: application/json: schema: type: object - responses: + responses: '200': description: Your server returns this code if it accepts the callback requestBodies: @@ -237,7 +237,7 @@ components: application/json: schema: type: object - properties: + properties: meter_name: type: string tenant: @@ -260,7 +260,7 @@ components: accountWrite: Allows accounts data to be written admin: read clientCredentials: - tokenUrl: tufin.io/token + tokenUrl: tufin.io/token examples: a: description: reuven diff --git a/openapi3/testdata/origin/openapi-test4.yaml b/openapi3/testdata/origin/openapi-test4.yaml index 5611e1983..d2a00d080 100644 --- a/openapi3/testdata/origin/openapi-test4.yaml +++ b/openapi3/testdata/origin/openapi-test4.yaml @@ -47,7 +47,7 @@ paths: type: string responses: default: - description: Tufin + description: Tufin servers: [] post: responses: diff --git a/openapi3/testdata/origin/openapi-test5.yaml b/openapi3/testdata/origin/openapi-test5.yaml index 96313812d..19bf922f6 100644 --- a/openapi3/testdata/origin/openapi-test5.yaml +++ b/openapi3/testdata/origin/openapi-test5.yaml @@ -37,7 +37,7 @@ paths: - in: query name: image schema: - description: alphanumeric + description: alphanumeric example: tufinim/generic-bank:cia-latest format: general string pattern: ^(?:[\w-./:]+)$ @@ -123,7 +123,7 @@ paths: - url: 'https://www.oasdiff.com' description: "2" variables: - name: + name: default: "joe" enum: ["joe", "bill"] title: @@ -152,24 +152,24 @@ components: properties: netpols: type: string - type: object + type: object responses: default: description: Tufin headers: test: - schema: + schema: $ref: '#/components/schemas/network-policies' testc: - content: + content: application/json: schema: type: string securitySchemes: - bearerAuth: + bearerAuth: type: http scheme: bearer - bearerFormat: JWT + bearerFormat: JWT AccessToken: type: oauth2 flows: diff --git a/openapi3/testdata/origin/openapi-test701.yaml b/openapi3/testdata/origin/openapi-test701.yaml index 6b1f02fac..934874f97 100644 --- a/openapi3/testdata/origin/openapi-test701.yaml +++ b/openapi3/testdata/origin/openapi-test701.yaml @@ -2,24 +2,24 @@ info: title: Tufin version: 1.0.0 openapi: 3.0.3 -x-extension-test: -x-extension-test2: go +x-extension-test: +x-extension-test2: go externalDocs: url: https://tufin.com tags: - name: security description: control security - x-extension-test: + x-extension-test: - name: reuven description: Harrison -servers: +servers: - url: tufin.com - x-extension-test: + x-extension-test: security: - bearerAuth: [] paths: /api/{domain}/{project}/badges/security-score: - x-extension-test: + x-extension-test: parameters: - in: path name: domain @@ -32,17 +32,17 @@ paths: type: string get: operationId: GetSecurityScores - x-extension-test: + x-extension-test: x-beta: true tags: - security parameters: - in: query name: filter - x-extension-test: + x-extension-test: content: application/json: - x-extension-test: + x-extension-test: schema: type: object properties: @@ -72,7 +72,7 @@ paths: value: 'reuven' schema: x-extension-test: - description: alphanumeric + description: alphanumeric example: tufinim/generic-bank:cia-latest format: general string pattern: ^(?:[\w-./:]+)$ @@ -160,7 +160,7 @@ paths: type: string - in: header name: network-policies - schema: + schema: $ref: '#/components/schemas/network-policies' responses: default: @@ -192,22 +192,22 @@ components: properties: netpols: type: string - type: object + type: object parameters: network-policies: name: network-policies in: header - schema: + schema: $ref: '#/components/schemas/network-policies' headers: test: - schema: + schema: $ref: '#/components/schemas/network-policies' new: - schema: + schema: $ref: '#/components/schemas/network-policies' testc: - content: + content: application/json: schema: type: object @@ -219,7 +219,7 @@ components: type: object discriminator: propertyName: meter_name - properties: + properties: meter_name: type: string tenant: @@ -231,15 +231,15 @@ components: dimensions: type: object securitySchemes: - bearerAuth: + bearerAuth: type: http scheme: bearer - bearerFormat: JWT + bearerFormat: JWT AccessToken: type: http scheme: bearer OAuth: - x-extension-test: + x-extension-test: type: oauth2 flows: authorizationCode: @@ -247,7 +247,7 @@ components: tokenUrl: https://tufin.io/token scopes: accountRead: Allows account data to be read - accountWrite: Allows account data to be written + accountWrite: Allows account data to be written responses: OK: description: 200 OK diff --git a/openapi3/testdata/origin/openapi-test702.yaml b/openapi3/testdata/origin/openapi-test702.yaml index ae917586e..8ee4117a0 100644 --- a/openapi3/testdata/origin/openapi-test702.yaml +++ b/openapi3/testdata/origin/openapi-test702.yaml @@ -2,24 +2,24 @@ info: title: Tufin version: 1.0.0 openapi: 3.0.3 -x-extension-test: -x-extension-test2: go +x-extension-test: +x-extension-test2: go externalDocs: url: https://tufin.com tags: - name: security description: control security - x-extension-test: + x-extension-test: - name: reuven description: Harrison -servers: +servers: - url: tufin.com - x-extension-test: + x-extension-test: security: - bearerAuth: [] paths: /api/{domain}/{project}/badges/security-score: - x-extension-test: + x-extension-test: parameters: - in: path name: domain @@ -32,17 +32,17 @@ paths: type: string get: operationId: GetSecurityScores - x-extension-test: + x-extension-test: x-beta: true tags: - security parameters: - in: query name: filter - x-extension-test: + x-extension-test: content: application/json: - x-extension-test: + x-extension-test: schema: type: object properties: @@ -72,7 +72,7 @@ paths: value: 'reuven' schema: x-extension-test: - description: alphanumeric + description: alphanumeric example: tufinim/generic-bank:cia-latest format: general string pattern: ^(?:[\w-./:]+)$ @@ -161,7 +161,7 @@ paths: type: string - in: header name: network-policies - schema: + schema: $ref: '#/components/schemas/network-policies' responses: default: @@ -216,7 +216,7 @@ paths: description: "test" "test2": operationId: "GetSecurityScores" - + 'bye': post: requestBody: # Contents of the callback message @@ -224,7 +224,7 @@ paths: content: application/json: schema: - type: object + type: object responses: # Expected responses to the callback message '200': description: Your server returns this code if it accepts the callback @@ -252,22 +252,22 @@ components: properties: netpols: type: string - type: object + type: object parameters: network-policies: name: network-policies in: header - schema: + schema: $ref: '#/components/schemas/network-policies' headers: test: - schema: + schema: $ref: '#/components/schemas/network-policies' new: - schema: + schema: $ref: '#/components/schemas/network-policies' testc: - content: + content: application/json: schema: type: object @@ -279,7 +279,7 @@ components: type: object discriminator: propertyName: meter_name - properties: + properties: meter_name: type: string tenant: @@ -291,15 +291,15 @@ components: dimensions: type: object securitySchemes: - bearerAuth: + bearerAuth: type: http scheme: bearer - bearerFormat: JWT + bearerFormat: JWT AccessToken: type: http scheme: bearer OAuth: - x-extension-test: + x-extension-test: type: oauth2 flows: authorizationCode: @@ -307,7 +307,7 @@ components: tokenUrl: https://tufin.io/token scopes: accountRead: Allows account data to be read - accountWrite: Allows account data to be written + accountWrite: Allows account data to be written responses: OK: description: 200 OK diff --git a/openapi3/testdata/origin/openapi-test703.yaml b/openapi3/testdata/origin/openapi-test703.yaml index 3c96cc32f..cf38d2c14 100644 --- a/openapi3/testdata/origin/openapi-test703.yaml +++ b/openapi3/testdata/origin/openapi-test703.yaml @@ -2,24 +2,24 @@ info: title: Tufin version: 1.0.0 openapi: 3.0.3 -x-extension-test: -x-extension-test2: go +x-extension-test: +x-extension-test2: go externalDocs: url: https://tufin.com tags: - name: security description: control security - x-extension-test: + x-extension-test: - name: reuven description: Harrison -servers: +servers: - url: tufin.com - x-extension-test: + x-extension-test: security: - bearerAuth: [] paths: /api/{domain}/{project}/badges/security-score: - x-extension-test: + x-extension-test: parameters: - in: path name: domain @@ -32,17 +32,17 @@ paths: type: string get: operationId: GetSecurityScores - x-extension-test: + x-extension-test: x-beta: true tags: - security parameters: - in: query name: filter - x-extension-test: + x-extension-test: content: application/json: - x-extension-test: + x-extension-test: schema: type: object properties: @@ -72,7 +72,7 @@ paths: value: 'reuven' schema: x-extension-test: - description: alphanumeric + description: alphanumeric example: tufinim/generic-bank:cia-latest format: general string pattern: ^(?:[\w-./:]+)$ @@ -160,7 +160,7 @@ paths: type: string - in: header name: network-policies - schema: + schema: $ref: '#/components/schemas/network-policies' responses: default: @@ -215,7 +215,7 @@ paths: description: "test" "test2": operationId: "GetSecurityScores" - + 'bye': post: requestBody: # Contents of the callback message @@ -223,7 +223,7 @@ paths: content: application/json: schema: - type: object + type: object responses: # Expected responses to the callback message '200': description: Your server returns this code if it accepts the callback @@ -269,22 +269,22 @@ components: properties: netpols: type: string - type: object + type: object parameters: network-policies: name: network-policies in: header - schema: + schema: $ref: '#/components/schemas/network-policies' headers: test: - schema: + schema: $ref: '#/components/schemas/network-policies' new: - schema: + schema: $ref: '#/components/schemas/network-policies' testc: - content: + content: application/json: schema: type: object @@ -296,7 +296,7 @@ components: type: object discriminator: propertyName: meter_name - properties: + properties: meter_name: type: string tenant: @@ -308,15 +308,15 @@ components: dimensions: type: object securitySchemes: - bearerAuth: + bearerAuth: type: http scheme: bearer - bearerFormat: JWT + bearerFormat: JWT AccessToken: type: http scheme: bearer OAuth: - x-extension-test: + x-extension-test: type: oauth2 flows: authorizationCode: @@ -324,7 +324,7 @@ components: tokenUrl: https://tufin.io/token scopes: accountRead: Allows account data to be read - accountWrite: Allows account data to be written + accountWrite: Allows account data to be written responses: OK: description: 200 OK diff --git a/openapi3/testdata/origin/openapi-test704.yaml b/openapi3/testdata/origin/openapi-test704.yaml index 97227356a..e17045acf 100644 --- a/openapi3/testdata/origin/openapi-test704.yaml +++ b/openapi3/testdata/origin/openapi-test704.yaml @@ -2,24 +2,24 @@ info: title: Tufin version: 1.0.0 openapi: 3.0.3 -x-extension-test: -x-extension-test2: go +x-extension-test: +x-extension-test2: go externalDocs: url: https://tufin.com tags: - name: security description: control security - x-extension-test: + x-extension-test: - name: reuven description: Harrison -servers: +servers: - url: tufin.com - x-extension-test: + x-extension-test: security: - bearerAuth: [] paths: /api/{domain}/{project}/badges/security-score: - x-extension-test: + x-extension-test: parameters: - in: path name: domain @@ -32,17 +32,17 @@ paths: type: string get: operationId: GetSecurityScores - x-extension-test: + x-extension-test: x-beta: true tags: - security parameters: - in: query name: filter - x-extension-test: + x-extension-test: content: application/json: - x-extension-test: + x-extension-test: schema: type: object properties: @@ -72,7 +72,7 @@ paths: value: 'reuven' schema: x-extension-test: - description: alphanumeric + description: alphanumeric example: tufinim/generic-bank:cia-latest format: general string pattern: ^(?:[\w-./:]+)$ @@ -160,7 +160,7 @@ paths: type: string - in: header name: network-policies - schema: + schema: $ref: '#/components/schemas/network-policies' responses: default: @@ -215,7 +215,7 @@ paths: description: "test" "test2": operationId: "GetSecurityScores" - + 'bye': post: requestBody: # Contents of the callback message @@ -223,7 +223,7 @@ paths: content: application/json: schema: - type: object + type: object responses: # Expected responses to the callback message '200': description: Your server returns this code if it accepts the callback @@ -271,22 +271,22 @@ components: properties: netpols: type: string - type: object + type: object parameters: network-policies: name: network-policies in: header - schema: + schema: $ref: '#/components/schemas/network-policies' headers: test: - schema: + schema: $ref: '#/components/schemas/network-policies' new: - schema: + schema: $ref: '#/components/schemas/network-policies' testc: - content: + content: application/json: schema: type: object @@ -298,7 +298,7 @@ components: type: object discriminator: propertyName: meter_name - properties: + properties: meter_name: type: string tenant: @@ -310,15 +310,15 @@ components: dimensions: type: object securitySchemes: - bearerAuth: + bearerAuth: type: http scheme: bearer - bearerFormat: JWT + bearerFormat: JWT AccessToken: type: http scheme: bearer OAuth: - x-extension-test: + x-extension-test: type: oauth2 flows: authorizationCode: @@ -326,7 +326,7 @@ components: tokenUrl: https://tufin.io/token scopes: accountRead: Allows account data to be read - accountWrite: Allows account data to be written + accountWrite: Allows account data to be written responses: OK: description: 200 OK diff --git a/openapi3/testdata/origin/request_body_default_value_changed_revision.yaml b/openapi3/testdata/origin/request_body_default_value_changed_revision.yaml index 726a06307..b2b9abf52 100644 --- a/openapi3/testdata/origin/request_body_default_value_changed_revision.yaml +++ b/openapi3/testdata/origin/request_body_default_value_changed_revision.yaml @@ -13,4 +13,4 @@ paths: schema: type: string default: "NewDefault" - description: RequestBody \ No newline at end of file + description: RequestBody \ No newline at end of file diff --git a/openapi3/testdata/origin/request_property_extensible_enum_base.yaml b/openapi3/testdata/origin/request_property_extensible_enum_base.yaml index 9b90bb98e..0807f5039 100644 --- a/openapi3/testdata/origin/request_property_extensible_enum_base.yaml +++ b/openapi3/testdata/origin/request_property_extensible_enum_base.yaml @@ -17,7 +17,7 @@ paths: x-extensible-enum: - available - pending - - sold + - sold responses: "200": description: OK diff --git a/openapi3/testdata/origin/request_property_min_length_decreased_base.yaml b/openapi3/testdata/origin/request_property_min_length_decreased_base.yaml index b84faabd7..2f5c5b2c6 100644 --- a/openapi3/testdata/origin/request_property_min_length_decreased_base.yaml +++ b/openapi3/testdata/origin/request_property_min_length_decreased_base.yaml @@ -24,7 +24,7 @@ paths: type: string minLength: 10 required: true - + responses: "200": description: OK diff --git a/openapi3/testdata/origin/response-media-type-base.yaml b/openapi3/testdata/origin/response-media-type-base.yaml index c8a043d3d..af72046a0 100644 --- a/openapi3/testdata/origin/response-media-type-base.yaml +++ b/openapi3/testdata/origin/response-media-type-base.yaml @@ -7,9 +7,9 @@ paths: /products: get: summary: Returns a list of all products - tags: + tags: - Products - parameters: + parameters: - $ref: '#/components/parameters/takeParam' - $ref: '#/components/parameters/skipParam' - in: query @@ -19,11 +19,11 @@ paths: maxLength: 13 - in: query name: name - schema: + schema: type: string - in: query name: beschreibung - schema: + schema: type: string responses: '200': @@ -35,7 +35,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ProductDto' - + post: summary: Creates a new product tags: @@ -49,11 +49,11 @@ paths: $ref: '#/components/schemas/ProductDto' '409': description: GTIN already taken - + /products/{productId}: get: summary: Gets the product with the specified productId - parameters: + parameters: - in: path name: productId schema: @@ -61,8 +61,8 @@ paths: format: uuid required: true description: The UUID of the requested product - - tags: + + tags: - Products responses: '200': @@ -73,11 +73,11 @@ paths: $ref: '#/components/schemas/ProductDto' '404': description: Product with provided ID does not exist - + /products/{productId}/categories: get: summary: Gets the categories of the specified product - parameters: + parameters: - in: path name: productId schema: @@ -85,8 +85,8 @@ paths: format: uuid required: true description: The UUID of the requested product - - tags: + + tags: - Products responses: '200': @@ -97,13 +97,13 @@ paths: $ref: '#/components/schemas/ProductDto' '404': description: Product with provided ID does not exist - + '500': description: Internal Server Error '400': description: Bad Request - - /users: + + /users: get: tags: - Users @@ -117,7 +117,7 @@ paths: type: string - in: query name: nachname - schema: + schema: type: string responses: '200': @@ -128,9 +128,9 @@ paths: type: array items: $ref: '#/components/schemas/PublicUserDto' - + post: - tags: + tags: - Users summary: Creates a new user requestBody: @@ -148,14 +148,14 @@ paths: $ref: '#/components/schemas/PrivateUserDto' '409': description: Email already taken - - + + /users/{userId}: get: - tags: + tags: - Users summary: Gets the requested user - parameters: + parameters: - in: path name: userId schema: @@ -170,7 +170,7 @@ paths: application/json: schema: $ref: '#/components/schemas/PublicUserDto' - + put: tags: - Users @@ -196,7 +196,7 @@ paths: application/json: schema: $ref: '#/components/schemas/PublicUserDto' - + /auth/login: post: tags: @@ -208,7 +208,7 @@ paths: application/json: schema: $ref: '#/components/schemas/LoginDto' - + responses: '201': description: Returns the created token pair @@ -218,7 +218,7 @@ paths: $ref: '#/components/schemas/TokenResponse' '403': description: Wrong email and/or password - + /auth/refresh: post: tags: @@ -241,7 +241,7 @@ paths: application/json: schema: $ref: '#/components/schemas/TokenResponse' - + components: securitySchemes: @@ -249,8 +249,8 @@ components: type: http scheme: bearer bearerFormat: JWT - - + + schemas: ResourceDto: type: object @@ -264,7 +264,7 @@ components: updatedAt: type: string format: datetime - + ProductDto: type: object allOf: @@ -288,7 +288,7 @@ components: herstellerId: type: string format: uuid - + TokenResponse: type: object properties: @@ -298,7 +298,7 @@ components: refreshToken: type: string format: jwt - + PublicUserDto: type: object properties: @@ -311,7 +311,7 @@ components: nachname: type: string maxLength: 255 - + PrivateUserDto: type: object allOf: @@ -322,7 +322,7 @@ components: type: string format: email maxLength: 255 - + LoginDto: type: object properties: @@ -330,11 +330,11 @@ components: type: string format: email maxLength: 255 - + password: type: string maxLength: 255 - + HaushaltDto: type: object allOf: @@ -344,7 +344,7 @@ components: name: type: string maxLength: 255 - + HaushaltProduktDto: type: object allOf: @@ -359,7 +359,7 @@ components: type: number soll: type: number - + HerstellerDto: type: object allOf: @@ -368,27 +368,27 @@ components: properties: name: type: string - + ProduktKategorieDto: type: object allOf: - $ref: '#/components/schemas/ResourceDto' - type: object properties: - name: + name: type: string maxLength: 255 parentId: type: string format: uuid - + RezeptDto: type: object allOf: - $ref: '#/components/schemas/ResourceDto' - type: object properties: - name: + name: type: string maxLength: 255 beschreibung: @@ -404,7 +404,7 @@ components: kategorieId: type: string format: string - + RezeptKategorieDto: type: object allOf: @@ -416,7 +416,7 @@ components: parentId: type: string format: uuid - + ZutatenDto: type: object allOf: @@ -435,10 +435,10 @@ components: rezeptId: type: string format: uuid - + CreateUserDto: type: object - required: + required: - password - vorname - nachname @@ -453,11 +453,11 @@ components: nachname: type: string maxLength: 255 - + UpdateUserDto: type: object properties: - password: + password: type: string maxLength: 255 vorname: @@ -466,7 +466,7 @@ components: nachname: type: string maxLength: 255 - + parameters: takeParam: in: query @@ -484,7 +484,7 @@ components: minimum: 1 maximum: 50 description: The amount of users to skip - - + + security: - bearerAuth: [] \ No newline at end of file diff --git a/openapi3/testdata/origin/response-media-type-revision.yaml b/openapi3/testdata/origin/response-media-type-revision.yaml index 84e4e1fdb..ae762b2d3 100644 --- a/openapi3/testdata/origin/response-media-type-revision.yaml +++ b/openapi3/testdata/origin/response-media-type-revision.yaml @@ -7,9 +7,9 @@ paths: /products: get: summary: Returns a list of all products - tags: + tags: - Products - parameters: + parameters: - $ref: '#/components/parameters/takeParam' - $ref: '#/components/parameters/skipParam' - in: query @@ -19,11 +19,11 @@ paths: maxLength: 13 - in: query name: name - schema: + schema: type: string - in: query name: beschreibung - schema: + schema: type: string responses: '200': @@ -32,7 +32,7 @@ paths: application/javascript: schema: type: string - + post: summary: Creates a new product tags: @@ -46,11 +46,11 @@ paths: $ref: '#/components/schemas/ProductDto' '409': description: GTIN already taken - + /products/{productId}: get: summary: Gets the product with the specified productId - parameters: + parameters: - in: path name: productId schema: @@ -58,8 +58,8 @@ paths: format: uuid required: true description: The UUID of the requested product - - tags: + + tags: - Products responses: '200': @@ -70,11 +70,11 @@ paths: $ref: '#/components/schemas/ProductDto' '404': description: Product with provided ID does not exist - + /products/{productId}/categories: get: summary: Gets the categories of the specified product - parameters: + parameters: - in: path name: productId schema: @@ -82,8 +82,8 @@ paths: format: uuid required: true description: The UUID of the requested product - - tags: + + tags: - Products responses: '200': @@ -94,13 +94,13 @@ paths: $ref: '#/components/schemas/ProductDto' '404': description: Product with provided ID does not exist - + '500': description: Internal Server Error '400': description: Bad Request - - /users: + + /users: get: tags: - Users @@ -114,7 +114,7 @@ paths: type: string - in: query name: nachname - schema: + schema: type: string responses: '200': @@ -125,9 +125,9 @@ paths: type: array items: $ref: '#/components/schemas/PublicUserDto' - + post: - tags: + tags: - Users summary: Creates a new user requestBody: @@ -145,14 +145,14 @@ paths: $ref: '#/components/schemas/PrivateUserDto' '409': description: Email already taken - - + + /users/{userId}: get: - tags: + tags: - Users summary: Gets the requested user - parameters: + parameters: - in: path name: userId schema: @@ -167,7 +167,7 @@ paths: application/json: schema: $ref: '#/components/schemas/PublicUserDto' - + put: tags: - Users @@ -193,7 +193,7 @@ paths: application/json: schema: $ref: '#/components/schemas/PublicUserDto' - + /auth/login: post: tags: @@ -205,7 +205,7 @@ paths: application/json: schema: $ref: '#/components/schemas/LoginDto' - + responses: '201': description: Returns the created token pair @@ -215,7 +215,7 @@ paths: $ref: '#/components/schemas/TokenResponse' '403': description: Wrong email and/or password - + /auth/refresh: post: tags: @@ -238,7 +238,7 @@ paths: application/json: schema: $ref: '#/components/schemas/TokenResponse' - + components: securitySchemes: @@ -246,8 +246,8 @@ components: type: http scheme: bearer bearerFormat: JWT - - + + schemas: ResourceDto: type: object @@ -261,7 +261,7 @@ components: updatedAt: type: string format: datetime - + ProductDto: type: object allOf: @@ -285,7 +285,7 @@ components: herstellerId: type: string format: uuid - + TokenResponse: type: object properties: @@ -295,7 +295,7 @@ components: refreshToken: type: string format: jwt - + PublicUserDto: type: object properties: @@ -308,7 +308,7 @@ components: nachname: type: string maxLength: 255 - + PrivateUserDto: type: object allOf: @@ -319,7 +319,7 @@ components: type: string format: email maxLength: 255 - + LoginDto: type: object properties: @@ -327,11 +327,11 @@ components: type: string format: email maxLength: 255 - + password: type: string maxLength: 255 - + HaushaltDto: type: object allOf: @@ -341,7 +341,7 @@ components: name: type: string maxLength: 255 - + HaushaltProduktDto: type: object allOf: @@ -356,7 +356,7 @@ components: type: number soll: type: number - + HerstellerDto: type: object allOf: @@ -365,27 +365,27 @@ components: properties: name: type: string - + ProduktKategorieDto: type: object allOf: - $ref: '#/components/schemas/ResourceDto' - type: object properties: - name: + name: type: string maxLength: 255 parentId: type: string format: uuid - + RezeptDto: type: object allOf: - $ref: '#/components/schemas/ResourceDto' - type: object properties: - name: + name: type: string maxLength: 255 beschreibung: @@ -401,7 +401,7 @@ components: kategorieId: type: string format: string - + RezeptKategorieDto: type: object allOf: @@ -413,7 +413,7 @@ components: parentId: type: string format: uuid - + ZutatenDto: type: object allOf: @@ -432,10 +432,10 @@ components: rezeptId: type: string format: uuid - + CreateUserDto: type: object - required: + required: - password - vorname - nachname @@ -450,11 +450,11 @@ components: nachname: type: string maxLength: 255 - + UpdateUserDto: type: object properties: - password: + password: type: string maxLength: 255 vorname: @@ -463,7 +463,7 @@ components: nachname: type: string maxLength: 255 - + parameters: takeParam: in: query @@ -481,7 +481,7 @@ components: minimum: 1 maximum: 50 description: The amount of users to skip - - + + security: - bearerAuth: [] \ No newline at end of file diff --git a/openapi3/testdata/origin/response_property_any_of_complex_base.yaml b/openapi3/testdata/origin/response_property_any_of_complex_base.yaml index e51eb868f..b93c99178 100644 --- a/openapi3/testdata/origin/response_property_any_of_complex_base.yaml +++ b/openapi3/testdata/origin/response_property_any_of_complex_base.yaml @@ -17,7 +17,7 @@ paths: - $ref: "#/components/schemas/Cat" - title: Rabbit type: string - - title: + - title: type: string components: schemas: diff --git a/openapi3/testdata/origin/response_property_any_of_complex_revision.yaml b/openapi3/testdata/origin/response_property_any_of_complex_revision.yaml index e6e027208..da29f4b05 100644 --- a/openapi3/testdata/origin/response_property_any_of_complex_revision.yaml +++ b/openapi3/testdata/origin/response_property_any_of_complex_revision.yaml @@ -18,7 +18,7 @@ paths: - title: Rabbit type: number - $ref: "#/components/schemas/Fox" - - title: + - title: type: number components: schemas: @@ -54,4 +54,3 @@ components: properties: name: type: string - \ No newline at end of file From d24b68a97bcac982bfc8589596b86e6821a4a5cd Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 17 Sep 2024 15:09:24 +0300 Subject: [PATCH 15/31] add comments --- openapi3/origin.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openapi3/origin.go b/openapi3/origin.go index 2e8d60ece..d1c3e3a61 100644 --- a/openapi3/origin.go +++ b/openapi3/origin.go @@ -4,11 +4,15 @@ import "encoding/json" const originKey = "origin" +// Origin contains the origin of a collection. +// Key is the location of the collection itself. +// Fields is a map of the location of each field in the collection. type Origin struct { Key *Location `json:"key,omitempty" yaml:"key,omitempty"` Fields map[string]Location `json:"fields,omitempty" yaml:"fields,omitempty"` } +// Location is a struct that contains the location of a field. type Location struct { Line int `json:"line,omitempty" yaml:"line,omitempty"` Column int `json:"column,omitempty" yaml:"column,omitempty"` From c5cf284521986cbe81d1d9cb51a133e840a60140 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 17 Sep 2024 15:09:37 +0300 Subject: [PATCH 16/31] remove trailing whitespace --- openapi3/testdata/origin/api_security_added_base.yaml | 2 +- openapi3/testdata/origin/api_security_added_revision.yaml | 2 +- openapi3/testdata/origin/api_security_global_added_base.yaml | 2 +- openapi3/testdata/origin/api_security_updated_base.yaml | 4 ++-- openapi3/testdata/origin/api_security_updated_revision.yaml | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openapi3/testdata/origin/api_security_added_base.yaml b/openapi3/testdata/origin/api_security_added_base.yaml index c999e9531..526c04ea3 100644 --- a/openapi3/testdata/origin/api_security_added_base.yaml +++ b/openapi3/testdata/origin/api_security_added_base.yaml @@ -24,7 +24,7 @@ components: securitySchemes: petstore_auth: type: oauth2 - flows: + flows: implicit: authorizationUrl: http://example.org/api/oauth/dialog scopes: diff --git a/openapi3/testdata/origin/api_security_added_revision.yaml b/openapi3/testdata/origin/api_security_added_revision.yaml index f5199ada6..921116aa5 100644 --- a/openapi3/testdata/origin/api_security_added_revision.yaml +++ b/openapi3/testdata/origin/api_security_added_revision.yaml @@ -28,7 +28,7 @@ components: securitySchemes: petstore_auth: type: oauth2 - flows: + flows: implicit: authorizationUrl: http://example.org/api/oauth/dialog scopes: diff --git a/openapi3/testdata/origin/api_security_global_added_base.yaml b/openapi3/testdata/origin/api_security_global_added_base.yaml index c999e9531..526c04ea3 100644 --- a/openapi3/testdata/origin/api_security_global_added_base.yaml +++ b/openapi3/testdata/origin/api_security_global_added_base.yaml @@ -24,7 +24,7 @@ components: securitySchemes: petstore_auth: type: oauth2 - flows: + flows: implicit: authorizationUrl: http://example.org/api/oauth/dialog scopes: diff --git a/openapi3/testdata/origin/api_security_updated_base.yaml b/openapi3/testdata/origin/api_security_updated_base.yaml index dfd988981..472d6a46a 100644 --- a/openapi3/testdata/origin/api_security_updated_base.yaml +++ b/openapi3/testdata/origin/api_security_updated_base.yaml @@ -28,7 +28,7 @@ components: securitySchemes: petstore_auth: type: oauth2 - flows: + flows: implicit: authorizationUrl: http://example.org/api/oauth/dialog scopes: @@ -36,7 +36,7 @@ components: read:pets: read your pets catstore_auth: type: oauth2 - flows: + flows: implicit: authorizationUrl: http://example.org/api/oauth/dialog scopes: diff --git a/openapi3/testdata/origin/api_security_updated_revision.yaml b/openapi3/testdata/origin/api_security_updated_revision.yaml index 93bd2530e..e46a08c36 100644 --- a/openapi3/testdata/origin/api_security_updated_revision.yaml +++ b/openapi3/testdata/origin/api_security_updated_revision.yaml @@ -27,7 +27,7 @@ components: securitySchemes: petstore_auth: type: oauth2 - flows: + flows: implicit: authorizationUrl: http://example.org/api/oauth/dialog scopes: @@ -35,7 +35,7 @@ components: read:pets: read your pets catstore_auth: type: oauth2 - flows: + flows: implicit: authorizationUrl: http://example.org/api/oauth/dialog scopes: From 98ace80ca97e4de125c4d72bd317d60add73c1c1 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 17 Sep 2024 15:12:07 +0300 Subject: [PATCH 17/31] update docs --- .github/docs/openapi3.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/docs/openapi3.txt b/.github/docs/openapi3.txt index 25b66e32c..239704c2a 100644 --- a/.github/docs/openapi3.txt +++ b/.github/docs/openapi3.txt @@ -827,6 +827,7 @@ type Location struct { Line int `json:"line,omitempty" yaml:"line,omitempty"` Column int `json:"column,omitempty" yaml:"column,omitempty"` } + Location is a struct that contains the location of a field. type MediaType struct { Extensions map[string]any `json:"-" yaml:"-"` @@ -1025,6 +1026,9 @@ type Origin struct { Key *Location `json:"key,omitempty" yaml:"key,omitempty"` Fields map[string]Location `json:"fields,omitempty" yaml:"fields,omitempty"` } + Origin contains the origin of a collection. Key is the location of the + collection itself. Fields is a map of the location of each field in the + collection. type Parameter struct { Extensions map[string]any `json:"-" yaml:"-"` From c981f302013fb1187ae60162e95d7afebe64aebc Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 17 Sep 2024 21:21:07 +0300 Subject: [PATCH 18/31] dedicated tests --- openapi3/external_docs.go | 2 + openapi3/openapi3_test.go | 22 ----- openapi3/origin_test.go | 91 +++++++++++++++++++ .../origin/additional_properties.yaml | 20 ++++ openapi3/testdata/origin/external_docs.yaml | 15 +++ 5 files changed, 128 insertions(+), 22 deletions(-) create mode 100644 openapi3/origin_test.go create mode 100644 openapi3/testdata/origin/additional_properties.yaml create mode 100644 openapi3/testdata/origin/external_docs.yaml diff --git a/openapi3/external_docs.go b/openapi3/external_docs.go index bd99511a5..f6794141e 100644 --- a/openapi3/external_docs.go +++ b/openapi3/external_docs.go @@ -12,6 +12,7 @@ import ( // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#external-documentation-object type ExternalDocs struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` URL string `json:"url,omitempty" yaml:"url,omitempty"` @@ -49,6 +50,7 @@ func (e *ExternalDocs) UnmarshalJSON(data []byte) error { return unmarshalError(err) } _ = json.Unmarshal(data, &x.Extensions) + delete(x.Extensions, originKey) delete(x.Extensions, "description") delete(x.Extensions, "url") if len(x.Extensions) == 0 { diff --git a/openapi3/openapi3_test.go b/openapi3/openapi3_test.go index d1e7d8689..3b68c1693 100644 --- a/openapi3/openapi3_test.go +++ b/openapi3/openapi3_test.go @@ -3,8 +3,6 @@ package openapi3 import ( "context" "encoding/json" - "fmt" - "os" "strings" "testing" @@ -478,23 +476,3 @@ func TestAddRemoveServer(t *testing.T) { doc3.Servers = Servers{} } - -func TestOrigin(t *testing.T) { - loader := NewLoader() - loader.IsExternalRefsAllowed = true - loader.IncludeOrigin = true - loader.Context = context.Background() - - const dir = "testdata/origin" - items, _ := os.ReadDir(dir) - for _, item := range items { - t.Run(item.Name(), func(t *testing.T) { - doc, err := loader.LoadFromFile(fmt.Sprintf("%s/%s", dir, item.Name())) - require.NoError(t, err) - if doc.Paths == nil { - t.Skip("no paths") - } - require.NotEmpty(t, doc.Paths.Origin) - }) - } -} diff --git a/openapi3/origin_test.go b/openapi3/origin_test.go new file mode 100644 index 000000000..f304d3ab1 --- /dev/null +++ b/openapi3/origin_test.go @@ -0,0 +1,91 @@ +package openapi3 + +import ( + "context" + "fmt" + "os" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestAll(t *testing.T) { + loader := NewLoader() + loader.IsExternalRefsAllowed = true + loader.IncludeOrigin = true + loader.Context = context.Background() + + const dir = "testdata/origin/" + items, _ := os.ReadDir(dir) + for _, item := range items { + t.Run(item.Name(), func(t *testing.T) { + doc, err := loader.LoadFromFile(fmt.Sprintf("%s/%s", dir, item.Name())) + require.NoError(t, err) + if doc.Paths == nil { + t.Skip("no paths") + } + require.NotEmpty(t, doc.Paths.Origin) + }) + } +} + +func TestSchemaInAdditionalProperties(t *testing.T) { + loader := NewLoader() + loader.IsExternalRefsAllowed = true + loader.IncludeOrigin = true + loader.Context = context.Background() + + doc, err := loader.LoadFromFile("testdata/origin/additional_properties.yaml") + require.NoError(t, err) + + require.NotNil(t, doc.Paths.Find("/partner-api/test/some-method").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.AdditionalProperties) + additionalProperties := doc.Paths.Find("/partner-api/test/some-method").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.AdditionalProperties + + require.NotNil(t, additionalProperties.Schema.Value.Origin) + require.Equal(t, + &Location{ + Line: 14, + Column: 17, + }, + additionalProperties.Schema.Value.Origin.Key) + + require.Equal(t, + Location{ + Line: 15, + Column: 19, + }, + additionalProperties.Schema.Value.Origin.Fields["type"]) +} + +func TestExternalDocs(t *testing.T) { + loader := NewLoader() + loader.IsExternalRefsAllowed = true + loader.IncludeOrigin = true + loader.Context = context.Background() + + doc, err := loader.LoadFromFile("testdata/origin/external_docs.yaml") + require.NoError(t, err) + + require.NotNil(t, doc.ExternalDocs.Origin) + + require.Equal(t, + &Location{ + Line: 13, + Column: 1, + }, + doc.ExternalDocs.Origin.Key) + + require.Equal(t, + Location{ + Line: 14, + Column: 3, + }, + doc.ExternalDocs.Origin.Fields["description"]) + + require.Equal(t, + Location{ + Line: 15, + Column: 3, + }, + doc.ExternalDocs.Origin.Fields["url"]) +} diff --git a/openapi3/testdata/origin/additional_properties.yaml b/openapi3/testdata/origin/additional_properties.yaml new file mode 100644 index 000000000..ec3794a0c --- /dev/null +++ b/openapi3/testdata/origin/additional_properties.yaml @@ -0,0 +1,20 @@ +openapi: 3.0.1 +info: + title: Test API + version: v1 +paths: + /partner-api/test/some-method: + get: + responses: + "200": + description: Success + content: + application/json: + schema: + additionalProperties: + type: object + properties: + code: + type: integer + text: + type: string diff --git a/openapi3/testdata/origin/external_docs.yaml b/openapi3/testdata/origin/external_docs.yaml new file mode 100644 index 000000000..bfc5ba09e --- /dev/null +++ b/openapi3/testdata/origin/external_docs.yaml @@ -0,0 +1,15 @@ +openapi: 3.0.1 +info: + title: Test API + version: v1 +paths: + /partner-api/test/some-method: + get: + tags: + - Test + responses: + "200": + description: Success +externalDocs: + description: API Documentation + url: https://openweathermap.org/api \ No newline at end of file From 6daf324a9c16e5f6a02281ef2c8b497765001a8b Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 17 Sep 2024 21:21:45 +0300 Subject: [PATCH 19/31] update docs --- .github/docs/openapi3.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/docs/openapi3.txt b/.github/docs/openapi3.txt index 239704c2a..df9479ec7 100644 --- a/.github/docs/openapi3.txt +++ b/.github/docs/openapi3.txt @@ -543,6 +543,7 @@ func (examples *Examples) UnmarshalJSON(data []byte) (err error) type ExternalDocs struct { Extensions map[string]any `json:"-" yaml:"-"` + Origin *Origin `json:"origin,omitempty" yaml:"origin,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` URL string `json:"url,omitempty" yaml:"url,omitempty"` From 17db6ab3308dad3551a315cd1da383e3c82876bb Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 17 Sep 2024 21:31:39 +0300 Subject: [PATCH 20/31] remove whitespace --- .../testdata/origin/api_security_global_added_revision.yaml | 2 +- openapi3/testdata/origin/api_security_updated_base.yaml | 1 - openapi3/testdata/origin/circular1.yaml | 1 - openapi3/testdata/origin/openapi-test5.yaml | 1 - .../origin/request_property_extensible_enum_revision.yaml | 1 - .../testdata/origin/request_property_max_decreased_base.yaml | 1 - .../testdata/origin/request_property_max_length_set_base.yaml | 1 - .../origin/request_property_max_length_set_revision.yaml | 1 - openapi3/testdata/origin/request_property_max_set_base.yaml | 1 - openapi3/testdata/origin/request_property_max_set_revision.yaml | 1 - .../testdata/origin/request_property_min_increased_base.yaml | 1 - .../origin/request_property_min_increased_revision.yaml | 1 - .../request_property_type_changed_revision_array_to_object.yaml | 1 - .../testdata/origin/response_pattern_added_or_changed_base.yaml | 1 - .../origin/response_required_property_added_revision.yaml | 1 - .../response_required_property_write_only_read_only_base.yaml | 1 - 16 files changed, 1 insertion(+), 16 deletions(-) diff --git a/openapi3/testdata/origin/api_security_global_added_revision.yaml b/openapi3/testdata/origin/api_security_global_added_revision.yaml index d4b9532f8..09b32d687 100644 --- a/openapi3/testdata/origin/api_security_global_added_revision.yaml +++ b/openapi3/testdata/origin/api_security_global_added_revision.yaml @@ -28,7 +28,7 @@ components: securitySchemes: petstore_auth: type: oauth2 - flows: + flows: implicit: authorizationUrl: http://example.org/api/oauth/dialog scopes: diff --git a/openapi3/testdata/origin/api_security_updated_base.yaml b/openapi3/testdata/origin/api_security_updated_base.yaml index 472d6a46a..b6b49bac1 100644 --- a/openapi3/testdata/origin/api_security_updated_base.yaml +++ b/openapi3/testdata/origin/api_security_updated_base.yaml @@ -42,4 +42,3 @@ components: scopes: write:pets: modify pets in your account read:pets: read your pets - diff --git a/openapi3/testdata/origin/circular1.yaml b/openapi3/testdata/origin/circular1.yaml index 228388d19..ab1ea9e86 100644 --- a/openapi3/testdata/origin/circular1.yaml +++ b/openapi3/testdata/origin/circular1.yaml @@ -37,4 +37,3 @@ components: circular6: oneOf: - $ref: '#/components/schemas/circular6' - diff --git a/openapi3/testdata/origin/openapi-test5.yaml b/openapi3/testdata/origin/openapi-test5.yaml index 19bf922f6..b28604106 100644 --- a/openapi3/testdata/origin/openapi-test5.yaml +++ b/openapi3/testdata/origin/openapi-test5.yaml @@ -178,4 +178,3 @@ components: scopes: write:pets: modify pets in your account read:pets": read your pets - diff --git a/openapi3/testdata/origin/request_property_extensible_enum_revision.yaml b/openapi3/testdata/origin/request_property_extensible_enum_revision.yaml index 3edefb38e..41e54483e 100644 --- a/openapi3/testdata/origin/request_property_extensible_enum_revision.yaml +++ b/openapi3/testdata/origin/request_property_extensible_enum_revision.yaml @@ -20,4 +20,3 @@ paths: responses: "200": description: OK - diff --git a/openapi3/testdata/origin/request_property_max_decreased_base.yaml b/openapi3/testdata/origin/request_property_max_decreased_base.yaml index 4b743bcc4..cf9ee1560 100644 --- a/openapi3/testdata/origin/request_property_max_decreased_base.yaml +++ b/openapi3/testdata/origin/request_property_max_decreased_base.yaml @@ -20,4 +20,3 @@ paths: responses: "200": description: OK - diff --git a/openapi3/testdata/origin/request_property_max_length_set_base.yaml b/openapi3/testdata/origin/request_property_max_length_set_base.yaml index 5d8ec950b..7c7974fa8 100644 --- a/openapi3/testdata/origin/request_property_max_length_set_base.yaml +++ b/openapi3/testdata/origin/request_property_max_length_set_base.yaml @@ -19,4 +19,3 @@ paths: responses: "200": description: OK - diff --git a/openapi3/testdata/origin/request_property_max_length_set_revision.yaml b/openapi3/testdata/origin/request_property_max_length_set_revision.yaml index 687a264b4..b0b964239 100644 --- a/openapi3/testdata/origin/request_property_max_length_set_revision.yaml +++ b/openapi3/testdata/origin/request_property_max_length_set_revision.yaml @@ -20,4 +20,3 @@ paths: responses: "200": description: OK - diff --git a/openapi3/testdata/origin/request_property_max_set_base.yaml b/openapi3/testdata/origin/request_property_max_set_base.yaml index 04a11be89..449f8c0ad 100644 --- a/openapi3/testdata/origin/request_property_max_set_base.yaml +++ b/openapi3/testdata/origin/request_property_max_set_base.yaml @@ -19,4 +19,3 @@ paths: responses: "200": description: OK - diff --git a/openapi3/testdata/origin/request_property_max_set_revision.yaml b/openapi3/testdata/origin/request_property_max_set_revision.yaml index 0cbdc334b..670a59c59 100644 --- a/openapi3/testdata/origin/request_property_max_set_revision.yaml +++ b/openapi3/testdata/origin/request_property_max_set_revision.yaml @@ -20,4 +20,3 @@ paths: responses: "200": description: OK - diff --git a/openapi3/testdata/origin/request_property_min_increased_base.yaml b/openapi3/testdata/origin/request_property_min_increased_base.yaml index a8c335b16..6288edff3 100644 --- a/openapi3/testdata/origin/request_property_min_increased_base.yaml +++ b/openapi3/testdata/origin/request_property_min_increased_base.yaml @@ -20,4 +20,3 @@ paths: responses: "200": description: OK - diff --git a/openapi3/testdata/origin/request_property_min_increased_revision.yaml b/openapi3/testdata/origin/request_property_min_increased_revision.yaml index ce064936a..85801588d 100644 --- a/openapi3/testdata/origin/request_property_min_increased_revision.yaml +++ b/openapi3/testdata/origin/request_property_min_increased_revision.yaml @@ -20,4 +20,3 @@ paths: responses: "200": description: OK - diff --git a/openapi3/testdata/origin/request_property_type_changed_revision_array_to_object.yaml b/openapi3/testdata/origin/request_property_type_changed_revision_array_to_object.yaml index a85097a53..0bfd4379f 100644 --- a/openapi3/testdata/origin/request_property_type_changed_revision_array_to_object.yaml +++ b/openapi3/testdata/origin/request_property_type_changed_revision_array_to_object.yaml @@ -58,4 +58,3 @@ paths: - green required: - name - diff --git a/openapi3/testdata/origin/response_pattern_added_or_changed_base.yaml b/openapi3/testdata/origin/response_pattern_added_or_changed_base.yaml index 287c074d5..1f1f58a42 100644 --- a/openapi3/testdata/origin/response_pattern_added_or_changed_base.yaml +++ b/openapi3/testdata/origin/response_pattern_added_or_changed_base.yaml @@ -48,4 +48,3 @@ components: - name - writeOnlyName - id - diff --git a/openapi3/testdata/origin/response_required_property_added_revision.yaml b/openapi3/testdata/origin/response_required_property_added_revision.yaml index f66e7db23..4b7e84eff 100644 --- a/openapi3/testdata/origin/response_required_property_added_revision.yaml +++ b/openapi3/testdata/origin/response_required_property_added_revision.yaml @@ -46,4 +46,3 @@ components: required: - name - new - diff --git a/openapi3/testdata/origin/response_required_property_write_only_read_only_base.yaml b/openapi3/testdata/origin/response_required_property_write_only_read_only_base.yaml index 287c074d5..1f1f58a42 100644 --- a/openapi3/testdata/origin/response_required_property_write_only_read_only_base.yaml +++ b/openapi3/testdata/origin/response_required_property_write_only_read_only_base.yaml @@ -48,4 +48,3 @@ components: - name - writeOnlyName - id - From 015b63e4675a119148c81c46692418c9bc4219be Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 17 Sep 2024 23:32:28 +0300 Subject: [PATCH 21/31] rm empty line --- openapi3/testdata/origin/api_security_added_revision.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi3/testdata/origin/api_security_added_revision.yaml b/openapi3/testdata/origin/api_security_added_revision.yaml index 921116aa5..178e702dd 100644 --- a/openapi3/testdata/origin/api_security_added_revision.yaml +++ b/openapi3/testdata/origin/api_security_added_revision.yaml @@ -33,4 +33,4 @@ components: authorizationUrl: http://example.org/api/oauth/dialog scopes: write:pets: modify pets in your account - read:pets: read your pets + read:pets: read your pets \ No newline at end of file From 34f95b79a4ebbba5dc4e2d3fffd7fe539ed2a15d Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 17 Sep 2024 23:37:32 +0300 Subject: [PATCH 22/31] rm last newline --- openapi3/testdata/origin/additional_properties.yaml | 2 +- openapi3/testdata/origin/api_security_added_base.yaml | 2 +- openapi3/testdata/origin/api_security_global_added_base.yaml | 2 +- .../testdata/origin/api_security_global_added_revision.yaml | 2 +- openapi3/testdata/origin/api_security_updated_base.yaml | 2 +- openapi3/testdata/origin/api_security_updated_revision.yaml | 2 +- openapi3/testdata/origin/circular1.yaml | 2 +- openapi3/testdata/origin/circular2.yaml | 2 +- openapi3/testdata/origin/circular3.yaml | 2 +- openapi3/testdata/origin/component_security_updated_base.yaml | 2 +- .../testdata/origin/component_security_updated_revision.yaml | 2 +- .../testdata/origin/different_component_modified_parameter.yaml | 2 +- openapi3/testdata/origin/different_component_same_header.yaml | 2 +- .../testdata/origin/different_component_same_parameter.yaml | 2 +- openapi3/testdata/origin/different_component_same_schema.yaml | 2 +- openapi3/testdata/origin/empty.yaml | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/openapi3/testdata/origin/additional_properties.yaml b/openapi3/testdata/origin/additional_properties.yaml index ec3794a0c..8e865bc92 100644 --- a/openapi3/testdata/origin/additional_properties.yaml +++ b/openapi3/testdata/origin/additional_properties.yaml @@ -17,4 +17,4 @@ paths: code: type: integer text: - type: string + type: string \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_added_base.yaml b/openapi3/testdata/origin/api_security_added_base.yaml index 526c04ea3..91ba7591d 100644 --- a/openapi3/testdata/origin/api_security_added_base.yaml +++ b/openapi3/testdata/origin/api_security_added_base.yaml @@ -29,4 +29,4 @@ components: authorizationUrl: http://example.org/api/oauth/dialog scopes: write:pets: modify pets in your account - read:pets: read your pets + read:pets: read your pets \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_global_added_base.yaml b/openapi3/testdata/origin/api_security_global_added_base.yaml index 526c04ea3..91ba7591d 100644 --- a/openapi3/testdata/origin/api_security_global_added_base.yaml +++ b/openapi3/testdata/origin/api_security_global_added_base.yaml @@ -29,4 +29,4 @@ components: authorizationUrl: http://example.org/api/oauth/dialog scopes: write:pets: modify pets in your account - read:pets: read your pets + read:pets: read your pets \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_global_added_revision.yaml b/openapi3/testdata/origin/api_security_global_added_revision.yaml index 09b32d687..8412ee5f4 100644 --- a/openapi3/testdata/origin/api_security_global_added_revision.yaml +++ b/openapi3/testdata/origin/api_security_global_added_revision.yaml @@ -33,4 +33,4 @@ components: authorizationUrl: http://example.org/api/oauth/dialog scopes: write:pets: modify pets in your account - read:pets: read your pets + read:pets: read your pets \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_updated_base.yaml b/openapi3/testdata/origin/api_security_updated_base.yaml index b6b49bac1..0ff8d7dc5 100644 --- a/openapi3/testdata/origin/api_security_updated_base.yaml +++ b/openapi3/testdata/origin/api_security_updated_base.yaml @@ -41,4 +41,4 @@ components: authorizationUrl: http://example.org/api/oauth/dialog scopes: write:pets: modify pets in your account - read:pets: read your pets + read:pets: read your pets \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_updated_revision.yaml b/openapi3/testdata/origin/api_security_updated_revision.yaml index e46a08c36..d53dba3a4 100644 --- a/openapi3/testdata/origin/api_security_updated_revision.yaml +++ b/openapi3/testdata/origin/api_security_updated_revision.yaml @@ -40,4 +40,4 @@ components: authorizationUrl: http://example.org/api/oauth/dialog scopes: write:pets: modify pets in your account - read:pets: read your pets + read:pets: read your pets \ No newline at end of file diff --git a/openapi3/testdata/origin/circular1.yaml b/openapi3/testdata/origin/circular1.yaml index ab1ea9e86..d8c441c18 100644 --- a/openapi3/testdata/origin/circular1.yaml +++ b/openapi3/testdata/origin/circular1.yaml @@ -36,4 +36,4 @@ components: - $ref: '#/components/schemas/circular1' circular6: oneOf: - - $ref: '#/components/schemas/circular6' + - $ref: '#/components/schemas/circular6' \ No newline at end of file diff --git a/openapi3/testdata/origin/circular2.yaml b/openapi3/testdata/origin/circular2.yaml index 0a48bac52..fcbaf5b79 100644 --- a/openapi3/testdata/origin/circular2.yaml +++ b/openapi3/testdata/origin/circular2.yaml @@ -37,4 +37,4 @@ components: circular6: oneOf: - $ref: '#/components/schemas/circular6' - - $ref: '#/components/schemas/circular1' + - $ref: '#/components/schemas/circular1' \ No newline at end of file diff --git a/openapi3/testdata/origin/circular3.yaml b/openapi3/testdata/origin/circular3.yaml index c2d4a4acd..f5e201175 100644 --- a/openapi3/testdata/origin/circular3.yaml +++ b/openapi3/testdata/origin/circular3.yaml @@ -22,4 +22,4 @@ components: - $ref: '#/components/schemas/circular3' circular3: oneOf: - - $ref: '#/components/schemas/circular1' + - $ref: '#/components/schemas/circular1' \ No newline at end of file diff --git a/openapi3/testdata/origin/component_security_updated_base.yaml b/openapi3/testdata/origin/component_security_updated_base.yaml index 921116aa5..178e702dd 100644 --- a/openapi3/testdata/origin/component_security_updated_base.yaml +++ b/openapi3/testdata/origin/component_security_updated_base.yaml @@ -33,4 +33,4 @@ components: authorizationUrl: http://example.org/api/oauth/dialog scopes: write:pets: modify pets in your account - read:pets: read your pets + read:pets: read your pets \ No newline at end of file diff --git a/openapi3/testdata/origin/component_security_updated_revision.yaml b/openapi3/testdata/origin/component_security_updated_revision.yaml index 63ca91b3b..cd5438d51 100644 --- a/openapi3/testdata/origin/component_security_updated_revision.yaml +++ b/openapi3/testdata/origin/component_security_updated_revision.yaml @@ -36,4 +36,4 @@ components: read:pets: read your pets BasicAuth: type: http - scheme: basic + scheme: basic \ No newline at end of file diff --git a/openapi3/testdata/origin/different_component_modified_parameter.yaml b/openapi3/testdata/origin/different_component_modified_parameter.yaml index 1fbb93e11..22e2f6ec0 100755 --- a/openapi3/testdata/origin/different_component_modified_parameter.yaml +++ b/openapi3/testdata/origin/different_component_modified_parameter.yaml @@ -22,4 +22,4 @@ components: enum: - option_1 default: option_1 - description: Let's mention the only option, option_1. + description: Let's mention the only option, option_1. \ No newline at end of file diff --git a/openapi3/testdata/origin/different_component_same_header.yaml b/openapi3/testdata/origin/different_component_same_header.yaml index 9e0f9fb58..40dc02702 100755 --- a/openapi3/testdata/origin/different_component_same_header.yaml +++ b/openapi3/testdata/origin/different_component_same_header.yaml @@ -16,4 +16,4 @@ components: enum: - option_1 default: option_1 - description: Let's mention the only option, option_1. + description: Let's mention the only option, option_1. \ No newline at end of file diff --git a/openapi3/testdata/origin/different_component_same_parameter.yaml b/openapi3/testdata/origin/different_component_same_parameter.yaml index 7d412b03e..cd946a204 100755 --- a/openapi3/testdata/origin/different_component_same_parameter.yaml +++ b/openapi3/testdata/origin/different_component_same_parameter.yaml @@ -22,4 +22,4 @@ components: enum: - option_1 default: option_1 - description: Let's mention the only option, option_1. + description: Let's mention the only option, option_1. \ No newline at end of file diff --git a/openapi3/testdata/origin/different_component_same_schema.yaml b/openapi3/testdata/origin/different_component_same_schema.yaml index 45f959da4..274e068fd 100755 --- a/openapi3/testdata/origin/different_component_same_schema.yaml +++ b/openapi3/testdata/origin/different_component_same_schema.yaml @@ -7,4 +7,4 @@ components: type: string differentComponentName_B: name: sameParamName - type: string + type: string \ No newline at end of file diff --git a/openapi3/testdata/origin/empty.yaml b/openapi3/testdata/origin/empty.yaml index acf144550..06c7545cd 100644 --- a/openapi3/testdata/origin/empty.yaml +++ b/openapi3/testdata/origin/empty.yaml @@ -2,4 +2,4 @@ openapi: 3.0.1 info: title: Test API version: v1 -paths: +paths: \ No newline at end of file From 020e44bdff0b70b38c6d97f6b4a4fd4bdc50dcd7 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 19 Sep 2024 14:52:58 +0300 Subject: [PATCH 23/31] add tests --- openapi3/origin_test.go | 72 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 3 deletions(-) diff --git a/openapi3/origin_test.go b/openapi3/origin_test.go index f304d3ab1..0fe2232b2 100644 --- a/openapi3/origin_test.go +++ b/openapi3/origin_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" ) -func TestAll(t *testing.T) { +func TestOrigin_All(t *testing.T) { loader := NewLoader() loader.IsExternalRefsAllowed = true loader.IncludeOrigin = true @@ -29,7 +29,73 @@ func TestAll(t *testing.T) { } } -func TestSchemaInAdditionalProperties(t *testing.T) { +func TestOrigin_Info(t *testing.T) { + loader := NewLoader() + loader.IsExternalRefsAllowed = true + loader.IncludeOrigin = true + loader.Context = context.Background() + + doc, err := loader.LoadFromFile("testdata/origin/simple.yaml") + require.NoError(t, err) + + require.NotNil(t, doc.Info.Origin) + require.Equal(t, + &Location{ + Line: 2, + Column: 1, + }, + doc.Info.Origin.Key) + + require.Equal(t, + Location{ + Line: 3, + Column: 3, + }, + doc.Info.Origin.Fields["title"]) + + require.Equal(t, + Location{ + Line: 4, + Column: 3, + }, + doc.Info.Origin.Fields["version"]) +} + +func TestOrigin_Paths(t *testing.T) { + loader := NewLoader() + loader.IsExternalRefsAllowed = true + loader.IncludeOrigin = true + loader.Context = context.Background() + + doc, err := loader.LoadFromFile("testdata/origin/simple.yaml") + require.NoError(t, err) + + require.NotNil(t, doc.Paths.Origin) + require.Equal(t, + &Location{ + Line: 5, + Column: 1, + }, + doc.Paths.Origin.Key) + + require.NotNil(t, doc.Paths.Find("/partner-api/test/another-method").Origin) + require.Equal(t, + &Location{ + Line: 13, + Column: 3, + }, + doc.Paths.Find("/partner-api/test/another-method").Origin.Key) + + require.NotNil(t, doc.Paths.Find("/partner-api/test/another-method").Get.Origin) + require.Equal(t, + &Location{ + Line: 14, + Column: 5, + }, + doc.Paths.Find("/partner-api/test/another-method").Get.Origin.Key) +} + +func TestOrigin_SchemaInAdditionalProperties(t *testing.T) { loader := NewLoader() loader.IsExternalRefsAllowed = true loader.IncludeOrigin = true @@ -57,7 +123,7 @@ func TestSchemaInAdditionalProperties(t *testing.T) { additionalProperties.Schema.Value.Origin.Fields["type"]) } -func TestExternalDocs(t *testing.T) { +func TestOrigin_ExternalDocs(t *testing.T) { loader := NewLoader() loader.IsExternalRefsAllowed = true loader.IncludeOrigin = true From 07a3b25b291c7d19c792cd55d80b532afa194445 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Fri, 20 Sep 2024 22:18:38 +0300 Subject: [PATCH 24/31] rm unused test files --- .../origin/add_new_media_type_base.yaml | 58 -- .../origin/add_new_media_type_revision.yaml | 68 --- .../origin/api_security_added_base.yaml | 32 - .../origin/api_security_added_revision.yaml | 36 -- .../api_security_global_added_base.yaml | 32 - .../api_security_global_added_revision.yaml | 36 -- .../origin/api_security_updated_base.yaml | 44 -- .../origin/api_security_updated_revision.yaml | 43 -- openapi3/testdata/origin/circular1.yaml | 39 -- openapi3/testdata/origin/circular2.yaml | 40 -- openapi3/testdata/origin/circular3.yaml | 25 - .../component_security_updated_base.yaml | 36 -- .../component_security_updated_revision.yaml | 39 -- ...ifferent_component_modified_parameter.yaml | 25 - .../different_component_same_header.yaml | 19 - .../different_component_same_parameter.yaml | 25 - .../different_component_same_schema.yaml | 10 - openapi3/testdata/origin/empty.yaml | 5 - openapi3/testdata/origin/home-iot-api-1.yaml | 573 ------------------ openapi3/testdata/origin/home-iot-api-2.yaml | 573 ------------------ openapi3/testdata/origin/openapi-test1.yaml | 312 ---------- openapi3/testdata/origin/openapi-test2.yaml | 72 --- openapi3/testdata/origin/openapi-test3.yaml | 269 -------- openapi3/testdata/origin/openapi-test4.yaml | 56 -- openapi3/testdata/origin/openapi-test5.yaml | 180 ------ openapi3/testdata/origin/openapi-test6.yaml | 23 - openapi3/testdata/origin/openapi-test7.yaml | 5 - openapi3/testdata/origin/openapi-test701.yaml | 253 -------- openapi3/testdata/origin/openapi-test702.yaml | 313 ---------- openapi3/testdata/origin/openapi-test703.yaml | 330 ---------- openapi3/testdata/origin/openapi-test704.yaml | 332 ---------- openapi3/testdata/origin/openapi-test8.yaml | 17 - openapi3/testdata/origin/openapi31-test1.yaml | 34 -- openapi3/testdata/origin/openapi31-test2.yaml | 35 -- .../origin/operation_id_added_base.yaml | 59 -- .../origin/operation_id_removed_base.yaml | 60 -- .../origin/{simple4.yaml => parameters.yaml} | 0 .../origin/pattern-base-recursive.yaml | 65 -- openapi3/testdata/origin/pattern-base.yaml | 62 -- .../pattern-modified-not-anystring.yaml | 62 -- .../testdata/origin/pattern-modified.yaml | 62 -- .../origin/pattern-parameter-base.yaml | 63 -- ...tern-parameter-modified-not-anystring.yaml | 63 -- .../origin/pattern-parameter-revision.yaml | 62 -- .../origin/pattern-revision-recursive.yaml | 64 -- .../testdata/origin/pattern-revision.yaml | 61 -- .../request_body_became_optional_base.yaml | 60 -- .../request_body_became_required_base.yaml | 60 -- ...quest_body_default_value_changed_base.yaml | 25 - ...t_body_default_value_changed_revision.yaml | 16 - ...equest_body_max_length_decreased_base.yaml | 29 - .../request_body_max_length_set_base.yaml | 16 - .../request_body_max_length_set_revision.yaml | 17 - .../origin/request_body_max_set_base.yaml | 16 - .../origin/request_body_max_set_revision.yaml | 17 - .../request_body_media_type_updated_base.yaml | 59 -- ...uest_body_media_type_updated_revision.yaml | 63 -- ...al_property_write_only_read_only_base.yaml | 23 - .../request_parameter_became_enum_base.yaml | 57 -- ...equest_parameter_became_enum_revision.yaml | 60 -- ..._parameter_default_value_changed_base.yaml | 62 -- ...ameter_default_value_changed_revision.yaml | 62 -- ...est_parameter_enum_value_updated_base.yaml | 20 - ...parameter_enum_value_updated_revision.yaml | 19 - ...equest_parameter_extensible_enum_base.yaml | 60 -- ...st_parameter_extensible_enum_revision.yaml | 59 -- ...uest_parameter_max_items_updated_base.yaml | 61 -- ..._parameter_max_items_updated_revision.yaml | 61 -- ...request_parameter_max_length_set_base.yaml | 15 - ...est_parameter_max_length_set_revision.yaml | 16 - ...est_parameter_max_length_updated_base.yaml | 16 - ...parameter_max_length_updated_revision.yaml | 16 - .../request_parameter_max_updated_base.yaml | 60 -- ...equest_parameter_max_updated_revision.yaml | 60 -- .../request_parameter_min_increased_base.yaml | 58 -- ...uest_parameter_min_increased_revision.yaml | 58 -- ...st_parameter_min_items_increased_base.yaml | 60 -- ...arameter_min_items_increased_revision.yaml | 60 -- ...t_parameter_min_length_increased_base.yaml | 17 - ...rameter_min_length_increased_revision.yaml | 17 - ...rameter_pattern_added_or_changed_base.yaml | 17 - ...ter_pattern_added_or_changed_revision.yaml | 16 - ...ameter_property_type_changed_base_int.yaml | 80 --- ...ameter_property_type_changed_base_num.yaml | 80 --- ...ameter_property_type_changed_revision.yaml | 80 --- .../request_parameter_type_changed_base.yaml | 72 --- .../origin/request_property_added_base.yaml | 21 - .../request_property_added_revision.yaml | 24 - .../request_property_added_revision2.yaml | 26 - .../request_property_added_with_default.yaml | 25 - .../request_property_all_of_added_base.yaml | 49 -- ...equest_property_all_of_added_revision.yaml | 62 -- .../request_property_all_of_removed_base.yaml | 62 -- ...uest_property_all_of_removed_revision.yaml | 49 -- .../request_property_any_of_added_base.yaml | 49 -- ...equest_property_any_of_added_revision.yaml | 62 -- .../request_property_any_of_removed_base.yaml | 62 -- ...uest_property_any_of_removed_revision.yaml | 49 -- ...request_property_became_nullable_base.yaml | 21 - ...est_property_became_nullable_revision.yaml | 22 - ...request_property_became_required_base.yaml | 23 - ...t_property_default_value_changed_base.yaml | 21 - ...est_property_discriminator_added_base.yaml | 51 -- ...riminator_added_property_name_changed.yaml | 61 -- ...property_discriminator_added_revision.yaml | 61 -- ...roperty_discriminator_mapping_changed.yaml | 67 -- ...uest_property_enum_value_updated_base.yaml | 43 -- ...request_property_extensible_enum_base.yaml | 24 - ...est_property_extensible_enum_revision.yaml | 22 - .../request_property_max_decreased_base.yaml | 22 - .../request_property_max_length_set_base.yaml | 21 - ...uest_property_max_length_set_revision.yaml | 22 - .../origin/request_property_max_set_base.yaml | 21 - .../request_property_max_set_revision.yaml | 22 - .../request_property_min_increased_base.yaml | 22 - ...quest_property_min_increased_revision.yaml | 22 - ...est_property_min_items_increased_base.yaml | 21 - ...property_min_items_increased_revision.yaml | 21 - ...st_property_min_length_decreased_base.yaml | 31 - .../request_property_one_of_added_base.yaml | 49 -- ...equest_property_one_of_added_revision.yaml | 62 -- .../request_property_one_of_removed_base.yaml | 62 -- ...uest_property_one_of_removed_revision.yaml | 49 -- ...roperty_pattern_added_or_changed_base.yaml | 25 - ...rty_pattern_added_or_changed_revision.yaml | 25 - .../request_property_type_changed_base.yaml | 24 - ...rty_type_changed_base_array_to_object.yaml | 46 -- ...equest_property_type_changed_revision.yaml | 24 - ...type_changed_revision_array_to_object.yaml | 60 -- .../origin/response-media-type-base.yaml | 490 --------------- .../origin/response-media-type-revision.yaml | 487 --------------- ...sponse_optional_property_removed_base.yaml | 45 -- ...se_optional_property_removed_revision.yaml | 42 -- ...al_property_write_only_read_only_base.yaml | 46 -- ...esponse_pattern_added_or_changed_base.yaml | 50 -- ...nse_pattern_added_or_changed_revision.yaml | 51 -- .../response_property_all_of_added_base.yaml | 47 -- ...sponse_property_all_of_added_revision.yaml | 60 -- ...response_property_all_of_removed_base.yaml | 60 -- ...onse_property_all_of_removed_revision.yaml | 47 -- .../response_property_any_of_added_base.yaml | 47 -- ...sponse_property_any_of_added_revision.yaml | 60 -- ...response_property_any_of_complex_base.yaml | 50 -- ...onse_property_any_of_complex_revision.yaml | 56 -- ...response_property_any_of_removed_base.yaml | 60 -- ...onse_property_any_of_removed_revision.yaml | 47 -- ...esponse_property_became_optional_base.yaml | 49 -- ...nse_property_became_optional_revision.yaml | 43 -- ...e_property_default_value_changed_base.yaml | 56 -- ...operty_default_value_changed_revision.yaml | 56 -- ...nse_property_discriminator_added_base.yaml | 52 -- ...riminator_added_property_name_changed.yaml | 62 -- ...property_discriminator_added_revision.yaml | 62 -- ...roperty_discriminator_mapping_changed.yaml | 68 --- .../response_property_enum_added_base.yaml | 56 -- .../response_property_one_of_added_base.yaml | 61 -- ...sponse_property_one_of_added_revision.yaml | 79 --- ...response_property_one_of_removed_base.yaml | 79 --- ...onse_property_one_of_removed_revision.yaml | 61 -- ...response_required_property_added_base.yaml | 45 -- ...onse_required_property_added_revision.yaml | 48 -- ...ed_property_write_only_read_only_base.yaml | 50 -- .../response_schema_format_changed_base.yaml | 46 -- .../response_schema_type_changed_base.yaml | 29 - ...response_schema_type_changed_revision.yaml | 45 -- .../testdata/origin/response_status_base.yaml | 58 -- openapi3/testdata/origin/simple1.yaml | 10 - openapi3/testdata/origin/simple2.yaml | 10 - openapi3/testdata/origin/simple3.yaml | 14 - openapi3/testdata/origin/simple5.yaml | 19 - openapi3/testdata/origin/tag_added_base.yaml | 58 -- .../testdata/origin/tag_removed_base.yaml | 60 -- 172 files changed, 11020 deletions(-) delete mode 100644 openapi3/testdata/origin/add_new_media_type_base.yaml delete mode 100644 openapi3/testdata/origin/add_new_media_type_revision.yaml delete mode 100644 openapi3/testdata/origin/api_security_added_base.yaml delete mode 100644 openapi3/testdata/origin/api_security_added_revision.yaml delete mode 100644 openapi3/testdata/origin/api_security_global_added_base.yaml delete mode 100644 openapi3/testdata/origin/api_security_global_added_revision.yaml delete mode 100644 openapi3/testdata/origin/api_security_updated_base.yaml delete mode 100644 openapi3/testdata/origin/api_security_updated_revision.yaml delete mode 100644 openapi3/testdata/origin/circular1.yaml delete mode 100644 openapi3/testdata/origin/circular2.yaml delete mode 100644 openapi3/testdata/origin/circular3.yaml delete mode 100644 openapi3/testdata/origin/component_security_updated_base.yaml delete mode 100644 openapi3/testdata/origin/component_security_updated_revision.yaml delete mode 100755 openapi3/testdata/origin/different_component_modified_parameter.yaml delete mode 100755 openapi3/testdata/origin/different_component_same_header.yaml delete mode 100755 openapi3/testdata/origin/different_component_same_parameter.yaml delete mode 100755 openapi3/testdata/origin/different_component_same_schema.yaml delete mode 100644 openapi3/testdata/origin/empty.yaml delete mode 100644 openapi3/testdata/origin/home-iot-api-1.yaml delete mode 100644 openapi3/testdata/origin/home-iot-api-2.yaml delete mode 100644 openapi3/testdata/origin/openapi-test1.yaml delete mode 100644 openapi3/testdata/origin/openapi-test2.yaml delete mode 100644 openapi3/testdata/origin/openapi-test3.yaml delete mode 100644 openapi3/testdata/origin/openapi-test4.yaml delete mode 100644 openapi3/testdata/origin/openapi-test5.yaml delete mode 100644 openapi3/testdata/origin/openapi-test6.yaml delete mode 100644 openapi3/testdata/origin/openapi-test7.yaml delete mode 100644 openapi3/testdata/origin/openapi-test701.yaml delete mode 100644 openapi3/testdata/origin/openapi-test702.yaml delete mode 100644 openapi3/testdata/origin/openapi-test703.yaml delete mode 100644 openapi3/testdata/origin/openapi-test704.yaml delete mode 100644 openapi3/testdata/origin/openapi-test8.yaml delete mode 100644 openapi3/testdata/origin/openapi31-test1.yaml delete mode 100644 openapi3/testdata/origin/openapi31-test2.yaml delete mode 100644 openapi3/testdata/origin/operation_id_added_base.yaml delete mode 100644 openapi3/testdata/origin/operation_id_removed_base.yaml rename openapi3/testdata/origin/{simple4.yaml => parameters.yaml} (100%) delete mode 100644 openapi3/testdata/origin/pattern-base-recursive.yaml delete mode 100644 openapi3/testdata/origin/pattern-base.yaml delete mode 100644 openapi3/testdata/origin/pattern-modified-not-anystring.yaml delete mode 100644 openapi3/testdata/origin/pattern-modified.yaml delete mode 100644 openapi3/testdata/origin/pattern-parameter-base.yaml delete mode 100644 openapi3/testdata/origin/pattern-parameter-modified-not-anystring.yaml delete mode 100644 openapi3/testdata/origin/pattern-parameter-revision.yaml delete mode 100644 openapi3/testdata/origin/pattern-revision-recursive.yaml delete mode 100644 openapi3/testdata/origin/pattern-revision.yaml delete mode 100644 openapi3/testdata/origin/request_body_became_optional_base.yaml delete mode 100644 openapi3/testdata/origin/request_body_became_required_base.yaml delete mode 100644 openapi3/testdata/origin/request_body_default_value_changed_base.yaml delete mode 100644 openapi3/testdata/origin/request_body_default_value_changed_revision.yaml delete mode 100644 openapi3/testdata/origin/request_body_max_length_decreased_base.yaml delete mode 100644 openapi3/testdata/origin/request_body_max_length_set_base.yaml delete mode 100644 openapi3/testdata/origin/request_body_max_length_set_revision.yaml delete mode 100644 openapi3/testdata/origin/request_body_max_set_base.yaml delete mode 100644 openapi3/testdata/origin/request_body_max_set_revision.yaml delete mode 100644 openapi3/testdata/origin/request_body_media_type_updated_base.yaml delete mode 100644 openapi3/testdata/origin/request_body_media_type_updated_revision.yaml delete mode 100644 openapi3/testdata/origin/request_optional_property_write_only_read_only_base.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_became_enum_base.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_became_enum_revision.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_default_value_changed_base.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_default_value_changed_revision.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_enum_value_updated_base.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_enum_value_updated_revision.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_extensible_enum_base.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_extensible_enum_revision.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_max_items_updated_base.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_max_items_updated_revision.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_max_length_set_base.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_max_length_set_revision.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_max_length_updated_base.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_max_length_updated_revision.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_max_updated_base.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_max_updated_revision.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_min_increased_base.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_min_increased_revision.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_min_items_increased_base.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_min_items_increased_revision.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_min_length_increased_base.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_min_length_increased_revision.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_pattern_added_or_changed_base.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_pattern_added_or_changed_revision.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_property_type_changed_base_int.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_property_type_changed_base_num.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_property_type_changed_revision.yaml delete mode 100644 openapi3/testdata/origin/request_parameter_type_changed_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_added_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_added_revision.yaml delete mode 100644 openapi3/testdata/origin/request_property_added_revision2.yaml delete mode 100644 openapi3/testdata/origin/request_property_added_with_default.yaml delete mode 100644 openapi3/testdata/origin/request_property_all_of_added_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_all_of_added_revision.yaml delete mode 100644 openapi3/testdata/origin/request_property_all_of_removed_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_all_of_removed_revision.yaml delete mode 100644 openapi3/testdata/origin/request_property_any_of_added_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_any_of_added_revision.yaml delete mode 100644 openapi3/testdata/origin/request_property_any_of_removed_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_any_of_removed_revision.yaml delete mode 100644 openapi3/testdata/origin/request_property_became_nullable_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_became_nullable_revision.yaml delete mode 100644 openapi3/testdata/origin/request_property_became_required_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_default_value_changed_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_discriminator_added_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_discriminator_added_property_name_changed.yaml delete mode 100644 openapi3/testdata/origin/request_property_discriminator_added_revision.yaml delete mode 100644 openapi3/testdata/origin/request_property_discriminator_mapping_changed.yaml delete mode 100644 openapi3/testdata/origin/request_property_enum_value_updated_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_extensible_enum_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_extensible_enum_revision.yaml delete mode 100644 openapi3/testdata/origin/request_property_max_decreased_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_max_length_set_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_max_length_set_revision.yaml delete mode 100644 openapi3/testdata/origin/request_property_max_set_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_max_set_revision.yaml delete mode 100644 openapi3/testdata/origin/request_property_min_increased_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_min_increased_revision.yaml delete mode 100644 openapi3/testdata/origin/request_property_min_items_increased_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_min_items_increased_revision.yaml delete mode 100644 openapi3/testdata/origin/request_property_min_length_decreased_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_one_of_added_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_one_of_added_revision.yaml delete mode 100644 openapi3/testdata/origin/request_property_one_of_removed_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_one_of_removed_revision.yaml delete mode 100644 openapi3/testdata/origin/request_property_pattern_added_or_changed_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_pattern_added_or_changed_revision.yaml delete mode 100644 openapi3/testdata/origin/request_property_type_changed_base.yaml delete mode 100644 openapi3/testdata/origin/request_property_type_changed_base_array_to_object.yaml delete mode 100644 openapi3/testdata/origin/request_property_type_changed_revision.yaml delete mode 100644 openapi3/testdata/origin/request_property_type_changed_revision_array_to_object.yaml delete mode 100644 openapi3/testdata/origin/response-media-type-base.yaml delete mode 100644 openapi3/testdata/origin/response-media-type-revision.yaml delete mode 100644 openapi3/testdata/origin/response_optional_property_removed_base.yaml delete mode 100644 openapi3/testdata/origin/response_optional_property_removed_revision.yaml delete mode 100644 openapi3/testdata/origin/response_optional_property_write_only_read_only_base.yaml delete mode 100644 openapi3/testdata/origin/response_pattern_added_or_changed_base.yaml delete mode 100644 openapi3/testdata/origin/response_pattern_added_or_changed_revision.yaml delete mode 100644 openapi3/testdata/origin/response_property_all_of_added_base.yaml delete mode 100644 openapi3/testdata/origin/response_property_all_of_added_revision.yaml delete mode 100644 openapi3/testdata/origin/response_property_all_of_removed_base.yaml delete mode 100644 openapi3/testdata/origin/response_property_all_of_removed_revision.yaml delete mode 100644 openapi3/testdata/origin/response_property_any_of_added_base.yaml delete mode 100644 openapi3/testdata/origin/response_property_any_of_added_revision.yaml delete mode 100644 openapi3/testdata/origin/response_property_any_of_complex_base.yaml delete mode 100644 openapi3/testdata/origin/response_property_any_of_complex_revision.yaml delete mode 100644 openapi3/testdata/origin/response_property_any_of_removed_base.yaml delete mode 100644 openapi3/testdata/origin/response_property_any_of_removed_revision.yaml delete mode 100644 openapi3/testdata/origin/response_property_became_optional_base.yaml delete mode 100644 openapi3/testdata/origin/response_property_became_optional_revision.yaml delete mode 100644 openapi3/testdata/origin/response_property_default_value_changed_base.yaml delete mode 100644 openapi3/testdata/origin/response_property_default_value_changed_revision.yaml delete mode 100644 openapi3/testdata/origin/response_property_discriminator_added_base.yaml delete mode 100644 openapi3/testdata/origin/response_property_discriminator_added_property_name_changed.yaml delete mode 100644 openapi3/testdata/origin/response_property_discriminator_added_revision.yaml delete mode 100644 openapi3/testdata/origin/response_property_discriminator_mapping_changed.yaml delete mode 100644 openapi3/testdata/origin/response_property_enum_added_base.yaml delete mode 100644 openapi3/testdata/origin/response_property_one_of_added_base.yaml delete mode 100644 openapi3/testdata/origin/response_property_one_of_added_revision.yaml delete mode 100644 openapi3/testdata/origin/response_property_one_of_removed_base.yaml delete mode 100644 openapi3/testdata/origin/response_property_one_of_removed_revision.yaml delete mode 100644 openapi3/testdata/origin/response_required_property_added_base.yaml delete mode 100644 openapi3/testdata/origin/response_required_property_added_revision.yaml delete mode 100644 openapi3/testdata/origin/response_required_property_write_only_read_only_base.yaml delete mode 100644 openapi3/testdata/origin/response_schema_format_changed_base.yaml delete mode 100644 openapi3/testdata/origin/response_schema_type_changed_base.yaml delete mode 100644 openapi3/testdata/origin/response_schema_type_changed_revision.yaml delete mode 100644 openapi3/testdata/origin/response_status_base.yaml delete mode 100644 openapi3/testdata/origin/simple1.yaml delete mode 100644 openapi3/testdata/origin/simple2.yaml delete mode 100644 openapi3/testdata/origin/simple3.yaml delete mode 100644 openapi3/testdata/origin/simple5.yaml delete mode 100644 openapi3/testdata/origin/tag_added_base.yaml delete mode 100644 openapi3/testdata/origin/tag_removed_base.yaml diff --git a/openapi3/testdata/origin/add_new_media_type_base.yaml b/openapi3/testdata/origin/add_new_media_type_base.yaml deleted file mode 100644 index 2740e8a2b..000000000 --- a/openapi3/testdata/origin/add_new_media_type_base.yaml +++ /dev/null @@ -1,58 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/add_new_media_type_revision.yaml b/openapi3/testdata/origin/add_new_media_type_revision.yaml deleted file mode 100644 index ec60a3bc1..000000000 --- a/openapi3/testdata/origin/add_new_media_type_revision.yaml +++ /dev/null @@ -1,68 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - application/xml: # Another media type - schema: - type: object - properties: - id: - type: integer - name: - type: string - fullTime: - type: boolean - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_added_base.yaml b/openapi3/testdata/origin/api_security_added_base.yaml deleted file mode 100644 index 91ba7591d..000000000 --- a/openapi3/testdata/origin/api_security_added_base.yaml +++ /dev/null @@ -1,32 +0,0 @@ -openapi: 3.0.0 -info: - title: Security Requirement Example - version: 1.0.0 -paths: - /subscribe: - post: - requestBody: - content: - application/json: - schema: - type: object - properties: - inProgressUrl: - type: string - failedUrl: - type: string - successUrl: - type: string - responses: - "200": - description: OK -components: - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: http://example.org/api/oauth/dialog - scopes: - write:pets: modify pets in your account - read:pets: read your pets \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_added_revision.yaml b/openapi3/testdata/origin/api_security_added_revision.yaml deleted file mode 100644 index 178e702dd..000000000 --- a/openapi3/testdata/origin/api_security_added_revision.yaml +++ /dev/null @@ -1,36 +0,0 @@ -openapi: 3.0.0 -info: - title: Security Requirement Example - version: 1.0.0 -paths: - /subscribe: - post: - requestBody: - content: - application/json: - schema: - type: object - properties: - inProgressUrl: - type: string - failedUrl: - type: string - successUrl: - type: string - responses: - "200": - description: OK - security: - - petstore_auth: - - write:pets - - read:pets -components: - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: http://example.org/api/oauth/dialog - scopes: - write:pets: modify pets in your account - read:pets: read your pets \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_global_added_base.yaml b/openapi3/testdata/origin/api_security_global_added_base.yaml deleted file mode 100644 index 91ba7591d..000000000 --- a/openapi3/testdata/origin/api_security_global_added_base.yaml +++ /dev/null @@ -1,32 +0,0 @@ -openapi: 3.0.0 -info: - title: Security Requirement Example - version: 1.0.0 -paths: - /subscribe: - post: - requestBody: - content: - application/json: - schema: - type: object - properties: - inProgressUrl: - type: string - failedUrl: - type: string - successUrl: - type: string - responses: - "200": - description: OK -components: - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: http://example.org/api/oauth/dialog - scopes: - write:pets: modify pets in your account - read:pets: read your pets \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_global_added_revision.yaml b/openapi3/testdata/origin/api_security_global_added_revision.yaml deleted file mode 100644 index 8412ee5f4..000000000 --- a/openapi3/testdata/origin/api_security_global_added_revision.yaml +++ /dev/null @@ -1,36 +0,0 @@ -openapi: 3.0.0 -info: - title: Security Requirement Example - version: 1.0.0 -security: -- petstore_auth: - - write:pets - - read:pets -paths: - /subscribe: - post: - requestBody: - content: - application/json: - schema: - type: object - properties: - inProgressUrl: - type: string - failedUrl: - type: string - successUrl: - type: string - responses: - "200": - description: OK -components: - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: http://example.org/api/oauth/dialog - scopes: - write:pets: modify pets in your account - read:pets: read your pets \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_updated_base.yaml b/openapi3/testdata/origin/api_security_updated_base.yaml deleted file mode 100644 index 0ff8d7dc5..000000000 --- a/openapi3/testdata/origin/api_security_updated_base.yaml +++ /dev/null @@ -1,44 +0,0 @@ -openapi: 3.0.0 -info: - title: Security Requirement Example - version: 1.0.0 -paths: - /subscribe: - post: - requestBody: - content: - application/json: - schema: - type: object - properties: - inProgressUrl: - type: string - failedUrl: - type: string - successUrl: - type: string - responses: - "200": - description: OK - security: - - petstore_auth: - - write:pets - - read:pets -components: - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: http://example.org/api/oauth/dialog - scopes: - write:pets: modify pets in your account - read:pets: read your pets - catstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: http://example.org/api/oauth/dialog - scopes: - write:pets: modify pets in your account - read:pets: read your pets \ No newline at end of file diff --git a/openapi3/testdata/origin/api_security_updated_revision.yaml b/openapi3/testdata/origin/api_security_updated_revision.yaml deleted file mode 100644 index d53dba3a4..000000000 --- a/openapi3/testdata/origin/api_security_updated_revision.yaml +++ /dev/null @@ -1,43 +0,0 @@ -openapi: 3.0.0 -info: - title: Security Requirement Example - version: 1.0.0 -paths: - /subscribe: - post: - requestBody: - content: - application/json: - schema: - type: object - properties: - inProgressUrl: - type: string - failedUrl: - type: string - successUrl: - type: string - responses: - "200": - description: OK - security: - - petstore_auth: - - write:pets -components: - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: http://example.org/api/oauth/dialog - scopes: - write:pets: modify pets in your account - read:pets: read your pets - catstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: http://example.org/api/oauth/dialog - scopes: - write:pets: modify pets in your account - read:pets: read your pets \ No newline at end of file diff --git a/openapi3/testdata/origin/circular1.yaml b/openapi3/testdata/origin/circular1.yaml deleted file mode 100644 index d8c441c18..000000000 --- a/openapi3/testdata/origin/circular1.yaml +++ /dev/null @@ -1,39 +0,0 @@ -openapi: 3.0.1 -info: - title: Circular Schema - version: v1 -paths: - /test: - post: - responses: - '200': - description: Success - content: - application/json: - schema: - $ref: '#/components/schemas/circular1' -components: - schemas: - circular1: - type: object - properties: - children: - type: array - items: - type: object - circular2: - oneOf: - - $ref: '#/components/schemas/circular2' - circular3: - oneOf: - - $ref: '#/components/schemas/circular3' - circular4: - oneOf: - - oneOf: - - $ref: '#/components/schemas/circular4' - circular5: - oneOf: - - $ref: '#/components/schemas/circular1' - circular6: - oneOf: - - $ref: '#/components/schemas/circular6' \ No newline at end of file diff --git a/openapi3/testdata/origin/circular2.yaml b/openapi3/testdata/origin/circular2.yaml deleted file mode 100644 index fcbaf5b79..000000000 --- a/openapi3/testdata/origin/circular2.yaml +++ /dev/null @@ -1,40 +0,0 @@ -openapi: 3.0.1 -info: - title: Circular Schema - version: v1 -paths: - /test: - post: - responses: - '200': - description: Success - content: - application/json: - schema: - $ref: '#/components/schemas/circular1' -components: - schemas: - circular1: - type: object - properties: - children: - type: array - items: - $ref: '#/components/schemas/circular1' - circular2: - oneOf: - - $ref: '#/components/schemas/circular2' - circular3: - oneOf: - - $ref: '#/components/schemas/circular2' - circular4: - oneOf: - - oneOf: - - $ref: '#/components/schemas/circular4' - circular5: - oneOf: - - $ref: '#/components/schemas/circular1' - circular6: - oneOf: - - $ref: '#/components/schemas/circular6' - - $ref: '#/components/schemas/circular1' \ No newline at end of file diff --git a/openapi3/testdata/origin/circular3.yaml b/openapi3/testdata/origin/circular3.yaml deleted file mode 100644 index f5e201175..000000000 --- a/openapi3/testdata/origin/circular3.yaml +++ /dev/null @@ -1,25 +0,0 @@ -openapi: 3.0.1 -info: - title: Circular Schema - version: v1 -paths: - /test: - post: - responses: - '200': - description: Success - content: - application/json: - schema: - $ref: '#/components/schemas/circular1' -components: - schemas: - circular1: - oneOf: - - $ref: '#/components/schemas/circular2' - circular2: - oneOf: - - $ref: '#/components/schemas/circular3' - circular3: - oneOf: - - $ref: '#/components/schemas/circular1' \ No newline at end of file diff --git a/openapi3/testdata/origin/component_security_updated_base.yaml b/openapi3/testdata/origin/component_security_updated_base.yaml deleted file mode 100644 index 178e702dd..000000000 --- a/openapi3/testdata/origin/component_security_updated_base.yaml +++ /dev/null @@ -1,36 +0,0 @@ -openapi: 3.0.0 -info: - title: Security Requirement Example - version: 1.0.0 -paths: - /subscribe: - post: - requestBody: - content: - application/json: - schema: - type: object - properties: - inProgressUrl: - type: string - failedUrl: - type: string - successUrl: - type: string - responses: - "200": - description: OK - security: - - petstore_auth: - - write:pets - - read:pets -components: - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: http://example.org/api/oauth/dialog - scopes: - write:pets: modify pets in your account - read:pets: read your pets \ No newline at end of file diff --git a/openapi3/testdata/origin/component_security_updated_revision.yaml b/openapi3/testdata/origin/component_security_updated_revision.yaml deleted file mode 100644 index cd5438d51..000000000 --- a/openapi3/testdata/origin/component_security_updated_revision.yaml +++ /dev/null @@ -1,39 +0,0 @@ -openapi: 3.0.0 -info: - title: Security Requirement Example - version: 1.0.0 -paths: - /subscribe: - post: - requestBody: - content: - application/json: - schema: - type: object - properties: - inProgressUrl: - type: string - failedUrl: - type: string - successUrl: - type: string - responses: - "200": - description: OK - security: - - petstore_auth: - - write:pets - - read:pets -components: - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: http://example.org/api/oauth/dialog - scopes: - write:pets: modify pets in your account - read:pets: read your pets - BasicAuth: - type: http - scheme: basic \ No newline at end of file diff --git a/openapi3/testdata/origin/different_component_modified_parameter.yaml b/openapi3/testdata/origin/different_component_modified_parameter.yaml deleted file mode 100755 index 22e2f6ec0..000000000 --- a/openapi3/testdata/origin/different_component_modified_parameter.yaml +++ /dev/null @@ -1,25 +0,0 @@ -openapi: 3.0.3 - -components: - parameters: - differentComponentName_A: - name: sameParamName - in: query - required: true - schema: - type: string - enum: - - option_1 - - option_2 - default: option_1 - description: Let's mention both options, option_1 and option_2. - differentComponentName_B: - name: sameParamName - in: query - required: false - schema: - type: string - enum: - - option_1 - default: option_1 - description: Let's mention the only option, option_1. \ No newline at end of file diff --git a/openapi3/testdata/origin/different_component_same_header.yaml b/openapi3/testdata/origin/different_component_same_header.yaml deleted file mode 100755 index 40dc02702..000000000 --- a/openapi3/testdata/origin/different_component_same_header.yaml +++ /dev/null @@ -1,19 +0,0 @@ -openapi: 3.0.3 - -components: - headers: - differentComponentName_A: - schema: - type: string - enum: - - option_1 - - option_2 - default: option_1 - description: Let's mention both options, option_1 and option_2. - differentComponentName_B: - schema: - type: string - enum: - - option_1 - default: option_1 - description: Let's mention the only option, option_1. \ No newline at end of file diff --git a/openapi3/testdata/origin/different_component_same_parameter.yaml b/openapi3/testdata/origin/different_component_same_parameter.yaml deleted file mode 100755 index cd946a204..000000000 --- a/openapi3/testdata/origin/different_component_same_parameter.yaml +++ /dev/null @@ -1,25 +0,0 @@ -openapi: 3.0.3 - -components: - parameters: - differentComponentName_A: - name: sameParamName - in: header - required: true - schema: - type: string - enum: - - option_1 - - option_2 - default: option_1 - description: Let's mention both options, option_1 and option_2. - differentComponentName_B: - name: sameParamName - in: query - required: false - schema: - type: string - enum: - - option_1 - default: option_1 - description: Let's mention the only option, option_1. \ No newline at end of file diff --git a/openapi3/testdata/origin/different_component_same_schema.yaml b/openapi3/testdata/origin/different_component_same_schema.yaml deleted file mode 100755 index 274e068fd..000000000 --- a/openapi3/testdata/origin/different_component_same_schema.yaml +++ /dev/null @@ -1,10 +0,0 @@ -openapi: 3.0.3 - -components: - schemas: - differentComponentName_A: - name: sameParamName - type: string - differentComponentName_B: - name: sameParamName - type: string \ No newline at end of file diff --git a/openapi3/testdata/origin/empty.yaml b/openapi3/testdata/origin/empty.yaml deleted file mode 100644 index 06c7545cd..000000000 --- a/openapi3/testdata/origin/empty.yaml +++ /dev/null @@ -1,5 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: v1 -paths: \ No newline at end of file diff --git a/openapi3/testdata/origin/home-iot-api-1.yaml b/openapi3/testdata/origin/home-iot-api-1.yaml deleted file mode 100644 index 87c40832a..000000000 --- a/openapi3/testdata/origin/home-iot-api-1.yaml +++ /dev/null @@ -1,573 +0,0 @@ -openapi: 3.0.0 -servers: - # Added by API Auto Mocking Plugin - - description: SwaggerHub API Auto Mocking - url: https://virtserver.swaggerhub.com/home4984/API/1.0.0 -info: - version: "1.0.0" - title: home-iot-api - description: The API for the EatBacon IOT project -paths: - /devices: - get: - tags: - - Device - description: returns all registered devices - operationId: getDevices - parameters: - - in: query - name: skip - description: number of records to skip - schema: - type: integer - format: int32 - - in: query - name: limit - description: max number of records to return - schema: - type: integer - format: int32 - responses: - '200': - description: All the devices - content: - application/json: - schema: - type: array - items: - type: string - format: uri - example: 'http://10.0.0.225:8080' - post: - tags: - - Device - operationId: register - responses: - '200': - description: successfully registered device - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DeviceRegistrationInfo' - '/lighting/dimmers/{deviceId}/{value}': - post: - tags: - - Z-Wave - operationId: setDimmer - parameters: - - name: deviceId - in: path - required: true - schema: - type: string - - name: value - in: path - required: true - schema: - type: integer - format: int32 - minimum: 0 - maximum: 100 - responses: - '200': - description: response - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - x-swagger-router-controller: ZWave - '/lighting/dimmers/{deviceId}/{value}/timer/{timeunit}': - post: - tags: - - Z-Wave - description: sets a dimmer to a specific value on a timer - operationId: setDimmerTimer - parameters: - - name: deviceId - in: path - required: true - schema: - type: string - - name: value - in: path - required: true - schema: - type: integer - format: int32 - - name: timeunit - in: path - required: true - schema: - type: integer - format: int32 - - name: units - in: query - required: false - schema: - type: string - enum: - - seconds - - minutes - - milliseconds - default: milliseconds - responses: - '200': - description: response - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - x-swagger-router-controller: ZWave - '/lighting/switches/{deviceId}': - get: - tags: - - Z-Wave - operationId: getSwitchState - parameters: - - name: deviceId - in: path - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - $ref: '#/components/schemas/DeviceState' - x-swagger-router-controller: ZWave - '/lighting/switches/{deviceId}/{value}': - post: - tags: - - Z-Wave - operationId: setSwitch - parameters: - - name: deviceId - in: path - required: true - schema: - type: string - - name: value - in: path - required: true - schema: - type: string - enum: - - true - - false - responses: - '200': - description: response - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - x-swagger-router-controller: ZWave - '/lighting/switches/{deviceId}/{value}/timer/{minutes}': - post: - tags: - - Z-Wave - description: sets a switch to a specific value on a timer - operationId: setSwitchTimer - parameters: - - name: deviceId - in: path - required: true - schema: - type: string - - name: value - in: path - required: true - schema: - type: string - enum: - - true - - false - - name: minutes - in: path - required: true - schema: - type: integer - format: int32 - responses: - '200': - description: response - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - x-swagger-router-controller: ZWave - /lightingSummary: - get: - tags: - - Z-Wave - operationId: getLightingSummary - responses: - '200': - description: ok - content: - application/json: - schema: - $ref: '#/components/schemas/LightingSummary' - x-swagger-router-controller: ZWave - /temperature: - get: - tags: - - Environment - operationId: temperatureSummary - responses: - '200': - description: ok - content: - application/json: - schema: - $ref: '#/components/schemas/TemperatureSummary' - x-swagger-router-controller: Environment - '/temperature/forecast/{days}': - get: - tags: - - Environment - operationId: getForecast - parameters: - - name: days - in: path - required: true - schema: - type: integer - format: int32 - responses: - '200': - description: the forecast - content: - application/json: - schema: - $ref: '#/components/schemas/ForecastResponse' - x-swagger-router-controller: Environment - '/temperature/{zoneId}': - get: - tags: - - Environment - operationId: getZoneTemperature - parameters: - - name: zoneId - in: path - required: true - schema: - type: string - responses: - '200': - description: Zone temperature - content: - application/json: - schema: - $ref: '#/components/schemas/TemperatueZoneStatus' - x-swagger-router-controller: Environment - '/temperature/{zoneId}/heater': - get: - tags: - - Environment - description: gets the state of the heater - operationId: getHeaterState - parameters: - - name: zoneId - in: path - required: true - schema: - type: string - responses: - '200': - description: heater state - content: - application/json: - schema: - $ref: '#/components/schemas/HeaterState' - x-swagger-router-controller: Environment - '/temperature/{zoneId}/heater/{state}': - post: - tags: - - Environment - description: turns the heater on or off - operationId: setHeaterState - parameters: - - name: zoneId - in: path - required: true - schema: - type: string - - name: state - in: path - required: true - schema: - type: string - enum: - - false - - true - responses: - '200': - description: Status of the operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - x-swagger-router-controller: Environment - /zones: - get: - tags: - - Zones - operationId: getZones - responses: - '200': - description: ok - content: - application/json: - schema: - type: array - items: - type: string - x-swagger-router-controller: Zones - '/zones/{zoneId}/quiet': - get: - tags: - - Zones - operationId: quietZone - parameters: - - name: zoneId - in: path - required: true - schema: - type: string - enum: - - basement - - x: - reuven - - second-floor - responses: - '200': - description: ok - x-swagger-router-controller: Zones -components: - schemas: - LightingSummary: - type: object - properties: - zones: - type: array - items: - $ref: '#/components/schemas/LightingZone' - zoneStatus: - type: array - items: - $ref: '#/components/schemas/LightingZoneStatus' - description: ok - LightingZone: - type: object - properties: - id: - type: string - name: - type: string - deviceId: - type: integer - format: int32 - deviceType: - type: string - enum: - - dimmer - - switch - zone: - type: string - LightingZoneStatus: - type: object - properties: - id: - type: string - name: - type: string - lastUpdate: - type: string - format: date-time - level: - type: integer - format: int32 - description: the status of the lighting zone. - TemperatureSummary: - type: object - properties: - zones: - type: array - items: - $ref: '#/components/schemas/TemperatureZone' - zoneStatus: - type: array - items: - $ref: '#/components/schemas/TemperatueZoneStatus' - description: ok - TemperatureZone: - type: object - required: - - id - - name - properties: - id: - type: integer - format: int32 - description: the unique identifier for the zone - name: - type: string - inputPosition: - type: integer - format: int32 - outputPosition: - type: integer - format: int32 - zone: - type: string - description: a single temperature zone - TemperatueZoneStatus: - type: object - required: - - id - - timestamp - - value - properties: - id: - type: string - description: the unique identifier for the zone - name: - type: string - description: the name of the zone - value: - type: number - format: double - description: the temperature in the zone - units: - type: string - description: the temperature units - enum: - - celsius - - fahrenheit - default: fahrenheit - timestamp: - type: string - format: date-time - description: the timestamp when the temperature was measured - description: status of a single zone - ApiResponse: - type: object - properties: - code: - type: integer - format: int32 - message: - type: number - example: everything is ok - HeaterState: - type: object - properties: - id: - type: string - state: - type: string - DeviceState: - type: object - properties: - id: - type: string - name: - type: string - lastUpdate: - type: string - format: date-time - level: - type: integer - format: int32 - ForecastResponse: - type: object - properties: - city: - $ref: '#/components/schemas/City' - values: - type: array - items: - $ref: '#/components/schemas/Forecast' - Forecast: - type: object - properties: - date: - type: string - format: date-time - pressure: - type: number - format: double - humidity: - type: integer - format: int32 - windSpeed: - type: number - format: double - clouds: - type: integer - format: int32 - temperature: - $ref: '#/components/schemas/ForecastTemperature' - weather: - $ref: '#/components/schemas/WeatherForecast' - City: - type: object - properties: - id: - type: integer - format: int64 - name: - type: string - lat: - type: number - format: double - lon: - type: number - format: double - country: - type: string - ForecastTemperature: - type: object - properties: - low: - type: number - format: double - high: - type: number - format: double - morning: - type: number - format: double - day: - type: number - format: double - evening: - type: number - format: double - night: - type: number - format: double - WeatherForecast: - type: object - properties: - summary: - type: string - description: - type: string - icon: - type: string - DeviceRegistrationInfo: - type: object - properties: - uri: - type: string - format: uri - example: 'http://10.0.0.221:8080' - id: - type: string - format: uuid - example: 0729a580-2240-11e6-9eb5-0002a5d5c51b \ No newline at end of file diff --git a/openapi3/testdata/origin/home-iot-api-2.yaml b/openapi3/testdata/origin/home-iot-api-2.yaml deleted file mode 100644 index 87c40832a..000000000 --- a/openapi3/testdata/origin/home-iot-api-2.yaml +++ /dev/null @@ -1,573 +0,0 @@ -openapi: 3.0.0 -servers: - # Added by API Auto Mocking Plugin - - description: SwaggerHub API Auto Mocking - url: https://virtserver.swaggerhub.com/home4984/API/1.0.0 -info: - version: "1.0.0" - title: home-iot-api - description: The API for the EatBacon IOT project -paths: - /devices: - get: - tags: - - Device - description: returns all registered devices - operationId: getDevices - parameters: - - in: query - name: skip - description: number of records to skip - schema: - type: integer - format: int32 - - in: query - name: limit - description: max number of records to return - schema: - type: integer - format: int32 - responses: - '200': - description: All the devices - content: - application/json: - schema: - type: array - items: - type: string - format: uri - example: 'http://10.0.0.225:8080' - post: - tags: - - Device - operationId: register - responses: - '200': - description: successfully registered device - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DeviceRegistrationInfo' - '/lighting/dimmers/{deviceId}/{value}': - post: - tags: - - Z-Wave - operationId: setDimmer - parameters: - - name: deviceId - in: path - required: true - schema: - type: string - - name: value - in: path - required: true - schema: - type: integer - format: int32 - minimum: 0 - maximum: 100 - responses: - '200': - description: response - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - x-swagger-router-controller: ZWave - '/lighting/dimmers/{deviceId}/{value}/timer/{timeunit}': - post: - tags: - - Z-Wave - description: sets a dimmer to a specific value on a timer - operationId: setDimmerTimer - parameters: - - name: deviceId - in: path - required: true - schema: - type: string - - name: value - in: path - required: true - schema: - type: integer - format: int32 - - name: timeunit - in: path - required: true - schema: - type: integer - format: int32 - - name: units - in: query - required: false - schema: - type: string - enum: - - seconds - - minutes - - milliseconds - default: milliseconds - responses: - '200': - description: response - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - x-swagger-router-controller: ZWave - '/lighting/switches/{deviceId}': - get: - tags: - - Z-Wave - operationId: getSwitchState - parameters: - - name: deviceId - in: path - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - $ref: '#/components/schemas/DeviceState' - x-swagger-router-controller: ZWave - '/lighting/switches/{deviceId}/{value}': - post: - tags: - - Z-Wave - operationId: setSwitch - parameters: - - name: deviceId - in: path - required: true - schema: - type: string - - name: value - in: path - required: true - schema: - type: string - enum: - - true - - false - responses: - '200': - description: response - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - x-swagger-router-controller: ZWave - '/lighting/switches/{deviceId}/{value}/timer/{minutes}': - post: - tags: - - Z-Wave - description: sets a switch to a specific value on a timer - operationId: setSwitchTimer - parameters: - - name: deviceId - in: path - required: true - schema: - type: string - - name: value - in: path - required: true - schema: - type: string - enum: - - true - - false - - name: minutes - in: path - required: true - schema: - type: integer - format: int32 - responses: - '200': - description: response - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - x-swagger-router-controller: ZWave - /lightingSummary: - get: - tags: - - Z-Wave - operationId: getLightingSummary - responses: - '200': - description: ok - content: - application/json: - schema: - $ref: '#/components/schemas/LightingSummary' - x-swagger-router-controller: ZWave - /temperature: - get: - tags: - - Environment - operationId: temperatureSummary - responses: - '200': - description: ok - content: - application/json: - schema: - $ref: '#/components/schemas/TemperatureSummary' - x-swagger-router-controller: Environment - '/temperature/forecast/{days}': - get: - tags: - - Environment - operationId: getForecast - parameters: - - name: days - in: path - required: true - schema: - type: integer - format: int32 - responses: - '200': - description: the forecast - content: - application/json: - schema: - $ref: '#/components/schemas/ForecastResponse' - x-swagger-router-controller: Environment - '/temperature/{zoneId}': - get: - tags: - - Environment - operationId: getZoneTemperature - parameters: - - name: zoneId - in: path - required: true - schema: - type: string - responses: - '200': - description: Zone temperature - content: - application/json: - schema: - $ref: '#/components/schemas/TemperatueZoneStatus' - x-swagger-router-controller: Environment - '/temperature/{zoneId}/heater': - get: - tags: - - Environment - description: gets the state of the heater - operationId: getHeaterState - parameters: - - name: zoneId - in: path - required: true - schema: - type: string - responses: - '200': - description: heater state - content: - application/json: - schema: - $ref: '#/components/schemas/HeaterState' - x-swagger-router-controller: Environment - '/temperature/{zoneId}/heater/{state}': - post: - tags: - - Environment - description: turns the heater on or off - operationId: setHeaterState - parameters: - - name: zoneId - in: path - required: true - schema: - type: string - - name: state - in: path - required: true - schema: - type: string - enum: - - false - - true - responses: - '200': - description: Status of the operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - x-swagger-router-controller: Environment - /zones: - get: - tags: - - Zones - operationId: getZones - responses: - '200': - description: ok - content: - application/json: - schema: - type: array - items: - type: string - x-swagger-router-controller: Zones - '/zones/{zoneId}/quiet': - get: - tags: - - Zones - operationId: quietZone - parameters: - - name: zoneId - in: path - required: true - schema: - type: string - enum: - - basement - - x: - reuven - - second-floor - responses: - '200': - description: ok - x-swagger-router-controller: Zones -components: - schemas: - LightingSummary: - type: object - properties: - zones: - type: array - items: - $ref: '#/components/schemas/LightingZone' - zoneStatus: - type: array - items: - $ref: '#/components/schemas/LightingZoneStatus' - description: ok - LightingZone: - type: object - properties: - id: - type: string - name: - type: string - deviceId: - type: integer - format: int32 - deviceType: - type: string - enum: - - dimmer - - switch - zone: - type: string - LightingZoneStatus: - type: object - properties: - id: - type: string - name: - type: string - lastUpdate: - type: string - format: date-time - level: - type: integer - format: int32 - description: the status of the lighting zone. - TemperatureSummary: - type: object - properties: - zones: - type: array - items: - $ref: '#/components/schemas/TemperatureZone' - zoneStatus: - type: array - items: - $ref: '#/components/schemas/TemperatueZoneStatus' - description: ok - TemperatureZone: - type: object - required: - - id - - name - properties: - id: - type: integer - format: int32 - description: the unique identifier for the zone - name: - type: string - inputPosition: - type: integer - format: int32 - outputPosition: - type: integer - format: int32 - zone: - type: string - description: a single temperature zone - TemperatueZoneStatus: - type: object - required: - - id - - timestamp - - value - properties: - id: - type: string - description: the unique identifier for the zone - name: - type: string - description: the name of the zone - value: - type: number - format: double - description: the temperature in the zone - units: - type: string - description: the temperature units - enum: - - celsius - - fahrenheit - default: fahrenheit - timestamp: - type: string - format: date-time - description: the timestamp when the temperature was measured - description: status of a single zone - ApiResponse: - type: object - properties: - code: - type: integer - format: int32 - message: - type: number - example: everything is ok - HeaterState: - type: object - properties: - id: - type: string - state: - type: string - DeviceState: - type: object - properties: - id: - type: string - name: - type: string - lastUpdate: - type: string - format: date-time - level: - type: integer - format: int32 - ForecastResponse: - type: object - properties: - city: - $ref: '#/components/schemas/City' - values: - type: array - items: - $ref: '#/components/schemas/Forecast' - Forecast: - type: object - properties: - date: - type: string - format: date-time - pressure: - type: number - format: double - humidity: - type: integer - format: int32 - windSpeed: - type: number - format: double - clouds: - type: integer - format: int32 - temperature: - $ref: '#/components/schemas/ForecastTemperature' - weather: - $ref: '#/components/schemas/WeatherForecast' - City: - type: object - properties: - id: - type: integer - format: int64 - name: - type: string - lat: - type: number - format: double - lon: - type: number - format: double - country: - type: string - ForecastTemperature: - type: object - properties: - low: - type: number - format: double - high: - type: number - format: double - morning: - type: number - format: double - day: - type: number - format: double - evening: - type: number - format: double - night: - type: number - format: double - WeatherForecast: - type: object - properties: - summary: - type: string - description: - type: string - icon: - type: string - DeviceRegistrationInfo: - type: object - properties: - uri: - type: string - format: uri - example: 'http://10.0.0.221:8080' - id: - type: string - format: uuid - example: 0729a580-2240-11e6-9eb5-0002a5d5c51b \ No newline at end of file diff --git a/openapi3/testdata/origin/openapi-test1.yaml b/openapi3/testdata/origin/openapi-test1.yaml deleted file mode 100644 index 1851c6d27..000000000 --- a/openapi3/testdata/origin/openapi-test1.yaml +++ /dev/null @@ -1,312 +0,0 @@ -info: - title: Tufin - version: 1.0.0 -openapi: 3.0.3 -x-extension-test: -x-extension-test2: go -externalDocs: - url: https://tufin.com -tags: -- name: security - description: control security - x-extension-test: -- name: reuven - description: Harrison -servers: -- url: tufin.com - x-extension-test: -security: -- bearerAuth: [] -paths: - /api/{domain}/{project}/badges/security-score: - x-extension-test: - parameters: - - in: path - name: domain - required: true - schema: - description: Hyphen-separated list of lowercase string - example: generic-bank - format: hyphen-separated list - pattern: ^(?:([a-z]+-)*([a-z]+)?)$ - type: string - get: - operationId: GetSecurityScores - x-extension-test: - x-beta: true - tags: - - security - parameters: - - in: query - name: filter - x-extension-test: - content: - application/json: - x-extension-test: - schema: - type: object - properties: - type: - type: string - color: - type: string - - in: header - name: user - content: - application/json: - schema: - type: object - properties: - name: - type: string - - in: cookie - name: test - content: - application/json: - schema: - type: object - - in: query - name: image - examples: - 0: - value: 'reuven' - schema: - x-extension-test: - description: alphanumeric - example: tufinim/generic-bank:cia-latest - format: general string - pattern: ^(?:[\w-./:]+)$ - type: string - - in: query - name: token - schema: - description: RFC 4122 UUID - example: 26734565-dbcc-449a-a370-0beaaf04b0e8 - format: uuid - pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ - type: string - maxLength: 29 - - in: header - name: X-Auth-Name - required: true - schema: - description: empty string - format: empty string - pattern: ^(?:)$ - type: string - - in: path - name: domain - required: true - schema: - description: Hyphen-separated list of lowercase string - example: generic-bank - format: hyphen-separated list - pattern: ^(?:([a-z]+-)*([a-z]+)?)$ - type: string - - in: path - name: project - required: true - schema: - description: Lowercase string - example: retail - format: lowercase string - pattern: ^(?:[a-z]+)$ - type: string - responses: - '200': - description: OK - '201': - description: none - content: - application/xml: - schema: - type: string - '400': - description: "bad request" - content: - application/json: - schema: - type: string - servers: [] - /api/{domain}/{project}/install-command: - get: - parameters: - - in: header - name: X-Auth-Name - required: true - schema: - description: any string - example: Joe - format: any string - pattern: ^(?:.*)$ - type: string - - in: path - name: domain - required: true - schema: - enum: - - generic-bank - - tufin - type: string - - in: path - name: project - required: true - schema: - enum: - - retail - - my-project - - test - - eks - type: string - - in: header - name: network-policies - schema: - $ref: '#/components/schemas/network-policies' - responses: - default: - description: Tufin1 - headers: - X-RateLimit-Limit: - schema: - type: integer - description: Request limit per hour. - servers: [] - /subscribe: - post: - summary: Subscribe to a webhook - callbacks: # Callback definition - myEvent: # Event name - 'hi': - post: - requestBody: # Contents of the callback message - required: true - content: - application/json: - schema: - type: object - properties: - message: - type: number - example: Some event happened - required: - - message - encoding: - historyMetadata: - # require XML Content-Type in utf-8 encoding - contentType: application/xml; charset=utf-8 - style: spaceDelimited - profileImage: - # only accept png/jpeg - contentType: image/png, image/jpeg - headers: - i: - schema: - type: integer - description: integer - responses: # Expected responses to the callback message - '200': - description: Your server returns this code if it accepts the callback - links: - "test": - operationId: "reuven" - description: "test" - "test1": - operationId: "reuven" - description: "test" - "test2": - operationId: "GetSecurityScores" - - 'bye': - post: - requestBody: # Contents of the callback message - required: true - content: - application/json: - schema: - type: object - responses: # Expected responses to the callback message - '200': - description: Your server returns this code if it accepts the callback - responses: - default: - description: Tufin - /register: - post: - security: - - bearerAuth: [] - - OAuth: [] - summary: Subscribe to a webhook - responses: - default: - description: Tufin -components: - schemas: - network-policies: - additionalProperties: true - properties: - netpols: - type: string - type: object - rules: - properties: - netpols: - type: string - type: object - parameters: - network-policies: - name: network-policies - in: header - schema: - $ref: '#/components/schemas/network-policies' - headers: - test: - schema: - $ref: '#/components/schemas/network-policies' - new: - schema: - $ref: '#/components/schemas/network-policies' - testc: - content: - application/json: - schema: - type: object - requestBodies: - reuven: - content: - application/json: - schema: - type: object - discriminator: - propertyName: meter_name - properties: - meter_name: - type: string - tenant: - type: string - meter_value: - type: number - time: - type: integer - dimensions: - type: object - securitySchemes: - bearerAuth: - type: http - scheme: bearer - bearerFormat: JWT - AccessToken: - type: http - scheme: bearer - OAuth: - x-extension-test: - type: oauth2 - flows: - authorizationCode: - authorizationUrl: https://tufin.io/auth - tokenUrl: https://tufin.io/token - scopes: - accountRead: Allows account data to be read - accountWrite: Allows account data to be written - responses: - OK: - description: 200 OK diff --git a/openapi3/testdata/origin/openapi-test2.yaml b/openapi3/testdata/origin/openapi-test2.yaml deleted file mode 100644 index c763828b5..000000000 --- a/openapi3/testdata/origin/openapi-test2.yaml +++ /dev/null @@ -1,72 +0,0 @@ -info: - title: Tufin - version: 1.0.1 - contact: - email: support@tufin.com -openapi: 3.0.3 -paths: - /api/{domain}/{project}/badges/security-score: - get: - parameters: - - in: query - name: filter - content: - application/json: - schema: - type: object - properties: - type: - type: string - color: - type: number - - in: query - name: image - explode: true - schema: - description: alphanumeric with underscore, dash, period, slash and colon - example: tufinim/generic-bank:cia-latest - format: general string - pattern: ^(?:[\w-./:]+)$ - type: string - - in: query - name: token - schema: - anyOf: - - description: RFC 4122 UUID - example: 26734565-dbcc-449a-a370-0beaaf04b0e8 - format: uuid - pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ - type: string - - description: UUID - example: 26734565-dbcc-449a-a370-0beaaf04b0e8 - format: uuid - pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ - type: string - - in: path - name: domain - required: true - schema: - description: Non-negative integers (including zero) - example: "100" - format: non-negative integer - pattern: ^(?:\d+)$ - type: integer - minimum: 7 - - in: path - name: project - required: true - schema: - description: Lowercase string - example: retail - format: lowercase string - pattern: ^(?:[a-z]+)$ - type: string - responses: - default: - description: Tufin - servers: [] - post: - responses: - default: - description: Tufin - servers: [] diff --git a/openapi3/testdata/origin/openapi-test3.yaml b/openapi3/testdata/origin/openapi-test3.yaml deleted file mode 100644 index 36c5506bd..000000000 --- a/openapi3/testdata/origin/openapi-test3.yaml +++ /dev/null @@ -1,269 +0,0 @@ -info: - title: Tufin1 - version: 1.0.1 - contact: - email: support@tufin.com - url: www.tufin.com - license: - name: apache -openapi: 3.0.3 -x-extension-test2: nogo -externalDocs: - url: https://tufin.io -tags: -- name: reuven - description: harrison -paths: - /api/{domain}/{project}/badges/security-score: - get: - operationId: GetSecurityScore - x-beta: true - parameters: - - in: query - name: image - examples: - 0: - value: 'reuven1' - 1: - value: 'test' - x-extension-test: - schema: - not: - description: alphanumeric with underscore, dash, period, slash and colon - example: tufinim/generic-bank:cia-latest - format: general string - pattern: ^(?:[\w-./:]+)$ - type: string - - in: query - name: token - schema: - description: RFC 4122 UUID - example: 26734565-dbcc-449a-a370-0beaaf04b0e7 - format: uuid - pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ - type: string - maxLength: 30 - - in: header - name: X-Auth-Name - required: true - schema: - description: empty string - format: empty string - pattern: ^(?:)$ - type: string - - in: path - name: domain - required: true - schema: - description: Hyphen-separated list of lowercase string - example: generic-bank - format: hyphen-separated list - pattern: ^(?:([a-z]+-)*([a-z]+)?)$ - type: string - - in: path - name: project - required: true - schema: - description: Lowercase string - example: retail - format: lowercase string - pattern: ^(?:[a-z]+)$ - type: string - responses: - default: - description: Tufin - servers: [] - /api/{domain}/{project}/install-command: - get: - parameters: - - in: header - name: X-Auth-Name - required: true - schema: - description: any string - example: Joe - format: any string - pattern: ^(?:.*)$ - type: string - - in: path - name: domain - required: true - schema: - enum: - - tufin - - generic-bank - type: string - - in: path - name: project - required: true - schema: - enum: - - retail - - my-project - - test - - eks - - test1 - type: string - responses: - default: - x-test: - description: Tufin - x-extension-test: - headers: - X-RateLimit-Limit: - schema: - type: integer - description: Request limit per min. - x-test: - servers: - - url: 'https://api.oasdiff.com' - - url: 'https://www.oasdiff.com' - description: "1" - variables: - title: - default: "CEO" - x-extension-test: - servers: - - url: 'https://api.oasdiff.com' - parameters: - - in: header - name: name - schema: - enum: - - tufin - /register: - post: - security: - - OAuth: - - write:pets - summary: Subscribe to a webhook - callbacks: # Callback definition - myEvent: # Event name - 'hi': - post: - requestBody: # Contents of the callback message - required: true - content: - application/json: - schema: - type: object - responses: # Expected responses to the callback message - '200': - description: Your server returns this code if it accepts the callback - responses: - default: - description: Tufin - /subscribe: - post: - summary: Subscribe to a webhook - callbacks: # Callback definition - myEvent: # Event name - 'hi': - post: - requestBody: # Contents of the callback message - required: true - content: - application/json: - x-extension-test: - schema: - type: object - properties: - message: - type: string - example: Some event happened - required: - - message - encoding: - profileImage: - # only accept png - contentType: image/png - headers: - i: - x-extension-test: - schema: - type: integer - description: number - responses: # Expected responses to the callback message - '200': - description: Your server returns this code if it accepts the callback - links: - "test": - operationId: "reuven" - "test2": - operationId: "GetSecurityScore" - '{$request.body#/callbackUrl}': # The callback URL, - # Refers to the passed URL - post: - requestBody: # Contents of the callback message - required: true - content: - application/json: - schema: - type: object - properties: - message: - type: string - example: Some event happened - required: - - message - responses: # Expected responses to the callback message - '200': - description: Your server returns this code if it accepts the callback - 'bye': - post: - responses: # Expected responses to the callback message - '200': - description: Your server returns this code if it accepts the callback - responses: - default: - description: Tufin -components: - callbacks: - test: - 'reuven': - post: - requestBody: - required: true - content: - application/json: - schema: - type: object - responses: - '200': - description: Your server returns this code if it accepts the callback - requestBodies: - reuven: - content: - application/json: - schema: - type: object - properties: - meter_name: - type: string - tenant: - type: string - meter_value: - type: integer - time: - type: integer - dimensions: - type: object - securitySchemes: - OAuth: - type: oauth2 - flows: - authorizationCode: - authorizationUrl: https://example.org/auth - tokenUrl: https://example.org/token - scopes: - accountRead: Allows account data to be read - accountWrite: Allows accounts data to be written - admin: read - clientCredentials: - tokenUrl: tufin.io/token - examples: - a: - description: reuven - links: - b: - description: reuven diff --git a/openapi3/testdata/origin/openapi-test4.yaml b/openapi3/testdata/origin/openapi-test4.yaml deleted file mode 100644 index d2a00d080..000000000 --- a/openapi3/testdata/origin/openapi-test4.yaml +++ /dev/null @@ -1,56 +0,0 @@ -info: - title: Tufin - version: 1.0.0 -openapi: 3.0.3 -paths: - /prefix/api/{domain}/{project}/badges/security-score: - get: - parameters: - - in: query - name: image - schema: - description: alphanumeric with underscore, dash, period, slash and colon - example: tufinim/generic-bank:cia-latest - format: general string - pattern: ^(?:[\w-./:]+)$ - type: string - - in: query - name: token - schema: - anyOf: - - description: RFC 4122 UUID - example: 26734565-dbcc-449a-a370-0beaaf04b0e8 - format: uuid - pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ - type: string - - description: RFC 4122 UUID - example: 26734565-dbcc-449a-a370-0beaaf04b0e8 - format: uuid - type: string - - in: path - name: domain - required: true - schema: - description: Non-negative integers (including zero) - example: "100" - format: non-negative integer - pattern: ^(?:\d+)$ - type: integer - - in: path - name: project - required: true - schema: - description: Lowercase string - example: retail - format: lowercase string - pattern: ^(?:[a-z]+)$ - type: string - responses: - default: - description: Tufin - servers: [] - post: - responses: - default: - description: Tufin - servers: [] diff --git a/openapi3/testdata/origin/openapi-test5.yaml b/openapi3/testdata/origin/openapi-test5.yaml deleted file mode 100644 index b28604106..000000000 --- a/openapi3/testdata/origin/openapi-test5.yaml +++ /dev/null @@ -1,180 +0,0 @@ -info: - title: Tufin1 - version: 1.0.1 - contact: - email: support@tufin.com - url: www.tufin.com - license: - name: apache -openapi: 3.0.3 -paths: - /api/{domain}/{project}/badges/security-score: - get: - parameters: - - in: query - name: filter - content: - application/json: - schema: - type: object - properties: - type: - type: string - color: - type: string - required: - - type - - in: header - name: user - schema: - type: string - - in: cookie - name: test - content: - application/json: - schema: - type: string - - in: query - name: image - schema: - description: alphanumeric - example: tufinim/generic-bank:cia-latest - format: general string - pattern: ^(?:[\w-./:]+)$ - type: string - - in: query - name: token - schema: - description: RFC 4122 UUID - example: 26734565-dbcc-449a-a370-0beaaf04b0e8 - format: uuid - pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ - type: string - - in: header - name: X-Auth-Name - required: true - schema: - description: empty string - format: empty string - pattern: ^(?:)$ - type: string - - in: path - name: domain - required: true - schema: - description: Hyphen-separated list of lowercase string - example: generic-bank - format: hyphen-separated list - pattern: ^(?:([a-z]+-)*([a-z]+)?)$ - type: string - - in: path - name: project - required: true - schema: - description: Lowercase string - example: retail - format: lowercase string - pattern: ^(?:[a-z]+)$ - type: string - responses: - default: - description: Tufin - '201': - description: none - content: - application/xml: - schema: - type: object - servers: [] - /api/{domain}/{project}/install-command: - get: - parameters: - - in: header - name: X-Auth-Name - required: true - schema: - description: any string - example: Joe - format: any string - pattern: ^(?:.*)$ - type: string - - in: path - name: domain - required: true - schema: - enum: - - generic-bank - - tufin - type: string - - in: path - name: project - required: true - schema: - enum: - - retail - - my-project - - test - - eks - type: string - responses: - default: - description: Tufin - servers: - - url: 'https://www.oasdiff.com' - description: "2" - variables: - name: - default: "joe" - enum: ["joe", "bill"] - title: - default: "developer" - x-test: -components: - schemas: - requests: - additionalProperties: false - properties: - email: - description: Email address - example: road.runner@acme.com - format: email - pattern: ^(?:[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$ - type: string - type: object - network-policies: - additionalProperties: false - properties: - netpols: - type: string - type: object - rules: - additionalProperties: false - properties: - netpols: - type: string - type: object - responses: - default: - description: Tufin - headers: - test: - schema: - $ref: '#/components/schemas/network-policies' - testc: - content: - application/json: - schema: - type: string - securitySchemes: - bearerAuth: - type: http - scheme: bearer - bearerFormat: JWT - AccessToken: - type: oauth2 - flows: - implicit: - authorizationUrl: https://example.com/api/oauth/dialog - scopes: - write:pets: modify pets in your account - read:pets": read your pets diff --git a/openapi3/testdata/origin/openapi-test6.yaml b/openapi3/testdata/origin/openapi-test6.yaml deleted file mode 100644 index 9138911bd..000000000 --- a/openapi3/testdata/origin/openapi-test6.yaml +++ /dev/null @@ -1,23 +0,0 @@ -openapi: "3.0.0" -info: - title: "Test API" - version: "1.0.0" -paths: - /health: - get: - summary: "Get health status" - responses: - 200: - description: "Success" - /health/live: - get: - summary: "Get live health status" - responses: - 200: - description: "Success" - /health/ready: - get: - summary: "Get readiness status" - responses: - 200: - description: "Success" \ No newline at end of file diff --git a/openapi3/testdata/origin/openapi-test7.yaml b/openapi3/testdata/origin/openapi-test7.yaml deleted file mode 100644 index bcd08b620..000000000 --- a/openapi3/testdata/origin/openapi-test7.yaml +++ /dev/null @@ -1,5 +0,0 @@ -openapi: "3.0.0" -info: - title: "Test API" - version: "2.0.0" -paths: {} \ No newline at end of file diff --git a/openapi3/testdata/origin/openapi-test701.yaml b/openapi3/testdata/origin/openapi-test701.yaml deleted file mode 100644 index 934874f97..000000000 --- a/openapi3/testdata/origin/openapi-test701.yaml +++ /dev/null @@ -1,253 +0,0 @@ -info: - title: Tufin - version: 1.0.0 -openapi: 3.0.3 -x-extension-test: -x-extension-test2: go -externalDocs: - url: https://tufin.com -tags: -- name: security - description: control security - x-extension-test: -- name: reuven - description: Harrison -servers: -- url: tufin.com - x-extension-test: -security: -- bearerAuth: [] -paths: - /api/{domain}/{project}/badges/security-score: - x-extension-test: - parameters: - - in: path - name: domain - required: true - schema: - description: Hyphen-separated list of lowercase string - example: generic-bank - format: hyphen-separated list - pattern: ^(?:([a-z]+-)*([a-z]+)?)$ - type: string - get: - operationId: GetSecurityScores - x-extension-test: - x-beta: true - tags: - - security - parameters: - - in: query - name: filter - x-extension-test: - content: - application/json: - x-extension-test: - schema: - type: object - properties: - type: - type: string - color: - type: string - - in: header - name: user - content: - application/json: - schema: - type: object - properties: - name: - type: string - - in: cookie - name: test - content: - application/json: - schema: - type: object - - in: query - name: image - examples: - 0: - value: 'reuven' - schema: - x-extension-test: - description: alphanumeric - example: tufinim/generic-bank:cia-latest - format: general string - pattern: ^(?:[\w-./:]+)$ - type: string - - in: query - name: token - schema: - description: RFC 4122 UUID - example: 26734565-dbcc-449a-a370-0beaaf04b0e8 - format: uuid - pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ - type: string - maxLength: 29 - - in: header - name: X-Auth-Name - required: true - schema: - description: empty string - format: empty string - pattern: ^(?:)$ - type: string - - in: path - name: domain - required: true - schema: - description: Hyphen-separated list of lowercase string - example: generic-bank - format: hyphen-separated list - pattern: ^(?:([a-z]+-)*([a-z]+)?)$ - type: string - - in: path - name: project - required: true - schema: - description: Lowercase string - example: retail - format: lowercase string - pattern: ^(?:[a-z]+)$ - type: string - responses: - '200': - description: OK - '201': - description: none - content: - application/xml: - schema: - type: string - '400': - description: "bad request" - content: - application/json: - schema: - type: string - servers: [] - /api/{domain}/{project}/install-command: - get: - parameters: - - in: header - name: X-Auth-Name - required: true - schema: - description: any string - example: Joe - format: any string - pattern: ^(?:.*)$ - type: string - - in: path - name: domain - required: true - schema: - enum: - - generic-bank - - tufin - type: string - - in: path - name: project - required: true - schema: - enum: - - retail - - my-project - - test - - eks - type: string - - in: header - name: network-policies - schema: - $ref: '#/components/schemas/network-policies' - responses: - default: - description: Tufin1 - headers: - X-RateLimit-Limit: - schema: - type: integer - description: Request limit per hour. - servers: [] - /register: - post: - security: - - bearerAuth: [] - - OAuth: [] - summary: Subscribe to a webhook - responses: - default: - description: Tufin -components: - schemas: - network-policies: - additionalProperties: true - properties: - netpols: - type: string - type: object - rules: - properties: - netpols: - type: string - type: object - parameters: - network-policies: - name: network-policies - in: header - schema: - $ref: '#/components/schemas/network-policies' - headers: - test: - schema: - $ref: '#/components/schemas/network-policies' - new: - schema: - $ref: '#/components/schemas/network-policies' - testc: - content: - application/json: - schema: - type: object - requestBodies: - reuven: - content: - application/json: - schema: - type: object - discriminator: - propertyName: meter_name - properties: - meter_name: - type: string - tenant: - type: string - meter_value: - type: number - time: - type: integer - dimensions: - type: object - securitySchemes: - bearerAuth: - type: http - scheme: bearer - bearerFormat: JWT - AccessToken: - type: http - scheme: bearer - OAuth: - x-extension-test: - type: oauth2 - flows: - authorizationCode: - authorizationUrl: https://tufin.io/auth - tokenUrl: https://tufin.io/token - scopes: - accountRead: Allows account data to be read - accountWrite: Allows account data to be written - responses: - OK: - description: 200 OK diff --git a/openapi3/testdata/origin/openapi-test702.yaml b/openapi3/testdata/origin/openapi-test702.yaml deleted file mode 100644 index 8ee4117a0..000000000 --- a/openapi3/testdata/origin/openapi-test702.yaml +++ /dev/null @@ -1,313 +0,0 @@ -info: - title: Tufin - version: 1.0.0 -openapi: 3.0.3 -x-extension-test: -x-extension-test2: go -externalDocs: - url: https://tufin.com -tags: -- name: security - description: control security - x-extension-test: -- name: reuven - description: Harrison -servers: -- url: tufin.com - x-extension-test: -security: -- bearerAuth: [] -paths: - /api/{domain}/{project}/badges/security-score: - x-extension-test: - parameters: - - in: path - name: domain - required: true - schema: - description: Hyphen-separated list of lowercase string - example: generic-bank - format: hyphen-separated list - pattern: ^(?:([a-z]+-)*([a-z]+)?)$ - type: string - get: - operationId: GetSecurityScores - x-extension-test: - x-beta: true - tags: - - security - parameters: - - in: query - name: filter - x-extension-test: - content: - application/json: - x-extension-test: - schema: - type: object - properties: - type: - type: string - color: - type: string - - in: header - name: user - content: - application/json: - schema: - type: object - properties: - name: - type: string - - in: cookie - name: test - content: - application/json: - schema: - type: object - - in: query - name: image - examples: - 0: - value: 'reuven' - schema: - x-extension-test: - description: alphanumeric - example: tufinim/generic-bank:cia-latest - format: general string - pattern: ^(?:[\w-./:]+)$ - type: string - - in: query - name: token - schema: - description: RFC 4122 UUID - example: 26734565-dbcc-449a-a370-0beaaf04b0e8 - format: uuid - pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ - type: string - maxLength: 29 - - in: header - name: X-Auth-Name - required: true - schema: - description: empty string - format: empty string - pattern: ^(?:)$ - type: string - - in: path - name: domain - required: true - schema: - description: Hyphen-separated list of lowercase string - example: generic-bank - format: hyphen-separated list - pattern: ^(?:([a-z]+-)*([a-z]+)?)$ - type: string - - in: path - name: project - required: true - schema: - description: Lowercase string - example: retail - format: lowercase string - pattern: ^(?:[a-z]+)$ - type: string - responses: - '200': - description: OK - '201': - description: none - content: - application/xml: - schema: - type: string - '400': - description: "bad request" - content: - application/json: - schema: - type: string - servers: [] - /api/{domain}/{project}/install-command: - get: - parameters: - - in: header - name: X-Auth-Name - required: true - schema: - description: any string - example: Joe - format: any string - pattern: ^(?:.*)$ - type: string - - in: path - name: domain - required: true - schema: - enum: - - generic-bank - - tufin - - removed-value - type: string - - in: path - name: project - required: true - schema: - enum: - - retail - - my-project - - test - - eks - type: string - - in: header - name: network-policies - schema: - $ref: '#/components/schemas/network-policies' - responses: - default: - description: Tufin1 - headers: - X-RateLimit-Limit: - schema: - type: integer - description: Request limit per hour. - servers: [] - /subscribe: - post: - summary: Subscribe to a webhook - callbacks: # Callback definition - myEvent: # Event name - 'hi': - post: - requestBody: # Contents of the callback message - required: true - content: - application/json: - schema: - type: object - properties: - message: - type: number - example: Some event happened - required: - - message - encoding: - historyMetadata: - # require XML Content-Type in utf-8 encoding - contentType: application/xml; charset=utf-8 - style: spaceDelimited - profileImage: - # only accept png/jpeg - contentType: image/png, image/jpeg - headers: - i: - schema: - type: integer - description: integer - responses: # Expected responses to the callback message - '200': - description: Your server returns this code if it accepts the callback - links: - "test": - operationId: "reuven" - description: "test" - "test1": - operationId: "reuven" - description: "test" - "test2": - operationId: "GetSecurityScores" - - 'bye': - post: - requestBody: # Contents of the callback message - required: true - content: - application/json: - schema: - type: object - responses: # Expected responses to the callback message - '200': - description: Your server returns this code if it accepts the callback - responses: - default: - description: Tufin - /register: - post: - security: - - bearerAuth: [] - - OAuth: [] - summary: Subscribe to a webhook - responses: - default: - description: Tufin -components: - schemas: - network-policies: - additionalProperties: true - properties: - netpols: - type: string - type: object - rules: - properties: - netpols: - type: string - type: object - parameters: - network-policies: - name: network-policies - in: header - schema: - $ref: '#/components/schemas/network-policies' - headers: - test: - schema: - $ref: '#/components/schemas/network-policies' - new: - schema: - $ref: '#/components/schemas/network-policies' - testc: - content: - application/json: - schema: - type: object - requestBodies: - reuven: - content: - application/json: - schema: - type: object - discriminator: - propertyName: meter_name - properties: - meter_name: - type: string - tenant: - type: string - meter_value: - type: number - time: - type: integer - dimensions: - type: object - securitySchemes: - bearerAuth: - type: http - scheme: bearer - bearerFormat: JWT - AccessToken: - type: http - scheme: bearer - OAuth: - x-extension-test: - type: oauth2 - flows: - authorizationCode: - authorizationUrl: https://tufin.io/auth - tokenUrl: https://tufin.io/token - scopes: - accountRead: Allows account data to be read - accountWrite: Allows account data to be written - responses: - OK: - description: 200 OK diff --git a/openapi3/testdata/origin/openapi-test703.yaml b/openapi3/testdata/origin/openapi-test703.yaml deleted file mode 100644 index cf38d2c14..000000000 --- a/openapi3/testdata/origin/openapi-test703.yaml +++ /dev/null @@ -1,330 +0,0 @@ -info: - title: Tufin - version: 1.0.0 -openapi: 3.0.3 -x-extension-test: -x-extension-test2: go -externalDocs: - url: https://tufin.com -tags: -- name: security - description: control security - x-extension-test: -- name: reuven - description: Harrison -servers: -- url: tufin.com - x-extension-test: -security: -- bearerAuth: [] -paths: - /api/{domain}/{project}/badges/security-score: - x-extension-test: - parameters: - - in: path - name: domain - required: true - schema: - description: Hyphen-separated list of lowercase string - example: generic-bank - format: hyphen-separated list - pattern: ^(?:([a-z]+-)*([a-z]+)?)$ - type: string - get: - operationId: GetSecurityScores - x-extension-test: - x-beta: true - tags: - - security - parameters: - - in: query - name: filter - x-extension-test: - content: - application/json: - x-extension-test: - schema: - type: object - properties: - type: - type: string - color: - type: string - - in: header - name: user - content: - application/json: - schema: - type: object - properties: - name: - type: string - - in: cookie - name: test - content: - application/json: - schema: - type: object - - in: query - name: image - examples: - 0: - value: 'reuven' - schema: - x-extension-test: - description: alphanumeric - example: tufinim/generic-bank:cia-latest - format: general string - pattern: ^(?:[\w-./:]+)$ - type: string - - in: query - name: token - schema: - description: RFC 4122 UUID - example: 26734565-dbcc-449a-a370-0beaaf04b0e8 - format: uuid - pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ - type: string - maxLength: 29 - - in: header - name: X-Auth-Name - required: true - schema: - description: empty string - format: empty string - pattern: ^(?:)$ - type: string - - in: path - name: domain - required: true - schema: - description: Hyphen-separated list of lowercase string - example: generic-bank - format: hyphen-separated list - pattern: ^(?:([a-z]+-)*([a-z]+)?)$ - type: string - - in: path - name: project - required: true - schema: - description: Lowercase string - example: retail - format: lowercase string - pattern: ^(?:[a-z]+)$ - type: string - responses: - '200': - description: OK - '201': - description: none - content: - application/xml: - schema: - type: string - '400': - description: "bad request" - content: - application/json: - schema: - type: string - servers: [] - /api/{domain}/{project}/install-command: - get: - parameters: - - in: header - name: X-Auth-Name - required: true - schema: - description: any string - example: Joe - format: any string - pattern: ^(?:.*)$ - type: string - - in: path - name: domain - required: true - schema: - enum: - - generic-bank - - tufin - type: string - - in: path - name: project - required: true - schema: - enum: - - retail - - my-project - - test - - eks - type: string - - in: header - name: network-policies - schema: - $ref: '#/components/schemas/network-policies' - responses: - default: - description: Tufin1 - headers: - X-RateLimit-Limit: - schema: - type: integer - description: Request limit per hour. - servers: [] - /subscribe: - post: - summary: Subscribe to a webhook - callbacks: # Callback definition - myEvent: # Event name - 'hi': - post: - requestBody: # Contents of the callback message - required: true - content: - application/json: - schema: - type: object - properties: - message: - type: number - example: Some event happened - required: - - message - encoding: - historyMetadata: - # require XML Content-Type in utf-8 encoding - contentType: application/xml; charset=utf-8 - style: spaceDelimited - profileImage: - # only accept png/jpeg - contentType: image/png, image/jpeg - headers: - i: - schema: - type: integer - description: integer - responses: # Expected responses to the callback message - '200': - description: Your server returns this code if it accepts the callback - links: - "test": - operationId: "reuven" - description: "test" - "test1": - operationId: "reuven" - description: "test" - "test2": - operationId: "GetSecurityScores" - - 'bye': - post: - requestBody: # Contents of the callback message - required: true - content: - application/json: - schema: - type: object - responses: # Expected responses to the callback message - '200': - description: Your server returns this code if it accepts the callback - responses: - default: - description: Tufin - /register: - post: - security: - - bearerAuth: [] - - OAuth: [] - summary: Subscribe to a webhook - responses: - default: - content: - application/json: - schema: - type: object - properties: - respenum: - type: string - enum: - - ASD - - TER - respenum2: - type: object - properties: - respenum3: - type: string - enum: - - ASD2 - - QWE2 - description: Tufin -components: - schemas: - network-policies: - additionalProperties: true - properties: - netpols: - type: string - type: object - rules: - properties: - netpols: - type: string - type: object - parameters: - network-policies: - name: network-policies - in: header - schema: - $ref: '#/components/schemas/network-policies' - headers: - test: - schema: - $ref: '#/components/schemas/network-policies' - new: - schema: - $ref: '#/components/schemas/network-policies' - testc: - content: - application/json: - schema: - type: object - requestBodies: - reuven: - content: - application/json: - schema: - type: object - discriminator: - propertyName: meter_name - properties: - meter_name: - type: string - tenant: - type: string - meter_value: - type: number - time: - type: integer - dimensions: - type: object - securitySchemes: - bearerAuth: - type: http - scheme: bearer - bearerFormat: JWT - AccessToken: - type: http - scheme: bearer - OAuth: - x-extension-test: - type: oauth2 - flows: - authorizationCode: - authorizationUrl: https://tufin.io/auth - tokenUrl: https://tufin.io/token - scopes: - accountRead: Allows account data to be read - accountWrite: Allows account data to be written - responses: - OK: - description: 200 OK diff --git a/openapi3/testdata/origin/openapi-test704.yaml b/openapi3/testdata/origin/openapi-test704.yaml deleted file mode 100644 index e17045acf..000000000 --- a/openapi3/testdata/origin/openapi-test704.yaml +++ /dev/null @@ -1,332 +0,0 @@ -info: - title: Tufin - version: 1.0.0 -openapi: 3.0.3 -x-extension-test: -x-extension-test2: go -externalDocs: - url: https://tufin.com -tags: -- name: security - description: control security - x-extension-test: -- name: reuven - description: Harrison -servers: -- url: tufin.com - x-extension-test: -security: -- bearerAuth: [] -paths: - /api/{domain}/{project}/badges/security-score: - x-extension-test: - parameters: - - in: path - name: domain - required: true - schema: - description: Hyphen-separated list of lowercase string - example: generic-bank - format: hyphen-separated list - pattern: ^(?:([a-z]+-)*([a-z]+)?)$ - type: string - get: - operationId: GetSecurityScores - x-extension-test: - x-beta: true - tags: - - security - parameters: - - in: query - name: filter - x-extension-test: - content: - application/json: - x-extension-test: - schema: - type: object - properties: - type: - type: string - color: - type: string - - in: header - name: user - content: - application/json: - schema: - type: object - properties: - name: - type: string - - in: cookie - name: test - content: - application/json: - schema: - type: object - - in: query - name: image - examples: - 0: - value: 'reuven' - schema: - x-extension-test: - description: alphanumeric - example: tufinim/generic-bank:cia-latest - format: general string - pattern: ^(?:[\w-./:]+)$ - type: string - - in: query - name: token - schema: - description: RFC 4122 UUID - example: 26734565-dbcc-449a-a370-0beaaf04b0e8 - format: uuid - pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ - type: string - maxLength: 29 - - in: header - name: X-Auth-Name - required: true - schema: - description: empty string - format: empty string - pattern: ^(?:)$ - type: string - - in: path - name: domain - required: true - schema: - description: Hyphen-separated list of lowercase string - example: generic-bank - format: hyphen-separated list - pattern: ^(?:([a-z]+-)*([a-z]+)?)$ - type: string - - in: path - name: project - required: true - schema: - description: Lowercase string - example: retail - format: lowercase string - pattern: ^(?:[a-z]+)$ - type: string - responses: - '200': - description: OK - '201': - description: none - content: - application/xml: - schema: - type: string - '400': - description: "bad request" - content: - application/json: - schema: - type: string - servers: [] - /api/{domain}/{project}/install-command: - get: - parameters: - - in: header - name: X-Auth-Name - required: true - schema: - description: any string - example: Joe - format: any string - pattern: ^(?:.*)$ - type: string - - in: path - name: domain - required: true - schema: - enum: - - generic-bank - - tufin - type: string - - in: path - name: project - required: true - schema: - enum: - - retail - - my-project - - test - - eks - type: string - - in: header - name: network-policies - schema: - $ref: '#/components/schemas/network-policies' - responses: - default: - description: Tufin1 - headers: - X-RateLimit-Limit: - schema: - type: integer - description: Request limit per hour. - servers: [] - /subscribe: - post: - summary: Subscribe to a webhook - callbacks: # Callback definition - myEvent: # Event name - 'hi': - post: - requestBody: # Contents of the callback message - required: true - content: - application/json: - schema: - type: object - properties: - message: - type: number - example: Some event happened - required: - - message - encoding: - historyMetadata: - # require XML Content-Type in utf-8 encoding - contentType: application/xml; charset=utf-8 - style: spaceDelimited - profileImage: - # only accept png/jpeg - contentType: image/png, image/jpeg - headers: - i: - schema: - type: integer - description: integer - responses: # Expected responses to the callback message - '200': - description: Your server returns this code if it accepts the callback - links: - "test": - operationId: "reuven" - description: "test" - "test1": - operationId: "reuven" - description: "test" - "test2": - operationId: "GetSecurityScores" - - 'bye': - post: - requestBody: # Contents of the callback message - required: true - content: - application/json: - schema: - type: object - responses: # Expected responses to the callback message - '200': - description: Your server returns this code if it accepts the callback - responses: - default: - description: Tufin - /register: - post: - security: - - bearerAuth: [] - - OAuth: [] - summary: Subscribe to a webhook - responses: - default: - content: - application/json: - schema: - type: object - properties: - respenum: - type: string - enum: - - ASD - - QWE - - TER - respenum2: - type: object - properties: - respenum3: - type: string - enum: - - ASD2 - - QWE2 - - TER2 - description: Tufin -components: - schemas: - network-policies: - additionalProperties: true - properties: - netpols: - type: string - type: object - rules: - properties: - netpols: - type: string - type: object - parameters: - network-policies: - name: network-policies - in: header - schema: - $ref: '#/components/schemas/network-policies' - headers: - test: - schema: - $ref: '#/components/schemas/network-policies' - new: - schema: - $ref: '#/components/schemas/network-policies' - testc: - content: - application/json: - schema: - type: object - requestBodies: - reuven: - content: - application/json: - schema: - type: object - discriminator: - propertyName: meter_name - properties: - meter_name: - type: string - tenant: - type: string - meter_value: - type: number - time: - type: integer - dimensions: - type: object - securitySchemes: - bearerAuth: - type: http - scheme: bearer - bearerFormat: JWT - AccessToken: - type: http - scheme: bearer - OAuth: - x-extension-test: - type: oauth2 - flows: - authorizationCode: - authorizationUrl: https://tufin.io/auth - tokenUrl: https://tufin.io/token - scopes: - accountRead: Allows account data to be read - accountWrite: Allows account data to be written - responses: - OK: - description: 200 OK diff --git a/openapi3/testdata/origin/openapi-test8.yaml b/openapi3/testdata/origin/openapi-test8.yaml deleted file mode 100644 index e47f2c96f..000000000 --- a/openapi3/testdata/origin/openapi-test8.yaml +++ /dev/null @@ -1,17 +0,0 @@ -openapi: "3.0.0" -info: - title: "Test API" - version: "1.0.0" -paths: - /resource/new: - get: - summary: "Get new resource" - responses: - 200: - description: "Success" - /resource/newest: - get: - summary: "Get newest resource" - responses: - 200: - description: "Success" diff --git a/openapi3/testdata/origin/openapi31-test1.yaml b/openapi3/testdata/origin/openapi31-test1.yaml deleted file mode 100644 index 3a4783ae9..000000000 --- a/openapi3/testdata/origin/openapi31-test1.yaml +++ /dev/null @@ -1,34 +0,0 @@ -openapi: 3.1.0 -info: - title: Webhook Example - version: 1.0.0 -# Since OAS 3.1.0 the paths element isn't necessary. Now a valid OpenAPI Document can describe only paths, webhooks, or even only reusable components -webhooks: - # Each webhook needs a name - newPet: - # This is a Path Item Object, the only difference is that the request is initiated by the API provider - post: - requestBody: - description: Information about a new pet in the system - content: - application/json: - schema: - $ref: "#/components/schemas/Pet" - responses: - "200": - description: Return a 200 status to indicate that the data was received successfully - -components: - schemas: - Pet: - required: - - id - - name - properties: - id: - type: integer - format: int64 - name: - type: string - tag: - type: string \ No newline at end of file diff --git a/openapi3/testdata/origin/openapi31-test2.yaml b/openapi3/testdata/origin/openapi31-test2.yaml deleted file mode 100644 index e948e028d..000000000 --- a/openapi3/testdata/origin/openapi31-test2.yaml +++ /dev/null @@ -1,35 +0,0 @@ -openapi: 3.1.0 -info: - title: Webhook Example - version: 1.0.0 -# Since OAS 3.1.0 the paths element isn't necessary. Now a valid OpenAPI Document can describe only paths, webhooks, or even only reusable components -webhooks: - # Each webhook needs a name - newPet: - # This is a Path Item Object, the only difference is that the request is initiated by the API provider - post: - requestBody: - description: Information about a new pet in the system - content: - application/json: - schema: - $ref: "#/components/schemas/Pet" - responses: - "200": - description: Return a 200 status to indicate that the data was received successfully - -components: - schemas: - Pet: - required: - - id - - name - - tag - properties: - id: - type: integer - format: int64 - name: - type: string - tag: - type: string \ No newline at end of file diff --git a/openapi3/testdata/origin/operation_id_added_base.yaml b/openapi3/testdata/origin/operation_id_added_base.yaml deleted file mode 100644 index 207da4732..000000000 --- a/openapi3/testdata/origin/operation_id_added_base.yaml +++ /dev/null @@ -1,59 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - tags: - - Group - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/operation_id_removed_base.yaml b/openapi3/testdata/origin/operation_id_removed_base.yaml deleted file mode 100644 index 5835dd48c..000000000 --- a/openapi3/testdata/origin/operation_id_removed_base.yaml +++ /dev/null @@ -1,60 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - tags: - - Group - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/simple4.yaml b/openapi3/testdata/origin/parameters.yaml similarity index 100% rename from openapi3/testdata/origin/simple4.yaml rename to openapi3/testdata/origin/parameters.yaml diff --git a/openapi3/testdata/origin/pattern-base-recursive.yaml b/openapi3/testdata/origin/pattern-base-recursive.yaml deleted file mode 100644 index e287d99cd..000000000 --- a/openapi3/testdata/origin/pattern-base-recursive.yaml +++ /dev/null @@ -1,65 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "1.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project - /api/v1.0/groups/{groupId}: - get: - operationId: returnOneGroup - parameters: - - $ref: '#/components/parameters/groupId' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Return One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-base.yaml b/openapi3/testdata/origin/pattern-base.yaml deleted file mode 100644 index 384ddde6d..000000000 --- a/openapi3/testdata/origin/pattern-base.yaml +++ /dev/null @@ -1,62 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "1.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project - /api/v1.0/groups/{groupId}: - get: - operationId: returnOneGroup - parameters: - - $ref: '#/components/parameters/groupId' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Return One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-modified-not-anystring.yaml b/openapi3/testdata/origin/pattern-modified-not-anystring.yaml deleted file mode 100644 index 7f0cd7fc9..000000000 --- a/openapi3/testdata/origin/pattern-modified-not-anystring.yaml +++ /dev/null @@ -1,62 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "1.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project - /api/v1.0/groups/{groupId}: - get: - operationId: returnOneGroup - parameters: - - $ref: '#/components/parameters/groupId' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Return One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: ".+" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-modified.yaml b/openapi3/testdata/origin/pattern-modified.yaml deleted file mode 100644 index 959545745..000000000 --- a/openapi3/testdata/origin/pattern-modified.yaml +++ /dev/null @@ -1,62 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "1.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project - /api/v1.0/groups/{groupId}: - get: - operationId: returnOneGroup - parameters: - - $ref: '#/components/parameters/groupId' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Return One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: ".*" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-parameter-base.yaml b/openapi3/testdata/origin/pattern-parameter-base.yaml deleted file mode 100644 index 0bc8252be..000000000 --- a/openapi3/testdata/origin/pattern-parameter-base.yaml +++ /dev/null @@ -1,63 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "1.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project - /api/v1.0/groups/{groupId}: - get: - operationId: returnOneGroup - parameters: - - $ref: '#/components/parameters/groupId' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Return One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - pattern: "[0-9a-f]+" - schemas: - GroupView: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-parameter-modified-not-anystring.yaml b/openapi3/testdata/origin/pattern-parameter-modified-not-anystring.yaml deleted file mode 100644 index 55ea0350d..000000000 --- a/openapi3/testdata/origin/pattern-parameter-modified-not-anystring.yaml +++ /dev/null @@ -1,63 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "1.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project - /api/v1.0/groups/{groupId}: - get: - operationId: returnOneGroup - parameters: - - $ref: '#/components/parameters/groupId' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Return One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - pattern: "[0-9]+" - schemas: - GroupView: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-parameter-revision.yaml b/openapi3/testdata/origin/pattern-parameter-revision.yaml deleted file mode 100644 index 384ddde6d..000000000 --- a/openapi3/testdata/origin/pattern-parameter-revision.yaml +++ /dev/null @@ -1,62 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "1.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project - /api/v1.0/groups/{groupId}: - get: - operationId: returnOneGroup - parameters: - - $ref: '#/components/parameters/groupId' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Return One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-revision-recursive.yaml b/openapi3/testdata/origin/pattern-revision-recursive.yaml deleted file mode 100644 index 53c4647c8..000000000 --- a/openapi3/testdata/origin/pattern-revision-recursive.yaml +++ /dev/null @@ -1,64 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "1.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project - /api/v1.0/groups/{groupId}: - get: - operationId: returnOneGroup - parameters: - - $ref: '#/components/parameters/groupId' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Return One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/pattern-revision.yaml b/openapi3/testdata/origin/pattern-revision.yaml deleted file mode 100644 index fb6efb8b1..000000000 --- a/openapi3/testdata/origin/pattern-revision.yaml +++ /dev/null @@ -1,61 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "1.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project - /api/v1.0/groups/{groupId}: - get: - operationId: returnOneGroup - parameters: - - $ref: '#/components/parameters/groupId' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Return One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_body_became_optional_base.yaml b/openapi3/testdata/origin/request_body_became_optional_base.yaml deleted file mode 100644 index 5835dd48c..000000000 --- a/openapi3/testdata/origin/request_body_became_optional_base.yaml +++ /dev/null @@ -1,60 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - tags: - - Group - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_body_became_required_base.yaml b/openapi3/testdata/origin/request_body_became_required_base.yaml deleted file mode 100644 index 5dddd5edc..000000000 --- a/openapi3/testdata/origin/request_body_became_required_base.yaml +++ /dev/null @@ -1,60 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - tags: - - Group - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: false - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_body_default_value_changed_base.yaml b/openapi3/testdata/origin/request_body_default_value_changed_base.yaml deleted file mode 100644 index ea98ca0f7..000000000 --- a/openapi3/testdata/origin/request_body_default_value_changed_base.yaml +++ /dev/null @@ -1,25 +0,0 @@ -openapi: 3.0.0 -info: - title: Sample API - version: 1.0.0 -paths: - /products: - post: - summary: Create a new product - operationId: createProduct - requestBody: - content: - text/plain: - schema: - type: string - default: "Default" - application/json: - schema: - type: object - properties: - name: - type: string - price: - type: number - default: 10.0 - description: RequestBody diff --git a/openapi3/testdata/origin/request_body_default_value_changed_revision.yaml b/openapi3/testdata/origin/request_body_default_value_changed_revision.yaml deleted file mode 100644 index b2b9abf52..000000000 --- a/openapi3/testdata/origin/request_body_default_value_changed_revision.yaml +++ /dev/null @@ -1,16 +0,0 @@ -openapi: 3.0.0 -info: - title: Sample API - version: 1.0.0 -paths: - /products: - post: - summary: Create a new product - operationId: createProduct - requestBody: - content: - text/plain: - schema: - type: string - default: "NewDefault" - description: RequestBody \ No newline at end of file diff --git a/openapi3/testdata/origin/request_body_max_length_decreased_base.yaml b/openapi3/testdata/origin/request_body_max_length_decreased_base.yaml deleted file mode 100644 index de412a5b3..000000000 --- a/openapi3/testdata/origin/request_body_max_length_decreased_base.yaml +++ /dev/null @@ -1,29 +0,0 @@ -openapi: 3.0.1 -info: - title: Pet Store API - version: "1.0" -servers: - - url: https://api.example.com/v1 -paths: - /pets: - post: - operationId: addPet - requestBody: - content: - application/json: - schema: - type: object - properties: - id: - type: integer - name: - type: string - maxLength: 100 - description: - type: string - maxLength: 100 - required: true - responses: - "200": - description: OK -components: {} diff --git a/openapi3/testdata/origin/request_body_max_length_set_base.yaml b/openapi3/testdata/origin/request_body_max_length_set_base.yaml deleted file mode 100644 index 1d8107885..000000000 --- a/openapi3/testdata/origin/request_body_max_length_set_base.yaml +++ /dev/null @@ -1,16 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: 1.0.0 -paths: - /pets: - post: - operationId: addPet - requestBody: - content: - text/plain: - schema: - type: string - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_body_max_length_set_revision.yaml b/openapi3/testdata/origin/request_body_max_length_set_revision.yaml deleted file mode 100644 index 8c23a83e3..000000000 --- a/openapi3/testdata/origin/request_body_max_length_set_revision.yaml +++ /dev/null @@ -1,17 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: 1.0.0 -paths: - /pets: - post: - operationId: addPet - requestBody: - content: - text/plain: - schema: - type: string - maxLength: 15 - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_body_max_set_base.yaml b/openapi3/testdata/origin/request_body_max_set_base.yaml deleted file mode 100644 index a51bb0c06..000000000 --- a/openapi3/testdata/origin/request_body_max_set_base.yaml +++ /dev/null @@ -1,16 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: 1.0.0 -paths: - /pets: - post: - operationId: addPet - requestBody: - content: - text/plain: - schema: - type: number - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_body_max_set_revision.yaml b/openapi3/testdata/origin/request_body_max_set_revision.yaml deleted file mode 100644 index 65255d6c4..000000000 --- a/openapi3/testdata/origin/request_body_max_set_revision.yaml +++ /dev/null @@ -1,17 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: 1.0.0 -paths: - /pets: - post: - operationId: addPet - requestBody: - content: - text/plain: - schema: - type: number - maximum: 15 - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_body_media_type_updated_base.yaml b/openapi3/testdata/origin/request_body_media_type_updated_base.yaml deleted file mode 100644 index 7d4b88925..000000000 --- a/openapi3/testdata/origin/request_body_media_type_updated_base.yaml +++ /dev/null @@ -1,59 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - tags: - - Group - operationId: createOneGroup - requestBody: - content: - text/plain: - schema: - type: string - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_body_media_type_updated_revision.yaml b/openapi3/testdata/origin/request_body_media_type_updated_revision.yaml deleted file mode 100644 index 4e2547dbc..000000000 --- a/openapi3/testdata/origin/request_body_media_type_updated_revision.yaml +++ /dev/null @@ -1,63 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - tags: - - Group - operationId: createOneGroup - requestBody: - content: - text/plain: - schema: - type: string - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_optional_property_write_only_read_only_base.yaml b/openapi3/testdata/origin/request_optional_property_write_only_read_only_base.yaml deleted file mode 100644 index 2afedbf1f..000000000 --- a/openapi3/testdata/origin/request_optional_property_write_only_read_only_base.yaml +++ /dev/null @@ -1,23 +0,0 @@ -openapi: 3.0.0 -info: - title: Sample API - version: 1.0.0 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - required: true - content: - application/json: - schema: - type: object - required: - - id - properties: - id: - type: integer - writeOnly: false - name: - type: string - writeOnly: false # Set this to true in the next version for testing diff --git a/openapi3/testdata/origin/request_parameter_became_enum_base.yaml b/openapi3/testdata/origin/request_parameter_became_enum_base.yaml deleted file mode 100644 index f19237091..000000000 --- a/openapi3/testdata/origin/request_parameter_became_enum_base.yaml +++ /dev/null @@ -1,57 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - parameters: - - in: path - name: groupId - required: true - schema: - type: string - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_parameter_became_enum_revision.yaml b/openapi3/testdata/origin/request_parameter_became_enum_revision.yaml deleted file mode 100644 index fd908733d..000000000 --- a/openapi3/testdata/origin/request_parameter_became_enum_revision.yaml +++ /dev/null @@ -1,60 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - parameters: - - in: path - name: groupId - required: true - schema: - type: integer - enum: - - 1 - - 2 - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_parameter_default_value_changed_base.yaml b/openapi3/testdata/origin/request_parameter_default_value_changed_base.yaml deleted file mode 100644 index 51d9901ee..000000000 --- a/openapi3/testdata/origin/request_parameter_default_value_changed_base.yaml +++ /dev/null @@ -1,62 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - parameters: - - in: path - name: groupId - required: true - schema: - type: string - - in: query - name: category - schema: - type: string - default: "default_category" - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name diff --git a/openapi3/testdata/origin/request_parameter_default_value_changed_revision.yaml b/openapi3/testdata/origin/request_parameter_default_value_changed_revision.yaml deleted file mode 100644 index 646a42b09..000000000 --- a/openapi3/testdata/origin/request_parameter_default_value_changed_revision.yaml +++ /dev/null @@ -1,62 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - parameters: - - in: path - name: groupId - required: true - schema: - type: string - - in: query - name: category - schema: - type: string - default: "updated_category" - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_parameter_enum_value_updated_base.yaml b/openapi3/testdata/origin/request_parameter_enum_value_updated_base.yaml deleted file mode 100644 index 6fd5b8a21..000000000 --- a/openapi3/testdata/origin/request_parameter_enum_value_updated_base.yaml +++ /dev/null @@ -1,20 +0,0 @@ -openapi: 3.0.0 -info: - title: Test API - version: 1.0.0 -paths: - /test: - get: - operationId: getTest - parameters: - - name: status - in: query - schema: - type: string - enum: - - available - - busy - - offline - responses: - '200': - description: OK diff --git a/openapi3/testdata/origin/request_parameter_enum_value_updated_revision.yaml b/openapi3/testdata/origin/request_parameter_enum_value_updated_revision.yaml deleted file mode 100644 index 144ad2c23..000000000 --- a/openapi3/testdata/origin/request_parameter_enum_value_updated_revision.yaml +++ /dev/null @@ -1,19 +0,0 @@ -openapi: 3.0.0 -info: - title: Test API - version: 1.0.0 -paths: - /test: - get: - operationId: getTest - parameters: - - name: status - in: query - schema: - type: string - enum: - - busy - - offline - responses: - '200': - description: OK diff --git a/openapi3/testdata/origin/request_parameter_extensible_enum_base.yaml b/openapi3/testdata/origin/request_parameter_extensible_enum_base.yaml deleted file mode 100644 index 39e802ade..000000000 --- a/openapi3/testdata/origin/request_parameter_extensible_enum_base.yaml +++ /dev/null @@ -1,60 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - parameters: - - in: path - name: groupId - required: true - schema: - type: string - x-extensible-enum: - - "1" - - "2" - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_parameter_extensible_enum_revision.yaml b/openapi3/testdata/origin/request_parameter_extensible_enum_revision.yaml deleted file mode 100644 index 6405ba9ec..000000000 --- a/openapi3/testdata/origin/request_parameter_extensible_enum_revision.yaml +++ /dev/null @@ -1,59 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - parameters: - - in: path - name: groupId - required: true - schema: - type: string - x-extensible-enum: - - "1" - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_parameter_max_items_updated_base.yaml b/openapi3/testdata/origin/request_parameter_max_items_updated_base.yaml deleted file mode 100644 index a00c1250f..000000000 --- a/openapi3/testdata/origin/request_parameter_max_items_updated_base.yaml +++ /dev/null @@ -1,61 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: - - url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - tags: - - Group - operationId: createOneGroup - parameters: - - in: query - name: category - schema: - type: array - items: - type: string - maxItems: 10 - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name diff --git a/openapi3/testdata/origin/request_parameter_max_items_updated_revision.yaml b/openapi3/testdata/origin/request_parameter_max_items_updated_revision.yaml deleted file mode 100644 index 01557d912..000000000 --- a/openapi3/testdata/origin/request_parameter_max_items_updated_revision.yaml +++ /dev/null @@ -1,61 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: - - url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - tags: - - Group - operationId: createOneGroup - parameters: - - in: query - name: category - schema: - type: array - items: - type: string - maxItems: 20 - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name diff --git a/openapi3/testdata/origin/request_parameter_max_length_set_base.yaml b/openapi3/testdata/origin/request_parameter_max_length_set_base.yaml deleted file mode 100644 index 2266e1880..000000000 --- a/openapi3/testdata/origin/request_parameter_max_length_set_base.yaml +++ /dev/null @@ -1,15 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: "1.0" -paths: - /test: - post: - parameters: - - in: query - name: category - schema: - type: string - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_parameter_max_length_set_revision.yaml b/openapi3/testdata/origin/request_parameter_max_length_set_revision.yaml deleted file mode 100644 index 9a9a84499..000000000 --- a/openapi3/testdata/origin/request_parameter_max_length_set_revision.yaml +++ /dev/null @@ -1,16 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: "2.0" -paths: - /test: - post: - parameters: - - in: query - name: category - schema: - type: string - maxLength: 15 - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_parameter_max_length_updated_base.yaml b/openapi3/testdata/origin/request_parameter_max_length_updated_base.yaml deleted file mode 100644 index 46e609b1a..000000000 --- a/openapi3/testdata/origin/request_parameter_max_length_updated_base.yaml +++ /dev/null @@ -1,16 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: "1.0" -paths: - /test: - post: - parameters: - - in: query - name: category - schema: - type: string - maxLength: 10 - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_parameter_max_length_updated_revision.yaml b/openapi3/testdata/origin/request_parameter_max_length_updated_revision.yaml deleted file mode 100644 index 9a9a84499..000000000 --- a/openapi3/testdata/origin/request_parameter_max_length_updated_revision.yaml +++ /dev/null @@ -1,16 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: "2.0" -paths: - /test: - post: - parameters: - - in: query - name: category - schema: - type: string - maxLength: 15 - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_parameter_max_updated_base.yaml b/openapi3/testdata/origin/request_parameter_max_updated_base.yaml deleted file mode 100644 index 24ee44825..000000000 --- a/openapi3/testdata/origin/request_parameter_max_updated_base.yaml +++ /dev/null @@ -1,60 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: - - url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - parameters: - - in: query - name: category - required: true - schema: - type: array - items: - type: string - maximum: 5 - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name diff --git a/openapi3/testdata/origin/request_parameter_max_updated_revision.yaml b/openapi3/testdata/origin/request_parameter_max_updated_revision.yaml deleted file mode 100644 index 3c392e816..000000000 --- a/openapi3/testdata/origin/request_parameter_max_updated_revision.yaml +++ /dev/null @@ -1,60 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: - - url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - parameters: - - in: query - name: category - required: true - schema: - type: array - items: - type: string - maximum: 10 - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name diff --git a/openapi3/testdata/origin/request_parameter_min_increased_base.yaml b/openapi3/testdata/origin/request_parameter_min_increased_base.yaml deleted file mode 100644 index a3e763ab7..000000000 --- a/openapi3/testdata/origin/request_parameter_min_increased_base.yaml +++ /dev/null @@ -1,58 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: - - url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - parameters: - - in: path - name: groupId - required: true - schema: - type: integer - minimum: 1 - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name diff --git a/openapi3/testdata/origin/request_parameter_min_increased_revision.yaml b/openapi3/testdata/origin/request_parameter_min_increased_revision.yaml deleted file mode 100644 index 59c9e3a42..000000000 --- a/openapi3/testdata/origin/request_parameter_min_increased_revision.yaml +++ /dev/null @@ -1,58 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: - - url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - parameters: - - in: path - name: groupId - required: true - schema: - type: integer - minimum: 10 # Changed minimum value from 1 to 10 - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name diff --git a/openapi3/testdata/origin/request_parameter_min_items_increased_base.yaml b/openapi3/testdata/origin/request_parameter_min_items_increased_base.yaml deleted file mode 100644 index bea1ee597..000000000 --- a/openapi3/testdata/origin/request_parameter_min_items_increased_base.yaml +++ /dev/null @@ -1,60 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: - - url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - parameters: - - in: query - name: category - required: true - schema: - type: array - items: - type: string - minItems: 2 - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name diff --git a/openapi3/testdata/origin/request_parameter_min_items_increased_revision.yaml b/openapi3/testdata/origin/request_parameter_min_items_increased_revision.yaml deleted file mode 100644 index ecf84fe67..000000000 --- a/openapi3/testdata/origin/request_parameter_min_items_increased_revision.yaml +++ /dev/null @@ -1,60 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: - - url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - parameters: - - in: query - name: category - required: true - schema: - type: array - items: - type: string - minItems: 3 # Changed minItems value from 2 to 3 - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name diff --git a/openapi3/testdata/origin/request_parameter_min_length_increased_base.yaml b/openapi3/testdata/origin/request_parameter_min_length_increased_base.yaml deleted file mode 100644 index 71d97c0b9..000000000 --- a/openapi3/testdata/origin/request_parameter_min_length_increased_base.yaml +++ /dev/null @@ -1,17 +0,0 @@ -openapi: 3.0.1 -info: - title: Test Base API - version: 1.0.0 -paths: - /test: - post: - operationId: createTest - parameters: - - in: query - name: name - schema: - type: string - minLength: 3 - responses: - '200': - description: OK diff --git a/openapi3/testdata/origin/request_parameter_min_length_increased_revision.yaml b/openapi3/testdata/origin/request_parameter_min_length_increased_revision.yaml deleted file mode 100644 index e3e977429..000000000 --- a/openapi3/testdata/origin/request_parameter_min_length_increased_revision.yaml +++ /dev/null @@ -1,17 +0,0 @@ -openapi: 3.0.1 -info: - title: Test Revision API - version: 1.0.0 -paths: - /test: - post: - operationId: createTest - parameters: - - in: query - name: name - schema: - type: string - minLength: 5 - responses: - '200': - description: OK diff --git a/openapi3/testdata/origin/request_parameter_pattern_added_or_changed_base.yaml b/openapi3/testdata/origin/request_parameter_pattern_added_or_changed_base.yaml deleted file mode 100644 index 43e2608bd..000000000 --- a/openapi3/testdata/origin/request_parameter_pattern_added_or_changed_base.yaml +++ /dev/null @@ -1,17 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: "1.0" -paths: - /test: - post: - parameters: - - in: query - name: category - required: true - schema: - type: string - pattern: '^\w+$' - responses: - '200': - description: OK diff --git a/openapi3/testdata/origin/request_parameter_pattern_added_or_changed_revision.yaml b/openapi3/testdata/origin/request_parameter_pattern_added_or_changed_revision.yaml deleted file mode 100644 index 20b752051..000000000 --- a/openapi3/testdata/origin/request_parameter_pattern_added_or_changed_revision.yaml +++ /dev/null @@ -1,16 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: "1.0" -paths: - /test: - post: - parameters: - - in: query - name: category - required: true - schema: - type: string - responses: - '200': - description: OK diff --git a/openapi3/testdata/origin/request_parameter_property_type_changed_base_int.yaml b/openapi3/testdata/origin/request_parameter_property_type_changed_base_int.yaml deleted file mode 100644 index 062a0a0b2..000000000 --- a/openapi3/testdata/origin/request_parameter_property_type_changed_base_int.yaml +++ /dev/null @@ -1,80 +0,0 @@ -openapi: 3.0.1 -paths: - /groups: - get: - operationId: getGroups - summary: Get groups - parameters: - - name: skip - required: false - in: query - schema: - type: string - - name: take - required: false - in: query - schema: - type: string - - name: filters - required: false - in: query - style: deepObject - explode: true - schema: - $ref: '#/components/schemas/GroupFilters' - responses: - "200": - description: Successfully received results - content: - application/json: - schema: - type: object - title: BaseGroupListResponse - required: - - total - - skip - - take - - results - properties: - total: - type: integer - skip: - type: integer - take: - type: integer - results: - type: array - items: - $ref: '#/components/schemas/BaseGroup' -info: - title: Backend - description: "" - version: v1 - contact: {} -tags: [] -servers: [] -components: - schemas: - GroupFilters: - type: object - properties: - groupId: - # - # 👇🏻 Breaking change here - # - type: integer - nullable: true - name: - type: array - items: - type: string - BaseGroup: - type: object - properties: - groupId: - type: number - name: - type: string - required: - - groupId - - name diff --git a/openapi3/testdata/origin/request_parameter_property_type_changed_base_num.yaml b/openapi3/testdata/origin/request_parameter_property_type_changed_base_num.yaml deleted file mode 100644 index 7a827c55d..000000000 --- a/openapi3/testdata/origin/request_parameter_property_type_changed_base_num.yaml +++ /dev/null @@ -1,80 +0,0 @@ -openapi: 3.0.1 -paths: - /groups: - get: - operationId: getGroups - summary: Get groups - parameters: - - name: skip - required: false - in: query - schema: - type: string - - name: take - required: false - in: query - schema: - type: string - - name: filters - required: false - in: query - style: deepObject - explode: true - schema: - $ref: '#/components/schemas/GroupFilters' - responses: - "200": - description: Successfully received results - content: - application/json: - schema: - type: object - title: BaseGroupListResponse - required: - - total - - skip - - take - - results - properties: - total: - type: integer - skip: - type: integer - take: - type: integer - results: - type: array - items: - $ref: '#/components/schemas/BaseGroup' -info: - title: Backend - description: "" - version: v1 - contact: {} -tags: [] -servers: [] -components: - schemas: - GroupFilters: - type: object - properties: - groupId: - # - # 👇🏻 Breaking change here - # - type: number - nullable: true - name: - type: array - items: - type: string - BaseGroup: - type: object - properties: - groupId: - type: number - name: - type: string - required: - - groupId - - name diff --git a/openapi3/testdata/origin/request_parameter_property_type_changed_revision.yaml b/openapi3/testdata/origin/request_parameter_property_type_changed_revision.yaml deleted file mode 100644 index c6683cc0f..000000000 --- a/openapi3/testdata/origin/request_parameter_property_type_changed_revision.yaml +++ /dev/null @@ -1,80 +0,0 @@ -openapi: 3.0.1 -paths: - /groups: - get: - operationId: getGroups - summary: Get groups - parameters: - - name: skip - required: false - in: query - schema: - type: string - - name: take - required: false - in: query - schema: - type: string - - name: filters - required: false - in: query - style: deepObject - explode: true - schema: - $ref: '#/components/schemas/GroupFilters' - responses: - "200": - description: Successfully received results - content: - application/json: - schema: - type: object - title: BaseGroupListResponse - required: - - total - - skip - - take - - results - properties: - total: - type: integer - skip: - type: integer - take: - type: integer - results: - type: array - items: - $ref: '#/components/schemas/BaseGroup' -info: - title: Backend - description: "" - version: v1 - contact: {} -tags: [] -servers: [] -components: - schemas: - GroupFilters: - type: object - properties: - groupId: - # - # 👇🏻 Breaking change here - # - type: string - nullable: true - name: - type: array - items: - type: string - BaseGroup: - type: object - properties: - groupId: - type: number - name: - type: string - required: - - groupId - - name diff --git a/openapi3/testdata/origin/request_parameter_type_changed_base.yaml b/openapi3/testdata/origin/request_parameter_type_changed_base.yaml deleted file mode 100644 index c0333d48d..000000000 --- a/openapi3/testdata/origin/request_parameter_type_changed_base.yaml +++ /dev/null @@ -1,72 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - parameters: - - in: path - name: groupId - required: true - schema: - type: string - - in: query - name: token - schema: - description: RFC 4122 UUID - example: 26734565-dbcc-449a-a370-0beaaf04b0e8 - format: uuid - pattern: ^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12})$ - type: string - maxLength: 29 - - in: header - name: X-Request-ID - schema: - type: string - format: uuid - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/request_property_added_base.yaml b/openapi3/testdata/origin/request_property_added_base.yaml deleted file mode 100644 index c252b7a39..000000000 --- a/openapi3/testdata/origin/request_property_added_base.yaml +++ /dev/null @@ -1,21 +0,0 @@ -openapi: 3.0.0 -info: - title: Sample API - version: 1.0.0 -paths: - /products: - post: - operationId: addProduct - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string - required: - - name - responses: - '200': - description: OK diff --git a/openapi3/testdata/origin/request_property_added_revision.yaml b/openapi3/testdata/origin/request_property_added_revision.yaml deleted file mode 100644 index 223d3203a..000000000 --- a/openapi3/testdata/origin/request_property_added_revision.yaml +++ /dev/null @@ -1,24 +0,0 @@ -openapi: 3.0.0 -info: - title: Sample API - version: 1.0.0 -paths: - /products: - post: - operationId: addProduct - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string - description: - type: string - required: - - name - - description - responses: - '200': - description: OK diff --git a/openapi3/testdata/origin/request_property_added_revision2.yaml b/openapi3/testdata/origin/request_property_added_revision2.yaml deleted file mode 100644 index a4fbdd4f7..000000000 --- a/openapi3/testdata/origin/request_property_added_revision2.yaml +++ /dev/null @@ -1,26 +0,0 @@ -openapi: 3.0.0 -info: - title: Sample API - version: 1.0.0 -paths: - /products: - post: - operationId: addProduct - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string - description: - type: string - info: - type: string - required: - - name - - description - responses: - '200': - description: OK diff --git a/openapi3/testdata/origin/request_property_added_with_default.yaml b/openapi3/testdata/origin/request_property_added_with_default.yaml deleted file mode 100644 index d6fd2c723..000000000 --- a/openapi3/testdata/origin/request_property_added_with_default.yaml +++ /dev/null @@ -1,25 +0,0 @@ -openapi: 3.0.0 -info: - title: Sample API - version: 1.0.0 -paths: - /products: - post: - operationId: addProduct - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string - description: - type: string - default: "default description" - required: - - name - - description - responses: - '200': - description: OK diff --git a/openapi3/testdata/origin/request_property_all_of_added_base.yaml b/openapi3/testdata/origin/request_property_all_of_added_base.yaml deleted file mode 100644 index 039c5cce1..000000000 --- a/openapi3/testdata/origin/request_property_all_of_added_base.yaml +++ /dev/null @@ -1,49 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - requestBody: - content: - application/json: - schema: - allOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - responses: - "200": - description: Updated - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - allOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/request_property_all_of_added_revision.yaml b/openapi3/testdata/origin/request_property_all_of_added_revision.yaml deleted file mode 100644 index 43da3d5f2..000000000 --- a/openapi3/testdata/origin/request_property_all_of_added_revision.yaml +++ /dev/null @@ -1,62 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - requestBody: - content: - application/json: - schema: - allOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - - $ref: "#/components/schemas/Rabbit" - responses: - "200": - description: Updated - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - allOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - $ref: "#/components/schemas/Breed3" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - Breed3: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string - - Rabbit: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/request_property_all_of_removed_base.yaml b/openapi3/testdata/origin/request_property_all_of_removed_base.yaml deleted file mode 100644 index 43da3d5f2..000000000 --- a/openapi3/testdata/origin/request_property_all_of_removed_base.yaml +++ /dev/null @@ -1,62 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - requestBody: - content: - application/json: - schema: - allOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - - $ref: "#/components/schemas/Rabbit" - responses: - "200": - description: Updated - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - allOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - $ref: "#/components/schemas/Breed3" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - Breed3: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string - - Rabbit: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/request_property_all_of_removed_revision.yaml b/openapi3/testdata/origin/request_property_all_of_removed_revision.yaml deleted file mode 100644 index 039c5cce1..000000000 --- a/openapi3/testdata/origin/request_property_all_of_removed_revision.yaml +++ /dev/null @@ -1,49 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - requestBody: - content: - application/json: - schema: - allOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - responses: - "200": - description: Updated - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - allOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/request_property_any_of_added_base.yaml b/openapi3/testdata/origin/request_property_any_of_added_base.yaml deleted file mode 100644 index 2f1f16ee3..000000000 --- a/openapi3/testdata/origin/request_property_any_of_added_base.yaml +++ /dev/null @@ -1,49 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - requestBody: - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - responses: - "200": - description: Updated - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - anyOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/request_property_any_of_added_revision.yaml b/openapi3/testdata/origin/request_property_any_of_added_revision.yaml deleted file mode 100644 index 65b924b2a..000000000 --- a/openapi3/testdata/origin/request_property_any_of_added_revision.yaml +++ /dev/null @@ -1,62 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - requestBody: - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - - $ref: "#/components/schemas/Rabbit" - responses: - "200": - description: Updated - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - anyOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - $ref: "#/components/schemas/Breed3" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - Breed3: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string - - Rabbit: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/request_property_any_of_removed_base.yaml b/openapi3/testdata/origin/request_property_any_of_removed_base.yaml deleted file mode 100644 index 65b924b2a..000000000 --- a/openapi3/testdata/origin/request_property_any_of_removed_base.yaml +++ /dev/null @@ -1,62 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - requestBody: - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - - $ref: "#/components/schemas/Rabbit" - responses: - "200": - description: Updated - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - anyOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - $ref: "#/components/schemas/Breed3" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - Breed3: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string - - Rabbit: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/request_property_any_of_removed_revision.yaml b/openapi3/testdata/origin/request_property_any_of_removed_revision.yaml deleted file mode 100644 index 2f1f16ee3..000000000 --- a/openapi3/testdata/origin/request_property_any_of_removed_revision.yaml +++ /dev/null @@ -1,49 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - requestBody: - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - responses: - "200": - description: Updated - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - anyOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/request_property_became_nullable_base.yaml b/openapi3/testdata/origin/request_property_became_nullable_base.yaml deleted file mode 100644 index c252b7a39..000000000 --- a/openapi3/testdata/origin/request_property_became_nullable_base.yaml +++ /dev/null @@ -1,21 +0,0 @@ -openapi: 3.0.0 -info: - title: Sample API - version: 1.0.0 -paths: - /products: - post: - operationId: addProduct - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string - required: - - name - responses: - '200': - description: OK diff --git a/openapi3/testdata/origin/request_property_became_nullable_revision.yaml b/openapi3/testdata/origin/request_property_became_nullable_revision.yaml deleted file mode 100644 index d1d6ccda3..000000000 --- a/openapi3/testdata/origin/request_property_became_nullable_revision.yaml +++ /dev/null @@ -1,22 +0,0 @@ -openapi: 3.0.0 -info: - title: Sample API - version: 2.0.0 # Updated version -paths: - /products: - post: - operationId: addProduct - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string - nullable: true - required: - - name - responses: - '200': - description: OK diff --git a/openapi3/testdata/origin/request_property_became_required_base.yaml b/openapi3/testdata/origin/request_property_became_required_base.yaml deleted file mode 100644 index 23693252e..000000000 --- a/openapi3/testdata/origin/request_property_became_required_base.yaml +++ /dev/null @@ -1,23 +0,0 @@ -openapi: 3.0.0 -info: - title: Sample API - version: 1.0.0 -paths: - /products: - post: - operationId: addProduct - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string - description: - type: string - required: - - name - responses: - '200': - description: OK diff --git a/openapi3/testdata/origin/request_property_default_value_changed_base.yaml b/openapi3/testdata/origin/request_property_default_value_changed_base.yaml deleted file mode 100644 index 739f2e0df..000000000 --- a/openapi3/testdata/origin/request_property_default_value_changed_base.yaml +++ /dev/null @@ -1,21 +0,0 @@ -openapi: 3.0.0 -info: - title: Sample API - version: 1.0.0 -paths: - /products: - post: - summary: Create a new product - operationId: createProduct - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - name: - type: string - price: - type: number - default: 10.0 \ No newline at end of file diff --git a/openapi3/testdata/origin/request_property_discriminator_added_base.yaml b/openapi3/testdata/origin/request_property_discriminator_added_base.yaml deleted file mode 100644 index 8a880a8e9..000000000 --- a/openapi3/testdata/origin/request_property_discriminator_added_base.yaml +++ /dev/null @@ -1,51 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - requestBody: - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - -components: - schemas: - Dog: - type: object - properties: - petType: - type: string - name: - type: string - breed: - type: object - oneOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - petType: - type: string - name: - type: string diff --git a/openapi3/testdata/origin/request_property_discriminator_added_property_name_changed.yaml b/openapi3/testdata/origin/request_property_discriminator_added_property_name_changed.yaml deleted file mode 100644 index c342174eb..000000000 --- a/openapi3/testdata/origin/request_property_discriminator_added_property_name_changed.yaml +++ /dev/null @@ -1,61 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - requestBody: - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - discriminator: - propertyName: petType2 - mapping: - cat: "#/components/schemas/Cat" - dog: "#/components/schemas/Dog" - -components: - schemas: - Dog: - type: object - properties: - petType2: - type: string - name: - type: string - breed: - type: object - oneOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - discriminator: - propertyName: name2 - mapping: - breed1: "#/components/schemas/Breed1" - breed2: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name2: - type: string - - Breed2: - type: object - properties: - name2: - type: string - - Cat: - type: object - properties: - petType2: - type: string - name: - type: string diff --git a/openapi3/testdata/origin/request_property_discriminator_added_revision.yaml b/openapi3/testdata/origin/request_property_discriminator_added_revision.yaml deleted file mode 100644 index 674d0c9e8..000000000 --- a/openapi3/testdata/origin/request_property_discriminator_added_revision.yaml +++ /dev/null @@ -1,61 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - requestBody: - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - discriminator: - propertyName: petType - mapping: - cat: "#/components/schemas/Cat" - dog: "#/components/schemas/Dog" - -components: - schemas: - Dog: - type: object - properties: - petType: - type: string - name: - type: string - breed: - type: object - oneOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - discriminator: - propertyName: name - mapping: - breed1: "#/components/schemas/Breed1" - breed2: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - petType: - type: string - name: - type: string diff --git a/openapi3/testdata/origin/request_property_discriminator_mapping_changed.yaml b/openapi3/testdata/origin/request_property_discriminator_mapping_changed.yaml deleted file mode 100644 index cb5051a3b..000000000 --- a/openapi3/testdata/origin/request_property_discriminator_mapping_changed.yaml +++ /dev/null @@ -1,67 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - requestBody: - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - discriminator: - propertyName: petType - mapping: - cats: "#/components/schemas/Cat" - dog: "#/components/schemas/Dog" - -components: - schemas: - Dog: - type: object - properties: - petType: - type: string - name: - type: string - breed: - type: object - oneOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - discriminator: - propertyName: name - mapping: - breed1Code: "#/components/schemas/Breed1" - breed2: "#/components/schemas/Breed3" - - Breed1: - type: object - properties: - name: - type: string - - Breed2: - type: object - properties: - name: - type: string - - Breed3: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - petType: - type: string - name: - type: string diff --git a/openapi3/testdata/origin/request_property_enum_value_updated_base.yaml b/openapi3/testdata/origin/request_property_enum_value_updated_base.yaml deleted file mode 100644 index 6345cbbc1..000000000 --- a/openapi3/testdata/origin/request_property_enum_value_updated_base.yaml +++ /dev/null @@ -1,43 +0,0 @@ -openapi: 3.0.1 -info: - title: Pet Store - version: 1.0.0 -paths: - /pets: - post: - operationId: updatePet - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - description: Update an existing pet - responses: - "200": - description: OK -components: - schemas: - Pet: - type: object - properties: - id: - type: integer - format: int64 - name: - type: string - status: - type: string - enum: - - available - - pending - - sold - category: - type: string - enum: - - dog - - cat - - bird - required: - - name - - status - - category diff --git a/openapi3/testdata/origin/request_property_extensible_enum_base.yaml b/openapi3/testdata/origin/request_property_extensible_enum_base.yaml deleted file mode 100644 index 0807f5039..000000000 --- a/openapi3/testdata/origin/request_property_extensible_enum_base.yaml +++ /dev/null @@ -1,24 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: 1.0.0 -paths: - /pets: - post: - operationId: addPet - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string - x-extensible-enum: - - available - - pending - - sold - responses: - "200": - description: OK - diff --git a/openapi3/testdata/origin/request_property_extensible_enum_revision.yaml b/openapi3/testdata/origin/request_property_extensible_enum_revision.yaml deleted file mode 100644 index 41e54483e..000000000 --- a/openapi3/testdata/origin/request_property_extensible_enum_revision.yaml +++ /dev/null @@ -1,22 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: 1.0.0 -paths: - /pets: - post: - operationId: addPet - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string - x-extensible-enum: - - available - - pending - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_property_max_decreased_base.yaml b/openapi3/testdata/origin/request_property_max_decreased_base.yaml deleted file mode 100644 index cf9ee1560..000000000 --- a/openapi3/testdata/origin/request_property_max_decreased_base.yaml +++ /dev/null @@ -1,22 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: 1.0.0 -paths: - /pets: - post: - operationId: addPet - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string - maximum: 15 - required: - - name - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_property_max_length_set_base.yaml b/openapi3/testdata/origin/request_property_max_length_set_base.yaml deleted file mode 100644 index 7c7974fa8..000000000 --- a/openapi3/testdata/origin/request_property_max_length_set_base.yaml +++ /dev/null @@ -1,21 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: 1.0.0 -paths: - /pets: - post: - operationId: addPet - requestBody: - content: - application/json: - schema: - type: object - properties: - age: - type: string - required: - - age - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_property_max_length_set_revision.yaml b/openapi3/testdata/origin/request_property_max_length_set_revision.yaml deleted file mode 100644 index b0b964239..000000000 --- a/openapi3/testdata/origin/request_property_max_length_set_revision.yaml +++ /dev/null @@ -1,22 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: 1.0.0 -paths: - /pets: - post: - operationId: addPet - requestBody: - content: - application/json: - schema: - type: object - properties: - age: - type: string - maxLength: 15 - required: - - age - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_property_max_set_base.yaml b/openapi3/testdata/origin/request_property_max_set_base.yaml deleted file mode 100644 index 449f8c0ad..000000000 --- a/openapi3/testdata/origin/request_property_max_set_base.yaml +++ /dev/null @@ -1,21 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: 1.0.0 -paths: - /pets: - post: - operationId: addPet - requestBody: - content: - application/json: - schema: - type: object - properties: - age: - type: integer - required: - - age - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_property_max_set_revision.yaml b/openapi3/testdata/origin/request_property_max_set_revision.yaml deleted file mode 100644 index 670a59c59..000000000 --- a/openapi3/testdata/origin/request_property_max_set_revision.yaml +++ /dev/null @@ -1,22 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: 1.0.0 -paths: - /pets: - post: - operationId: addPet - requestBody: - content: - application/json: - schema: - type: object - properties: - age: - type: integer - maximum: 15 - required: - - age - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_property_min_increased_base.yaml b/openapi3/testdata/origin/request_property_min_increased_base.yaml deleted file mode 100644 index 6288edff3..000000000 --- a/openapi3/testdata/origin/request_property_min_increased_base.yaml +++ /dev/null @@ -1,22 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: 1.0.0 -paths: - /pets: - post: - operationId: addPet - requestBody: - content: - application/json: - schema: - type: object - properties: - age: - type: integer - minimum: 10 - required: - - age - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_property_min_increased_revision.yaml b/openapi3/testdata/origin/request_property_min_increased_revision.yaml deleted file mode 100644 index 85801588d..000000000 --- a/openapi3/testdata/origin/request_property_min_increased_revision.yaml +++ /dev/null @@ -1,22 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: 1.0.0 -paths: - /pets: - post: - operationId: addPet - requestBody: - content: - application/json: - schema: - type: object - properties: - age: - type: integer - minimum: 15 - required: - - age - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_property_min_items_increased_base.yaml b/openapi3/testdata/origin/request_property_min_items_increased_base.yaml deleted file mode 100644 index 873e4eeb3..000000000 --- a/openapi3/testdata/origin/request_property_min_items_increased_base.yaml +++ /dev/null @@ -1,21 +0,0 @@ -openapi: 3.0.1 -info: - title: Product API - version: "1.0" -servers: - - url: https://api.example.com/v1 -paths: - /products: - post: - operationId: addProduct - requestBody: - content: - application/json: - schema: - type: array - items: - type: string - minItems: 10 - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_property_min_items_increased_revision.yaml b/openapi3/testdata/origin/request_property_min_items_increased_revision.yaml deleted file mode 100644 index 292781398..000000000 --- a/openapi3/testdata/origin/request_property_min_items_increased_revision.yaml +++ /dev/null @@ -1,21 +0,0 @@ -openapi: 3.0.1 -info: - title: Product API - version: "1.0" -servers: - - url: https://api.example.com/v1 -paths: - /products: - post: - operationId: addProduct - requestBody: - content: - application/json: - schema: - type: array - items: - type: string - minItems: 20 - responses: - "200": - description: OK diff --git a/openapi3/testdata/origin/request_property_min_length_decreased_base.yaml b/openapi3/testdata/origin/request_property_min_length_decreased_base.yaml deleted file mode 100644 index 2f5c5b2c6..000000000 --- a/openapi3/testdata/origin/request_property_min_length_decreased_base.yaml +++ /dev/null @@ -1,31 +0,0 @@ -openapi: 3.0.1 -info: - title: Product API - version: "1.0" -servers: - - url: https://api.example.com/v1 -paths: - /products: - post: - operationId: addProduct - requestBody: - content: - application/json: - schema: - type: object - minLength: 10 - properties: - id: - type: integer - name: - type: string - minLength: 3 - description: - type: string - minLength: 10 - required: true - - responses: - "200": - description: OK -components: {} diff --git a/openapi3/testdata/origin/request_property_one_of_added_base.yaml b/openapi3/testdata/origin/request_property_one_of_added_base.yaml deleted file mode 100644 index 9997daf75..000000000 --- a/openapi3/testdata/origin/request_property_one_of_added_base.yaml +++ /dev/null @@ -1,49 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - requestBody: - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - responses: - "200": - description: Updated - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - oneOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/request_property_one_of_added_revision.yaml b/openapi3/testdata/origin/request_property_one_of_added_revision.yaml deleted file mode 100644 index d8c60a6d3..000000000 --- a/openapi3/testdata/origin/request_property_one_of_added_revision.yaml +++ /dev/null @@ -1,62 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - requestBody: - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - - $ref: "#/components/schemas/Rabbit" - responses: - "200": - description: Updated - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - oneOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - $ref: "#/components/schemas/Breed3" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - Breed3: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string - - Rabbit: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/request_property_one_of_removed_base.yaml b/openapi3/testdata/origin/request_property_one_of_removed_base.yaml deleted file mode 100644 index d8c60a6d3..000000000 --- a/openapi3/testdata/origin/request_property_one_of_removed_base.yaml +++ /dev/null @@ -1,62 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - requestBody: - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - - $ref: "#/components/schemas/Rabbit" - responses: - "200": - description: Updated - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - oneOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - $ref: "#/components/schemas/Breed3" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - Breed3: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string - - Rabbit: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/request_property_one_of_removed_revision.yaml b/openapi3/testdata/origin/request_property_one_of_removed_revision.yaml deleted file mode 100644 index 9997daf75..000000000 --- a/openapi3/testdata/origin/request_property_one_of_removed_revision.yaml +++ /dev/null @@ -1,49 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - requestBody: - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - responses: - "200": - description: Updated - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - oneOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/request_property_pattern_added_or_changed_base.yaml b/openapi3/testdata/origin/request_property_pattern_added_or_changed_base.yaml deleted file mode 100644 index 0ddc94456..000000000 --- a/openapi3/testdata/origin/request_property_pattern_added_or_changed_base.yaml +++ /dev/null @@ -1,25 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: "1.0" -paths: - /test: - post: - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/TestRequest' - responses: - '200': - description: OK -components: - schemas: - TestRequest: - type: object - properties: - name: - type: string - pattern: '^\w+$' - age: - type: integer diff --git a/openapi3/testdata/origin/request_property_pattern_added_or_changed_revision.yaml b/openapi3/testdata/origin/request_property_pattern_added_or_changed_revision.yaml deleted file mode 100644 index 897671ca6..000000000 --- a/openapi3/testdata/origin/request_property_pattern_added_or_changed_revision.yaml +++ /dev/null @@ -1,25 +0,0 @@ -openapi: 3.0.1 -info: - title: Test API - version: "1.0" -paths: - /test: - post: - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/TestRequest' - responses: - '200': - description: OK -components: - schemas: - TestRequest: - type: object - properties: - name: - type: string - pattern: '' - age: - type: integer diff --git a/openapi3/testdata/origin/request_property_type_changed_base.yaml b/openapi3/testdata/origin/request_property_type_changed_base.yaml deleted file mode 100644 index 7565cd4d5..000000000 --- a/openapi3/testdata/origin/request_property_type_changed_base.yaml +++ /dev/null @@ -1,24 +0,0 @@ -openapi: 3.0.1 -info: - title: Sample API - version: 1.0.0 -paths: - /pets: - post: - summary: Add a new pet - operationId: addPet - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - name: - type: string - format: string - age: - type: integer - format: int32 - required: - - name diff --git a/openapi3/testdata/origin/request_property_type_changed_base_array_to_object.yaml b/openapi3/testdata/origin/request_property_type_changed_base_array_to_object.yaml deleted file mode 100644 index 4df9fda37..000000000 --- a/openapi3/testdata/origin/request_property_type_changed_base_array_to_object.yaml +++ /dev/null @@ -1,46 +0,0 @@ -openapi: 3.0.1 -info: - title: Sample API - version: 1.0.0 -paths: - /pets: - post: - summary: Add a new pet - operationId: addPet - requestBody: - required: true - content: - application/json: - schema: - type: array - items: - type: object - properties: - name: - type: string - format: string - age: - type: integer - format: int32 - required: - - name - /dogs: - post: - summary: Add a new dog - operationId: addDog - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - name: - type: string - format: string - colors: - type: array - items: - type: integer - required: - - name diff --git a/openapi3/testdata/origin/request_property_type_changed_revision.yaml b/openapi3/testdata/origin/request_property_type_changed_revision.yaml deleted file mode 100644 index 452285d0f..000000000 --- a/openapi3/testdata/origin/request_property_type_changed_revision.yaml +++ /dev/null @@ -1,24 +0,0 @@ -openapi: 3.0.1 -info: - title: Sample API - version: 1.0.0 -paths: - /pets: - post: - summary: Add a new pet - operationId: addPet - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - name: - type: string - format: string - age: - type: string - format: string - required: - - name diff --git a/openapi3/testdata/origin/request_property_type_changed_revision_array_to_object.yaml b/openapi3/testdata/origin/request_property_type_changed_revision_array_to_object.yaml deleted file mode 100644 index 0bfd4379f..000000000 --- a/openapi3/testdata/origin/request_property_type_changed_revision_array_to_object.yaml +++ /dev/null @@ -1,60 +0,0 @@ -openapi: 3.0.1 -info: - title: Sample API - version: 1.0.0 -paths: - /pets: - post: - summary: Add a new pet - operationId: addPet - requestBody: - required: true - content: - application/json: - schema: - type: object - required: - - data - properties: - data: - type: array - items: - type: object - properties: - name: - type: string - format: string - age: - type: integer - format: int32 - required: - - name - /dogs: - post: - summary: Add a new dog - operationId: addDog - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - name: - type: string - format: string - colors: - type: object - properties: - red: - type: integer - green: - type: integer - blue: - type: integer - required: - - red - - blue - - green - required: - - name diff --git a/openapi3/testdata/origin/response-media-type-base.yaml b/openapi3/testdata/origin/response-media-type-base.yaml deleted file mode 100644 index af72046a0..000000000 --- a/openapi3/testdata/origin/response-media-type-base.yaml +++ /dev/null @@ -1,490 +0,0 @@ -openapi: 3.0.0 -info: - title: SmartChef API - version: 1.0.0 - -paths: - /products: - get: - summary: Returns a list of all products - tags: - - Products - parameters: - - $ref: '#/components/parameters/takeParam' - - $ref: '#/components/parameters/skipParam' - - in: query - name: gtin - schema: - type: string - maxLength: 13 - - in: query - name: name - schema: - type: string - - in: query - name: beschreibung - schema: - type: string - responses: - '200': - description: JSON Array of products - content: - application/javascript: - schema: - type: string - application/json: - schema: - $ref: '#/components/schemas/ProductDto' - - post: - summary: Creates a new product - tags: - - Products - responses: - '201': - description: Returns the created product as JSON - content: - application/json: - schema: - $ref: '#/components/schemas/ProductDto' - '409': - description: GTIN already taken - - /products/{productId}: - get: - summary: Gets the product with the specified productId - parameters: - - in: path - name: productId - schema: - type: string - format: uuid - required: true - description: The UUID of the requested product - - tags: - - Products - responses: - '200': - description: Returns the requested product - content: - application/json: - schema: - $ref: '#/components/schemas/ProductDto' - '404': - description: Product with provided ID does not exist - - /products/{productId}/categories: - get: - summary: Gets the categories of the specified product - parameters: - - in: path - name: productId - schema: - type: string - format: uuid - required: true - description: The UUID of the requested product - - tags: - - Products - responses: - '200': - description: Returns the categories of the requested product - content: - application/json: - schema: - $ref: '#/components/schemas/ProductDto' - '404': - description: Product with provided ID does not exist - - '500': - description: Internal Server Error - '400': - description: Bad Request - - /users: - get: - tags: - - Users - summary: Gets all users - parameters: - - $ref: '#/components/parameters/takeParam' - - $ref: '#/components/parameters/skipParam' - - in: query - name: vorname - schema: - type: string - - in: query - name: nachname - schema: - type: string - responses: - '200': - description: Returns public users - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/PublicUserDto' - - post: - tags: - - Users - summary: Creates a new user - requestBody: - description: Data for the new user - content: - application/json: - schema: - $ref: '#/components/schemas/CreateUserDto' - responses: - '201': - description: The created user - content: - application/json: - schema: - $ref: '#/components/schemas/PrivateUserDto' - '409': - description: Email already taken - - - /users/{userId}: - get: - tags: - - Users - summary: Gets the requested user - parameters: - - in: path - name: userId - schema: - type: string - format: uuid - required: true - description: The UUID of the requested user - responses: - '200': - description: Returns the requested user - content: - application/json: - schema: - $ref: '#/components/schemas/PublicUserDto' - - put: - tags: - - Users - summary: Updates a user - parameters: - - in: path - name: userId - schema: - type: string - format: uuid - required: true - description: The UUID of the user to be updated - requestBody: - description: User update data - content: - application/json: - schema: - $ref: '#/components/schemas/UpdateUserDto' - responses: - '200': - description: Returns the updated user - content: - application/json: - schema: - $ref: '#/components/schemas/PublicUserDto' - - /auth/login: - post: - tags: - - Auth - summary: Logs in the user - requestBody: - description: User credentials - content: - application/json: - schema: - $ref: '#/components/schemas/LoginDto' - - responses: - '201': - description: Returns the created token pair - content: - application/json: - schema: - $ref: '#/components/schemas/TokenResponse' - '403': - description: Wrong email and/or password - - /auth/refresh: - post: - tags: - - Auth - summary: Gets a new access token using the provided refresh token - requestBody: - description: Refresh token - content: - application/json: - schema: - type: object - properties: - refreshToken: - type: string - format: jwt - responses: - '201': - description: Returns a new token pair - content: - application/json: - schema: - $ref: '#/components/schemas/TokenResponse' - - -components: - securitySchemes: - bearerAuth: # arbitrary name for the security scheme - type: http - scheme: bearer - bearerFormat: JWT - - - schemas: - ResourceDto: - type: object - properties: - id: - type: string - format: uuid - createdAt: - type: string - format: datetime - updatedAt: - type: string - format: datetime - - ProductDto: - type: object - allOf: - - $ref: '#/components/schemas/ResourceDto' - - type: object - properties: - gtin: - type: string - name: - type: string - beschreibung: - type: string - menge: - type: number - minimum: 0 - einheit: - type: string - kategorieId: - type: string - format: uuid - herstellerId: - type: string - format: uuid - - TokenResponse: - type: object - properties: - accessToken: - type: string - format: jwt - refreshToken: - type: string - format: jwt - - PublicUserDto: - type: object - properties: - id: - type: string - format: uuid - vorname: - type: string - maxLength: 255 - nachname: - type: string - maxLength: 255 - - PrivateUserDto: - type: object - allOf: - - $ref: '#/components/schemas/PublicUserDto' - - type: object - properties: - email: - type: string - format: email - maxLength: 255 - - LoginDto: - type: object - properties: - email: - type: string - format: email - maxLength: 255 - - password: - type: string - maxLength: 255 - - HaushaltDto: - type: object - allOf: - - $ref: '#/components/schemas/ResourceDto' - - type: object - properties: - name: - type: string - maxLength: 255 - - HaushaltProduktDto: - type: object - allOf: - - $ref: '#/components/schemas/ResourceDto' - - $ref: '#/components/schemas/ProductDto' - - type: object - properties: - haushaltId: - type: string - format: uuid - ist: - type: number - soll: - type: number - - HerstellerDto: - type: object - allOf: - - $ref: '#/components/schemas/ResourceDto' - - type: object - properties: - name: - type: string - - ProduktKategorieDto: - type: object - allOf: - - $ref: '#/components/schemas/ResourceDto' - - type: object - properties: - name: - type: string - maxLength: 255 - parentId: - type: string - format: uuid - - RezeptDto: - type: object - allOf: - - $ref: '#/components/schemas/ResourceDto' - - type: object - properties: - name: - type: string - maxLength: 255 - beschreibung: - type: string - maxLength: 255 - anleitungText: - type: string - maxLength: 4000 - url: - type: string - format: url - maxLength: 1024 - kategorieId: - type: string - format: string - - RezeptKategorieDto: - type: object - allOf: - - $ref: '#/components/schemas/ResourceDto' - - type: object - properties: - name: - type: string - parentId: - type: string - format: uuid - - ZutatenDto: - type: object - allOf: - - $ref: '#/components/schemas/ResourceDto' - - type: object - properties: - produktKategorieId: - type: string - maxLength: 255 - menge: - type: number - minimum: 0 - einheit: - type: string - maxLength: 255 - rezeptId: - type: string - format: uuid - - CreateUserDto: - type: object - required: - - password - - vorname - - nachname - properties: - password: - type: string - minLength: 8 - maxLength: 255 - vorname: - type: string - maxLength: 255 - nachname: - type: string - maxLength: 255 - - UpdateUserDto: - type: object - properties: - password: - type: string - maxLength: 255 - vorname: - type: string - maxLength: 255 - nachname: - type: string - maxLength: 255 - - parameters: - takeParam: - in: query - name: take - schema: - type: integer - minimum: 1 - maximum: 50 - description: The amount of users to return - skipParam: - in: query - name: skip - schema: - type: integer - minimum: 1 - maximum: 50 - description: The amount of users to skip - - -security: - - bearerAuth: [] \ No newline at end of file diff --git a/openapi3/testdata/origin/response-media-type-revision.yaml b/openapi3/testdata/origin/response-media-type-revision.yaml deleted file mode 100644 index ae762b2d3..000000000 --- a/openapi3/testdata/origin/response-media-type-revision.yaml +++ /dev/null @@ -1,487 +0,0 @@ -openapi: 3.0.0 -info: - title: SmartChef API - version: 1.0.0 - -paths: - /products: - get: - summary: Returns a list of all products - tags: - - Products - parameters: - - $ref: '#/components/parameters/takeParam' - - $ref: '#/components/parameters/skipParam' - - in: query - name: gtin - schema: - type: string - maxLength: 13 - - in: query - name: name - schema: - type: string - - in: query - name: beschreibung - schema: - type: string - responses: - '200': - description: JSON Array of products - content: - application/javascript: - schema: - type: string - - post: - summary: Creates a new product - tags: - - Products - responses: - '201': - description: Returns the created product as JSON - content: - application/json: - schema: - $ref: '#/components/schemas/ProductDto' - '409': - description: GTIN already taken - - /products/{productId}: - get: - summary: Gets the product with the specified productId - parameters: - - in: path - name: productId - schema: - type: string - format: uuid - required: true - description: The UUID of the requested product - - tags: - - Products - responses: - '200': - description: Returns the requested product - content: - application/json: - schema: - $ref: '#/components/schemas/ProductDto' - '404': - description: Product with provided ID does not exist - - /products/{productId}/categories: - get: - summary: Gets the categories of the specified product - parameters: - - in: path - name: productId - schema: - type: string - format: uuid - required: true - description: The UUID of the requested product - - tags: - - Products - responses: - '200': - description: Returns the categories of the requested product - content: - application/json: - schema: - $ref: '#/components/schemas/ProductDto' - '404': - description: Product with provided ID does not exist - - '500': - description: Internal Server Error - '400': - description: Bad Request - - /users: - get: - tags: - - Users - summary: Gets all users - parameters: - - $ref: '#/components/parameters/takeParam' - - $ref: '#/components/parameters/skipParam' - - in: query - name: vorname - schema: - type: string - - in: query - name: nachname - schema: - type: string - responses: - '200': - description: Returns public users - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/PublicUserDto' - - post: - tags: - - Users - summary: Creates a new user - requestBody: - description: Data for the new user - content: - application/json: - schema: - $ref: '#/components/schemas/CreateUserDto' - responses: - '201': - description: The created user - content: - application/json: - schema: - $ref: '#/components/schemas/PrivateUserDto' - '409': - description: Email already taken - - - /users/{userId}: - get: - tags: - - Users - summary: Gets the requested user - parameters: - - in: path - name: userId - schema: - type: string - format: uuid - required: true - description: The UUID of the requested user - responses: - '200': - description: Returns the requested user - content: - application/json: - schema: - $ref: '#/components/schemas/PublicUserDto' - - put: - tags: - - Users - summary: Updates a user - parameters: - - in: path - name: userId - schema: - type: string - format: uuid - required: true - description: The UUID of the user to be updated - requestBody: - description: User update data - content: - application/json: - schema: - $ref: '#/components/schemas/UpdateUserDto' - responses: - '200': - description: Returns the updated user - content: - application/json: - schema: - $ref: '#/components/schemas/PublicUserDto' - - /auth/login: - post: - tags: - - Auth - summary: Logs in the user - requestBody: - description: User credentials - content: - application/json: - schema: - $ref: '#/components/schemas/LoginDto' - - responses: - '201': - description: Returns the created token pair - content: - application/json: - schema: - $ref: '#/components/schemas/TokenResponse' - '403': - description: Wrong email and/or password - - /auth/refresh: - post: - tags: - - Auth - summary: Gets a new access token using the provided refresh token - requestBody: - description: Refresh token - content: - application/json: - schema: - type: object - properties: - refreshToken: - type: string - format: jwt - responses: - '201': - description: Returns a new token pair - content: - application/json: - schema: - $ref: '#/components/schemas/TokenResponse' - - -components: - securitySchemes: - bearerAuth: # arbitrary name for the security scheme - type: http - scheme: bearer - bearerFormat: JWT - - - schemas: - ResourceDto: - type: object - properties: - id: - type: string - format: uuid - createdAt: - type: string - format: datetime - updatedAt: - type: string - format: datetime - - ProductDto: - type: object - allOf: - - $ref: '#/components/schemas/ResourceDto' - - type: object - properties: - gtin: - type: string - name: - type: string - beschreibung: - type: string - menge: - type: number - minimum: 0 - einheit: - type: string - kategorieId: - type: string - format: uuid - herstellerId: - type: string - format: uuid - - TokenResponse: - type: object - properties: - accessToken: - type: string - format: jwt - refreshToken: - type: string - format: jwt - - PublicUserDto: - type: object - properties: - id: - type: string - format: uuid - vorname: - type: string - maxLength: 255 - nachname: - type: string - maxLength: 255 - - PrivateUserDto: - type: object - allOf: - - $ref: '#/components/schemas/PublicUserDto' - - type: object - properties: - email: - type: string - format: email - maxLength: 255 - - LoginDto: - type: object - properties: - email: - type: string - format: email - maxLength: 255 - - password: - type: string - maxLength: 255 - - HaushaltDto: - type: object - allOf: - - $ref: '#/components/schemas/ResourceDto' - - type: object - properties: - name: - type: string - maxLength: 255 - - HaushaltProduktDto: - type: object - allOf: - - $ref: '#/components/schemas/ResourceDto' - - $ref: '#/components/schemas/ProductDto' - - type: object - properties: - haushaltId: - type: string - format: uuid - ist: - type: number - soll: - type: number - - HerstellerDto: - type: object - allOf: - - $ref: '#/components/schemas/ResourceDto' - - type: object - properties: - name: - type: string - - ProduktKategorieDto: - type: object - allOf: - - $ref: '#/components/schemas/ResourceDto' - - type: object - properties: - name: - type: string - maxLength: 255 - parentId: - type: string - format: uuid - - RezeptDto: - type: object - allOf: - - $ref: '#/components/schemas/ResourceDto' - - type: object - properties: - name: - type: string - maxLength: 255 - beschreibung: - type: string - maxLength: 255 - anleitungText: - type: string - maxLength: 4000 - url: - type: string - format: url - maxLength: 1024 - kategorieId: - type: string - format: string - - RezeptKategorieDto: - type: object - allOf: - - $ref: '#/components/schemas/ResourceDto' - - type: object - properties: - name: - type: string - parentId: - type: string - format: uuid - - ZutatenDto: - type: object - allOf: - - $ref: '#/components/schemas/ResourceDto' - - type: object - properties: - produktKategorieId: - type: string - maxLength: 255 - menge: - type: number - minimum: 0 - einheit: - type: string - maxLength: 255 - rezeptId: - type: string - format: uuid - - CreateUserDto: - type: object - required: - - password - - vorname - - nachname - properties: - password: - type: string - minLength: 8 - maxLength: 255 - vorname: - type: string - maxLength: 255 - nachname: - type: string - maxLength: 255 - - UpdateUserDto: - type: object - properties: - password: - type: string - maxLength: 255 - vorname: - type: string - maxLength: 255 - nachname: - type: string - maxLength: 255 - - parameters: - takeParam: - in: query - name: take - schema: - type: integer - minimum: 1 - maximum: 50 - description: The amount of users to return - skipParam: - in: query - name: skip - schema: - type: integer - minimum: 1 - maximum: 50 - description: The amount of users to skip - - -security: - - bearerAuth: [] \ No newline at end of file diff --git a/openapi3/testdata/origin/response_optional_property_removed_base.yaml b/openapi3/testdata/origin/response_optional_property_removed_base.yaml deleted file mode 100644 index b4a511931..000000000 --- a/openapi3/testdata/origin/response_optional_property_removed_base.yaml +++ /dev/null @@ -1,45 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/response_optional_property_removed_revision.yaml b/openapi3/testdata/origin/response_optional_property_removed_revision.yaml deleted file mode 100644 index d53c03d65..000000000 --- a/openapi3/testdata/origin/response_optional_property_removed_revision.yaml +++ /dev/null @@ -1,42 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/response_optional_property_write_only_read_only_base.yaml b/openapi3/testdata/origin/response_optional_property_write_only_read_only_base.yaml deleted file mode 100644 index 729af592d..000000000 --- a/openapi3/testdata/origin/response_optional_property_write_only_read_only_base.yaml +++ /dev/null @@ -1,46 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - writeOnlyName: - type: string - writeOnly: true diff --git a/openapi3/testdata/origin/response_pattern_added_or_changed_base.yaml b/openapi3/testdata/origin/response_pattern_added_or_changed_base.yaml deleted file mode 100644 index 1f1f58a42..000000000 --- a/openapi3/testdata/origin/response_pattern_added_or_changed_base.yaml +++ /dev/null @@ -1,50 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - writeOnlyName: - type: string - writeOnly: true - required: - - name - - writeOnlyName - - id diff --git a/openapi3/testdata/origin/response_pattern_added_or_changed_revision.yaml b/openapi3/testdata/origin/response_pattern_added_or_changed_revision.yaml deleted file mode 100644 index b8aedc32b..000000000 --- a/openapi3/testdata/origin/response_pattern_added_or_changed_revision.yaml +++ /dev/null @@ -1,51 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: ^(?:([a-z]+-)*([a-z]+)?)$ - id: - type: string - readOnly: true - name: - type: string - writeOnlyName: - type: string - writeOnly: true - required: - - name - - writeOnlyName - - id - diff --git a/openapi3/testdata/origin/response_property_all_of_added_base.yaml b/openapi3/testdata/origin/response_property_all_of_added_base.yaml deleted file mode 100644 index a825af4d3..000000000 --- a/openapi3/testdata/origin/response_property_all_of_added_base.yaml +++ /dev/null @@ -1,47 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - get: - operationId: listPets - responses: - "200": - content: - application/json: - schema: - allOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - allOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/response_property_all_of_added_revision.yaml b/openapi3/testdata/origin/response_property_all_of_added_revision.yaml deleted file mode 100644 index 7d2821dfb..000000000 --- a/openapi3/testdata/origin/response_property_all_of_added_revision.yaml +++ /dev/null @@ -1,60 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - get: - operationId: listPets - responses: - "200": - content: - application/json: - schema: - allOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - - $ref: "#/components/schemas/Rabbit" - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - allOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - $ref: "#/components/schemas/Breed3" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - Breed3: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string - - Rabbit: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/response_property_all_of_removed_base.yaml b/openapi3/testdata/origin/response_property_all_of_removed_base.yaml deleted file mode 100644 index 7d2821dfb..000000000 --- a/openapi3/testdata/origin/response_property_all_of_removed_base.yaml +++ /dev/null @@ -1,60 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - get: - operationId: listPets - responses: - "200": - content: - application/json: - schema: - allOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - - $ref: "#/components/schemas/Rabbit" - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - allOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - $ref: "#/components/schemas/Breed3" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - Breed3: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string - - Rabbit: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/response_property_all_of_removed_revision.yaml b/openapi3/testdata/origin/response_property_all_of_removed_revision.yaml deleted file mode 100644 index a825af4d3..000000000 --- a/openapi3/testdata/origin/response_property_all_of_removed_revision.yaml +++ /dev/null @@ -1,47 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - get: - operationId: listPets - responses: - "200": - content: - application/json: - schema: - allOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - allOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/response_property_any_of_added_base.yaml b/openapi3/testdata/origin/response_property_any_of_added_base.yaml deleted file mode 100644 index 88a7b42a4..000000000 --- a/openapi3/testdata/origin/response_property_any_of_added_base.yaml +++ /dev/null @@ -1,47 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - get: - operationId: listPets - responses: - "200": - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - anyOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/response_property_any_of_added_revision.yaml b/openapi3/testdata/origin/response_property_any_of_added_revision.yaml deleted file mode 100644 index 994fab66e..000000000 --- a/openapi3/testdata/origin/response_property_any_of_added_revision.yaml +++ /dev/null @@ -1,60 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - get: - operationId: listPets - responses: - "200": - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - - $ref: "#/components/schemas/Rabbit" - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - anyOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - $ref: "#/components/schemas/Breed3" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - Breed3: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string - - Rabbit: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/response_property_any_of_complex_base.yaml b/openapi3/testdata/origin/response_property_any_of_complex_base.yaml deleted file mode 100644 index b93c99178..000000000 --- a/openapi3/testdata/origin/response_property_any_of_complex_base.yaml +++ /dev/null @@ -1,50 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - get: - operationId: listPets - responses: - "200": - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - - title: Rabbit - type: string - - title: - type: string -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - anyOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/response_property_any_of_complex_revision.yaml b/openapi3/testdata/origin/response_property_any_of_complex_revision.yaml deleted file mode 100644 index da29f4b05..000000000 --- a/openapi3/testdata/origin/response_property_any_of_complex_revision.yaml +++ /dev/null @@ -1,56 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - get: - operationId: listPets - responses: - "200": - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - - title: Rabbit - type: number - - $ref: "#/components/schemas/Fox" - - title: - type: number -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - anyOf: - - $ref: "#/components/schemas/Breed2" - - $ref: "#/components/schemas/Breed1" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: number - - Cat: - type: object - properties: - name: - type: string - Fox: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/response_property_any_of_removed_base.yaml b/openapi3/testdata/origin/response_property_any_of_removed_base.yaml deleted file mode 100644 index 994fab66e..000000000 --- a/openapi3/testdata/origin/response_property_any_of_removed_base.yaml +++ /dev/null @@ -1,60 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - get: - operationId: listPets - responses: - "200": - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - - $ref: "#/components/schemas/Rabbit" - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - anyOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - $ref: "#/components/schemas/Breed3" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - Breed3: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string - - Rabbit: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/response_property_any_of_removed_revision.yaml b/openapi3/testdata/origin/response_property_any_of_removed_revision.yaml deleted file mode 100644 index 88a7b42a4..000000000 --- a/openapi3/testdata/origin/response_property_any_of_removed_revision.yaml +++ /dev/null @@ -1,47 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - get: - operationId: listPets - responses: - "200": - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - anyOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string diff --git a/openapi3/testdata/origin/response_property_became_optional_base.yaml b/openapi3/testdata/origin/response_property_became_optional_base.yaml deleted file mode 100644 index 8720b98e3..000000000 --- a/openapi3/testdata/origin/response_property_became_optional_base.yaml +++ /dev/null @@ -1,49 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name - location: - type: string - required: - - location \ No newline at end of file diff --git a/openapi3/testdata/origin/response_property_became_optional_revision.yaml b/openapi3/testdata/origin/response_property_became_optional_revision.yaml deleted file mode 100644 index ef95b23ec..000000000 --- a/openapi3/testdata/origin/response_property_became_optional_revision.yaml +++ /dev/null @@ -1,43 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string \ No newline at end of file diff --git a/openapi3/testdata/origin/response_property_default_value_changed_base.yaml b/openapi3/testdata/origin/response_property_default_value_changed_base.yaml deleted file mode 100644 index 60ad88a51..000000000 --- a/openapi3/testdata/origin/response_property_default_value_changed_base.yaml +++ /dev/null @@ -1,56 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: - - url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - responses: - "200": - content: - application/json: - schema: - $ref: "#/components/schemas/GroupView" - description: OK - "404": - content: - text/plain: - schema: - type: string - default: "Error" - description: Error - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - default: "2020-01-01T00:00:00Z" - id: - type: string - readOnly: true - name: - type: string - enabled: - default: false - type: boolean - required: - - name diff --git a/openapi3/testdata/origin/response_property_default_value_changed_revision.yaml b/openapi3/testdata/origin/response_property_default_value_changed_revision.yaml deleted file mode 100644 index 3e10bf36d..000000000 --- a/openapi3/testdata/origin/response_property_default_value_changed_revision.yaml +++ /dev/null @@ -1,56 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: - - url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - responses: - "200": - content: - application/json: - schema: - $ref: "#/components/schemas/GroupView" - description: OK - "404": - content: - text/plain: - schema: - type: string - default: "Error" - description: Error - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - default: "2020-02-01T00:00:00Z" - id: - type: string - readOnly: true - name: - type: string - enabled: - default: true - type: boolean - required: - - name diff --git a/openapi3/testdata/origin/response_property_discriminator_added_base.yaml b/openapi3/testdata/origin/response_property_discriminator_added_base.yaml deleted file mode 100644 index 8fcc380b0..000000000 --- a/openapi3/testdata/origin/response_property_discriminator_added_base.yaml +++ /dev/null @@ -1,52 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - responses: - "200": - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - -components: - schemas: - Dog: - type: object - properties: - petType: - type: string - name: - type: string - breed: - type: object - oneOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - petType: - type: string - name: - type: string diff --git a/openapi3/testdata/origin/response_property_discriminator_added_property_name_changed.yaml b/openapi3/testdata/origin/response_property_discriminator_added_property_name_changed.yaml deleted file mode 100644 index 3794c87f6..000000000 --- a/openapi3/testdata/origin/response_property_discriminator_added_property_name_changed.yaml +++ /dev/null @@ -1,62 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - responses: - "200": - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - discriminator: - propertyName: petType2 - mapping: - cat: "#/components/schemas/Cat" - dog: "#/components/schemas/Dog" - -components: - schemas: - Dog: - type: object - properties: - petType2: - type: string - name: - type: string - breed: - type: object - oneOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - discriminator: - propertyName: name2 - mapping: - breed1: "#/components/schemas/Breed1" - breed2: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name2: - type: string - - Breed2: - type: object - properties: - name2: - type: string - - Cat: - type: object - properties: - petType2: - type: string - name: - type: string diff --git a/openapi3/testdata/origin/response_property_discriminator_added_revision.yaml b/openapi3/testdata/origin/response_property_discriminator_added_revision.yaml deleted file mode 100644 index b40b50abc..000000000 --- a/openapi3/testdata/origin/response_property_discriminator_added_revision.yaml +++ /dev/null @@ -1,62 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - responses: - "200": - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - discriminator: - propertyName: petType - mapping: - cat: "#/components/schemas/Cat" - dog: "#/components/schemas/Dog" - -components: - schemas: - Dog: - type: object - properties: - petType: - type: string - name: - type: string - breed: - type: object - oneOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - discriminator: - propertyName: name - mapping: - breed1: "#/components/schemas/Breed1" - breed2: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - petType: - type: string - name: - type: string diff --git a/openapi3/testdata/origin/response_property_discriminator_mapping_changed.yaml b/openapi3/testdata/origin/response_property_discriminator_mapping_changed.yaml deleted file mode 100644 index c38832172..000000000 --- a/openapi3/testdata/origin/response_property_discriminator_mapping_changed.yaml +++ /dev/null @@ -1,68 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - post: - operationId: updatePets - responses: - "200": - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - discriminator: - propertyName: petType - mapping: - cats: "#/components/schemas/Cat" - dog: "#/components/schemas/Dog" - -components: - schemas: - Dog: - type: object - properties: - petType: - type: string - name: - type: string - breed: - type: object - oneOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - discriminator: - propertyName: name - mapping: - breed1Code: "#/components/schemas/Breed1" - breed2: "#/components/schemas/Breed3" - - Breed1: - type: object - properties: - name: - type: string - - Breed2: - type: object - properties: - name: - type: string - - Breed3: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - petType: - type: string - name: - type: string diff --git a/openapi3/testdata/origin/response_property_enum_added_base.yaml b/openapi3/testdata/origin/response_property_enum_added_base.yaml deleted file mode 100644 index e5786c69e..000000000 --- a/openapi3/testdata/origin/response_property_enum_added_base.yaml +++ /dev/null @@ -1,56 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - typeEnum: - type: string - enum: - - TYPE1 - - TYPE2 - writeOnlyEnum: - type: string - writeOnly: true - enum: - - TYPE1 - - TYPE2 - required: - - name diff --git a/openapi3/testdata/origin/response_property_one_of_added_base.yaml b/openapi3/testdata/origin/response_property_one_of_added_base.yaml deleted file mode 100644 index 1d566c454..000000000 --- a/openapi3/testdata/origin/response_property_one_of_added_base.yaml +++ /dev/null @@ -1,61 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - get: - operationId: listPets - responses: - "200": - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - - $ref: "#/components/schemas/Fox" - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - oneOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string - - Fox: - type: object - properties: - name: - type: string - breed: - oneOf: - - enum: - - BROWN_1 - - BROWN_2 - title: Brown types - type: string diff --git a/openapi3/testdata/origin/response_property_one_of_added_revision.yaml b/openapi3/testdata/origin/response_property_one_of_added_revision.yaml deleted file mode 100644 index 43ada40cb..000000000 --- a/openapi3/testdata/origin/response_property_one_of_added_revision.yaml +++ /dev/null @@ -1,79 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - get: - operationId: listPets - responses: - "200": - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - - $ref: "#/components/schemas/Rabbit" - - $ref: "#/components/schemas/Fox" - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - oneOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - $ref: "#/components/schemas/Breed3" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - Breed3: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string - - Rabbit: - type: object - properties: - name: - type: string - - Fox: - type: object - properties: - name: - type: string - breed: - oneOf: - - enum: - - BROWN_1 - - BROWN_2 - title: Brown types - type: string - - enum: - - DARK_BROWN_1 - - DARK_BROWN_2 - title: Dark brown types - type: string diff --git a/openapi3/testdata/origin/response_property_one_of_removed_base.yaml b/openapi3/testdata/origin/response_property_one_of_removed_base.yaml deleted file mode 100644 index 43ada40cb..000000000 --- a/openapi3/testdata/origin/response_property_one_of_removed_base.yaml +++ /dev/null @@ -1,79 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - get: - operationId: listPets - responses: - "200": - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - - $ref: "#/components/schemas/Rabbit" - - $ref: "#/components/schemas/Fox" - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - oneOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - $ref: "#/components/schemas/Breed3" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - Breed3: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string - - Rabbit: - type: object - properties: - name: - type: string - - Fox: - type: object - properties: - name: - type: string - breed: - oneOf: - - enum: - - BROWN_1 - - BROWN_2 - title: Brown types - type: string - - enum: - - DARK_BROWN_1 - - DARK_BROWN_2 - title: Dark brown types - type: string diff --git a/openapi3/testdata/origin/response_property_one_of_removed_revision.yaml b/openapi3/testdata/origin/response_property_one_of_removed_revision.yaml deleted file mode 100644 index 1d566c454..000000000 --- a/openapi3/testdata/origin/response_property_one_of_removed_revision.yaml +++ /dev/null @@ -1,61 +0,0 @@ -openapi: 3.0.0 -info: - title: ACME - version: 1.0.0 - -paths: - /pets: - get: - operationId: listPets - responses: - "200": - content: - application/json: - schema: - oneOf: - - $ref: "#/components/schemas/Dog" - - $ref: "#/components/schemas/Cat" - - $ref: "#/components/schemas/Fox" - -components: - schemas: - Dog: - type: object - properties: - name: - type: string - breed: - type: object - oneOf: - - $ref: "#/components/schemas/Breed1" - - $ref: "#/components/schemas/Breed2" - - Breed1: - type: object - properties: - name: - type: string - Breed2: - type: object - properties: - name: - type: string - - Cat: - type: object - properties: - name: - type: string - - Fox: - type: object - properties: - name: - type: string - breed: - oneOf: - - enum: - - BROWN_1 - - BROWN_2 - title: Brown types - type: string diff --git a/openapi3/testdata/origin/response_required_property_added_base.yaml b/openapi3/testdata/origin/response_required_property_added_base.yaml deleted file mode 100644 index b4a511931..000000000 --- a/openapi3/testdata/origin/response_required_property_added_base.yaml +++ /dev/null @@ -1,45 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/response_required_property_added_revision.yaml b/openapi3/testdata/origin/response_required_property_added_revision.yaml deleted file mode 100644 index 4b7e84eff..000000000 --- a/openapi3/testdata/origin/response_required_property_added_revision.yaml +++ /dev/null @@ -1,48 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - new: - type: string - required: - - name - - new diff --git a/openapi3/testdata/origin/response_required_property_write_only_read_only_base.yaml b/openapi3/testdata/origin/response_required_property_write_only_read_only_base.yaml deleted file mode 100644 index 1f1f58a42..000000000 --- a/openapi3/testdata/origin/response_required_property_write_only_read_only_base.yaml +++ /dev/null @@ -1,50 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - writeOnlyName: - type: string - writeOnly: true - required: - - name - - writeOnlyName - - id diff --git a/openapi3/testdata/origin/response_schema_format_changed_base.yaml b/openapi3/testdata/origin/response_schema_format_changed_base.yaml deleted file mode 100644 index c5204f994..000000000 --- a/openapi3/testdata/origin/response_schema_format_changed_base.yaml +++ /dev/null @@ -1,46 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: string - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - format: hostname - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/response_schema_type_changed_base.yaml b/openapi3/testdata/origin/response_schema_type_changed_base.yaml deleted file mode 100644 index ea4f910f7..000000000 --- a/openapi3/testdata/origin/response_schema_type_changed_base.yaml +++ /dev/null @@ -1,29 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: string \ No newline at end of file diff --git a/openapi3/testdata/origin/response_schema_type_changed_revision.yaml b/openapi3/testdata/origin/response_schema_type_changed_revision.yaml deleted file mode 100644 index 0bce6d27e..000000000 --- a/openapi3/testdata/origin/response_schema_type_changed_revision.yaml +++ /dev/null @@ -1,45 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: string - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/response_status_base.yaml b/openapi3/testdata/origin/response_status_base.yaml deleted file mode 100644 index 2740e8a2b..000000000 --- a/openapi3/testdata/origin/response_status_base.yaml +++ /dev/null @@ -1,58 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/simple1.yaml b/openapi3/testdata/origin/simple1.yaml deleted file mode 100644 index 13ef5d0ca..000000000 --- a/openapi3/testdata/origin/simple1.yaml +++ /dev/null @@ -1,10 +0,0 @@ -info: - title: Tufin - version: 1.0.0 -openapi: 3.0.3 -paths: - /api/test: - get: - responses: - 200: - description: OK diff --git a/openapi3/testdata/origin/simple2.yaml b/openapi3/testdata/origin/simple2.yaml deleted file mode 100644 index dbfea1cbd..000000000 --- a/openapi3/testdata/origin/simple2.yaml +++ /dev/null @@ -1,10 +0,0 @@ -info: - title: Tufin - version: 1.0.0 -openapi: 3.0.3 -paths: - /api/test: - post: - responses: - 200: - description: OK diff --git a/openapi3/testdata/origin/simple3.yaml b/openapi3/testdata/origin/simple3.yaml deleted file mode 100644 index be67c478b..000000000 --- a/openapi3/testdata/origin/simple3.yaml +++ /dev/null @@ -1,14 +0,0 @@ -info: - title: Tufin - version: 1.0.0 -openapi: 3.0.3 -paths: - /api/test: - get: - responses: - 200: - description: OK - post: - responses: - 201: - description: OK diff --git a/openapi3/testdata/origin/simple5.yaml b/openapi3/testdata/origin/simple5.yaml deleted file mode 100644 index 3e3a33242..000000000 --- a/openapi3/testdata/origin/simple5.yaml +++ /dev/null @@ -1,19 +0,0 @@ -info: - title: Tufin - version: 1.0.0 -openapi: 3.0.3 -paths: - /api/test: - get: - parameters: - - name: a - in: query - schema: - type: string - responses: - 200: - description: OK - post: - responses: - 201: - description: OK diff --git a/openapi3/testdata/origin/tag_added_base.yaml b/openapi3/testdata/origin/tag_added_base.yaml deleted file mode 100644 index 2740e8a2b..000000000 --- a/openapi3/testdata/origin/tag_added_base.yaml +++ /dev/null @@ -1,58 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file diff --git a/openapi3/testdata/origin/tag_removed_base.yaml b/openapi3/testdata/origin/tag_removed_base.yaml deleted file mode 100644 index d7af0ebe5..000000000 --- a/openapi3/testdata/origin/tag_removed_base.yaml +++ /dev/null @@ -1,60 +0,0 @@ -openapi: 3.0.1 -info: - title: Tufin - version: "2.0" -servers: -- url: https://localhost:9080 -paths: - /api/v1.0/groups: - post: - tags: - - Test - operationId: createOneGroup - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Creates one project. - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: OK - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/GroupView' - description: Conflict - summary: Create One Project -components: - parameters: - groupId: - in: path - name: groupId - required: true - schema: - type: string - schemas: - GroupView: - type: object - properties: - data: - type: object - properties: - created: - type: string - format: date-time - readOnly: true - pattern: "^[a-z]+$" - id: - type: string - readOnly: true - name: - type: string - required: - - name \ No newline at end of file From cba19cf8a92d775adcdf56eb0d2dcfe70628a45f Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Fri, 20 Sep 2024 22:18:54 +0300 Subject: [PATCH 25/31] update deps --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index abdf0ff9f..7d370323d 100644 --- a/go.mod +++ b/go.mod @@ -2,9 +2,9 @@ module github.com/getkin/kin-openapi go 1.22.5 -replace gopkg.in/yaml.v3 => github.com/oasdiff/yaml3 v0.0.0-20240819204501-233901bce7fe +replace gopkg.in/yaml.v3 => github.com/oasdiff/yaml3 v0.0.0-20240920135353-c185dc6ea7c6 -replace github.com/invopop/yaml => github.com/oasdiff/yaml v0.0.0-20240822113848-2830227c9671 +replace github.com/invopop/yaml => github.com/oasdiff/yaml v0.0.0-20240920191703-3e5a9fb5bdf3 require ( github.com/go-openapi/jsonpointer v0.21.0 diff --git a/go.sum b/go.sum index c7798590a..f9643cd07 100644 --- a/go.sum +++ b/go.sum @@ -18,10 +18,10 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= -github.com/oasdiff/yaml v0.0.0-20240822113848-2830227c9671 h1:qM2AH1Js3b+0wWCE5SrfSwa/rIXtqMyQZyXx3YaIb5Q= -github.com/oasdiff/yaml v0.0.0-20240822113848-2830227c9671/go.mod h1:/hkd7qQO7Qp3G9ytouXHWapZeeq18qNBkyNAHDpqR1U= -github.com/oasdiff/yaml3 v0.0.0-20240819204501-233901bce7fe h1:sHb5QDQFoFYvM+Ebq0Bo2JC27+U8oHM8Mm50oBwBtnQ= -github.com/oasdiff/yaml3 v0.0.0-20240819204501-233901bce7fe/go.mod h1:lqlOfJRrYpgeWHQj+ky2tf7UJ3PzgHTHRQEpc90nbp0= +github.com/oasdiff/yaml v0.0.0-20240920191703-3e5a9fb5bdf3 h1:nqCxALSUgWobWkFGIrhLRzR/bpImQdGj+3JS4/scTJo= +github.com/oasdiff/yaml v0.0.0-20240920191703-3e5a9fb5bdf3/go.mod h1:AOyUNV9ElKz7EEZeBm/48U54UtjtgCMT9fFbZEsClQc= +github.com/oasdiff/yaml3 v0.0.0-20240920135353-c185dc6ea7c6 h1:+ZsuDTdapTJxfMQk7SOJiNMg0v36pui01L7FEO615r8= +github.com/oasdiff/yaml3 v0.0.0-20240920135353-c185dc6ea7c6/go.mod h1:lqlOfJRrYpgeWHQj+ky2tf7UJ3PzgHTHRQEpc90nbp0= github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= From 2d5e393b147b6bb75631869a0f0378a8839b031f Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Fri, 20 Sep 2024 22:19:31 +0300 Subject: [PATCH 26/31] fix paths test --- openapi3/origin_test.go | 97 +++++++++++++++++++++++++++++++++++------ 1 file changed, 84 insertions(+), 13 deletions(-) diff --git a/openapi3/origin_test.go b/openapi3/origin_test.go index 0fe2232b2..30e7dbc0e 100644 --- a/openapi3/origin_test.go +++ b/openapi3/origin_test.go @@ -78,21 +78,91 @@ func TestOrigin_Paths(t *testing.T) { }, doc.Paths.Origin.Key) - require.NotNil(t, doc.Paths.Find("/partner-api/test/another-method").Origin) + base := doc.Paths.Find("/partner-api/test/another-method") + + require.NotNil(t, base.Origin) require.Equal(t, &Location{ Line: 13, Column: 3, }, - doc.Paths.Find("/partner-api/test/another-method").Origin.Key) + base.Origin.Key) - require.NotNil(t, doc.Paths.Find("/partner-api/test/another-method").Get.Origin) + require.NotNil(t, base.Get.Origin) require.Equal(t, &Location{ Line: 14, Column: 5, }, - doc.Paths.Find("/partner-api/test/another-method").Get.Origin.Key) + base.Get.Origin.Key) +} + +func TestOrigin_Responses(t *testing.T) { + loader := NewLoader() + loader.IsExternalRefsAllowed = true + loader.IncludeOrigin = true + loader.Context = context.Background() + + doc, err := loader.LoadFromFile("testdata/origin/simple.yaml") + require.NoError(t, err) + + base := doc.Paths.Find("/partner-api/test/another-method").Get.Responses + require.NotNil(t, base.Origin) + require.Equal(t, + &Location{ + Line: 17, + Column: 7, + }, + base.Origin.Key) + + require.NotNil(t, base.Origin) + require.Nil(t, base.Value("200").Origin) + require.Equal(t, + &Location{ + Line: 18, + Column: 9, + }, + base.Value("200").Value.Origin.Key) + + require.Equal(t, + Location{ + Line: 19, + Column: 11, + }, + base.Value("200").Value.Origin.Fields["description"]) +} + +func TestOrigin_Parameters(t *testing.T) { + loader := NewLoader() + loader.IsExternalRefsAllowed = true + loader.IncludeOrigin = true + loader.Context = context.Background() + + doc, err := loader.LoadFromFile("testdata/origin/parameters.yaml") + require.NoError(t, err) + + base := doc.Paths.Find("/api/test").Get.Parameters[0].Value + require.NotNil(t, base) + require.Equal(t, + &Location{ + Line: 9, + Column: 11, + }, + base.Origin.Key) + + require.Equal(t, + Location{ + Line: 10, + Column: 11, + }, + base.Origin.Fields["in"]) + + require.Equal(t, + Location{ + Line: 9, + Column: 11, + }, + base.Origin.Fields["name"]) } func TestOrigin_SchemaInAdditionalProperties(t *testing.T) { @@ -104,23 +174,23 @@ func TestOrigin_SchemaInAdditionalProperties(t *testing.T) { doc, err := loader.LoadFromFile("testdata/origin/additional_properties.yaml") require.NoError(t, err) - require.NotNil(t, doc.Paths.Find("/partner-api/test/some-method").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.AdditionalProperties) - additionalProperties := doc.Paths.Find("/partner-api/test/some-method").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.AdditionalProperties + base := doc.Paths.Find("/partner-api/test/some-method").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.AdditionalProperties + require.NotNil(t, base) - require.NotNil(t, additionalProperties.Schema.Value.Origin) + require.NotNil(t, base.Schema.Value.Origin) require.Equal(t, &Location{ Line: 14, Column: 17, }, - additionalProperties.Schema.Value.Origin.Key) + base.Schema.Value.Origin.Key) require.Equal(t, Location{ Line: 15, Column: 19, }, - additionalProperties.Schema.Value.Origin.Fields["type"]) + base.Schema.Value.Origin.Fields["type"]) } func TestOrigin_ExternalDocs(t *testing.T) { @@ -132,26 +202,27 @@ func TestOrigin_ExternalDocs(t *testing.T) { doc, err := loader.LoadFromFile("testdata/origin/external_docs.yaml") require.NoError(t, err) - require.NotNil(t, doc.ExternalDocs.Origin) + base := doc.ExternalDocs.Origin + require.NotNil(t, base) require.Equal(t, &Location{ Line: 13, Column: 1, }, - doc.ExternalDocs.Origin.Key) + base.Key) require.Equal(t, Location{ Line: 14, Column: 3, }, - doc.ExternalDocs.Origin.Fields["description"]) + base.Fields["description"]) require.Equal(t, Location{ Line: 15, Column: 3, }, - doc.ExternalDocs.Origin.Fields["url"]) + base.Fields["url"]) } From b9f7dd6bf1ccdf9b7f08b8efabdfcd1c5f4ad39c Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Fri, 20 Sep 2024 22:46:07 +0300 Subject: [PATCH 27/31] test components/security --- openapi3/origin_test.go | 58 +++++++++++++++++++++++--- openapi3/testdata/origin/security.yaml | 36 ++++++++++++++++ 2 files changed, 89 insertions(+), 5 deletions(-) create mode 100644 openapi3/testdata/origin/security.yaml diff --git a/openapi3/origin_test.go b/openapi3/origin_test.go index 30e7dbc0e..442b8265a 100644 --- a/openapi3/origin_test.go +++ b/openapi3/origin_test.go @@ -202,27 +202,75 @@ func TestOrigin_ExternalDocs(t *testing.T) { doc, err := loader.LoadFromFile("testdata/origin/external_docs.yaml") require.NoError(t, err) - base := doc.ExternalDocs.Origin - require.NotNil(t, base) + base := doc.ExternalDocs + require.NotNil(t, base.Origin) require.Equal(t, &Location{ Line: 13, Column: 1, }, - base.Key) + base.Origin.Key) require.Equal(t, Location{ Line: 14, Column: 3, }, - base.Fields["description"]) + base.Origin.Fields["description"]) require.Equal(t, Location{ Line: 15, Column: 3, }, - base.Fields["url"]) + base.Origin.Fields["url"]) +} + +func TestOrigin_Security(t *testing.T) { + loader := NewLoader() + loader.IsExternalRefsAllowed = true + loader.IncludeOrigin = true + loader.Context = context.Background() + + doc, err := loader.LoadFromFile("testdata/origin/security.yaml") + require.NoError(t, err) + + base := doc.Components.SecuritySchemes["petstore_auth"].Value + require.NotNil(t, base) + + require.Equal(t, + &Location{ + Line: 29, + Column: 5, + }, + base.Origin.Key) + + require.Equal(t, + Location{ + Line: 30, + Column: 7, + }, + base.Origin.Fields["type"]) + + require.Equal(t, + &Location{ + Line: 31, + Column: 7, + }, + base.Flows.Origin.Key) + + require.Equal(t, + &Location{ + Line: 32, + Column: 9, + }, + base.Flows.Implicit.Origin.Key) + + require.Equal(t, + Location{ + Line: 33, + Column: 11, + }, + base.Flows.Implicit.Origin.Fields["authorizationUrl"]) } diff --git a/openapi3/testdata/origin/security.yaml b/openapi3/testdata/origin/security.yaml new file mode 100644 index 000000000..178e702dd --- /dev/null +++ b/openapi3/testdata/origin/security.yaml @@ -0,0 +1,36 @@ +openapi: 3.0.0 +info: + title: Security Requirement Example + version: 1.0.0 +paths: + /subscribe: + post: + requestBody: + content: + application/json: + schema: + type: object + properties: + inProgressUrl: + type: string + failedUrl: + type: string + successUrl: + type: string + responses: + "200": + description: OK + security: + - petstore_auth: + - write:pets + - read:pets +components: + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://example.org/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets \ No newline at end of file From aa8c5b1360ba77bbcb545605c55483fd77c29abd Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Fri, 20 Sep 2024 22:56:12 +0300 Subject: [PATCH 28/31] fix LF --- openapi3/testdata/origin/security.yaml | 70 +++++++++++++------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/openapi3/testdata/origin/security.yaml b/openapi3/testdata/origin/security.yaml index 178e702dd..7594e961a 100644 --- a/openapi3/testdata/origin/security.yaml +++ b/openapi3/testdata/origin/security.yaml @@ -1,36 +1,36 @@ -openapi: 3.0.0 -info: - title: Security Requirement Example - version: 1.0.0 -paths: - /subscribe: - post: - requestBody: - content: - application/json: - schema: - type: object - properties: - inProgressUrl: - type: string - failedUrl: - type: string - successUrl: - type: string - responses: - "200": - description: OK - security: - - petstore_auth: - - write:pets - - read:pets -components: - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: http://example.org/api/oauth/dialog - scopes: - write:pets: modify pets in your account +openapi: 3.0.0 +info: + title: Security Requirement Example + version: 1.0.0 +paths: + /subscribe: + post: + requestBody: + content: + application/json: + schema: + type: object + properties: + inProgressUrl: + type: string + failedUrl: + type: string + successUrl: + type: string + responses: + "200": + description: OK + security: + - petstore_auth: + - write:pets + - read:pets +components: + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://example.org/api/oauth/dialog + scopes: + write:pets: modify pets in your account read:pets: read your pets \ No newline at end of file From 8a00ba059558d10976d9dbc6d9a46d88150650da Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sat, 21 Sep 2024 10:52:17 +0300 Subject: [PATCH 29/31] include origin in unmarshal maps --- .github/docs/openapi3.txt | 4 +- openapi3/components.go | 18 +++--- openapi3/content.go | 2 +- openapi3/origin.go | 64 +++++++++++++--------- openapi3/origin_test.go | 27 +++++++++ openapi3/security_requirements.go | 2 +- openapi3/testdata/origin/request_body.yaml | 22 ++++++++ 7 files changed, 100 insertions(+), 39 deletions(-) create mode 100644 openapi3/testdata/origin/request_body.yaml diff --git a/.github/docs/openapi3.txt b/.github/docs/openapi3.txt index df9479ec7..1f475ffbe 100644 --- a/.github/docs/openapi3.txt +++ b/.github/docs/openapi3.txt @@ -2057,8 +2057,8 @@ func NewRegexpFormatValidator(pattern string) StringFormatValidator expression to validate the value. type StringMap map[string]string - StringMap allows us to customize the unmarshalling of a map[string]string in - order to support the `origin` field. + StringMap is a map[string]string that ignores the origin in the underlying + json representation. func (stringMap *StringMap) UnmarshalJSON(data []byte) (err error) UnmarshalJSON sets StringMap to a copy of data. diff --git a/openapi3/components.go b/openapi3/components.go index ca2ed8286..7348c2ac0 100644 --- a/openapi3/components.go +++ b/openapi3/components.go @@ -114,55 +114,55 @@ func (components *Components) UnmarshalJSON(data []byte) error { // UnmarshalJSON sets Callbacks to a copy of data. func (callbacks *Callbacks) UnmarshalJSON(data []byte) (err error) { - *callbacks, err = unmarshalStringMapP[CallbackRef](data) + *callbacks, _, err = unmarshalStringMapP[CallbackRef](data) return } // UnmarshalJSON sets Examples to a copy of data. func (examples *Examples) UnmarshalJSON(data []byte) (err error) { - *examples, err = unmarshalStringMapP[ExampleRef](data) + *examples, _, err = unmarshalStringMapP[ExampleRef](data) return } // UnmarshalJSON sets Headers to a copy of data. func (headers *Headers) UnmarshalJSON(data []byte) (err error) { - *headers, err = unmarshalStringMapP[HeaderRef](data) + *headers, _, err = unmarshalStringMapP[HeaderRef](data) return } // UnmarshalJSON sets Links to a copy of data. func (links *Links) UnmarshalJSON(data []byte) (err error) { - *links, err = unmarshalStringMapP[LinkRef](data) + *links, _, err = unmarshalStringMapP[LinkRef](data) return } // UnmarshalJSON sets ParametersMap to a copy of data. func (parametersMap *ParametersMap) UnmarshalJSON(data []byte) (err error) { - *parametersMap, err = unmarshalStringMapP[ParameterRef](data) + *parametersMap, _, err = unmarshalStringMapP[ParameterRef](data) return } // UnmarshalJSON sets RequestBodies to a copy of data. func (requestBodies *RequestBodies) UnmarshalJSON(data []byte) (err error) { - *requestBodies, err = unmarshalStringMapP[RequestBodyRef](data) + *requestBodies, _, err = unmarshalStringMapP[RequestBodyRef](data) return } // UnmarshalJSON sets ResponseBodies to a copy of data. func (responseBodies *ResponseBodies) UnmarshalJSON(data []byte) (err error) { - *responseBodies, err = unmarshalStringMapP[ResponseRef](data) + *responseBodies, _, err = unmarshalStringMapP[ResponseRef](data) return } // UnmarshalJSON sets Schemas to a copy of data. func (schemas *Schemas) UnmarshalJSON(data []byte) (err error) { - *schemas, err = unmarshalStringMapP[SchemaRef](data) + *schemas, _, err = unmarshalStringMapP[SchemaRef](data) return } // UnmarshalJSON sets SecuritySchemes to a copy of data. func (securitySchemes *SecuritySchemes) UnmarshalJSON(data []byte) (err error) { - *securitySchemes, err = unmarshalStringMapP[SecuritySchemeRef](data) + *securitySchemes, _, err = unmarshalStringMapP[SecuritySchemeRef](data) return } diff --git a/openapi3/content.go b/openapi3/content.go index 64db65f65..73e301e05 100644 --- a/openapi3/content.go +++ b/openapi3/content.go @@ -125,6 +125,6 @@ func (content Content) Validate(ctx context.Context, opts ...ValidationOption) e // UnmarshalJSON sets Content to a copy of data. func (content *Content) UnmarshalJSON(data []byte) (err error) { - *content, err = unmarshalStringMapP[MediaType](data) + *content, _, err = unmarshalStringMapP[MediaType](data) return } diff --git a/openapi3/origin.go b/openapi3/origin.go index d1c3e3a61..c78734db8 100644 --- a/openapi3/origin.go +++ b/openapi3/origin.go @@ -19,62 +19,74 @@ type Location struct { } // unmarshalStringMapP unmarshals given json into a map[string]*V -func unmarshalStringMapP[V any](data []byte) (map[string]*V, error) { +func unmarshalStringMapP[V any](data []byte) (map[string]*V, *Origin, error) { var m map[string]any if err := json.Unmarshal(data, &m); err != nil { - return nil, err + return nil, nil, err } - // TODO: add origin to the result + origin, err := deepCast[Origin](m[originKey]) + if err != nil { + return nil, nil, err + } delete(m, originKey) result := make(map[string]*V, len(m)) for k, v := range m { - if data, err := json.Marshal(v); err != nil { - return nil, err - } else { - var v V - if err = json.Unmarshal(data, &v); err != nil { - return nil, err - } - result[k] = &v + value, err := deepCast[V](v) + if err != nil { + return nil, nil, err } + result[k] = value } - return result, nil + return result, origin, nil } // unmarshalStringMap unmarshals given json into a map[string]V -func unmarshalStringMap[V any](data []byte) (map[string]V, error) { +func unmarshalStringMap[V any](data []byte) (map[string]V, *Origin, error) { var m map[string]any if err := json.Unmarshal(data, &m); err != nil { - return nil, err + return nil, nil, err } - // TODO: add origin to the result + origin, err := deepCast[Origin](m[originKey]) + if err != nil { + return nil, nil, err + } delete(m, originKey) result := make(map[string]V, len(m)) for k, v := range m { - if data, err := json.Marshal(v); err != nil { - return nil, err - } else { - var v V - if err = json.Unmarshal(data, &v); err != nil { - return nil, err - } - result[k] = v + value, err := deepCast[V](v) + if err != nil { + return nil, nil, err } + result[k] = *value } - return result, nil + return result, origin, nil } -// StringMap allows us to customize the unmarshalling of a map[string]string in order to support the `origin` field. +// StringMap is a map[string]string that ignores the origin in the underlying json representation. type StringMap map[string]string // UnmarshalJSON sets StringMap to a copy of data. func (stringMap *StringMap) UnmarshalJSON(data []byte) (err error) { - *stringMap, err = unmarshalStringMap[string](data) + *stringMap, _, err = unmarshalStringMap[string](data) return } + +// deepCast casts any value to a value of type V. +func deepCast[V any](value any) (*V, error) { + data, err := json.Marshal(value) + if err != nil { + return nil, err + } + + var result V + if err = json.Unmarshal(data, &result); err != nil { + return nil, err + } + return &result, nil +} diff --git a/openapi3/origin_test.go b/openapi3/origin_test.go index 442b8265a..56d8f1d44 100644 --- a/openapi3/origin_test.go +++ b/openapi3/origin_test.go @@ -97,6 +97,33 @@ func TestOrigin_Paths(t *testing.T) { base.Get.Origin.Key) } +func TestOrigin_RequestBody(t *testing.T) { + loader := NewLoader() + loader.IsExternalRefsAllowed = true + loader.IncludeOrigin = true + loader.Context = context.Background() + + doc, err := loader.LoadFromFile("testdata/origin/request_body.yaml") + require.NoError(t, err) + + base := doc.Paths.Find("/subscribe").Post.RequestBody.Value + require.NotNil(t, base.Origin) + require.Equal(t, + &Location{ + Line: 8, + Column: 7, + }, + base.Origin.Key) + + require.NotNil(t, base.Content["application/json"].Origin) + require.Equal(t, + &Location{ + Line: 10, + Column: 11, + }, + base.Content["application/json"].Origin.Key) +} + func TestOrigin_Responses(t *testing.T) { loader := NewLoader() loader.IsExternalRefsAllowed = true diff --git a/openapi3/security_requirements.go b/openapi3/security_requirements.go index d5310d87a..6af80e8b3 100644 --- a/openapi3/security_requirements.go +++ b/openapi3/security_requirements.go @@ -52,6 +52,6 @@ func (security *SecurityRequirement) Validate(ctx context.Context, opts ...Valid // UnmarshalJSON sets SecurityRequirement to a copy of data. func (security *SecurityRequirement) UnmarshalJSON(data []byte) (err error) { - *security, err = unmarshalStringMap[[]string](data) + *security, _, err = unmarshalStringMap[[]string](data) return } diff --git a/openapi3/testdata/origin/request_body.yaml b/openapi3/testdata/origin/request_body.yaml new file mode 100644 index 000000000..094363842 --- /dev/null +++ b/openapi3/testdata/origin/request_body.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.0 +info: + title: Security Requirement Example + version: 1.0.0 +paths: + /subscribe: + post: + requestBody: + content: + application/json: + schema: + type: object + properties: + inProgressUrl: + type: string + failedUrl: + type: string + successUrl: + type: string + responses: + "200": + description: OK From 3aca4e0da1aa3cda3cc58f0a6b797da2a1b26d86 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Mon, 14 Oct 2024 10:43:42 +0300 Subject: [PATCH 30/31] move component unmarshallers to respective files --- openapi3/callback.go | 6 +++++ openapi3/components.go | 54 ------------------------------------- openapi3/example.go | 6 +++++ openapi3/header.go | 6 +++++ openapi3/link.go | 6 +++++ openapi3/parameter.go | 6 +++++ openapi3/request_body.go | 6 +++++ openapi3/response.go | 6 +++++ openapi3/schema.go | 6 +++++ openapi3/security_scheme.go | 6 +++++ 10 files changed, 54 insertions(+), 54 deletions(-) diff --git a/openapi3/callback.go b/openapi3/callback.go index 6c21706ff..3ae6da692 100644 --- a/openapi3/callback.go +++ b/openapi3/callback.go @@ -53,3 +53,9 @@ func (callback *Callback) Validate(ctx context.Context, opts ...ValidationOption return validateExtensions(ctx, callback.Extensions) } + +// UnmarshalJSON sets Callbacks to a copy of data. +func (callbacks *Callbacks) UnmarshalJSON(data []byte) (err error) { + *callbacks, _, err = unmarshalStringMapP[CallbackRef](data) + return +} diff --git a/openapi3/components.go b/openapi3/components.go index 7348c2ac0..aecf8b648 100644 --- a/openapi3/components.go +++ b/openapi3/components.go @@ -112,60 +112,6 @@ func (components *Components) UnmarshalJSON(data []byte) error { return nil } -// UnmarshalJSON sets Callbacks to a copy of data. -func (callbacks *Callbacks) UnmarshalJSON(data []byte) (err error) { - *callbacks, _, err = unmarshalStringMapP[CallbackRef](data) - return -} - -// UnmarshalJSON sets Examples to a copy of data. -func (examples *Examples) UnmarshalJSON(data []byte) (err error) { - *examples, _, err = unmarshalStringMapP[ExampleRef](data) - return -} - -// UnmarshalJSON sets Headers to a copy of data. -func (headers *Headers) UnmarshalJSON(data []byte) (err error) { - *headers, _, err = unmarshalStringMapP[HeaderRef](data) - return -} - -// UnmarshalJSON sets Links to a copy of data. -func (links *Links) UnmarshalJSON(data []byte) (err error) { - *links, _, err = unmarshalStringMapP[LinkRef](data) - return -} - -// UnmarshalJSON sets ParametersMap to a copy of data. -func (parametersMap *ParametersMap) UnmarshalJSON(data []byte) (err error) { - *parametersMap, _, err = unmarshalStringMapP[ParameterRef](data) - return -} - -// UnmarshalJSON sets RequestBodies to a copy of data. -func (requestBodies *RequestBodies) UnmarshalJSON(data []byte) (err error) { - *requestBodies, _, err = unmarshalStringMapP[RequestBodyRef](data) - return -} - -// UnmarshalJSON sets ResponseBodies to a copy of data. -func (responseBodies *ResponseBodies) UnmarshalJSON(data []byte) (err error) { - *responseBodies, _, err = unmarshalStringMapP[ResponseRef](data) - return -} - -// UnmarshalJSON sets Schemas to a copy of data. -func (schemas *Schemas) UnmarshalJSON(data []byte) (err error) { - *schemas, _, err = unmarshalStringMapP[SchemaRef](data) - return -} - -// UnmarshalJSON sets SecuritySchemes to a copy of data. -func (securitySchemes *SecuritySchemes) UnmarshalJSON(data []byte) (err error) { - *securitySchemes, _, err = unmarshalStringMapP[SecuritySchemeRef](data) - return -} - // Validate returns an error if Components does not comply with the OpenAPI spec. func (components *Components) Validate(ctx context.Context, opts ...ValidationOption) (err error) { ctx = WithValidationOptions(ctx, opts...) diff --git a/openapi3/example.go b/openapi3/example.go index f9a7a6b07..9d38e4343 100644 --- a/openapi3/example.go +++ b/openapi3/example.go @@ -83,3 +83,9 @@ func (example *Example) Validate(ctx context.Context, opts ...ValidationOption) return validateExtensions(ctx, example.Extensions) } + +// UnmarshalJSON sets Examples to a copy of data. +func (examples *Examples) UnmarshalJSON(data []byte) (err error) { + *examples, _, err = unmarshalStringMapP[ExampleRef](data) + return +} diff --git a/openapi3/header.go b/openapi3/header.go index dc542874d..6b23db52e 100644 --- a/openapi3/header.go +++ b/openapi3/header.go @@ -94,3 +94,9 @@ func (header *Header) Validate(ctx context.Context, opts ...ValidationOption) er } return nil } + +// UnmarshalJSON sets Headers to a copy of data. +func (headers *Headers) UnmarshalJSON(data []byte) (err error) { + *headers, _, err = unmarshalStringMapP[HeaderRef](data) + return +} diff --git a/openapi3/link.go b/openapi3/link.go index 6e5c27796..44caf7d99 100644 --- a/openapi3/link.go +++ b/openapi3/link.go @@ -94,3 +94,9 @@ func (link *Link) Validate(ctx context.Context, opts ...ValidationOption) error return validateExtensions(ctx, link.Extensions) } + +// UnmarshalJSON sets Links to a copy of data. +func (links *Links) UnmarshalJSON(data []byte) (err error) { + *links, _, err = unmarshalStringMapP[LinkRef](data) + return +} diff --git a/openapi3/parameter.go b/openapi3/parameter.go index 133c865c1..d69bd5f59 100644 --- a/openapi3/parameter.go +++ b/openapi3/parameter.go @@ -416,3 +416,9 @@ func (parameter *Parameter) Validate(ctx context.Context, opts ...ValidationOpti return validateExtensions(ctx, parameter.Extensions) } + +// UnmarshalJSON sets ParametersMap to a copy of data. +func (parametersMap *ParametersMap) UnmarshalJSON(data []byte) (err error) { + *parametersMap, _, err = unmarshalStringMapP[ParameterRef](data) + return +} diff --git a/openapi3/request_body.go b/openapi3/request_body.go index 03d91e6da..39288ee77 100644 --- a/openapi3/request_body.go +++ b/openapi3/request_body.go @@ -138,3 +138,9 @@ func (requestBody *RequestBody) Validate(ctx context.Context, opts ...Validation return validateExtensions(ctx, requestBody.Extensions) } + +// UnmarshalJSON sets RequestBodies to a copy of data. +func (requestBodies *RequestBodies) UnmarshalJSON(data []byte) (err error) { + *requestBodies, _, err = unmarshalStringMapP[RequestBodyRef](data) + return +} diff --git a/openapi3/response.go b/openapi3/response.go index 3103c3f60..d4bfe42e0 100644 --- a/openapi3/response.go +++ b/openapi3/response.go @@ -228,3 +228,9 @@ func (response *Response) Validate(ctx context.Context, opts ...ValidationOption return validateExtensions(ctx, response.Extensions) } + +// UnmarshalJSON sets ResponseBodies to a copy of data. +func (responseBodies *ResponseBodies) UnmarshalJSON(data []byte) (err error) { + *responseBodies, _, err = unmarshalStringMapP[ResponseRef](data) + return +} diff --git a/openapi3/schema.go b/openapi3/schema.go index b62da5211..401cf9396 100644 --- a/openapi3/schema.go +++ b/openapi3/schema.go @@ -2247,3 +2247,9 @@ func RegisterArrayUniqueItemsChecker(fn SliceUniqueItemsChecker) { func unsupportedFormat(format string) error { return fmt.Errorf("unsupported 'format' value %q", format) } + +// UnmarshalJSON sets Schemas to a copy of data. +func (schemas *Schemas) UnmarshalJSON(data []byte) (err error) { + *schemas, _, err = unmarshalStringMapP[SchemaRef](data) + return +} diff --git a/openapi3/security_scheme.go b/openapi3/security_scheme.go index 02a058720..ad026cb13 100644 --- a/openapi3/security_scheme.go +++ b/openapi3/security_scheme.go @@ -433,3 +433,9 @@ func (flow *OAuthFlow) validate(ctx context.Context, typ oAuthFlowType, opts ... return flow.Validate(ctx, opts...) } + +// UnmarshalJSON sets SecuritySchemes to a copy of data. +func (securitySchemes *SecuritySchemes) UnmarshalJSON(data []byte) (err error) { + *securitySchemes, _, err = unmarshalStringMapP[SecuritySchemeRef](data) + return +} From 7ea36a0cdcbdf5b0ee7aa55ff4eaa627762f7015 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Mon, 14 Oct 2024 10:56:35 +0300 Subject: [PATCH 31/31] fix test (json-schema 301) --- openapi3/issue495_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi3/issue495_test.go b/openapi3/issue495_test.go index ee4cad50b..09c90d3d5 100644 --- a/openapi3/issue495_test.go +++ b/openapi3/issue495_test.go @@ -107,7 +107,7 @@ paths: content: application/json: schema: - $ref: http://json-schema.org/draft-04/schema + $ref: https://json-schema.org/draft-04/schema `[1:]) sl := NewLoader()