Skip to content

Generalized configuration options #616

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

Closed
fehguy opened this issue Apr 9, 2015 · 14 comments
Closed

Generalized configuration options #616

fehguy opened this issue Apr 9, 2015 · 14 comments
Milestone

Comments

@fehguy
Copy link
Contributor

fehguy commented Apr 9, 2015

Need to pass a generalized configuration object to the generator so the default values can be overridden. Otherwise, everyone needs to recompile for every change.

@fehguy
Copy link
Contributor Author

fehguy commented Apr 14, 2015

Suggest the following:

  1. allow a json config file --config @config.json
  2. allow each language to expose a separate set of options that are usable from the command-line

We will still have sensible defaults that won't be Petstore.

@who
Copy link
Contributor

who commented Apr 14, 2015

@fehguy

👍 I like this, and seems flexible enough for now.

@wing328
Copy link
Contributor

wing328 commented Apr 15, 2015

@fehguy I agree and it's definitely better than the hard-coded Petstore. (my intention was to submit another PR soon with a better default package name)

On top of that, I suggest we come up with a better default package name base on the domain name from the host. (e.g. api.foursqaure.com maps to foursquare-php, foursquare-ruby, etc). The goal is to save time from users to come up with their own package naming convention (assuming the default one is good 90% of the time). In terms of priority, this is more like a day-2 requirement.

@gianluca-sabena
Copy link

+1

@hyeghiazaryan
Copy link
Contributor

I am planning on implementing this. Has any work been already done/committed ?

@olensmar
Copy link
Contributor

not that I know of - go for it :-)

@fehguy
Copy link
Contributor Author

fehguy commented May 19, 2015

@hyeghiazaryan sounds great. Basically we need to have a mechanism to pass args into the different language implementations and having them self-documented. Then the -h command should be able to list the args for each of the implementations.

I believe we want to have both a command-line (arg) model as well as a JSON payload. So for example setting the package for the models in the java generator could be something like such:

--model-package io.swagger.models

and in a configuration:

{
   "modelPackage": "io.swagger.models"
}

@rastaman
Copy link

Hi, i'm wondering why there is no getters and setters on the members of the codegenerators classes, is there any reason ?

I've patched my copy of swagger-codegen to have getters and setters for all the members of the generators, and patched the swagger-maven-plugin to set them on the CodeGenConfig object and it works well and is easy to code (at least to set string properties).

So i'm wondering what i have missed, could you give me a hint ? there is another way to inject properties without patching the code ?

(Sorry but i just begin to play with the swagger codegen)
PS : If anyone would like to take a look i have forked the repos (swagger-codegen and swagger-codegen-plugin) on my account, and the result works well for my use cases. I'm ok to push a pull request but would like to know before why it hasn't been already done :-)

@webron
Copy link
Contributor

webron commented May 22, 2015

@rastaman - it would be much better to open an issue for your question that post it on a completely unrelated one.

@rastaman
Copy link

@webron : yup, sorry to have spammed this issue, in my mind it is closely related, i have open issue #779 . Have a good day

@hyeghiazaryan
Copy link
Contributor

Work to add lang specific command-line args has been done.
Some args for java have been added.
I would highly appreciate any feedback on the code/design.
Please see the last 7 commits here https://github.com/hyeghiazaryan/swagger-codegen/commits/develop_2.0

@hyeghiazaryan
Copy link
Contributor

oops, seems like I have made changes to a Deprecated class, will transfer to swagger-codegen-cli

@hyeghiazaryan
Copy link
Contributor

rolled back deprecated class changes
added --config option to swagger-cli along with handling
https://github.com/hyeghiazaryan/swagger-codegen/commits/develop_2.0

olensmar pushed a commit that referenced this issue Jun 2, 2015
Support for file based config. Implementation for #616.
@wing328
Copy link
Contributor

wing328 commented Jun 16, 2015

I think this can be closed as #805 has been merged.

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

8 participants