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?
type Schema struct {
Type JsType `json:"type"`
Properities map[string]*Property `json:"properities,omitempty"`
AdditionalProperities *Property `json:"additionalProperities,omitempty"`
Properities map[string]*Property `json:"properties,omitempty"`
AdditionalProperities *Property `json:"additionalProperties,omitempty"`
}
type Property struct {
Type JsType `json:"type"`
Items *Item `json:"item,omitempty"`
Properities map[string]*Property `json:"properities,omitempty"`
AdditionalProperities *Property `json:"additionalProperities,omitempty"`
Properities map[string]*Property `json:"properties,omitempty"`
AdditionalProperities *Property `json:"additionalProperties,omitempty"`
}
// 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 :=
`{
"type": "object",
"properities": {
"properties": {
"bool_val": {
"type": "string"
},
@ -119,10 +119,10 @@ func TestObjectSchema(t *testing.T) {
expected :=
`{
"type": "object",
"properities": {
"properties": {
"hero": {
"type": "object",
"properities": {
"properties": {
"age": {
"type": "number"
},
@ -133,7 +133,7 @@ func TestObjectSchema(t *testing.T) {
},
"plot": {
"type": "object",
"properities": {
"properties": {
"stakes": {
"type": "array",
"item": {
@ -144,7 +144,7 @@ func TestObjectSchema(t *testing.T) {
},
"villian": {
"type": "object",
"properities": {
"properties": {
"age": {
"type": "number"
},