diff --git a/pkg/builder/openapi.go b/pkg/builder/openapi.go index 072c8ec4a..fd0e77cbb 100644 --- a/pkg/builder/openapi.go +++ b/pkg/builder/openapi.go @@ -31,8 +31,6 @@ import ( const ( OpenAPIVersion = "2.0" - // TODO: Make this configurable. - extensionPrefix = "x-kubernetes-" ) type openAPI struct { @@ -154,6 +152,11 @@ func (o *openAPI) buildDefinitionRecursively(name string) error { schema.Extensions[k] = v } } + if v, ok := item.Schema.Extensions[common.ExtensionV2Schema]; ok { + if v2Schema, isOpenAPISchema := v.(spec.Schema); isOpenAPISchema { + schema = v2Schema + } + } o.swagger.Definitions[uniqueName] = schema for _, v := range item.Dependencies { if err := o.buildDefinitionRecursively(v); err != nil { @@ -270,7 +273,7 @@ func (o *openAPI) buildOperations(route restful.Route, inPathCommonParamsMap map }, } for k, v := range route.Metadata { - if strings.HasPrefix(k, extensionPrefix) { + if strings.HasPrefix(k, common.ExtensionPrefix) { if ret.Extensions == nil { ret.Extensions = spec.Extensions{} } diff --git a/pkg/builder/openapi_test.go b/pkg/builder/openapi_test.go index eb67c1bc8..5086f46b2 100644 --- a/pkg/builder/openapi_test.go +++ b/pkg/builder/openapi_test.go @@ -55,6 +55,36 @@ type TestOutput struct { Count int `json:"count,omitempty"` } +type TestExtensionV2Schema struct{} + +func (_ TestExtensionV2Schema) OpenAPIDefinition() *openapi.OpenAPIDefinition { + schema := spec.Schema{ + VendorExtensible: spec.VendorExtensible{ + Extensions: map[string]interface{}{ + openapi.ExtensionV2Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + }, + }, + }, + }, + } + schema.Description = "Test extension V2 spec conversion" + schema.Properties = map[string]spec.Schema{ + "apple": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the output", + Type: []string{"string"}, + Format: "", + }, + }, + } + return &openapi.OpenAPIDefinition{ + Schema: schema, + Dependencies: []string{}, + } +} + func (_ TestInput) OpenAPIDefinition() *openapi.OpenAPIDefinition { schema := spec.Schema{} schema.Description = "Test input" @@ -182,12 +212,14 @@ func getConfig(fullMethods bool) (*openapi.Config, *restful.Container) { }, GetDefinitions: func(_ openapi.ReferenceCallback) map[string]openapi.OpenAPIDefinition { return map[string]openapi.OpenAPIDefinition{ - "k8s.io/kube-openapi/pkg/builder.TestInput": *TestInput{}.OpenAPIDefinition(), - "k8s.io/kube-openapi/pkg/builder.TestOutput": *TestOutput{}.OpenAPIDefinition(), + "k8s.io/kube-openapi/pkg/builder.TestInput": *TestInput{}.OpenAPIDefinition(), + "k8s.io/kube-openapi/pkg/builder.TestOutput": *TestOutput{}.OpenAPIDefinition(), + "k8s.io/kube-openapi/pkg/builder.TestExtensionV2Schema": *TestExtensionV2Schema{}.OpenAPIDefinition(), // Bazel changes the package name, this is ok for testing, but we need to fix it if it happened // in the main code. - "k8s.io/kube-openapi/pkg/builder/go_default_test.TestInput": *TestInput{}.OpenAPIDefinition(), - "k8s.io/kube-openapi/pkg/builder/go_default_test.TestOutput": *TestOutput{}.OpenAPIDefinition(), + "k8s.io/kube-openapi/pkg/builder/go_default_test.TestInput": *TestInput{}.OpenAPIDefinition(), + "k8s.io/kube-openapi/pkg/builder/go_default_test.TestOutput": *TestOutput{}.OpenAPIDefinition(), + "k8s.io/kube-openapi/pkg/builder/go_default_test.TestExtensionV2Schema": *TestExtensionV2Schema{}.OpenAPIDefinition(), } }, GetDefinitionName: func(name string) (string, spec.Extensions) { @@ -473,3 +505,27 @@ func TestBuildOpenAPIDefinitionsForResource(t *testing.T) { } assert.Equal(string(expected_json), string(actual_json)) } + +func TestBuildOpenAPIDefinitionsForResourceWithExtensionV2Schema(t *testing.T) { + config, _, assert := setUp(t, true) + expected := &spec.Definitions{ + "builder.TestExtensionV2Schema": spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + }, + }, + } + swagger, err := BuildOpenAPIDefinitionsForResource(TestExtensionV2Schema{}, config) + if !assert.NoError(err) { + return + } + expected_json, err := json.Marshal(expected) + if !assert.NoError(err) { + return + } + actual_json, err := json.Marshal(swagger) + if !assert.NoError(err) { + return + } + assert.Equal(string(expected_json), string(actual_json)) +} diff --git a/pkg/common/common.go b/pkg/common/common.go index 7d5534b24..f1c87c300 100644 --- a/pkg/common/common.go +++ b/pkg/common/common.go @@ -24,6 +24,12 @@ import ( "github.com/go-openapi/spec" ) +const ( + // TODO: Make this configurable. + ExtensionPrefix = "x-kubernetes-" + ExtensionV2Schema = ExtensionPrefix + "v2-schema" +) + // OpenAPIDefinition describes single type. Normally these definitions are auto-generated using gen-openapi. type OpenAPIDefinition struct { Schema spec.Schema @@ -43,6 +49,10 @@ type OpenAPIDefinitionGetter interface { OpenAPIDefinition() *OpenAPIDefinition } +type OpenAPIV3DefinitionGetter interface { + OpenAPIV3Definition() *OpenAPIDefinition +} + type PathHandler interface { Handle(path string, handler http.Handler) } @@ -172,3 +182,11 @@ func EscapeJsonPointer(p string) string { p = strings.Replace(p, "/", "~1", -1) return p } + +func EmbedOpenAPIDefinitionIntoV2Extension(main OpenAPIDefinition, embedded OpenAPIDefinition) OpenAPIDefinition { + if main.Schema.Extensions == nil { + main.Schema.Extensions = make(map[string]interface{}) + } + main.Schema.Extensions[ExtensionV2Schema] = embedded.Schema + return main +} diff --git a/pkg/generators/openapi.go b/pkg/generators/openapi.go index 6a4584730..d42ed6108 100644 --- a/pkg/generators/openapi.go +++ b/pkg/generators/openapi.go @@ -242,6 +242,16 @@ func methodReturnsValue(mt *types.Type, pkg, name string) bool { return r.Name.Name == name && r.Name.Package == pkg } +func hasOpenAPIV3DefinitionMethod(t *types.Type) bool { + for mn, mt := range t.Methods { + if mn != "OpenAPIV3Definition" { + continue + } + return methodReturnsValue(mt, openAPICommonPackagePath, "OpenAPIDefinition") + } + return false +} + func hasOpenAPIDefinitionMethod(t *types.Type) bool { for mn, mt := range t.Methods { if mn != "OpenAPIDefinition" { @@ -304,9 +314,21 @@ func (g openAPITypeWriter) generateCall(t *types.Type) error { case types.Struct: args := argsFromType(t) g.Do("\"$.$\": ", t.Name) - if hasOpenAPIDefinitionMethod(t) { + + hasV2Definition := hasOpenAPIDefinitionMethod(t) + hasV2DefinitionTypeAndFormat := hasOpenAPIDefinitionMethods(t) + hasV3Definition := hasOpenAPIV3DefinitionMethod(t) + + switch { + case hasV2DefinitionTypeAndFormat: + g.Do(nameTmpl+"(ref),\n", args) + case hasV2Definition && hasV3Definition: + g.Do("common.EmbedOpenAPIDefinitionIntoV2Extension($.type|raw${}.OpenAPIV3Definition(), $.type|raw${}.OpenAPIDefinition()),\n", args) + case hasV2Definition: g.Do("$.type|raw${}.OpenAPIDefinition(),\n", args) - } else { + case hasV3Definition: + g.Do("$.type|raw${}.OpenAPIV3Definition(),\n", args) + default: g.Do(nameTmpl+"(ref),\n", args) } } @@ -317,14 +339,30 @@ func (g openAPITypeWriter) generate(t *types.Type) error { // Only generate for struct type and ignore the rest switch t.Kind { case types.Struct: - if hasOpenAPIDefinitionMethod(t) { + hasV2Definition := hasOpenAPIDefinitionMethod(t) + hasV2DefinitionTypeAndFormat := hasOpenAPIDefinitionMethods(t) + hasV3Definition := hasOpenAPIV3DefinitionMethod(t) + + if hasV2Definition || (hasV3Definition && !hasV2DefinitionTypeAndFormat) { // already invoked directly return nil } args := argsFromType(t) g.Do("func "+nameTmpl+"(ref $.ReferenceCallback|raw$) $.OpenAPIDefinition|raw$ {\n", args) - if hasOpenAPIDefinitionMethods(t) { + switch { + case hasV2DefinitionTypeAndFormat && hasV3Definition: + g.Do("return common.EmbedOpenAPIDefinitionIntoV2Extension($.type|raw${}.OpenAPIV3Definition(), $.OpenAPIDefinition|raw${\n"+ + "Schema: spec.Schema{\n"+ + "SchemaProps: spec.SchemaProps{\n", args) + g.generateDescription(t.CommentLines) + g.Do("Type:$.type|raw${}.OpenAPISchemaType(),\n"+ + "Format:$.type|raw${}.OpenAPISchemaFormat(),\n"+ + "},\n"+ + "},\n"+ + "})\n}\n\n", args) + return nil + case hasV2DefinitionTypeAndFormat: g.Do("return $.OpenAPIDefinition|raw${\n"+ "Schema: spec.Schema{\n"+ "SchemaProps: spec.SchemaProps{\n", args) diff --git a/pkg/generators/openapi_test.go b/pkg/generators/openapi_test.go index 6aa09fc29..cf995ee5c 100644 --- a/pkg/generators/openapi_test.go +++ b/pkg/generators/openapi_test.go @@ -403,6 +403,79 @@ func (_ Blah) OpenAPIDefinition() openapi.OpenAPIDefinition { assert.Equal(``, funcBuffer.String()) } +func TestCustomDefV3(t *testing.T) { + callErr, funcErr, assert, callBuffer, funcBuffer := testOpenAPITypeWriter(t, ` +package foo + +import openapi "k8s.io/kube-openapi/pkg/common" + +type Blah struct { +} + +func (_ Blah) OpenAPIV3Definition() openapi.OpenAPIDefinition { + return openapi.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "date-time", + }, + }, + } +} +`) + if callErr != nil { + t.Fatal(callErr) + } + if funcErr != nil { + t.Fatal(funcErr) + } + assert.Equal(`"base/foo.Blah": foo.Blah{}.OpenAPIV3Definition(), +`, callBuffer.String()) + assert.Equal(``, funcBuffer.String()) +} + +func TestCustomDefV2AndV3(t *testing.T) { + callErr, funcErr, assert, callBuffer, funcBuffer := testOpenAPITypeWriter(t, ` +package foo + +import openapi "k8s.io/kube-openapi/pkg/common" + +type Blah struct { +} + +func (_ Blah) OpenAPIV3Definition() openapi.OpenAPIDefinition { + return openapi.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "date-time", + }, + }, + } +} + +func (_ Blah) OpenAPIDefinition() openapi.OpenAPIDefinition { + return openapi.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "date-time", + }, + }, + } +} +`) + if callErr != nil { + t.Fatal(callErr) + } + if funcErr != nil { + t.Fatal(funcErr) + } + assert.Equal(`"base/foo.Blah": common.EmbedOpenAPIDefinitionIntoV2Extension(foo.Blah{}.OpenAPIV3Definition(), foo.Blah{}.OpenAPIDefinition()), +`, callBuffer.String()) + assert.Equal(``, funcBuffer.String()) +} + func TestCustomDefs(t *testing.T) { callErr, funcErr, assert, callBuffer, funcBuffer := testOpenAPITypeWriter(t, ` package foo @@ -437,6 +510,53 @@ Format:foo.Blah{}.OpenAPISchemaFormat(), `, funcBuffer.String()) } +func TestCustomDefsV3(t *testing.T) { + callErr, funcErr, assert, callBuffer, funcBuffer := testOpenAPITypeWriter(t, ` +package foo + +import openapi "k8s.io/kube-openapi/pkg/common" + +// Blah is a custom type +type Blah struct { +} + +func (_ Blah) OpenAPIV3Definition() openapi.OpenAPIDefinition { + return openapi.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "date-time", + }, + }, + } +} + +func (_ Blah) OpenAPISchemaType() []string { return []string{"string"} } +func (_ Blah) OpenAPISchemaFormat() string { return "date-time" } +`) + if callErr != nil { + t.Fatal(callErr) + } + if funcErr != nil { + t.Fatal(funcErr) + } + assert.Equal(`"base/foo.Blah": schema_base_foo_Blah(ref), +`, callBuffer.String()) + assert.Equal(`func schema_base_foo_Blah(ref common.ReferenceCallback) common.OpenAPIDefinition { +return common.EmbedOpenAPIDefinitionIntoV2Extension(foo.Blah{}.OpenAPIV3Definition(), common.OpenAPIDefinition{ +Schema: spec.Schema{ +SchemaProps: spec.SchemaProps{ +Description: "Blah is a custom type", +Type:foo.Blah{}.OpenAPISchemaType(), +Format:foo.Blah{}.OpenAPISchemaFormat(), +}, +}, +}) +} + +`, funcBuffer.String()) +} + func TestPointer(t *testing.T) { callErr, funcErr, assert, callBuffer, funcBuffer := testOpenAPITypeWriter(t, ` package foo diff --git a/test/integration/builder/main.go b/test/integration/builder/main.go index 144d8cc9f..355c88590 100644 --- a/test/integration/builder/main.go +++ b/test/integration/builder/main.go @@ -26,7 +26,7 @@ import ( "github.com/emicklei/go-restful" "github.com/go-openapi/spec" - "k8s.io/kube-openapi/pkg/builder" + builderv2 "k8s.io/kube-openapi/pkg/builder" "k8s.io/kube-openapi/pkg/common" "k8s.io/kube-openapi/pkg/util" "k8s.io/kube-openapi/test/integration/pkg/generated" @@ -57,7 +57,7 @@ func main() { config := createOpenAPIBuilderConfig() config.GetDefinitions = generated.GetOpenAPIDefinitions // Build the Paths using a simple WebService for the final spec - swagger, serr := builder.BuildOpenAPISpec(createWebServices(), config) + swagger, serr := builderv2.BuildOpenAPISpec(createWebServices(), config) if serr != nil { log.Fatalf("ERROR: %s", serr.Error()) } @@ -111,6 +111,10 @@ func createWebServices() []*restful.WebService { w.Route(buildRouteForType(w, "listtype", "SetList")) w.Route(buildRouteForType(w, "uniontype", "TopLevelUnion")) w.Route(buildRouteForType(w, "uniontype", "InlinedUnion")) + w.Route(buildRouteForType(w, "custom", "Bal")) + w.Route(buildRouteForType(w, "custom", "Bak")) + w.Route(buildRouteForType(w, "custom", "Bac")) + w.Route(buildRouteForType(w, "custom", "Bah")) return []*restful.WebService{w} } diff --git a/test/integration/integration_suite_test.go b/test/integration/integration_suite_test.go index 058b0da19..5b6a8f72f 100644 --- a/test/integration/integration_suite_test.go +++ b/test/integration/integration_suite_test.go @@ -29,16 +29,19 @@ import ( ) const ( - testdataDir = "./testdata" - testPkgDir = "k8s.io/kube-openapi/test/integration/testdata" - inputDir = testPkgDir + "/listtype" + "," + testPkgDir + "/dummytype" + "," + testPkgDir + "/uniontype" + testdataDir = "./testdata" + testPkgDir = "k8s.io/kube-openapi/test/integration/testdata" + inputDir = testPkgDir + "/listtype" + + "," + testPkgDir + "/dummytype" + + "," + testPkgDir + "/uniontype" + + "," + testPkgDir + "/custom" outputBase = "pkg" outputPackage = "generated" outputBaseFileName = "openapi_generated" - generatedSwaggerFileName = "generated.json" - generatedReportFileName = "generated.report" - goldenSwaggerFileName = "golden.json" - goldenReportFileName = "golden.report" + generatedSwaggerFileName = "generated.v2.json" + generatedReportFileName = "generated.v2.report" + goldenSwaggerFileName = "golden.v2.json" + goldenReportFileName = "golden.v2.report" timeoutSeconds = 5.0 ) diff --git a/test/integration/pkg/generated/openapi_generated.go b/test/integration/pkg/generated/openapi_generated.go index 1c7a70491..b59894f9b 100644 --- a/test/integration/pkg/generated/openapi_generated.go +++ b/test/integration/pkg/generated/openapi_generated.go @@ -25,10 +25,15 @@ package generated import ( spec "github.com/go-openapi/spec" common "k8s.io/kube-openapi/pkg/common" + custom "k8s.io/kube-openapi/test/integration/testdata/custom" ) func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ + "k8s.io/kube-openapi/test/integration/testdata/custom.Bac": common.EmbedOpenAPIDefinitionIntoV2Extension(custom.Bac{}.OpenAPIV3Definition(), custom.Bac{}.OpenAPIDefinition()), + "k8s.io/kube-openapi/test/integration/testdata/custom.Bah": schema_test_integration_testdata_custom_Bah(ref), + "k8s.io/kube-openapi/test/integration/testdata/custom.Bak": custom.Bak{}.OpenAPIDefinition(), + "k8s.io/kube-openapi/test/integration/testdata/custom.Bal": custom.Bal{}.OpenAPIV3Definition(), "k8s.io/kube-openapi/test/integration/testdata/dummytype.Bar": schema_test_integration_testdata_dummytype_Bar(ref), "k8s.io/kube-openapi/test/integration/testdata/dummytype.Baz": schema_test_integration_testdata_dummytype_Baz(ref), "k8s.io/kube-openapi/test/integration/testdata/dummytype.Foo": schema_test_integration_testdata_dummytype_Foo(ref), @@ -45,6 +50,17 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA } } +func schema_test_integration_testdata_custom_Bah(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.EmbedOpenAPIDefinitionIntoV2Extension(custom.Bah{}.OpenAPIV3Definition(), common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: custom.Bah{}.OpenAPISchemaType(), + Format: custom.Bah{}.OpenAPISchemaFormat(), + }, + }, + }) +} + func schema_test_integration_testdata_dummytype_Bar(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/test/integration/testdata/custom/v2.go b/test/integration/testdata/custom/v2.go new file mode 100644 index 000000000..75836fc5f --- /dev/null +++ b/test/integration/testdata/custom/v2.go @@ -0,0 +1,35 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package custom + +import ( + "github.com/go-openapi/spec" + "k8s.io/kube-openapi/pkg/common" +) + +// +k8s:openapi-gen=true +type Bak struct{} + +func (_ Bak) OpenAPIDefinition() common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + }, + }, + } +} diff --git a/test/integration/testdata/custom/v3.go b/test/integration/testdata/custom/v3.go new file mode 100644 index 000000000..c747d3b4e --- /dev/null +++ b/test/integration/testdata/custom/v3.go @@ -0,0 +1,79 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package custom + +import ( + "github.com/go-openapi/spec" + "k8s.io/kube-openapi/pkg/common" +) + +// +k8s:openapi-gen=true +type Bal struct{} + +func (_ Bal) OpenAPIV3Definition() common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + }, + }, + } +} + +// +k8s:openapi-gen=true +type Bac struct{} + +func (_ Bac) OpenAPIV3Definition() common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + }, + }, + } +} + +func (_ Bac) OpenAPIDefinition() common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + }, + }, + } +} + +// +k8s:openapi-gen=true +type Bah struct{} + +func (_ Bah) OpenAPIV3Definition() common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + }, + }, + } +} + +func (_ Bah) OpenAPISchemaType() []string { + return []string{"test-type"} +} + +func (_ Bah) OpenAPISchemaFormat() string { + return "test-format" +} diff --git a/test/integration/testdata/golden.json b/test/integration/testdata/golden.v2.json similarity index 82% rename from test/integration/testdata/golden.json rename to test/integration/testdata/golden.v2.json index 47c43af53..c541c6f97 100644 --- a/test/integration/testdata/golden.json +++ b/test/integration/testdata/golden.v2.json @@ -5,6 +5,82 @@ "version": "1.0" }, "paths": { + "/test/custom/bac": { + "get": { + "schemes": [ + "https" + ], + "operationId": "func12", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/custom.Bac" + } + }, + "404": { + "$ref": "#/responses/NotFound" + } + } + } + }, + "/test/custom/bah": { + "get": { + "schemes": [ + "https" + ], + "operationId": "func13", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/custom.Bah" + } + }, + "404": { + "$ref": "#/responses/NotFound" + } + } + } + }, + "/test/custom/bak": { + "get": { + "schemes": [ + "https" + ], + "operationId": "func11", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/custom.Bak" + } + }, + "404": { + "$ref": "#/responses/NotFound" + } + } + } + }, + "/test/custom/bal": { + "get": { + "schemes": [ + "https" + ], + "operationId": "func10", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/custom.Bal" + } + }, + "404": { + "$ref": "#/responses/NotFound" + } + } + } + }, "/test/dummytype/bar": { "get": { "schemes": [ @@ -178,6 +254,19 @@ } }, "definitions": { + "custom.Bac": { + "type": "string" + }, + "custom.Bah": { + "type": "test-type", + "format": "test-format" + }, + "custom.Bak": { + "type": "integer" + }, + "custom.Bal": { + "type": "string" + }, "dummytype.Bar": { "type": "object", "required": [ diff --git a/test/integration/testdata/golden.report b/test/integration/testdata/golden.v2.report similarity index 100% rename from test/integration/testdata/golden.report rename to test/integration/testdata/golden.v2.report