swagger-api / swagger-api/swagger-codegen
[Spring] allowableValues uppercase
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I'm getting uppercased enum values instead of case used in spec. For example:
ResponseEntity<Text> chapterTextGet(@ApiParam(value = "Pipe delimited list of needed fields.", allowableValues = "TEXTID, TEXTWIKI, TEXTHTML, CONTENTS, FOOTNOTES") @RequestParam(value = "fields", required = false) List<String> fields);
Expected:
ResponseEntity<Text> chapterTextGet(@ApiParam(value = "Pipe delimited list of needed fields.", allowableValues = "textId, textWiki, textHtml, contents, footnotes") @RequestParam(value = "fields", required = false) List<String> fields);
This values are names of class fields, so case-sensitiveness is important for me
Swagger-codegen version
current master
Swagger declaration file content or url
swagger: '2.0'
info:
version: '1.0.0'
title: Test API
host: localhost:8080
basePath: /api
schemes:
- http
consumes:
- application/json
produces:
- application/json
paths:
/chapterText:
get:
parameters:
- name: fields
in: query
description: Pipe delimited list of needed fields.
required: false
type: array
items:
type: string
enum:
- textId
- textWiki
- textHtml
- contents
- footnotes
collectionFormat: pipes
default:
- textHtml
- contents
- footnotes
responses:
'200':
description: text response
schema:
$ref: '#/definitions/Text'
definitions:
Text:
type: object
properties:
textId:
type: integer
textWiki:
type: string
textHtml:
type: string
contents:
type: string
footnotes:
type: string
Command line used for generation
java -jar ~/Downloads/swagger-codegen-cli-2.2.1.jar generate -l spring -i test.yaml -o test/
Steps to reproduce
- Generate spring-boot server stub using command line script and spec file above
- Look at src/main/java/io/swagger/api/ChapterTextApi.java
Related issues
Don't think it really related, but it may by somewhere near https://github.com/swagger-api/swagger-codegen/issues/3792
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
Reproduce the issue with the supplied Swagger YAML and Spring generator command, then inspect src/main/java/io/swagger/api/ChapterTextApi.java. Compare the generated allowableValues text with the enum entries in the specification; done means the generated values preserve textId, textWiki, and textHtml casing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100