-
Notifications
You must be signed in to change notification settings - Fork 39
Move generator related CLI options into configuration file #134
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
Conversation
25c36db to
affd565
Compare
| arguments: [ | ||
| "--package", "test-query-parameters" | ||
| ] | ||
| name: "test-query-parameters" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In GenerateTestCase's snapshot method, I've updated it to infer the moduleName from the name parameter. This means that in a lot of places we no longer need to pass the moduleName so you'll see that --package turns into nothing in the diff since format: package is default
|
Continued from #85.
|
Yeah, in most cases you typically name the package after the name of the product that it exports (which is the target name) and we do this already. But there are cases where it differs. For example, the swift-argument-parser package has a target called ArgumentParser. If I won't tackle that in this PR though |
|
@LePips: I pushed up the changes, since I'm removing the I can add |
6844995 to
0a50d14
Compare
0a50d14 to
398c256
Compare
|
As per #130 (comment), I've also included |
enumunknown values #130 (comment)The
--merge-sources,--package,--module,--vendor,--generateand--entityname-templateoptions all alter the generator output but they are currently passed separately to the rest of the configuration options.As part of the linked ticket, we want all options that alter the behaviour of the generator to be sourced from the
ConfigOptionstype which loads primarily from the .create-api.yml configuration file. Doing so would allow the user to store all important information in a single place without having to worry about making sure that these values are always passed when they invoke the cli by wrapping in a script etc.In cases where the user might actually want to pass these kind of options, or others that were previously only defined in the configuration file, we've introduced the general purpose
--config-optionoption that allows you to pass akey.path=valuepair. See #126 for more info.Refer to the table below for a mapping of the options
--merge-sourcesmergeSources--packagegenerateandmodule--modulegenerateandmodule--vendorvendor--generategenerate--entityname-templateentities.nameTemplateFor more information, keep reading
mergeSourcesThis one is pretty straightforward, it's just a boolean flag at the top level:
The default value is
falsegenerateandmoduleThese two options differ slightly to how they were previously used since they are no longer mutually exclusive.
generateis now a set with three options (paths,entities, andpackage) andmoduleis the name of the module being generated.moduleis required andgeneratedefaults to[entities, paths, package]. So by default a complete package is generated, and all you need is to specify the module name:If you don't want the package, you'd do something like this:
Note that
isGeneratingEnumshas also been incorporated into thegenerateoption.vendorPretty straightforward although this is now an
enumso you can't specify anything other thangithubor null.entities.nameTemplateFinally, the
--entityname-templateoption has moved intoentitieslike so:Feedback on the approach is welcome, because there may well be a better way to approach this.