swagger-api/swagger-codegen

[Spring] allowableValues uppercase

Open

#4.550 aberto em 12 de jan. de 2017

Ver no GitHub
 (1 comment) (0 reactions) (0 assignees)HTML (5.474 forks)batch import
Feature: EnumIssue: BugServer: Springhelp wanted

Métricas do repositório

Stars
 (12.701 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 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
  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

Guia do colaborador