This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git
The following commit(s) were added to refs/heads/trunk by this push:
new f7c583a1a Improved: Update build.gradle to the latest dependencies
(OFBIZ-12658)
f7c583a1a is described below
commit f7c583a1a1ea0931e651e5e40c850953c625eab3
Author: Jacques Le Roux <[email protected]>
AuthorDate: Mon Jun 27 15:40:17 2022 +0200
Improved: Update build.gradle to the latest dependencies (OFBIZ-12658)
I handled <<addProperties(String,Schema) in Schema has been deprecated>>
Just needed to replace by addProperty(String,Schema) for each case
---
rest-api/build.gradle | 6 ++---
.../org/apache/ofbiz/ws/rs/util/OpenApiUtil.java | 26 ++++++++++++----------
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/rest-api/build.gradle b/rest-api/build.gradle
index 82d91b6b6..c587f670a 100644
--- a/rest-api/build.gradle
+++ b/rest-api/build.gradle
@@ -27,9 +27,9 @@ dependencies {
pluginLibsCompile 'org.glassfish.jersey.media:jersey-media-multipart:2.31'
pluginLibsCompile
'org.glassfish.jersey.media:jersey-media-json-jackson:2.31'
pluginLibsCompile 'org.glassfish.jersey.inject:jersey-hk2:2.31'
- pluginLibsCompile 'io.swagger.core.v3:swagger-jaxrs2:2.1.10'
- pluginLibsCompile
'io.swagger.core.v3:swagger-jaxrs2-servlet-initializer:2.1.10'
- pluginLibsCompile 'io.swagger.core.v3:swagger-annotations:2.1.10'
+ pluginLibsCompile 'io.swagger.core.v3:swagger-jaxrs2:2.2.1'
+ pluginLibsCompile
'io.swagger.core.v3:swagger-jaxrs2-servlet-initializer:2.2.1'
+ pluginLibsCompile 'io.swagger.core.v3:swagger-annotations:2.2.1'
}
task install {
diff --git
a/rest-api/src/main/java/org/apache/ofbiz/ws/rs/util/OpenApiUtil.java
b/rest-api/src/main/java/org/apache/ofbiz/ws/rs/util/OpenApiUtil.java
index 5444242dd..a9e49ec3f 100644
--- a/rest-api/src/main/java/org/apache/ofbiz/ws/rs/util/OpenApiUtil.java
+++ b/rest-api/src/main/java/org/apache/ofbiz/ws/rs/util/OpenApiUtil.java
@@ -159,10 +159,12 @@ public final class OpenApiUtil {
}
private static void buildApiResponseSchemas() {
- Schema<?> genericErrorSchema = new
MapSchema().addProperties("statusCode", new IntegerSchema().description("HTTP
Status Code"))
- .addProperties("statusDescription", new
StringSchema().description("HTTP Status Code Description"))
- .addProperties("errorType", new
StringSchema().description("Error Type for the error"))
- .addProperties("errorMessage", new
StringSchema().description("Error Message"));
+ Schema<?> genericErrorSchema = new MapSchema();
+ genericErrorSchema.addProperty("statusCode", new
IntegerSchema().description("HTTP Status Code"));
+
+ genericErrorSchema.addProperty("statusDescription", new
StringSchema().description("HTTP Status Code Description"));
+ genericErrorSchema.addProperty("errorType", new
StringSchema().description("Error Type for the error"));
+ genericErrorSchema.addProperty("errorMessage", new
StringSchema().description("Error Message"));
SCHEMAS.put("api.response.unauthorized.noheader", genericErrorSchema);
SCHEMAS.put("api.response.unauthorized.invalidtoken",
genericErrorSchema);
SCHEMAS.put("api.response.forbidden", genericErrorSchema);
@@ -283,7 +285,7 @@ public final class OpenApiUtil {
}
Schema<?> attrSchema = getAttributeSchema(service, param);
if (attrSchema != null) {
- parentSchema.addProperties(name, getAttributeSchema(service,
service.getParam(name)));
+ parentSchema.addProperty(name, getAttributeSchema(service,
service.getParam(name)));
}
});
parentSchema.setRequired(required);
@@ -333,7 +335,7 @@ public final class OpenApiUtil {
if (!param.isOptional()) {
required.add(childParam.getName());
}
- schema.addProperties(childParam.getName(),
getAttributeSchema(service, childParam));
+ schema.addProperty(childParam.getName(),
getAttributeSchema(service, childParam));
}
schema.setRequired(required);
}
@@ -346,15 +348,15 @@ public final class OpenApiUtil {
Schema<Object> parentSchema = new Schema<Object>();
parentSchema.setDescription("Out Schema for service: " +
service.getName() + " response");
parentSchema.setType("object");
- parentSchema.addProperties("statusCode", new
IntegerSchema().description("HTTP Status Code"));
- parentSchema.addProperties("statusDescription", new
StringSchema().description("HTTP Status Code Description"));
- parentSchema.addProperties("successMessage", new
StringSchema().description("Success Message"));
+ parentSchema.addProperty("statusCode", new
IntegerSchema().description("HTTP Status Code"));
+ parentSchema.addProperty("statusDescription", new
StringSchema().description("HTTP Status Code Description"));
+ parentSchema.addProperty("successMessage", new
StringSchema().description("Success Message"));
Schema<Object> dataSchema = new Schema<Object>();
- parentSchema.addProperties("data", dataSchema);
+ parentSchema.addProperty("data", dataSchema);
service.getOutParamNamesMap().forEach((name, type) -> {
Schema<?> attrSchema = getAttributeSchema(service,
service.getParam(name));
if (attrSchema != null) {
- dataSchema.addProperties(name, getAttributeSchema(service,
service.getParam(name)));
+ dataSchema.addProperty(name, getAttributeSchema(service,
service.getParam(name)));
}
});
return parentSchema;
@@ -385,7 +387,7 @@ public final class OpenApiUtil {
e.printStackTrace();
}
if (schemaClass != null) {
- dataSchema.addProperties(fieldNm, schema.description(fieldNm));
+ dataSchema.addProperty(fieldNm, schema.description(fieldNm));
}
}
return dataSchema;