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

2.x Correct errors in how OpenAPI generator config settings are set #7971

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 44 additions & 11 deletions docs/shared/openapi/openapi-generator.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////

Copyright (c) 2022 Oracle and/or its affiliates.
Copyright (c) 2022, 2023 Oracle and/or its affiliates.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -139,11 +139,11 @@ For complete lists see these pages:
* link:{openapi-generator-tool-generators-docs-url}/java-helidon-client.md[Helidon client generator options] and
* link:{openapi-generator-tool-generators-docs-url}/java-helidon-server.md[Helidon server generator options]

The OpenAPI generator divides its settings into two types:
The OpenAPI generator loosely divides its settings into three types:

* _options_
* _global properties_
+
These high-level settings generally govern the overall behavior of the tool.
These settings generally govern the overall behavior of the tool, regardless of which specific generator you use.
+
For the CLI, use the common option style:
+
Expand All @@ -159,9 +159,38 @@ For the Maven plug-in, use elements within the `<configuration>` section of the
<inputSpec>petstore.yaml</inputSpec>
</configuration>
----
* _options_
+
These settings typically affect how particular generators operate.
+
For the CLI, specify config options as additional properties:
+
`--additional-properties=groupId=com.mycompany.test,artifactId=my-example`
+
or
+
[source,bash]
----
-p groupId=com.mycompany.test
-p artifactId=my-example
----
+
For the Maven plug-in, use the `<configOptions>` section within `<configuration>`:
+
[source,xml]
----
<configuration>
...
<configOptions>
<groupId>com.mycompany.test</groupId>
<artifactId>my-example</artifactId>
</configOptions>
...
</configuration>
----
* _additional properties_
+
These settings typically affect how a specific generator or library generates the code.
Settings in this category typically are passed to the templates used in generating the files, although generators can use additional properties in deciding how to generate the files.
+
For the CLI:
+
Expand All @@ -175,16 +204,17 @@ or
-p returnResponse=true
----
+
For the Maven plug-in, use elements within the `<configuration><configOptions>` section:
For the Maven plug-in, use an `<additionalProperties>` section within the `<configuration>` section for the plug-in:
+
[source,xml]
----
<configuration>
....
<configOptions>
<useAbstractClasses>false</useAbstractClasses>
<returnResponse>true</returnResponse>
</configOptions>
...
<additionalProperties>
<additionalProperty>useAbstractClasses=false</additionalProperty>
<additionalProperty>returnResponse=true</additionalProperty>
</additionalProperties>
...
</configuration>
----

Expand Down Expand Up @@ -490,6 +520,9 @@ The plug-in execution in the following example is equivalent to the CLI example
<modelPackage>io.helidon.examples.openapigen.{flavor-lc}.{example-project-type}.model</modelPackage>
<invokerPackage>io.helidon.examples.openapigen.{flavor-lc}.{example-project-type}</invokerPackage>
</configOptions>
<additionalProperties>
<additionalProperty>returnResponse=true</additionalProperty>
</additionalProperties>
</configuration>
</execution>
</executions>
Expand Down