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

Code generation from API specification. #205

Closed
MarkLaarakkers opened this issue Mar 16, 2021 · 2 comments
Closed

Code generation from API specification. #205

MarkLaarakkers opened this issue Mar 16, 2021 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@MarkLaarakkers
Copy link

Hi,

I'm having troubles generating code based on the exampleUrlScheme.json. If I view this schema in swagger and can see for example, that a treatment has a medicine/batches/dose.

Using swagger (https://editor.swagger.io/?url=https://raw.githubusercontent.com/adewg/ICAR/ADE-1/url-schemes/exampleUrlScheme.json) to generate a client or server (For example on the top of the swagger page "Generate Client" -> "csharp"). Will yield an zip file with generated code, the models however are only "empty" collections. There are no references to fore example the medicine/batches/dose.

using autoreset to generate code also does not seem to work and cannot generate usable code and seems to indicate an errors in de models. e.g.
WARNING (Modeler/MissingType): The schema 'icarLocationCollection' has no type or format information whatsoever.

Is this something needs to be changed in the specification? Or could you recommend a tool which can correctly generate code based on this specification?

@ahokkonen
Copy link
Contributor

ahokkonen commented Mar 19, 2021

Hi @MarkLaarakkers,

Swagger online tools (CodeGen) are quite non-functional when using them directly from url reference.
Best way to generate code out of OpenAPI specs is to download sources and execute code generation locally.

I would prefer not to use GenTools provided by Swagger, but to use openapi-generator instead.

I was able to do code generation without any problems by taking ADE sources locally, installing openapi-generator via NPM and running generation command like (check tool specs for more configuration):

openapi-geneator generate -g csharp -i url-schemes/exampleUrlScheme.json -o output

@ahokkonen ahokkonen added the help wanted Extra attention is needed label Mar 19, 2021
@MarkLaarakkers
Copy link
Author

Hi @ahokkonen

Thank you for the help. Using the openapi-generator the models where generated without problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants