Enums in Schema are now interface{} types in datamodel #1

Addressing issues #1, Enums can be anything and should not be consideded plain strings.
This commit is contained in:
Dave Shanley
2022-10-27 06:51:37 -04:00
parent 626fe42ded
commit 54d924d46d
4 changed files with 269 additions and 248 deletions

View File

@@ -86,7 +86,7 @@ type Schema struct {
MaxProperties low.NodeReference[int64]
MinProperties low.NodeReference[int64]
Required low.NodeReference[[]low.ValueReference[string]]
Enum low.NodeReference[[]low.ValueReference[string]]
Enum low.NodeReference[[]low.ValueReference[any]]
Not low.NodeReference[[]low.ValueReference[*SchemaProxy]]
Items low.NodeReference[[]low.ValueReference[*SchemaProxy]]
Properties low.NodeReference[map[low.KeyReference[string]]low.ValueReference[*SchemaProxy]]
@@ -143,7 +143,7 @@ func (s *Schema) Hash() [32]byte {
d = append(d, s.Required.Value[i].Value)
}
for i := range s.Enum.Value {
d = append(d, s.Enum.Value[i].Value)
d = append(d, fmt.Sprint(s.Enum.Value[i].Value))
}
propertyKeys := make([]string, 0, len(s.Properties.Value))
for i := range s.Properties.Value {