Closed lhauspie closed 5 years ago
The openapi spec says:
additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
It seems not possible in go to have this kind of "double type" but the openapi spec also says that:
type: object additionalProperties: true
This is equivalent to:
type: object additionalProperties: {}
So I changed type of AdditionalProperties from bool to &schema.
bool
&schema
implementing the case *ast.MapType to generate:
case *ast.MapType
type: object additionalProperties: type: string # or other simple type like integer or boolean
or
type: object additionalProperties: $ref: '#/components/schemas/Pet' # or other complex type
Free-Form Objects (interface{}) still not be supported as Key or Value.
interface{}
Keys of maps can only be of type string, throw an error in case of keys are of another type.
Has this merge request a chance to be merged ?
@kratisto @denouche @alexjomin
Modification of the model
The openapi spec says:
It seems not possible in go to have this kind of "double type" but the openapi spec also says that:
This is equivalent to:
So I changed type of AdditionalProperties from
bool
to&schema
.Modification of the parser#parseNamedType
implementing the
case *ast.MapType
to generate:or
Free-Form Objects (
interface{}
) still not be supported as Key or Value.Note
Keys of maps can only be of type string, throw an error in case of keys are of another type.