(feat): Unpack extensions into complex function types #8

The more in-depth we use extensions, the more likely is is that we need custom extensions. New `UnpackExtensions` function in the high package makes this easy. Low level models have been updated to support feature fully and docs added in README and examples as well.

Signed-off-by: Dave Shanley <dave@quobix.com>
This commit is contained in:
Dave Shanley
2022-12-02 11:15:44 -05:00
parent 52a5b61de2
commit c08dd591b2
61 changed files with 756 additions and 89 deletions

View File

@@ -12,7 +12,8 @@ import (
func TestSchemaProxy_Build(t *testing.T) {
yml := `description: something`
yml := `x-windows: washed
description: something`
var sch SchemaProxy
var idxNode yaml.Node
@@ -21,7 +22,7 @@ func TestSchemaProxy_Build(t *testing.T) {
err := sch.Build(idxNode.Content[0], nil)
assert.NoError(t, err)
assert.Equal(t, "3fc9b689459d738f8c88a3a48aa9e33542016b7a4052e001aaa536fca74813cb",
assert.Equal(t, "db2a35dd6fb3d9481d0682571b9d687616bb2a34c1887f7863f0b2e769ca7b23",
low.GenerateHashString(&sch))
assert.Equal(t, "something", sch.Schema().Description.Value)
@@ -30,9 +31,11 @@ func TestSchemaProxy_Build(t *testing.T) {
assert.False(t, sch.IsSchemaReference())
// already rendered, should spit out the same
assert.Equal(t, "3fc9b689459d738f8c88a3a48aa9e33542016b7a4052e001aaa536fca74813cb",
assert.Equal(t, "db2a35dd6fb3d9481d0682571b9d687616bb2a34c1887f7863f0b2e769ca7b23",
low.GenerateHashString(&sch))
assert.Len(t, sch.Schema().GetExtensions(), 1)
}
func TestSchemaProxy_Build_CheckRef(t *testing.T) {