fixed typo, and tested schema is working

This commit is contained in:
Shreyas Goenka 2023-01-13 17:13:21 +01:00
parent 926db54a6d
commit cc5ed2bc76
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
2 changed files with 9 additions and 9 deletions

View File

@ -11,15 +11,15 @@ const MaxHistoryOccurances = 3
// TODO: should omit empty denote non required fields in the json schema? // TODO: should omit empty denote non required fields in the json schema?
type Schema struct { type Schema struct {
Type JsType `json:"type"` Type JsType `json:"type"`
Properities map[string]*Property `json:"properities,omitempty"` Properities map[string]*Property `json:"properties,omitempty"`
AdditionalProperities *Property `json:"additionalProperities,omitempty"` AdditionalProperities *Property `json:"additionalProperties,omitempty"`
} }
type Property struct { type Property struct {
Type JsType `json:"type"` Type JsType `json:"type"`
Items *Item `json:"item,omitempty"` Items *Item `json:"item,omitempty"`
Properities map[string]*Property `json:"properities,omitempty"` Properities map[string]*Property `json:"properties,omitempty"`
AdditionalProperities *Property `json:"additionalProperities,omitempty"` AdditionalProperities *Property `json:"additionalProperties,omitempty"`
} }
// TODO: panic for now, add support for adding schemas to $defs in case of cycles // TODO: panic for now, add support for adding schemas to $defs in case of cycles

View File

@ -44,7 +44,7 @@ func TestNumberStringBooleanSchema(t *testing.T) {
expected := expected :=
`{ `{
"type": "object", "type": "object",
"properities": { "properties": {
"bool_val": { "bool_val": {
"type": "string" "type": "string"
}, },
@ -119,10 +119,10 @@ func TestObjectSchema(t *testing.T) {
expected := expected :=
`{ `{
"type": "object", "type": "object",
"properities": { "properties": {
"hero": { "hero": {
"type": "object", "type": "object",
"properities": { "properties": {
"age": { "age": {
"type": "number" "type": "number"
}, },
@ -133,7 +133,7 @@ func TestObjectSchema(t *testing.T) {
}, },
"plot": { "plot": {
"type": "object", "type": "object",
"properities": { "properties": {
"stakes": { "stakes": {
"type": "array", "type": "array",
"item": { "item": {
@ -144,7 +144,7 @@ func TestObjectSchema(t *testing.T) {
}, },
"villian": { "villian": {
"type": "object", "type": "object",
"properities": { "properties": {
"age": { "age": {
"type": "number" "type": "number"
}, },