swagger-api / swagger-api/swagger-codegen
[java][feign] Bug generating optional fields, params are not optional in feign tested in 2.3.0 and 2.3.1
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
The following definition (this is not the full definition but only the related part)
'/projects':
get:
tags:
- Project Management
summary: Get project list
parameters:
- name: status
in: query
required: false
type: string
description: "Filter on project status [Created, Ready, Started]"
responses:
'200':
description: OK
schema:
$ref: '#/definitions/ProjectList'`
should generated a method without the status query and one/multiple with the status query but the one without is not generated
Swagger-codegen version
Tested with 2.3.0 and 2.3.1
Swagger declaration file content or url
See description
Command line used for generation
java -jar swagger-codegen-cli.jar
generate -i rest-api.yaml --api-package com.bla.client
--model-package com.bla.model --invoker-package com.bla.client.invoker --group-id com.bla--artifact-id spring-swagger-codegen-api-client --artifact-version 0.0.1-SNAPSHOT -l java --library feign -o example
Steps to reproduce
Create the client from swagger with an optional query field.
Related issues/PRs
3665 same issue but then for scala
Suggest a fix/enhancement
Create the client method without the parameter
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided Swagger definition and run the stated swagger-codegen-cli.jar command using the Java Feign library. Compare the generated client methods for the optional status query parameter with the expected method without that parameter, and verify the behavior against the related Scala issue 3665.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100