fixed typo

This commit is contained in:
Shreyas Goenka 2023-01-16 21:53:20 +01:00
parent 2945408f0d
commit 7385f37df6
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
1 changed files with 12 additions and 12 deletions

View File

@ -16,20 +16,20 @@ const MaxHistoryOccurances = 3
type Schema struct { type Schema struct {
Type JavascriptType `json:"type"` Type JavascriptType `json:"type"`
Properities map[string]*Property `json:"properties,omitempty"` Properties map[string]*Property `json:"properties,omitempty"`
AdditionalProperities *Property `json:"additionalProperties,omitempty"` AdditionalProperties *Property `json:"additionalProperties,omitempty"`
} }
type Property struct { type Property struct {
Type JavascriptType `json:"type"` Type JavascriptType `json:"type"`
Items *Item `json:"items,omitempty"` Items *Item `json:"items,omitempty"`
Properities map[string]*Property `json:"properties,omitempty"` Properties map[string]*Property `json:"properties,omitempty"`
AdditionalProperities *Property `json:"additionalProperties,omitempty"` AdditionalProperties *Property `json:"additionalProperties,omitempty"`
} }
type Item struct { type Item struct {
Type JavascriptType `json:"type"` Type JavascriptType `json:"type"`
Properities map[string]*Property `json:"properties,omitempty"` Properties map[string]*Property `json:"properties,omitempty"`
} }
func NewSchema(golangType reflect.Type) (*Schema, error) { func NewSchema(golangType reflect.Type) (*Schema, error) {
@ -41,8 +41,8 @@ func NewSchema(golangType reflect.Type) (*Schema, error) {
} }
return &Schema{ return &Schema{
Type: rootProp.Type, Type: rootProp.Type,
Properities: rootProp.Properities, Properties: rootProp.Properties,
AdditionalProperities: rootProp.AdditionalProperities, AdditionalProperties: rootProp.AdditionalProperties,
}, nil }, nil
} }
@ -185,7 +185,7 @@ func toProperty(golangType reflect.Type, seenTypes map[reflect.Type]struct{}, de
items = &Item{ items = &Item{
// TODO: Add a test for slice of object // TODO: Add a test for slice of object
Type: elemJavascriptType, Type: elemJavascriptType,
Properities: elemProps.Properities, Properties: elemProps.Properties,
} }
} }
@ -202,7 +202,7 @@ func toProperty(golangType reflect.Type, seenTypes map[reflect.Type]struct{}, de
} }
// case struct // case struct
properities := map[string]*Property{} properties := map[string]*Property{}
if golangType.Kind() == reflect.Struct { if golangType.Kind() == reflect.Struct {
children := []reflect.StructField{} children := []reflect.StructField{}
children = addStructFields(children, golangType) children = addStructFields(children, golangType)
@ -224,7 +224,7 @@ func toProperty(golangType reflect.Type, seenTypes map[reflect.Type]struct{}, de
if err != nil { if err != nil {
return nil, err return nil, err
} }
properities[childName] = fieldProps properties[childName] = fieldProps
// remove current field from debug trace // remove current field from debug trace
back := debugTrace.Back() back := debugTrace.Back()
@ -235,7 +235,7 @@ func toProperty(golangType reflect.Type, seenTypes map[reflect.Type]struct{}, de
return &Property{ return &Property{
Type: rootJavascriptType, Type: rootJavascriptType,
Items: items, Items: items,
Properities: properities, Properties: properties,
AdditionalProperities: additionalProperties, AdditionalProperties: additionalProperties,
}, nil }, nil
} }