swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
16.97k stars 6.04k forks source link

swagger-codegen-cli issue with serializing request parameters #11777

Open de5tro opened 2 years ago

de5tro commented 2 years ago
Description

Im using swagger codegen cli to generate a java client from openAPI json. I have a controller method on the server which receives a object as request param (Spring boot version 2.3.3.RELEASE). When running from swagger ui, the object is serialized properly. I'm using org.springdoc:springdoc-openapi-ui:1.6.7 to generate the OAS 3 specs.

However, when making the request from the client, the server can't deserialize the object from the request. It eventually uses a null object for processing.

Swagger-codegen version

Im using org.hidetake.swagger.generator v 2.18.2 along with io.swagger.codegen.v3:swagger-codegen-cli:3.0.34. It is a gradle project.

Swagger declaration file content or url

This is the part of the json which i want to use. This was created by springdoc in the spring boot server.

"/user": {
    "get": {
        "tags": [
            "user-controller"
        ],
        "summary": "Get list of all users",
        "description": "some desc",
        "operationId": "getAllUsers",
        "parameters": [
            {
                "name": "filter",
                "in": "query",
                "required": true,
                "schema": {
                    "$ref": "#/components/schemas/User_DTO_ShortView"
                }
            }
        ],
de5tro commented 2 years ago

Anyone else facing this issue?