Skip to content

[MAVEN] #3284: Made modelNamePrefix and -Suffix available through maven#3289

Merged
wing328 merged 2 commits intoswagger-api:masterfrom
d0x:Make_Pre_and_Suffix_Available
Jul 13, 2016
Merged

[MAVEN] #3284: Made modelNamePrefix and -Suffix available through maven#3289
wing328 merged 2 commits intoswagger-api:masterfrom
d0x:Make_Pre_and_Suffix_Available

Conversation

@d0x
Copy link
Copy Markdown

@d0x d0x commented Jul 4, 2016

As described in #3284

@d0x d0x changed the title #3284: Made modelNamePrefix and -Suffix available through maven [JAVA] #3284: Made modelNamePrefix and -Suffix available through maven Jul 4, 2016
@d0x d0x changed the title [JAVA] #3284: Made modelNamePrefix and -Suffix available through maven [MAVEN] #3284: Made modelNamePrefix and -Suffix available through maven Jul 4, 2016
@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Jul 4, 2016

@d0x thanks for the PR.

cc @ePaul

@ePaul
Copy link
Copy Markdown
Contributor

ePaul commented Jul 5, 2016

Looks nice. (I didn't test is yet.)

Previously I just passed this argument through the configOptionsadditionalProperties parameter, but this way is certainly nicer (and documented).

@d0x
Copy link
Copy Markdown
Author

d0x commented Jul 5, 2016

Thanks.
What exactly you mean by "just passed it through configOptions -> additionalProperties"?

This wasn't successful for me:


 <plugin>
                <groupId>io.swagger</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <version>2.2.0-SNAPSHOT</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <!-- specify the swagger yaml -->
                            <inputSpec>swagger.yaml</inputSpec>

                            <!-- target to generate -->
                            <language>java</language>

                            <!-- pass any necessary config options -->
                            <configOptions>
                                <dateLibrary>java8</dateLibrary>
                                <modelNameSuffix>DTO</modelNameSuffix>
                            </configOptions>

                            <!-- override the default library to jersey2 -->
                            <library>jersey2</library>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

And because it is a parameter in the cli I thought it makes sense to put it there as well.

If there is a way over the configOptions which you prefer, I could live with that too.

@ePaul
Copy link
Copy Markdown
Contributor

ePaul commented Jul 6, 2016

@d0x I think I used something like this (I don't have a project using this here right now):

                  <configOptions>
                      <additionalProperties>modelNameSuffix=DTO</additionalProperties>
                  </configOptions>

I actually prefer your way, I just was too lazy to build this in when adding the modelNameSuffix feature.

@wing328 wing328 modified the milestones: v2.3.0, v2.2.0 Jul 7, 2016
}

if(isNotEmpty(modelNameSuffix)) {
configurator.setModelNamePrefix(modelNameSuffix);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You have a copy+paste error here, this should be configurator.setModelNameSuffix(...).

@ePaul
Copy link
Copy Markdown
Contributor

ePaul commented Jul 9, 2016

With the fixed configurator call, it does what it pretends to do.

So 👍 depending on fixing what I mentioned.

Thankyou for the pull request, and sorry for taking so long to review it.

@d0x
Copy link
Copy Markdown
Author

d0x commented Jul 9, 2016

I fixed the c&p error. Sorry for that.

Have a nice sunday.

@ePaul
Copy link
Copy Markdown
Contributor

ePaul commented Jul 10, 2016

👍 – can be merged from my point of view.

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Jul 13, 2016

@d0x thanks for the contribution. PR merged into master (ready for 2.2.0 stable release)

@ePaul thanks for reviewing the change.

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.

3 participants