-
Notifications
You must be signed in to change notification settings - Fork 33
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
Move generator related CLI options into configuration file #134
Conversation
25c36db
to
affd565
Compare
name: "test-query-parameters", | ||
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 |
enum
unknown values #130 (comment)The
--merge-sources
,--package
,--module
,--vendor
,--generate
and--entityname-template
options 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
ConfigOptions
type 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-option
option that allows you to pass akey.path=value
pair. See #126 for more info.Refer to the table below for a mapping of the options
--merge-sources
mergeSources
--package
generate
andmodule
--module
generate
andmodule
--vendor
vendor
--generate
generate
--entityname-template
entities.nameTemplate
For more information, keep reading
mergeSources
This one is pretty straightforward, it's just a boolean flag at the top level:
The default value is
false
generate
andmodule
These two options differ slightly to how they were previously used since they are no longer mutually exclusive.
generate
is now a set with three options (paths
,entities
, andpackage
) andmodule
is the name of the module being generated.module
is required andgenerate
defaults 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
isGeneratingEnums
has also been incorporated into thegenerate
option.vendor
Pretty straightforward although this is now an
enum
so you can't specify anything other thangithub
or null.entities.nameTemplate
Finally, the
--entityname-template
option has moved intoentities
like so:Feedback on the approach is welcome, because there may well be a better way to approach this.