Skip to content

Commit 008adfe

Browse files
committed
fix(jaxrs-spec): map OpenAPI deprecated to Java/MicroProfile -> avoid @apioperation deprecated (#18941)
1 parent 312d180 commit 008adfe

5 files changed

Lines changed: 5 additions & 5 deletions

File tree

modules/openapi-generator/src/main/resources/JavaJaxRS/spec/apiInterface.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
@Path("{{{path}}}"){{/subresourceOperation}}{{#hasConsumes}}
1919
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}}
2020
@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}}{{#useSwaggerAnnotations}}
21-
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}"{{#isDeprecated}}, deprecated = true{{/isDeprecated}}{{#hasAuthMethods}}, authorizations = {
21+
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}"{{#hasAuthMethods}}, authorizations = {
2222
{{#authMethods}}{{#isOAuth}}@Authorization(value = "{{name}}", scopes = {
2323
{{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{^-last}},
2424
{{/-last}}{{/scopes}} }){{^-last}},{{/-last}}{{/isOAuth}}

modules/openapi-generator/src/main/resources/JavaJaxRS/spec/apiMethod.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@Path("{{{path}}}"){{/subresourceOperation}}{{#hasConsumes}}
66
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}}
77
@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}}{{#useSwaggerAnnotations}}
8-
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}"{{#isDeprecated}}, deprecated = true{{/isDeprecated}}, response = {{{returnBaseType}}}.class{{#returnContainer}}, responseContainer = "{{{.}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = {
8+
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnBaseType}}}.class{{#returnContainer}}, responseContainer = "{{{.}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = {
99
{{#authMethods}}{{#isOAuth}}@Authorization(value = "{{name}}", scopes = {
1010
{{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{^-last}},
1111
{{/-last}}{{/scopes}} }){{^-last}},{{/-last}}{{/isOAuth}}

modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiInterface.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
@Path("{{{path}}}"){{/subresourceOperation}}{{#hasConsumes}}
1212
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}}
1313
@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}}{{#useSwaggerAnnotations}}
14-
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}"{{#isDeprecated}}, deprecated = true{{/isDeprecated}}{{#hasAuthMethods}}, authorizations = {
14+
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}"{{#hasAuthMethods}}, authorizations = {
1515
{{#authMethods}}{{#isOAuth}}@Authorization(value = "{{name}}", scopes = {
1616
{{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{^-last}},
1717
{{/-last}}{{/scopes}} }){{^-last}},{{/-last}}{{/isOAuth}}

modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiMethod.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
@Path("{{{path}}}"){{/subresourceOperation}}{{#hasConsumes}}
99
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}}
1010
@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}}{{#useSwaggerAnnotations}}
11-
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}"{{#isDeprecated}}, deprecated = true{{/isDeprecated}}, response = {{{returnBaseType}}}.class{{#returnContainer}}, responseContainer = "{{{.}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = {
11+
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnBaseType}}}.class{{#returnContainer}}, responseContainer = "{{{.}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = {
1212
{{#authMethods}}{{#isOAuth}}@Authorization(value = "{{name}}", scopes = {
1313
{{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{^-last}},
1414
{{/-last}}{{/scopes}} }){{^-last}},{{/-last}}{{/isOAuth}}

modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecServerCodegenTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ public void generatesDeprecatedAnnotationsForModelsOperationsAndParameters_issue
13381338

13391339
Path petApi = output.toPath().resolve("src/gen/java/org/openapitools/api/PetApi.java");
13401340
JavaFileAssert.assertThat(petApi).assertMethod("findPetsByTags", "List<String>").hasAnnotation("Deprecated");
1341-
JavaFileAssert.assertThat(petApi).fileContains("@ApiOperation", "deprecated = true", "findPetsByTags");
1341+
JavaFileAssert.assertThat(petApi).fileContains("* @deprecated", "findPetsByTags");
13421342
JavaFileAssert.assertThat(petApi).fileContains("findPetsByStatus", "@Deprecated", "@QueryParam(\"status\")");
13431343
}
13441344

0 commit comments

Comments
 (0)