This is an automated email from the ASF dual-hosted git repository.
grv pushed a commit to branch trunk
in repository
https://gitbox.apache.org/repos/asf/ofbiz-plugins.gitThe following commit(s) were added to refs/heads/trunk by this push:
new 8bb8fee Fixed: inParams is not listed in OpenAPI spec if the service does not define any IN attributes(OFBIZ-11328)
8bb8fee is described below
commit 8bb8fee36f75d567c0709f57dfd77bb4402f9473
Author: Girish Vasmatkar <
[hidden email]>
AuthorDate: Mon Oct 12 15:58:05 2020 +0530
Fixed: inParams is not listed in OpenAPI spec if the service does not define any IN attributes(OFBIZ-11328)
---
.../apache/ofbiz/ws/rs/openapi/OFBizOpenApiReader.java | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/openapi/OFBizOpenApiReader.java b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/openapi/OFBizOpenApiReader.java
index 0287645..95c9a6f 100644
--- a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/openapi/OFBizOpenApiReader.java
+++ b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/openapi/OFBizOpenApiReader.java
@@ -174,13 +174,16 @@ public final class OFBizOpenApiReader extends Reader implements OpenApiReader {
.operationId(service.getName()).deprecated(false).addSecurityItem(security);
PathItem pathItemObject = new PathItem();
if (service.getAction().equalsIgnoreCase(HttpMethod.GET)) {
- final QueryParameter serviceInParam = (QueryParameter) new QueryParameter()
- .required(UtilValidate.isNotEmpty(service.getInParamNamesMap()) ? true : false)
- .description("Service In Parameters in JSON").name("inParams");
- Schema<?> refSchema = new Schema<>();
- refSchema.$ref("#/components/schemas/" + "api.request." + service.getName());
- serviceInParam.schema(refSchema);
- operation.addParametersItem(serviceInParam);
+ boolean inParamsEmpty = UtilValidate.isEmpty(service.getInParamNamesMap());
+ if (!inParamsEmpty) {
+ final QueryParameter serviceInParam = (QueryParameter) new QueryParameter()
+ .required(!inParamsEmpty)
+ .description("Service In Parameters in JSON").name("inParams");
+ Schema<?> refSchema = new Schema<>();
+ refSchema.$ref("#/components/schemas/" + "api.request." + service.getName());
+ serviceInParam.schema(refSchema);
+ operation.addParametersItem(serviceInParam);
+ }
operation.addParametersItem(HEADER_ACCEPT_JSON);
} else if (action.matches(HttpMethod.POST + "|" + HttpMethod.PUT + "|" + HttpMethod.PATCH)) {
RequestBody request = new RequestBody().description("Request Body for service " + service.getName())