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

How to generate individual files for models #4700

Closed
Stwissel opened this issue Feb 3, 2017 · 10 comments
Closed

How to generate individual files for models #4700

Stwissel opened this issue Feb 3, 2017 · 10 comments

Comments

@Stwissel
Copy link

Stwissel commented Feb 3, 2017

Description

Clarification request: How to generate individual model files.

I'm creating my own code generator for an IBM Domino database "schema" (will contribute it back here when I get it to work). One of the big questions I couldn't find an answer is:
I need to generate multiple files out of each model definition. E.g. I have:
definitions:
order
customer
product

I need to generate
forms/order.form
forms/customer.form
forms/product.form
views/order_view.view
views/customer_view.view
views/product_view.view
manifest.mf <-- this one needs the list of files generated

How do I configure codegen to write to individual files?

Swagger-codegen version

2.2.1

@wing328
Copy link
Contributor

wing328 commented Feb 3, 2017

@Stwissel is this for a particular language (e.g. Java, C#, etc) or a new language/generator that you're working on?

@wing328 wing328 added this to the v2.2.2 milestone Feb 3, 2017
@Stwissel
Copy link
Author

Stwissel commented Feb 3, 2017 via email

@wing328
Copy link
Contributor

wing328 commented Feb 3, 2017

I think a good starting point is to look at how model test files are generated. e.g. each PHP model comes with a model test file for testing the model (developers can update it with test cases to ensure the PHP model class is working properly).

The following PR is a good starting point:

#1921

manifest.mf <-- this one needs the list of files generated

I think this will be similar to the auto-generated README, e.g. https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/php/README.mustache#L106-L107

Let us know if you need further assistance.

@fehguy
Copy link
Contributor

fehguy commented Feb 3, 2017

@Stwissel you can also see here how to control the models being generated:

https://github.com/swagger-api/swagger-codegen#selective-generation

Please reopen with any other questions

@fehguy fehguy closed this as completed Feb 3, 2017
@Stwissel
Copy link
Author

Stwissel commented Feb 7, 2017

I got the generation of my form and view files out of my model working. The missing piece now it how to get them into their own directories. Like modeloutputdir/form/form1.form and modeloutputdir/view/view1.view

@wing328
Copy link
Contributor

wing328 commented Feb 7, 2017

@Stwissel
Copy link
Author

Stwissel commented Feb 7, 2017

Had a look at them. Probably I'm blur like sotong here. Where's that method where the full path name gets assembled. The one path + filename + extension ?

@wing328
Copy link
Contributor

wing328 commented Feb 7, 2017

There's no one single function you can override to assemble the full path (path + filename + extension). Can you submit a PR (WIP) so that we can review what you've so far?

@Stwissel
Copy link
Author

Stwissel commented Feb 7, 2017

I'll finish my code first ( I can use a shell script to move things around for the time being) then do a PR (wip)

@wing328
Copy link
Contributor

wing328 commented Sep 1, 2017

@Stwissel do you need help with the PR? We look forward to the first generator for database schema.

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

No branches or pull requests

3 participants