mirror of
https://github.com/niusmallnan/steve.git
synced 2025-07-02 17:31:52 +00:00
Convert array/map of native types properly
This commit is contained in:
parent
9b7fcc9a01
commit
d496dd31d1
@ -61,14 +61,18 @@ func toResourceField(name string, schema v1beta1.JSONSchemaProps, schemasMap map
|
||||
case "array":
|
||||
if itemSchema == nil {
|
||||
f.Type = "array[json]"
|
||||
} else {
|
||||
} else if itemSchema.Type == "object" {
|
||||
f.Type = "array[" + name + "]"
|
||||
modelV3ToSchema(name, itemSchema, schemasMap)
|
||||
} else {
|
||||
f.Type = "array[" + itemSchema.Type + "]"
|
||||
}
|
||||
case "object":
|
||||
if schema.AdditionalProperties != nil && schema.AdditionalProperties.Schema != nil {
|
||||
if schema.AdditionalProperties != nil && schema.AdditionalProperties.Schema != nil && schema.AdditionalProperties.Schema.Type == "object" {
|
||||
f.Type = "map[" + name + "]"
|
||||
modelV3ToSchema(name, schema.AdditionalProperties.Schema, schemasMap)
|
||||
} else if schema.AdditionalProperties != nil && schema.AdditionalProperties.Schema != nil {
|
||||
f.Type = "map[" + schema.AdditionalProperties.Schema.Type + "]"
|
||||
} else {
|
||||
f.Type = name
|
||||
modelV3ToSchema(name, &schema, schemasMap)
|
||||
|
Loading…
Reference in New Issue
Block a user