Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [typescript] Get Parameter Object not serialized properly #7340

Open
kathibeepboop opened this issue Sep 3, 2020 · 3 comments
Open

Comments

@kathibeepboop
Copy link

kathibeepboop commented Sep 3, 2020

Description

I am trying to serialize an object into an array.
The GET Url should be generated like this
http://localhost/index?filter[contact]=101d71e1-745e-4efc-8341-ad204bb1c5c7&page=1&count=8

but it generates like this
http://localhost/index/?filter=%5Bobject%20Object%5D&page=1&count=8

openapi-generator version

5.0.0-beta

OpenAPI declaration file content or url
{
   "openapi":"3.0.0",
   "info":{
      "title":"Demo API",
      "description":"",
      "version":"1.0.0"
   },
   "servers":[
      {
         "url":"http:\/\/localhost"
      }
   ],
   "paths":{
      "\/index":{
         "get":{
            "tags":[
               "Index"
            ],
            "summary":"Returns all Index.",
            "operationId":"search",
            "parameters":[
               {
                  "name":"filter",
                  "in":"query",
                  "schema":{
                     "$ref":"#\/components\/schemas\/IndexFilterType"
                  }
               },
               {
                  "name":"page",
                  "in":"query",
                  "description":"The page number",
                  "schema":{
                     "type":"number"
                  }
               },
               {
                  "name":"count",
                  "in":"query",
                  "description":"items per page to load",
                  "schema":{
                     "type":"number"
                  }
               }
            ],
            "responses":{
               "200":{
                  "description":"",
                  "content":{
                     "application\/json":{
                        "schema":{
                           "$ref":"#\/components\/schemas\/IndexResponse"
                        }
                     }
                  }
               }
            }
         },
      }
   },
   "components":{
      "schemas":{
         "IndexFilterType":{
            "type":"object",
            "properties": {
                "contact": {
                    "type": "string"
                }
            },
         },
         "IndexResponse":{
            "properties":{
               "status":{
                  "type":"string"
               },
               "data":{
                  "type":"array",
                  "items":{
                     "$ref":"#\/components\/schemas\/MetaDto"
                  }
               },
               "total":{
                  "type":"number"
               },
               "pages":{
                  "type":"number"
               }
            },
            "type":"object"
         },
         "MetaDto":{
            "properties":{
               "id":{
                  "type":"string"
               },
               "contact":{
                  "$ref":"#\/components\/schemas\/ContactDto"
               },
               "lead":{
                  "$ref":"#\/components\/schemas\/ContactDto"
               },
               "title":{
                  "type":"string"
               },
               "number":{
                  "type":"integer"
               }
            },
            "type":"object"
         },
         "ContactDto":{
            "properties":{
               "id":{
                  "type":"string"
               },
               "display_name":{
                  "type":"string"
               },
               "short_name":{
                  "type":"string"
               },
               "initials":{
                  "type":"string"
               },
               "type":{
                  "type":"string"
               },
               "pre_name":{
                  "type":"string"
               },
               "last_name":{
                  "type":"string"
               },
               "title":{
                  "type":"string"
               },
               "sex":{
                  "type":"string"
               },
               "company_name":{
                  "type":"string"
               },
               "birthday":{
                  "type":"string"
               },
               "tax_id":{
                  "type":"string"
               },
               "salutation":{
                  "type":"string"
               },
               "avatar":{
                  "$ref":"#\/components\/schemas\/FileMetaDto"
               }
            },
            "type":"object"
         },
         "FileMetaDto":{
            "properties":{
               "id":{
                  "type":"string"
               },
               "filename":{
                  "type":"string"
               },
               "mime_type":{
                  "type":"string"
               },
               "file_size":{
                  "title":"Filesize in Bytes",
                  "type":"integer"
               },
               "url":{
                  "type":"string"
               }
            },
            "type":"object"
         }
      }
   }
}
Generation Details
openapi-generator generate -i http://localhost/swagger.json -g typescript
Steps to reproduce
  1. See schema and generation details
Related issues/PRs

Maybe this? #100

@auto-labeler
Copy link

auto-labeler bot commented Sep 3, 2020

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@macjohnny
Copy link
Member

@MKHSKY would you like to fix this?

@kathibeepboop
Copy link
Author

i made a workaround by just using a "POST" form instead of the get form.
I don´t have the time to dig into the code sadly (and probably break something) ;/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants