swagger-api/swagger-codegen

[Spring] allowableValues uppercase

Open

#4550 aperta il 12 gen 2017

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)HTML (5474 fork)batch import
Feature: EnumIssue: BugServer: Springhelp wanted

Metriche repository

Star
 (12.701 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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
  1. Generate spring-boot server stub using command line script and spec file above
  2. 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

Guida contributor