diff --git a/datamodel/high/v3/document_test.go b/datamodel/high/v3/document_test.go index 299aa27..29ecdc0 100644 --- a/datamodel/high/v3/document_test.go +++ b/datamodel/high/v3/document_test.go @@ -217,7 +217,7 @@ func TestNewDocument_Components_Headers(t *testing.T) { initTest() h := NewDocument(lowDoc) assert.Len(t, h.Components.Headers, 1) - assert.Equal(t, "this is a header", h.Components.Headers["UseOil"].Description) + assert.Equal(t, "this is a header example for UseOil", h.Components.Headers["UseOil"].Description) assert.Equal(t, 318, h.Components.Headers["UseOil"].GoLow().Description.ValueNode.Line) assert.Equal(t, 20, h.Components.Headers["UseOil"].GoLow().Description.ValueNode.Column) } diff --git a/datamodel/low/v3/create_document_test.go b/datamodel/low/v3/create_document_test.go index b71c736..eda142b 100644 --- a/datamodel/low/v3/create_document_test.go +++ b/datamodel/low/v3/create_document_test.go @@ -212,7 +212,7 @@ func TestCreateDocument_Paths(t *testing.T) { param := burgerId.Value.Get.Value.Parameters.Value[1] assert.Equal(t, "burgerHeader", param.Value.Name.Value) prop := param.Value.Schema.Value.Schema().FindProperty("burgerTheme").Value - assert.Equal(t, "something about a theme?", prop.Schema().Description.Value) + assert.Equal(t, "something about a theme goes in here?", prop.Schema().Description.Value) assert.Equal(t, "big-mac", param.Value.Example.Value) // check content @@ -284,7 +284,7 @@ func TestCreateDocument_Paths(t *testing.T) { assert.Len(t, okCode.Value.Headers.Value, 1) okheader := okCode.Value.FindHeader("UseOil") assert.NotNil(t, okheader.Value) - assert.Equal(t, "this is a header", okheader.Value.Description.Value) + assert.Equal(t, "this is a header example for UseOil", okheader.Value.Description.Value) respContent := okCode.Value.FindContent("application/json").Value assert.NotNil(t, respContent) @@ -432,7 +432,7 @@ func TestCreateDocument_Components_Headers(t *testing.T) { useOil := components.FindHeader("UseOil") assert.NotNil(t, useOil.Value) - assert.Equal(t, "this is a header", useOil.Value.Description.Value) + assert.Equal(t, "this is a header example for UseOil", useOil.Value.Description.Value) assert.Equal(t, "string", useOil.Value.Schema.Value.Schema().Type.Value.A) } @@ -602,4 +602,4 @@ func ExampleCreateDocument() { // print out email address from the info > contact object. fmt.Print(document.Info.Value.Contact.Value.Email.Value) // Output: apiteam@swagger.io -} \ No newline at end of file +} diff --git a/datamodel/spec_info.go b/datamodel/spec_info.go index 7f490ac..dc59d9c 100644 --- a/datamodel/spec_info.go +++ b/datamodel/spec_info.go @@ -89,7 +89,7 @@ func ExtractSpecInfo(spec []byte) (*SpecInfo, error) { if spec.SpecType == utils.OpenApi3 { switch spec.Version { - case "3.0.0", "3.0.1": + case "3.0.0", "3.0.1", "3.0", "3": spec.APISchema = OpenAPI3SchemaData case "3.1.0": spec.APISchema = OpenAPI31SchemaData diff --git a/test_specs/burgershop.openapi.yaml b/test_specs/burgershop.openapi.yaml index b784a74..387129d 100644 --- a/test_specs/burgershop.openapi.yaml +++ b/test_specs/burgershop.openapi.yaml @@ -315,7 +315,7 @@ components: url: https://pb33f.io headers: UseOil: - description: this is a header + description: this is a header example for UseOil schema: type: string requestBodies: @@ -389,10 +389,10 @@ components: properties: burgerTheme: type: string - description: something about a theme? + description: something about a theme goes in here? burgerTime: type: number - description: number of burgers ordered this year. + description: number of burgers ordered so far this year. example: big-mac description: the name of the burger. use this to order your food required: true @@ -423,7 +423,7 @@ components: schema: type: string example: big-mac - description: the name of the burger. use this to order your food + description: the name of the burger. use this to order your tasty burger required: true schemas: Error: @@ -531,7 +531,7 @@ components: x-screaming-baby: loud x-something-something: darkside externalDocs: - description: "Find out more information about our products)" + description: "Find out more information about our products and services" url: "https://pb33f.io" jsonSchemaDialect: https://pb33f.io/schema webhooks: