OpenAPITools / OpenAPITools/openapi-generator
Cannot find symbol 'allowableValues' in pathParams template with oas3 and JavaSpring
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
Defining an enum schema in parameters object will cause the following compiling error:
'cannot find symbol': allowableValues
You can see the causing code here:
The field "allowableValues" no longer exists in the annotation @Parameter from io.swagger.v3.oas.annotations
openapi-generator version
5.3.1
OpenAPI declaration file content or url
openapi: 3.0.3
paths:
/api/{myEnum}:
post:
parameters:
- name: myEnum
in: path
required: true
schema:
$ref: '#/components/schemas/MyEnum'
components:
schemas:
MyEnum:
type: string
enum:
- A
- B
- C
Generation Details
I am using the maven plugin with the following config option:
<oas3>true</oas3>
Steps to reproduce
generate with maven plugin
Suggest a fix
Remove "allowableValues" from the template and use the @Schema annotation
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 in modules/openapi-generator/src/main/resources/JavaSpring/pathParams.mustache and inspect how the enum path parameter is rendered for the oas3 option. Reproduce the issue with the provided OpenAPI declaration and Maven plugin configuration, then verify that generated JavaSpring code compiles without the missing allowableValues symbol.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100