Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camelcase does not work with definitions / properties. #113

Closed
jamespearson opened this issue Jan 3, 2020 · 2 comments · Fixed by #129
Closed

Camelcase does not work with definitions / properties. #113

jamespearson opened this issue Jan 3, 2020 · 2 comments · Fixed by #129

Comments

@jamespearson
Copy link

Here is a sample from my swagger.yml ...

definitions:
  business_object:
    type: object
    properties:
      id:
        type: string
      type:
        type: string
      attributes:
        "$ref": "#/definitions/business_attributes"
    required:
    - id
    - type
    - attributes
  business_attributes:
    type: object
    properties:
      id:
        type: integer
      title:
        type: string
    required:
    - id
    - title

Converting using:

npx @manifoldco/swagger-to-ts swagger.yaml  --wrapper "declare namespace OpenAPI" --output schema.d.ts --camelcase

The output is:

export interface businessObject {
    id: string;
    type: string;
    attributes: business_attributes;
  }
  export interface businessAttributes {
    id: number;
    title: string;
  }

businessObject -> attributes is still using the none camelCase name business_attributes

Expected results:

export interface businessObject {
    id: string;
    type: string;
    attributes: businessAttributes;
  }
  export interface businessAttributes {
    id: number;
    title: string;
  }
@drwpow
Copy link
Owner

drwpow commented Feb 2, 2020

@jamespearson thanks for finding this bug, and posting a helpful example! Just merged a PR to fix this, added a test, and published 1.6.2 to npm which should resolve the issue.

@jamespearson
Copy link
Author

Works as expected in 1.6.2 :) Thanks for the great work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants