diff --git a/openapi/create_document.go b/openapi/create_document.go index ba38635..4569c68 100644 --- a/openapi/create_document.go +++ b/openapi/create_document.go @@ -19,7 +19,7 @@ func CreateDocument(spec []byte) (*v3.Document, error) { // build an index //idx := index.NewSpecIndex(info.RootNode) - datamodel.BuildModel(info.RootNode.Content[0], &doc) + //datamodel.BuildModel(info.RootNode.Content[0], &doc) // extract info extractErr := extractInfo(info, &doc) diff --git a/openapi/create_document_test.go b/openapi/create_document_test.go index 7d914a9..a5ecd6f 100644 --- a/openapi/create_document_test.go +++ b/openapi/create_document_test.go @@ -19,4 +19,14 @@ func TestCreateDocument(t *testing.T) { doc, err := CreateDocument(data) assert.NotNil(t, doc) assert.NoError(t, err) + + assert.Equal(t, "3.0.1", doc.Version.Value) + assert.Equal(t, "Burger Shop", doc.Info.Value.Title.Value) + assert.NotEmpty(t, doc.Info.Value.Title.Value) + assert.Equal(t, "https://pb33f.io", doc.Info.Value.TermsOfService.Value) + assert.Equal(t, "pb33f", doc.Info.Value.Contact.Value.Name.Value) + assert.Equal(t, "buckaroo@pb33f.io", doc.Info.Value.Contact.Value.Email.Value) + assert.Equal(t, "https://pb33f.io", doc.Info.Value.Contact.Value.URL.Value) + assert.Equal(t, "1.2", doc.Info.Value.Version.Value) + } diff --git a/test_specs/burgershop.openapi.yaml b/test_specs/burgershop.openapi.yaml index 883bac2..b606c41 100644 --- a/test_specs/burgershop.openapi.yaml +++ b/test_specs/burgershop.openapi.yaml @@ -2,14 +2,14 @@ openapi: 3.0.1 info: title: Burger Shop description: | - The best burger API at quobix. You can find the testiest burgers on the world - termsOfService: https://quobix.com + The best burger API at princess beef. You can find the testiest burgers in the world + termsOfService: https://pb33f.io contact: - name: quobix - email: test@quobix.com - url: https://quobix.com + name: pb33f + email: buckaroo@pb33f.io + url: https://pb33f.io license: - name: Quobix + name: pb33f url: https://quobix.com/made-up version: "1.2" tags: