Skip to content

Commit c280f9d

Browse files
committed
Improve description
1 parent f59f7b9 commit c280f9d

5 files changed

Lines changed: 9 additions & 11 deletions

File tree

docs/generators/java-camel.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
9595
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
9696
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
9797
|sourceFolder|source folder for generated code| |src/main/java|
98+
|springApiVersion|Value for 'version' attribute in @RequestMapping (for Spring 7 and above).| |null|
9899
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
99100
|title|server title name or client service name| |OpenAPI Spring|
100101
|unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).| |false|
@@ -108,7 +109,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
108109
|useOptional|Use Optional container for optional parameters| |false|
109110
|useResponseEntity|Use the `ResponseEntity` type to wrap return values of generated API methods. If disabled, method are annotated using a `@ResponseStatus` annotation, which has the status of the first response declared in the Api definition| |true|
110111
|useSealed|Whether to generate sealed model interfaces and classes| |false|
111-
|useSpringApiVersion|Generate version attribute in @RequestMapping for Spring 7.| |null|
112112
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
113113
|useSpringBuiltInValidation|Disable `@Validated` at the class level when using built-in validation.| |false|
114114
|useSpringController|Annotate the generated API as a Spring Controller| |false|
@@ -133,8 +133,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
133133
|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false
134134
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null
135135
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
136-
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
137-
|x-spring-api-version|Generate version attribute in @RequestMapping for Spring 7.|OPERATION|null
136+
|x-spring-api-version|Value for 'version' attribute in @RequestMapping (for Spring 7 and above).|OPERATION|null
138137

139138

140139
## IMPORT MAPPING

docs/generators/spring.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
8888
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
8989
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
9090
|sourceFolder|source folder for generated code| |src/main/java|
91+
|springApiVersion|Value for 'version' attribute in @RequestMapping (for Spring 7 and above).| |null|
9192
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
9293
|title|server title name or client service name| |OpenAPI Spring|
9394
|unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).| |false|
@@ -101,7 +102,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
101102
|useOptional|Use Optional container for optional parameters| |false|
102103
|useResponseEntity|Use the `ResponseEntity` type to wrap return values of generated API methods. If disabled, method are annotated using a `@ResponseStatus` annotation, which has the status of the first response declared in the Api definition| |true|
103104
|useSealed|Whether to generate sealed model interfaces and classes| |false|
104-
|useSpringApiVersion|Generate version attribute in @RequestMapping for Spring 7.| |null|
105105
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
106106
|useSpringBuiltInValidation|Disable `@Validated` at the class level when using built-in validation.| |false|
107107
|useSpringController|Annotate the generated API as a Spring Controller| |false|
@@ -126,8 +126,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
126126
|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false
127127
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null
128128
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
129-
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
130-
|x-spring-api-version|Generate version attribute in @RequestMapping for Spring 7.|OPERATION|null
129+
|x-spring-api-version|Value for 'version' attribute in @RequestMapping (for Spring 7 and above).|OPERATION|null
131130

132131

133132
## IMPORT MAPPING

modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public enum VendorExtension {
1313
X_KOTLIN_IMPLEMENTS("x-kotlin-implements", ExtensionLevel.MODEL, "Ability to specify interfaces that model must implement", "empty array"),
1414
X_KOTLIN_IMPLEMENTS_FIELDS("x-kotlin-implements-fields", ExtensionLevel.MODEL, "Specify attributes that are implemented by the interface(s) added via `x-kotlin-implements`", "empty array"),
1515
X_SPRING_PAGINATED("x-spring-paginated", ExtensionLevel.OPERATION, "Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.", "false"),
16-
X_SPRING_API_VERSION("x-spring-api-version", ExtensionLevel.OPERATION, "Generate version attribute in @RequestMapping for Spring 7.", null),
16+
X_SPRING_API_VERSION("x-spring-api-version", ExtensionLevel.OPERATION, "Value for 'version' attribute in @RequestMapping (for Spring 7 and above).", null),
1717
X_SPRING_PROVIDE_ARGS("x-spring-provide-args", ExtensionLevel.OPERATION, "Allows adding additional hidden parameters in the API specification to allow access to content such as header values or properties", "empty array"),
1818
X_DISCRIMINATOR_VALUE("x-discriminator-value", ExtensionLevel.MODEL, "Used with model inheritance to specify value for discriminator that identifies current model", ""),
1919
X_SETTER_EXTRA_ANNOTATION("x-setter-extra-annotation", ExtensionLevel.FIELD, "Custom annotation that can be specified over java setter for specific field", "When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value"),

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public class SpringCodegen extends AbstractJavaCodegen
100100
public static final String OPTIONAL_ACCEPT_NULLABLE = "optionalAcceptNullable";
101101
public static final String USE_SPRING_BUILT_IN_VALIDATION = "useSpringBuiltInValidation";
102102
public static final String USE_DEDUCTION_FOR_ONE_OF_INTERFACES = "useDeductionForOneOfInterfaces";
103-
public static final String USE_SPRING_API_VERSION = "useSpringApiVersion";
103+
public static final String SPRING_API_VERSION = "springApiVersion";
104104

105105
@Getter
106106
public enum RequestMappingMode {
@@ -287,7 +287,7 @@ public SpringCodegen() {
287287
optionalAcceptNullable));
288288

289289
cliOptions.add(CliOption.newBoolean(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "whether to use deduction for generated oneOf interfaces", useDeductionForOneOfInterfaces));
290-
cliOptions.add(CliOption.newString(USE_SPRING_API_VERSION, "Generate version attribute in @RequestMapping for Spring 7."));
290+
cliOptions.add(CliOption.newString(SPRING_API_VERSION, "Value for 'version' attribute in @RequestMapping (for Spring 7 and above)."));
291291
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application.");
292292
supportedLibraries.put(SPRING_CLOUD_LIBRARY,
293293
"Spring-Cloud-Feign client with Spring-Boot auto-configured settings.");
@@ -857,7 +857,7 @@ private void doDataTypeAssignment(String returnType, DataTypeAssigner dataTypeAs
857857
}
858858

859859
private void prepareVersioningParameters(List<CodegenOperation> operations) {
860-
Object apiVersion = additionalProperties.get(USE_SPRING_API_VERSION);
860+
Object apiVersion = additionalProperties.get(SPRING_API_VERSION);
861861
boolean hasApiVersion = apiVersion != null;
862862
for (CodegenOperation operation : operations) {
863863
if (operation.getHasHeaderParams()) {

modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5742,7 +5742,7 @@ public void testOneOfInterfaceWithAnnotation() throws IOException {
57425742
@Test
57435743
public void testApiVersion() throws IOException {
57445744
final Map<String, File> files = generateFromContract("src/test/resources/3_0/spring/apiVersion.yaml", SPRING_BOOT,
5745-
Map.of(SpringCodegen.USE_SPRING_API_VERSION, "v1",
5745+
Map.of(SpringCodegen.SPRING_API_VERSION, "v1",
57465746
USE_TAGS, true));
57475747
JavaFileAssert.assertThat(files.get("TestApi.java"))
57485748
.assertMethod("getVersions")

0 commit comments

Comments
 (0)