Skip to content

swagger-codegen generate -l html2 query parameter style (snake_case vs camelCase) is incosistent #5169

@jan-matejka

Description

@jan-matejka
Description

swagger-codegen generate -l html2 query parameter style (snake_case vs camelCase) is incosistent between actual parameters and what is shown in curl.

This issue exists in other language examples as well but I suppose that's due to the language conventions. On the other hand I don't know if the libraries will still make the right call. I suppose the staticaly typed ones as well could but languages like perl or python could just take the argument name as actual parameter. But then my assumption about conventions doesn't quite hold either as python is by convention snake_case but still generated example is using camelCase. We have to go deeper.

Swagger-codegen version

current master; HEAD = 1c160df

Swagger declaration file content or url
swagger: '2.0'

info:
  title: "sscce"
  version: '1.0'
  description: sscce

definitions:
  quux:
    type: string

parameters:
  qu_x:
    name: qux
    in: query
    type: integer

  quu_x:
    name: quux
    in: body
    schema: {$ref: "#/definitions/quu_x"}

  bar_id:
    type: integer
    in: query
    name: bar_id

paths:
  /foo/{bar_id}:
    post:
      parameters:
        - name: foo_bar
          in: query
          type: integer
        - $ref: "#/parameters/qu_x"
        - $ref: "#/parameters/quu_x"
        - $ref: "#/parameters/bar_id"
      responses:
        "200":
          description: foo
          type: string
Command line used for generation

JAR=".../swagger-codegen.git/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
java -jar "${JAR}" generate -i ~/sscce.yaml -l html2 -o foo

Steps to reproduce

actual

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions