openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[REQ] Model generation only

Open boesing opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe.

Nope.

Describe the solution you'd like

I wonder if it is doable to implement some kind of option which tells the generator to only generate the model files rather than having all the other files being created.

Something like:

npx @openapitools/openapi-generator-cli generate -i openapi.json -g typescript-angular -o generated-models/ --models-only

[main] INFO  o.o.codegen.TemplateManager - writing file /path/of/generated-models/./whateverGet200Response.ts
[...]

Describe alternatives you've considered

None.

Additional context

None.

boesing avatar Jul 01 '22 10:07 boesing

What generator we are talking about here? This is possible to be done already. Depending on generator you can specify:

withSeparateModelsAndApi=true,modelPackage=model,apiPackage=api

as properties. Ignore API folders or many different things. I believe that only generator that makes it "tricky" is golang - golang one has single package for both model and API.

wtrocki avatar Jul 08 '22 12:07 wtrocki

Also, I just found you can use --global-property models,apis if you only want models and apis to be created for example

alec-petersen avatar Oct 18 '22 12:10 alec-petersen

@alec-petersen Actually this is better suggestion as it would be supported in every generator!

wtrocki avatar Oct 18 '22 12:10 wtrocki

https://github.com/OpenAPITools/openapi-generator/issues/12754#issuecomment-1282285724 Thanks !

mztnnrt avatar Jul 09 '23 12:07 mztnnrt

Also, I just found you can use --global-property models,apis if you only want models and apis to be created for example

Thanks ! this worked for me

Closing here for now. Haven't actually tested this but since we got feedback that it should work, this request is obsolete.

boesing avatar Oct 09 '23 11:10 boesing