cyclosproject / ng-openapi-gen

An OpenAPI 3.0 codegen for Angular
MIT License
397 stars 132 forks source link

Generate for swashbuckle #147

Closed fennekit closed 3 years ago

fennekit commented 3 years ago

Simple fix for having the correct classes generated for the swashbuckle swagger.json. #142

luisfpg commented 3 years ago

Thanks @fennekit for the PR. To be consistent, there's also the function tsType in lib/gen-utils.ts which is used for inline types. Currently it also considers allOf and type: object to be mutually exclusive. Could you, please, apply a similar logic there? Thanks.

fennekit commented 3 years ago

Thanks the comment. Will have a look at that

fennekit commented 3 years ago

I made some changes to fix the issue you addressed. Not sure how to test this though.... Any suggestion?

luisfpg commented 3 years ago

You could define a model that has a property whose schema is an object with allOf (inline).

fennekit commented 3 years ago

I include a unit test as you suggested including a additional property. This is really exotic TypeScript for me :0)

luisfpg commented 3 years ago

Perfect! Just to merge it, I need it to conform with the tslint rules. Can you run npm run build to check them? Currently:

ERROR: /home/luis/git/ng-openapi-gen/lib/gen-utils.ts:233:1 - trailing whitespace
ERROR: /home/luis/git/ng-openapi-gen/lib/model.ts:100:6 - trailing whitespace
ERROR: /home/luis/git/ng-openapi-gen/lib/model.ts:101:1 - trailing whitespace
ERROR: /home/luis/git/ng-openapi-gen/test/polymorphic.spec.ts:36:87 - Missing semicolon
fennekit commented 3 years ago

Manual lint. For some reason lint does not work...

luisfpg commented 3 years ago

Great. Will try to release a new version with the fix in a few hours.

fennekit commented 3 years ago

Awesome. I always hate it to have a git link in my package.json file. Thanks for the quick respons

luisfpg commented 3 years ago

Released in 0.16.0. It is already on NPM.

fennekit commented 3 years ago

Thank you. I am already using it. Pleasure working with you.

Cheers,

Erik

On Mon, 1 Mar 2021 at 16:41, Luis Fernando Planella Gonzalez < notifications@github.com> wrote:

Released in 0.16.0. It is already on NPM.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cyclosproject/ng-openapi-gen/pull/147#issuecomment-788044625, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZBVIB7D4KDXHSKOCVS5PTTBOYQ5ANCNFSM4YJ6RADQ .

-- Met vriendelijke groet/Kind Regards,

Erik Konijnenburg http://www.fennek-it.nl +31 6 24218265

[image: View Erik Konijnenburg's profile on LinkedIn] http://nl.linkedin.com/pub/erik-konijnenburg/47/106/284

Op onze aanbiedingen zijn de Algemene Voorwaarden http://www.fennek-it.nl/Algemene%20Voorwaarden.pdf van toepassing.