Skip to content

Converting error #13

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

Closed
MrRefactoring opened this issue Jun 8, 2019 · 5 comments
Closed

Converting error #13

MrRefactoring opened this issue Jun 8, 2019 · 5 comments

Comments

@MrRefactoring
Copy link

MrRefactoring commented Jun 8, 2019

What can we do with this error?

λ npx @manifoldco/swagger-to-ts swagger.json --namespace OpenAPI --output schema.ts
npx: installed 63 in 9.204s
Property or signature expected. (330:1)
  328 | export interface UserList {
  329 | // The index of the last item returned on the page.
> 330 | end-index?: number;
      | ^
  331 | // The list of items.
  332 | items?: User[];
  333 | // The maximum number of results that could be on the page.
@drwpow
Copy link
Contributor

drwpow commented Jun 11, 2019

Which of the following would you prefer?

export interface UserList {
  // The index of the last item returned on the page.
  'end-index'?: number;
export interface UserList {
  // The index of the last item returned on the page.
  endIndex: number;

@drwpow
Copy link
Contributor

drwpow commented Jun 11, 2019

The latter can be fixed by specifying --camelcase, but you’re right the former would break. Let me see if there‘s an easy way to handle the former.

@MrRefactoring
Copy link
Author

I would prefer the second option, but I was surprised when I could not collect the typescript from the swagger. Thanks for correcting this error. If you wish, I will test your PR tomorrow

@drwpow
Copy link
Contributor

drwpow commented Jun 11, 2019

@MrRefactoring whenever you get a chance, try npx @swagger-to-ts@beta and let me know if that fixes the issue. But --camelCase should be working now.

Also note that I just published a new minor version with a breaking change. In your example, try this instead (you can specify anything for wrapper):

npx @manifoldco/swagger-to-ts@beta swagger.json --wrapper 'declare namespace OpenAPI' --output schema.d.ts

@MrRefactoring
Copy link
Author

Cool. Now everything works!

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

No branches or pull requests

2 participants