mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-10 04:20:24 +00:00
Fixed broken tests and ready to keep chugging
This commit is contained in:
@@ -116,7 +116,7 @@ additionalProperties: true `
|
|||||||
assert.Equal(t, "something object", sch.Description.Value)
|
assert.Equal(t, "something object", sch.Description.Value)
|
||||||
assert.True(t, sch.AdditionalProperties.Value.(bool))
|
assert.True(t, sch.AdditionalProperties.Value.(bool))
|
||||||
|
|
||||||
assert.Len(t, sch.Properties, 2)
|
assert.Len(t, sch.Properties.Value, 2)
|
||||||
v := sch.FindProperty("somethingB")
|
v := sch.FindProperty("somethingB")
|
||||||
|
|
||||||
assert.Equal(t, "https://pb33f.io", v.Value.ExternalDocs.Value.URL.Value)
|
assert.Equal(t, "https://pb33f.io", v.Value.ExternalDocs.Value.URL.Value)
|
||||||
@@ -139,71 +139,71 @@ additionalProperties: true `
|
|||||||
assert.Equal(t, true, addProps["thatIs"])
|
assert.Equal(t, true, addProps["thatIs"])
|
||||||
|
|
||||||
// check polymorphic values allOf
|
// check polymorphic values allOf
|
||||||
assert.Equal(t, "an allof thing", sch.AllOf[0].Value.Description.Value)
|
assert.Equal(t, "an allof thing", sch.AllOf.Value[0].Value.Description.Value)
|
||||||
assert.Len(t, sch.AllOf[0].Value.Properties, 2)
|
assert.Len(t, sch.AllOf.Value[0].Value.Properties.Value, 2)
|
||||||
|
|
||||||
v = sch.AllOf[0].Value.FindProperty("allOfA")
|
v = sch.AllOf.Value[0].Value.FindProperty("allOfA")
|
||||||
assert.NotNil(t, v)
|
assert.NotNil(t, v)
|
||||||
assert.Equal(t, "allOfA description", v.Value.Description.Value)
|
assert.Equal(t, "allOfA description", v.Value.Description.Value)
|
||||||
assert.Equal(t, "allOfAExp", v.Value.Example.Value)
|
assert.Equal(t, "allOfAExp", v.Value.Example.Value)
|
||||||
|
|
||||||
v = sch.AllOf[0].Value.FindProperty("allOfB")
|
v = sch.AllOf.Value[0].Value.FindProperty("allOfB")
|
||||||
assert.NotNil(t, v)
|
assert.NotNil(t, v)
|
||||||
assert.Equal(t, "allOfB description", v.Value.Description.Value)
|
assert.Equal(t, "allOfB description", v.Value.Description.Value)
|
||||||
assert.Equal(t, "allOfBExp", v.Value.Example.Value)
|
assert.Equal(t, "allOfBExp", v.Value.Example.Value)
|
||||||
|
|
||||||
// check polymorphic values anyOf
|
// check polymorphic values anyOf
|
||||||
assert.Equal(t, "an anyOf thing", sch.AnyOf[0].Value.Description.Value)
|
assert.Equal(t, "an anyOf thing", sch.AnyOf.Value[0].Value.Description.Value)
|
||||||
assert.Len(t, sch.AnyOf[0].Value.Properties, 2)
|
assert.Len(t, sch.AnyOf.Value[0].Value.Properties.Value, 2)
|
||||||
|
|
||||||
v = sch.AnyOf[0].Value.FindProperty("anyOfA")
|
v = sch.AnyOf.Value[0].Value.FindProperty("anyOfA")
|
||||||
assert.NotNil(t, v)
|
assert.NotNil(t, v)
|
||||||
assert.Equal(t, "anyOfA description", v.Value.Description.Value)
|
assert.Equal(t, "anyOfA description", v.Value.Description.Value)
|
||||||
assert.Equal(t, "anyOfAExp", v.Value.Example.Value)
|
assert.Equal(t, "anyOfAExp", v.Value.Example.Value)
|
||||||
|
|
||||||
v = sch.AnyOf[0].Value.FindProperty("anyOfB")
|
v = sch.AnyOf.Value[0].Value.FindProperty("anyOfB")
|
||||||
assert.NotNil(t, v)
|
assert.NotNil(t, v)
|
||||||
assert.Equal(t, "anyOfB description", v.Value.Description.Value)
|
assert.Equal(t, "anyOfB description", v.Value.Description.Value)
|
||||||
assert.Equal(t, "anyOfBExp", v.Value.Example.Value)
|
assert.Equal(t, "anyOfBExp", v.Value.Example.Value)
|
||||||
|
|
||||||
// check polymorphic values oneOf
|
// check polymorphic values oneOf
|
||||||
assert.Equal(t, "a oneof thing", sch.OneOf[0].Value.Description.Value)
|
assert.Equal(t, "a oneof thing", sch.OneOf.Value[0].Value.Description.Value)
|
||||||
assert.Len(t, sch.OneOf[0].Value.Properties, 2)
|
assert.Len(t, sch.OneOf.Value[0].Value.Properties.Value, 2)
|
||||||
|
|
||||||
v = sch.OneOf[0].Value.FindProperty("oneOfA")
|
v = sch.OneOf.Value[0].Value.FindProperty("oneOfA")
|
||||||
assert.NotNil(t, v)
|
assert.NotNil(t, v)
|
||||||
assert.Equal(t, "oneOfA description", v.Value.Description.Value)
|
assert.Equal(t, "oneOfA description", v.Value.Description.Value)
|
||||||
assert.Equal(t, "oneOfAExp", v.Value.Example.Value)
|
assert.Equal(t, "oneOfAExp", v.Value.Example.Value)
|
||||||
|
|
||||||
v = sch.OneOf[0].Value.FindProperty("oneOfB")
|
v = sch.OneOf.Value[0].Value.FindProperty("oneOfB")
|
||||||
assert.NotNil(t, v)
|
assert.NotNil(t, v)
|
||||||
assert.Equal(t, "oneOfB description", v.Value.Description.Value)
|
assert.Equal(t, "oneOfB description", v.Value.Description.Value)
|
||||||
assert.Equal(t, "oneOfBExp", v.Value.Example.Value)
|
assert.Equal(t, "oneOfBExp", v.Value.Example.Value)
|
||||||
|
|
||||||
// check values NOT
|
// check values NOT
|
||||||
assert.Equal(t, "a not thing", sch.Not[0].Value.Description.Value)
|
assert.Equal(t, "a not thing", sch.Not.Value[0].Value.Description.Value)
|
||||||
assert.Len(t, sch.Not[0].Value.Properties, 2)
|
assert.Len(t, sch.Not.Value[0].Value.Properties.Value, 2)
|
||||||
|
|
||||||
v = sch.Not[0].Value.FindProperty("notA")
|
v = sch.Not.Value[0].Value.FindProperty("notA")
|
||||||
assert.NotNil(t, v)
|
assert.NotNil(t, v)
|
||||||
assert.Equal(t, "notA description", v.Value.Description.Value)
|
assert.Equal(t, "notA description", v.Value.Description.Value)
|
||||||
assert.Equal(t, "notAExp", v.Value.Example.Value)
|
assert.Equal(t, "notAExp", v.Value.Example.Value)
|
||||||
|
|
||||||
v = sch.Not[0].Value.FindProperty("notB")
|
v = sch.Not.Value[0].Value.FindProperty("notB")
|
||||||
assert.NotNil(t, v)
|
assert.NotNil(t, v)
|
||||||
assert.Equal(t, "notB description", v.Value.Description.Value)
|
assert.Equal(t, "notB description", v.Value.Description.Value)
|
||||||
assert.Equal(t, "notBExp", v.Value.Example.Value)
|
assert.Equal(t, "notBExp", v.Value.Example.Value)
|
||||||
|
|
||||||
// check values Items
|
// check values Items
|
||||||
assert.Equal(t, "an items thing", sch.Items[0].Value.Description.Value)
|
assert.Equal(t, "an items thing", sch.Items.Value[0].Value.Description.Value)
|
||||||
assert.Len(t, sch.Items[0].Value.Properties, 2)
|
assert.Len(t, sch.Items.Value[0].Value.Properties.Value, 2)
|
||||||
|
|
||||||
v = sch.Items[0].Value.FindProperty("itemsA")
|
v = sch.Items.Value[0].Value.FindProperty("itemsA")
|
||||||
assert.NotNil(t, v)
|
assert.NotNil(t, v)
|
||||||
assert.Equal(t, "itemsA description", v.Value.Description.Value)
|
assert.Equal(t, "itemsA description", v.Value.Description.Value)
|
||||||
assert.Equal(t, "itemsAExp", v.Value.Example.Value)
|
assert.Equal(t, "itemsAExp", v.Value.Example.Value)
|
||||||
|
|
||||||
v = sch.Items[0].Value.FindProperty("itemsB")
|
v = sch.Items.Value[0].Value.FindProperty("itemsB")
|
||||||
assert.NotNil(t, v)
|
assert.NotNil(t, v)
|
||||||
assert.Equal(t, "itemsB description", v.Value.Description.Value)
|
assert.Equal(t, "itemsB description", v.Value.Description.Value)
|
||||||
assert.Equal(t, "itemsBExp", v.Value.Example.Value)
|
assert.Equal(t, "itemsBExp", v.Value.Example.Value)
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ func TestSpecIndex_PetstoreV3(t *testing.T) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var mappedRefs = 8
|
var mappedRefs = 9
|
||||||
|
|
||||||
func TestSpecIndex_BurgerShop(t *testing.T) {
|
func TestSpecIndex_BurgerShop(t *testing.T) {
|
||||||
|
|
||||||
@@ -173,16 +173,16 @@ func TestSpecIndex_BurgerShop(t *testing.T) {
|
|||||||
index := NewSpecIndex(&rootNode)
|
index := NewSpecIndex(&rootNode)
|
||||||
|
|
||||||
assert.Len(t, index.allRefs, mappedRefs)
|
assert.Len(t, index.allRefs, mappedRefs)
|
||||||
assert.Len(t, index.allMappedRefs, mappedRefs)
|
assert.Len(t, index.allMappedRefs, mappedRefs-1)
|
||||||
assert.Equal(t, mappedRefs, len(index.GetMappedReferences()))
|
assert.Equal(t, mappedRefs-1, len(index.GetMappedReferences()))
|
||||||
assert.Equal(t, mappedRefs, len(index.GetMappedReferencesSequenced()))
|
assert.Equal(t, mappedRefs-1, len(index.GetMappedReferencesSequenced()))
|
||||||
|
|
||||||
assert.Equal(t, 7, index.pathCount)
|
assert.Equal(t, 7, index.pathCount)
|
||||||
assert.Equal(t, 7, index.GetPathCount())
|
assert.Equal(t, 7, index.GetPathCount())
|
||||||
|
|
||||||
assert.Equal(t, 5, len(index.GetAllSchemas()))
|
assert.Equal(t, 5, len(index.GetAllSchemas()))
|
||||||
|
|
||||||
assert.Equal(t, 21, len(index.GetAllSequencedReferences()))
|
assert.Equal(t, 22, len(index.GetAllSequencedReferences()))
|
||||||
assert.NotNil(t, index.GetSchemasNode())
|
assert.NotNil(t, index.GetSchemasNode())
|
||||||
assert.NotNil(t, index.GetParametersNode())
|
assert.NotNil(t, index.GetParametersNode())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user