According to the spec, additionalProperties may be true, false, or a schema. If not present, true is implied. If it's a schema, true is implied. If it's false, no additional properties are allowed. We're going to act a little differently, in that if you want additionalProperties code to be generated
(schema *openapi3.Schema)
| 885 | // you must specify an additionalProperties type |
| 886 | // If additionalProperties it true/false, this field will be non-nil. |
| 887 | func SchemaHasAdditionalProperties(schema *openapi3.Schema) bool { |
| 888 | if schema.AdditionalProperties.Has != nil && *schema.AdditionalProperties.Has { |
| 889 | return true |
| 890 | } |
| 891 | |
| 892 | if schema.AdditionalProperties.Schema != nil { |
| 893 | return true |
| 894 | } |
| 895 | return false |
| 896 | } |
| 897 | |
| 898 | // PathToTypeName converts a path, like Object/field1/nestedField into a go |
| 899 | // type name. |