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

Generate typescript definitions from openapi spec #799

Open
juliusknorr opened this issue Jan 25, 2024 · 1 comment
Open

Generate typescript definitions from openapi spec #799

juliusknorr opened this issue Jan 25, 2024 · 1 comment
Labels
1. to develop Accepted and waiting to be taken care of technical debt Technical issue

Comments

@juliusknorr
Copy link
Member

juliusknorr commented Jan 25, 2024

As @enjeck brought up it is quite hard to work with a yet unfamiliar code base that has complex data structures as the tables app, so we thought that the openapi spec could be used to automatically generate typescript definitions.

While rolling out typescript in general is probably worth a general discussion and an iterative process, using https://www.npmjs.com/package/openapi-typescript seems to be able to generate a somewhat reasonable definition file:

npx openapi-typescript ./openapi.json -o ./src/schema.d.ts

We should see if:

  • this can be used as jsdoc annotations to get proper IDE type hints
  • We need any additional setup to be able to already move parts of the code to typescript
  • Probably automate generating and updating the definitions
@juliusknorr juliusknorr added technical debt Technical issue 1. to develop Accepted and waiting to be taken care of labels Jan 25, 2024
@enjeck
Copy link
Contributor

enjeck commented Jan 26, 2024

this can be used as jsdoc annotations to get proper IDE type hints

I tried doing something like this. I created a new file with typedefs for Tables, Columns and others. Imported these types into other files, and it was kinda helpful.

The problem now might be VS Code not integrating well with Vue? For example, suppose there is a component, having a prop named columns under props. The columns prop doesn't get referenced when when I use it (via this.columns) under the data, computed and methods option. Wondering if using a specific IDE or extension helps with this. If I could fix this, I'll be very happy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of technical debt Technical issue
Projects
None yet
Development

No branches or pull requests

2 participants