swagger-api / swagger-api/swagger-codegen

swagger-codegen-cli issue with serializing request parameters

Open
#11,777 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

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"
				}
			}
		],

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated Java client for the OpenAPI JSON GET /user operation and compare its request serialization with the Spring Boot server's expected filter parameter. Reproduce the request using swagger-codegen-cli 3.0.34 and the provided schema reference, then verify that the server receives a deserializable object instead of null.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi, spring
Domain
backend-api-design, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.