swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
16.79k stars 6.02k forks source link

Path with dash generates invalid Java client code #690

Closed kkrauth closed 9 years ago

kkrauth commented 9 years ago

For example:

paths:
  /account-inquiry:
    put:
      tags: 
      - Lost/Stolen
      summary: Accounts that have been reported by issuers to be lost or stolen.
      parameters:
      - name: AccountInquiry
        in: body
        required: true
        schema:
          $ref: '#/definitions/AccountInquiry'
      responses:
        '200':
          description: Account inquiry response
          schema:
            type: object
            $ref: '#/definitions/Account'
        default:
          description: unexpected error
          schema:
            $ref: '#/definitions/errorModel'

Produces:

 public Account account-inquiryPut (AccountInquiry AccountInquiry) throws ApiException {

Which doesn't compile.

wing328 commented 9 years ago

Are you using the develop_2.0 branch, which should have converted the method name into accountInquiryPut ?

kkrauth commented 9 years ago

Nope, I used the following:

<groupId>com.wordnik</groupId>
<artifactId>swagger-codegen-distribution</artifactId>
<version>2.1.2-M1</version>

Didn't realize this was addressed in develop_2.0 branch. Will try that out, thanks.

fehguy commented 9 years ago

Please use 2.1.3-SNAPSHOT:

  <repositories>
    <repository>
      <id>sonatype-snapshots</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
  </repositories>
  <dependencies>
    <dependency>
      <groupId>com.wordnik</groupId>
      <artifactId>swagger-codegen</artifactId>
      <version>2.1.3-SNAPSHOT</version>
    </dependency>
  </dependencies>