Skip to content

[RUBY] Json object defined with additionalProperties in swagger.yml gets validated against array datatype instead of hash #7310

Open
@aakanksha-sib

Description

@aakanksha-sib
Description

I have a JSON input object with one of its keys as another object but variable key-value pairs:

parentObject:
    type: object
    properties:
      key1:
        type: object
        additionalProperties:
          description: Name of custom property
          type: string
          example: 'Ellie'

In generated ruby wrapper, this key1 object is getting validated against array datatype instead of hash which is causing the request failure.
For example, following piece of code is not working:

input_params = MyApi::ObjectCreationApi.new({'key1'=> {'name'=>'abc', 'place'=>'bcd'}})
MyApi::ObjectsApi.new.create_object(input_params)
Swagger-codegen version

2.2.3

Suggest a fix/enhancement

Type of key1 should be matched against hash not array.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions