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

select Generator by language|framework|type composite key #885

Closed
wants to merge 11 commits into from

Conversation

rienafairefr
Copy link
Contributor

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.3.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

@jmini @jimschubert

Description of the PR

implementation prototype for #137 to select a given generator either by generatorName as it is now, or alternatively select it by language|framework|type, and error out when there is an ambiguity.

tomplus and others added 7 commits August 24, 2018 09:43
* Improve handling of all primitive types

* Fix missing includes in case of simple APIs

* Fix minor error in template function

* Remove tabs

* Refactor code for simplicity

* Remove tabs

* rework the router for handling multiple path param

* rework router to handle multiple path parameters

* rework router to handle multiple path parameters

* rework router

* Add support for Multi path param

* Add comments to code block and remove duplicate parameters

* Remove tabs :(

* Add missing imports after resolving conflict
…PITools#876)

Simplify other scripts needing this jar
Consistent with openapi-generator-cli
rienafairefr and others added 4 commits August 24, 2018 10:47
…enAPITools#775)

* Remove using model namespace when model is unused
* Add comments to clarify introduction of hasModelImport at API/operations level instead of operation/vendorExtensions level.
Copy link
Member

@jimschubert jimschubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've only done a very quick glance. I wanted to leave the comments I had this far in order to start any conversation. I've had a full week, and today is my son's 2nd birthday, so I'll try to revisit more in depth over the next few days.

@@ -397,14 +397,17 @@ SYNOPSIS
[(-c <configuration file> | --config <configuration file>)]
[-D <system properties>...]
[(-g <generator name> | --generator-name <generator name>)]
[(-lang <language>)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like these may have been added manually?

This should follow

  • single hyphen followed by single character for short options
  • double hyphen followed by kebab case phrase for long options

This table part of docs can be copied from the cli's help output

@@ -27,6 +27,6 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate --artifact-id "scala-akka-petstore-client" -t modules/openapi-generator/src/main/resources/scala-akka-client -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g akka-scala -o samples/client/petstore/scala-akka $@"
ags="generate --artifact-id "scala-akka-petstore-client" -t modules/openapi-generator/src/main/resources/scala-akka-client -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g scala-akka -o samples/client/petstore/scala-akka $@"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not be flipping the standardized generator name structures. This was already done for 3.0, and any additional changes are intended to wait for this options split to be completed.

@@ -48,10 +46,18 @@
@Option(name = {"-v", "--verbose"}, description = "verbose mode")
private Boolean verbose;

@Option(name = {"-l", "--lang"}, title = "language",
description = "client language to generate (maybe class name in classpath, required)")
@Option(name = {"-lang"}, title = "language",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These long name options should have double hyphen to match all other options formats

@@ -18,6 +23,18 @@
@Option(name = {"-s", "--short" }, description = "shortened output (suitable for scripting)")
private Boolean shortened = false;

@Option(name = {"-lang"}, title = "language",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use double hyphen for long names

*/
@Parameter(name = "language")
@Parameter(name = "generatorLanguage")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these all prefixed with generator while CLI options are not? Is there some Maven key conflict?

@@ -30,7 +30,7 @@
private static Map<String, CodegenType> names = new HashMap<String, CodegenType>();

@JsonCreator
public static CodegenType forValue(String value) {
public static CodegenType fromString(String value) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid changing APIs like this unless there's good reason. This will be a breaking change for those consuming the project programmatically (such as my intellij-openapi-generator).

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

Successfully merging this pull request may close these issues.

7 participants