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

Automatically generate client typescript library from openapi spec #41

Closed
rwblair opened this issue Jun 23, 2021 · 3 comments
Closed

Automatically generate client typescript library from openapi spec #41

rwblair opened this issue Jun 23, 2021 · 3 comments
Labels

Comments

@rwblair
Copy link

rwblair commented Jun 23, 2021

https://github.com/OpenAPITools/openapi-generator

We can generate a client library for the site from the speciifcation so we don't have to roll our own. I tested using typescript-fetch on the specification in the submodule commit and its almost there. Errors generated were:

Errors:
-attribute components.schemas.analysis.items is missing
-attribute components.schemas.study.items is missing

Can generate the library using the --skip-validate-spec. Haven't tested importing and using the generated code yet.

@jdkent @nicoalee What do y'all think?

@jdkent
Copy link
Member

jdkent commented Jun 23, 2021

I'm on board, I'll take a look into those errors, it may come down to a difference on how connexion interprets the spec and how the openapi tools read the spec.

@nicoalee
Copy link
Collaborator

i think this is a good idea especially because alejandro mentioned how the api is very simple.
One small downside - if we were to implement some CI/CD pipeline in the future. this will be an additional step to building and deploying

@nicoalee
Copy link
Collaborator

nicoalee commented Jul 14, 2021

this seems like a good idea but unfortunately I'm running into a lot of difficulties implementing it. For starters, it seems like the generated code does not build properly. I keep getting errors:

./gen/api/configuration.ts 19:7
Module parse failed: Unexpected token (19:7)
File was processed with these loaders:
 * ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
You may need an additional loader to handle the result of these loaders.
| 
| 
> export interface ConfigurationParameters {
|     apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|     username?: string;

And while not exactly the same, I think people are facing similar problems:

swagger-api/swagger-codegen#9712
swagger-api/swagger-codegen#9459
swagger-api/swagger-codegen#8024

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

No branches or pull requests

4 participants