mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-07 04:20:14 +00:00
Updated readme with new docs link
Added in some new helper methods for building out new models. More details in the docs. Added another example.
This commit is contained in:
@@ -31,7 +31,7 @@ func TestSchemaProxy_MarshalYAML(t *testing.T) {
|
||||
var idxNode yaml.Node
|
||||
err := yaml.Unmarshal([]byte(ymlComponents), &idxNode)
|
||||
assert.NoError(t, err)
|
||||
return index.NewSpecIndex(&idxNode)
|
||||
return index.NewSpecIndexWithConfig(&idxNode, index.CreateOpenAPIIndexConfig())
|
||||
}()
|
||||
|
||||
const ref = "#/components/schemas/nice"
|
||||
@@ -53,3 +53,14 @@ func TestSchemaProxy_MarshalYAML(t *testing.T) {
|
||||
assert.Equal(t, "$ref: '#/components/schemas/nice'", strings.TrimSpace(string(rend)))
|
||||
|
||||
}
|
||||
|
||||
func TestCreateSchemaProxy(t *testing.T) {
|
||||
sp := CreateSchemaProxy(&Schema{Description: "iAmASchema"})
|
||||
assert.Equal(t, "iAmASchema", sp.rendered.Description)
|
||||
}
|
||||
|
||||
func TestCreateSchemaProxyRef(t *testing.T) {
|
||||
sp := CreateSchemaProxyRef("#/components/schemas/MySchema")
|
||||
assert.Equal(t, "#/components/schemas/MySchema", sp.GetReference())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user