This is an automated email from the ASF dual-hosted git repository.

Lukas-Finster pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 87ee59bdbf Improved: made rest-api openApi specification configurable 
(OFBIZ-13497)
87ee59bdbf is described below

commit 87ee59bdbf57706e7e8d4bdbc2fdcc58ba84bac7
Author: Lukas Finster <[email protected]>
AuthorDate: Wed Aug 19 09:07:47 2026 +0200

    Improved: made rest-api openApi specification configurable (OFBIZ-13497)
---
 framework/rest-api/config/rest-api.properties      | 14 +++++++++++++-
 .../ofbiz/ws/rs/resources/OpenApiResource.java     | 22 ++++++++++++++--------
 2 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/framework/rest-api/config/rest-api.properties 
b/framework/rest-api/config/rest-api.properties
index e7b2ca08d6..4e8e4b5aaa 100644
--- a/framework/rest-api/config/rest-api.properties
+++ b/framework/rest-api/config/rest-api.properties
@@ -21,4 +21,16 @@ rest-api.auth.baseSecurityGroupPermission = REST-API_ADMIN
 ### Configures jackson serialization inclusion. Possible values are:
 #   ALWAYS,NON_NULL,NON_ABSENT,NON_EMPTY,NON_DEFAULT,CUSTOM,USE_DEFAULTS
 rest-api.jackson.serialization.inclusion.value=NON_NULL
-rest-api.jackson.serialization.inclusion.content=NON_NULL
\ No newline at end of file
+rest-api.jackson.serialization.inclusion.content=NON_NULL
+
+###openAPI specification
+rest-api.info.version = 1.0.0
+rest-api.info.title = OFBiz REST APIs
+rest-api.info.description = Open API specification for OFBiz RESTful APIs.
+rest-api.info.termsOfService = http://www.apache.org/licenses/LICENSE-2.0.html
+rest-api.info.contact.name = OFBiz DEV API Team
+rest-api.info.contact.email = [email protected]
+rest-api.info.contact.url = https://ofbiz.apache.org/
+rest-api.info.license.name = Apache 2.0
+rest-api.info.license.url = http://www.apache.org/licenses/LICENSE-2.0.txt
+rest-api.server.description = Server Hosting the REST API
diff --git 
a/framework/rest-api/src/main/java/org/apache/ofbiz/ws/rs/resources/OpenApiResource.java
 
b/framework/rest-api/src/main/java/org/apache/ofbiz/ws/rs/resources/OpenApiResource.java
index 408bcbcc31..1ad95f3560 100644
--- 
a/framework/rest-api/src/main/java/org/apache/ofbiz/ws/rs/resources/OpenApiResource.java
+++ 
b/framework/rest-api/src/main/java/org/apache/ofbiz/ws/rs/resources/OpenApiResource.java
@@ -21,6 +21,7 @@ package org.apache.ofbiz.ws.rs.resources;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import org.apache.ofbiz.base.util.UtilProperties;
 import org.apache.ofbiz.base.util.UtilValidate;
 import org.apache.ofbiz.ws.rs.openapi.OFBizOpenApiReader;
 import org.apache.ofbiz.ws.rs.openapi.OFBizResourceScanner;
@@ -135,26 +136,31 @@ public final class OpenApiResource {
 
 
     private Info buildOpenApiInfo() {
-        Info info = new Info().version("1.0.0").title("OFBiz REST APIs")
-                .description("Open API specification for OFBiz RESTful 
APIs.").contact(buildOpenApiContact())
-                
.termsOfService("http://www.apache.org/licenses/LICENSE-2.0.html";)
+        Info info = new Info()
+                .version(UtilProperties.getPropertyValue("rest-api", 
"rest-api.info.version"))
+                .title(UtilProperties.getPropertyValue("rest-api", 
"rest-api.info.title"))
+                .description(UtilProperties.getPropertyValue("rest-api", 
"rest-api.info.description"))
+                .contact(buildOpenApiContact())
+                .termsOfService(UtilProperties.getPropertyValue("rest-api", 
"rest-api.info.termsOfService"))
                 .license(new License()
-                        .name("Apache 2.0")
-                        
.url("http://www.apache.org/licenses/LICENSE-2.0.txt";));
+                        .name(UtilProperties.getPropertyValue("rest-api", 
"rest-api.info.license.name"))
+                        .url(UtilProperties.getPropertyValue("rest-api", 
"rest-api.info.license.url")));
 
         return info;
     }
 
     private Contact buildOpenApiContact() {
-        Contact contact = new Contact().name("OFBiz DEV API 
Team").email("[email protected]")
-                .url("https://ofbiz.apache.org/";);
+        Contact contact = new Contact()
+                .name(UtilProperties.getPropertyValue("rest-api", 
"rest-api.info.contact.name"))
+                .email(UtilProperties.getPropertyValue("rest-api", 
"rest-api.info.contact.email"))
+                .url(UtilProperties.getPropertyValue("rest-api", 
"rest-api.info.contact.url"));
         return contact;
     }
 
     private Server buildOpenApiServer() {
         Server serverItem =
                 new Server().url(request.getScheme() + "://" + 
request.getServerName() + ":" + request.getServerPort() + 
request.getContextPath())
-                        .description("Server Hosting the REST API");
+                        
.description(UtilProperties.getPropertyValue("rest-api", 
"rest-api.server.description"));
         return serverItem;
     }
 }

Reply via email to