From 888bc4dcd277f37454b812018ce0528bb1973d70 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Wed, 10 Dec 2025 13:41:40 +0100 Subject: [PATCH 01/26] Move resttemplate moustache into dedicated folder --- .../openapi/generator/GenerationConfigurationConverter.java | 2 +- .../{mustache-templates => resttemplate}/Readme.md | 0 .../auth/ApiKeyAuth.mustache | 0 .../auth/Authentication.mustache | 0 .../auth/HttpBasicAuth.mustache | 0 .../auth/HttpBearerAuth.mustache | 0 .../{mustache-templates => resttemplate}/auth/OAuth.mustache | 0 .../auth/OAuthFlow.mustache | 0 .../libraries/resttemplate/api.mustache | 0 .../libraries/resttemplate/auth/ApiKeyAuth.mustache | 0 .../libraries/resttemplate/auth/Authentication.mustache | 0 .../libraries/resttemplate/auth/HttpBasicAuth.mustache | 0 .../libraries/resttemplate/auth/HttpBearerAuth.mustache | 0 .../libraries/resttemplate/auth/OAuth.mustache | 0 .../libraries/resttemplate/auth/OAuthFlow.mustache | 0 .../{mustache-templates => resttemplate}/licenseInfo.mustache | 0 .../{mustache-templates => resttemplate}/model.mustache | 0 .../{mustache-templates => resttemplate}/modelEnum.mustache | 0 .../modelInnerEnum.mustache | 0 .../oneof_interface.mustache | 0 .../{mustache-templates => resttemplate}/pojo.mustache | 0 .../{mustache-templates => resttemplate}/pojoBuilder.mustache | 0 .../typeInfoAnnotation.mustache | 0 .../{mustache-templates => resttemplate}/xmlAnnotation.mustache | 0 24 files changed, 1 insertion(+), 1 deletion(-) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/Readme.md (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/auth/ApiKeyAuth.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/auth/Authentication.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/auth/HttpBasicAuth.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/auth/HttpBearerAuth.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/auth/OAuth.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/auth/OAuthFlow.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/libraries/resttemplate/api.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/libraries/resttemplate/auth/ApiKeyAuth.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/libraries/resttemplate/auth/Authentication.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/libraries/resttemplate/auth/HttpBasicAuth.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/libraries/resttemplate/auth/HttpBearerAuth.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/libraries/resttemplate/auth/OAuth.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/libraries/resttemplate/auth/OAuthFlow.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/licenseInfo.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/model.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/modelEnum.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/modelInnerEnum.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/oneof_interface.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/pojo.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/pojoBuilder.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/typeInfoAnnotation.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{mustache-templates => resttemplate}/xmlAnnotation.mustache (100%) diff --git a/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java b/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java index 596d8545c..3ea277d98 100644 --- a/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java +++ b/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java @@ -47,7 +47,7 @@ class GenerationConfigurationConverter static final String SAP_COPYRIGHT_HEADER = "Copyright (c) " + Year.now() + " SAP SE or an SAP affiliate company. All rights reserved."; - static final String TEMPLATE_DIRECTORY = Paths.get("openapi-generator").resolve("mustache-templates").toString(); + static final String TEMPLATE_DIRECTORY = Paths.get("openapi-generator").resolve("resttemplate").toString(); static final String LIBRARY_NAME = JavaClientCodegen.RESTTEMPLATE; @Nonnull diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/Readme.md b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/Readme.md similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/Readme.md rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/Readme.md diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/ApiKeyAuth.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/ApiKeyAuth.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/ApiKeyAuth.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/ApiKeyAuth.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/Authentication.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/Authentication.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/Authentication.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/Authentication.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/HttpBasicAuth.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/HttpBasicAuth.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/HttpBasicAuth.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/HttpBasicAuth.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/HttpBearerAuth.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/HttpBearerAuth.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/HttpBearerAuth.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/HttpBearerAuth.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/OAuth.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/OAuth.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/OAuth.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/OAuth.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/OAuthFlow.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/OAuthFlow.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/OAuthFlow.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/OAuthFlow.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/api.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/api.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/api.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/api.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/ApiKeyAuth.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/ApiKeyAuth.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/ApiKeyAuth.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/ApiKeyAuth.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/Authentication.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/Authentication.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/Authentication.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/Authentication.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/HttpBasicAuth.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/HttpBasicAuth.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/HttpBasicAuth.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/HttpBasicAuth.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/HttpBearerAuth.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/HttpBearerAuth.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/HttpBearerAuth.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/HttpBearerAuth.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/OAuth.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/OAuth.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/OAuth.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/OAuth.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/OAuthFlow.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/OAuthFlow.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/OAuthFlow.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/OAuthFlow.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/licenseInfo.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/licenseInfo.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/licenseInfo.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/licenseInfo.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/model.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/model.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/model.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/model.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/modelEnum.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/modelEnum.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/modelEnum.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/modelEnum.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/modelInnerEnum.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/modelInnerEnum.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/modelInnerEnum.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/modelInnerEnum.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/oneof_interface.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/oneof_interface.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/oneof_interface.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/oneof_interface.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/pojo.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/pojo.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/pojo.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/pojo.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/pojoBuilder.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/pojoBuilder.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/pojoBuilder.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/pojoBuilder.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/typeInfoAnnotation.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/typeInfoAnnotation.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/typeInfoAnnotation.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/typeInfoAnnotation.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/xmlAnnotation.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/xmlAnnotation.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/xmlAnnotation.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/xmlAnnotation.mustache From 3473fff3ec7307f47f303b3360d00faf2eecb2ce Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Wed, 10 Dec 2025 16:49:25 +0100 Subject: [PATCH 02/26] Revert "Move resttemplate moustache into dedicated folder" This reverts commit 888bc4dcd277f37454b812018ce0528bb1973d70. --- .../openapi/generator/GenerationConfigurationConverter.java | 2 +- .../{resttemplate => mustache-templates}/Readme.md | 0 .../auth/ApiKeyAuth.mustache | 0 .../auth/Authentication.mustache | 0 .../auth/HttpBasicAuth.mustache | 0 .../auth/HttpBearerAuth.mustache | 0 .../{resttemplate => mustache-templates}/auth/OAuth.mustache | 0 .../auth/OAuthFlow.mustache | 0 .../libraries/resttemplate/api.mustache | 0 .../libraries/resttemplate/auth/ApiKeyAuth.mustache | 0 .../libraries/resttemplate/auth/Authentication.mustache | 0 .../libraries/resttemplate/auth/HttpBasicAuth.mustache | 0 .../libraries/resttemplate/auth/HttpBearerAuth.mustache | 0 .../libraries/resttemplate/auth/OAuth.mustache | 0 .../libraries/resttemplate/auth/OAuthFlow.mustache | 0 .../{resttemplate => mustache-templates}/licenseInfo.mustache | 0 .../{resttemplate => mustache-templates}/model.mustache | 0 .../{resttemplate => mustache-templates}/modelEnum.mustache | 0 .../modelInnerEnum.mustache | 0 .../oneof_interface.mustache | 0 .../{resttemplate => mustache-templates}/pojo.mustache | 0 .../{resttemplate => mustache-templates}/pojoBuilder.mustache | 0 .../typeInfoAnnotation.mustache | 0 .../{resttemplate => mustache-templates}/xmlAnnotation.mustache | 0 24 files changed, 1 insertion(+), 1 deletion(-) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/Readme.md (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/auth/ApiKeyAuth.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/auth/Authentication.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/auth/HttpBasicAuth.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/auth/HttpBearerAuth.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/auth/OAuth.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/auth/OAuthFlow.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/libraries/resttemplate/api.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/libraries/resttemplate/auth/ApiKeyAuth.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/libraries/resttemplate/auth/Authentication.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/libraries/resttemplate/auth/HttpBasicAuth.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/libraries/resttemplate/auth/HttpBearerAuth.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/libraries/resttemplate/auth/OAuth.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/libraries/resttemplate/auth/OAuthFlow.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/licenseInfo.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/model.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/modelEnum.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/modelInnerEnum.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/oneof_interface.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/pojo.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/pojoBuilder.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/typeInfoAnnotation.mustache (100%) rename datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/{resttemplate => mustache-templates}/xmlAnnotation.mustache (100%) diff --git a/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java b/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java index 3ea277d98..596d8545c 100644 --- a/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java +++ b/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java @@ -47,7 +47,7 @@ class GenerationConfigurationConverter static final String SAP_COPYRIGHT_HEADER = "Copyright (c) " + Year.now() + " SAP SE or an SAP affiliate company. All rights reserved."; - static final String TEMPLATE_DIRECTORY = Paths.get("openapi-generator").resolve("resttemplate").toString(); + static final String TEMPLATE_DIRECTORY = Paths.get("openapi-generator").resolve("mustache-templates").toString(); static final String LIBRARY_NAME = JavaClientCodegen.RESTTEMPLATE; @Nonnull diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/Readme.md b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/Readme.md similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/Readme.md rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/Readme.md diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/ApiKeyAuth.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/ApiKeyAuth.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/ApiKeyAuth.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/ApiKeyAuth.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/Authentication.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/Authentication.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/Authentication.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/Authentication.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/HttpBasicAuth.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/HttpBasicAuth.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/HttpBasicAuth.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/HttpBasicAuth.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/HttpBearerAuth.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/HttpBearerAuth.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/HttpBearerAuth.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/HttpBearerAuth.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/OAuth.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/OAuth.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/OAuth.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/OAuth.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/OAuthFlow.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/OAuthFlow.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/auth/OAuthFlow.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/auth/OAuthFlow.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/api.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/api.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/api.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/api.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/ApiKeyAuth.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/ApiKeyAuth.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/ApiKeyAuth.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/ApiKeyAuth.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/Authentication.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/Authentication.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/Authentication.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/Authentication.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/HttpBasicAuth.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/HttpBasicAuth.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/HttpBasicAuth.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/HttpBasicAuth.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/HttpBearerAuth.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/HttpBearerAuth.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/HttpBearerAuth.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/HttpBearerAuth.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/OAuth.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/OAuth.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/OAuth.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/OAuth.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/OAuthFlow.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/OAuthFlow.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/libraries/resttemplate/auth/OAuthFlow.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/resttemplate/auth/OAuthFlow.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/licenseInfo.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/licenseInfo.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/licenseInfo.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/licenseInfo.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/model.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/model.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/model.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/model.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/modelEnum.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/modelEnum.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/modelEnum.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/modelEnum.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/modelInnerEnum.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/modelInnerEnum.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/modelInnerEnum.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/modelInnerEnum.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/oneof_interface.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/oneof_interface.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/oneof_interface.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/oneof_interface.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/pojo.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/pojo.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/pojo.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/pojo.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/pojoBuilder.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/pojoBuilder.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/pojoBuilder.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/pojoBuilder.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/typeInfoAnnotation.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/typeInfoAnnotation.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/typeInfoAnnotation.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/typeInfoAnnotation.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/xmlAnnotation.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/xmlAnnotation.mustache similarity index 100% rename from datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/resttemplate/xmlAnnotation.mustache rename to datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/xmlAnnotation.mustache From 7991ce9183d3eb1139b4724d3d323a483c8b7564 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Wed, 10 Dec 2025 16:57:44 +0100 Subject: [PATCH 03/26] Add apache-httpclient/api.moustache --- .../libraries/apache-httpclient/api.mustache | 245 ++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache new file mode 100644 index 000000000..14d806bb0 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache @@ -0,0 +1,245 @@ +{{>licenseInfo}} +package {{package}}; + +import com.fasterxml.jackson.core.type.TypeReference; + +import {{invokerPackage}}.ApiException; +import {{invokerPackage}}.ApiClient; +import {{invokerPackage}}.BaseApi; +import {{invokerPackage}}.Configuration; +{{#models.0}} + import {{modelPackage}}.*; +{{/models.0}} +import {{invokerPackage}}.Pair; + +{{#imports}}import {{import}}; +{{/imports}} + + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.StringJoiner; + +{{#useBeanValidation}} + import {{javaxPackage}}.validation.constraints.*; + import {{javaxPackage}}.validation.Valid; + +{{/useBeanValidation}} +{{>generatedAnnotation}} + +{{#operations}} + public class {{classname}} extends BaseApi { + + public {{classname}}() { + super(Configuration.getDefaultApiClient()); + } + + public {{classname}}(ApiClient apiClient) { + super(apiClient); + } + + {{#operation}} + /** + * {{summary}} + * {{notes}} + {{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} + {{/allParams}} + {{#returnType}} + * @return {{returnType}} + {{/returnType}} + * @throws ApiException if fails to make API call + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + {{#returnType}}return {{/returnType}}this.{{operationId}}({{#allParams}}{{paramName}}, {{/allParams}}Collections.emptyMap()); + } + + + /** + * {{summary}} + * {{notes}} + {{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} + {{/allParams}} + * @param additionalHeaders additionalHeaders for this call + {{#returnType}} + * @return {{returnType}} + {{/returnType}} + * @throws ApiException if fails to make API call + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}, {{/allParams}}Map additionalHeaders) throws ApiException { + Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + {{#allParams}}{{#required}} + // verify the required parameter '{{paramName}}' is set + if ({{paramName}} == null) { + throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}"); + } + {{/required}}{{/allParams}} + // create path and map variables + String localVarPath = "{{{path}}}"{{#pathParams}} + .replaceAll("\\{" + "{{baseName}}" + "\\}", apiClient.escapeString(apiClient.parameterToString({{{paramName}}}))){{/pathParams}}; + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + {{#queryParams}} + {{#isDeepObject}} + localVarQueryParameterBaseName = "{{{baseName}}}"; + {{#isArray}} + for (int i=0; i < {{paramName}}.size(); i++) { + localVarQueryStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format(Locale.ROOT, "{{baseName}}[%d]", i))); + } + {{/isArray}} + {{^isArray}} + localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString("{{baseName}}")); + {{/isArray}} + {{/isDeepObject}} + {{^isDeepObject}} + {{#isExplode}} + {{#hasVars}} + {{#vars}} + {{#isArray}} + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "{{baseName}}", {{paramName}}.{{getter}}())); + {{/isArray}} + {{^isArray}} + localVarQueryParams.addAll(apiClient.parameterToPair("{{baseName}}", {{paramName}}.{{getter}}())); + {{/isArray}} + {{/vars}} + {{/hasVars}} + {{^hasVars}} + {{#isModel}} + localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString()); + {{/isModel}} + {{^isModel}} + {{#collectionFormat}}localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(apiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); + {{/isModel}} + {{/hasVars}} + {{/isExplode}} + {{^isExplode}} + {{#collectionFormat}}localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(apiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); + {{/isExplode}} + {{/isDeepObject}} + {{/queryParams}} + {{#headerParams}}if ({{paramName}} != null) + localVarHeaderParams.put("{{baseName}}", apiClient.parameterToString({{paramName}})); + {{/headerParams}} + + localVarHeaderParams.putAll(additionalHeaders); + + {{#cookieParams}}if ({{paramName}} != null) + localVarCookieParams.put("{{baseName}}", apiClient.parameterToString({{paramName}})); + {{/cookieParams}} + + {{#formParams}}if ({{paramName}} != null) + localVarFormParams.put("{{baseName}}", {{paramName}}); + {{/formParams}} + + final String[] localVarAccepts = { + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; + + {{#returnType}} + TypeReference<{{{returnType}}}> localVarReturnType = new TypeReference<{{{returnType}}}>() {}; + return apiClient.invokeAPI( + {{/returnType}} + {{^returnType}} + apiClient.invokeAPI( + {{/returnType}} + localVarPath, + "{{httpMethod}}", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}} + ); + } + + {{#-last}} + @Override + public T invokeAPI(String url, String method, Object request, TypeReference returnType, Map additionalHeaders) throws ApiException { + String localVarPath = url.replace(apiClient.getBaseURL(), ""); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; + + return apiClient.invokeAPI( + localVarPath, + method, + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + request, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + returnType + ); + } + {{/-last}} + {{/operation}} + } +{{/operations}} \ No newline at end of file From 6638e7aff8f0e995b60ee29f6ceb7e095f536c15 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Thu, 11 Dec 2025 11:09:52 +0100 Subject: [PATCH 04/26] openapi apache sample - models only --- .../openapi/openapi-api-apache-sample/pom.xml | 85 + .../sample/model/AssistantChatMessage.java | 414 ++++ .../sample/model/AzureContentSafetyInput.java | 371 +++ .../AzureContentSafetyInputFilterConfig.java | 312 +++ .../model/AzureContentSafetyOutput.java | 374 +++ .../AzureContentSafetyOutputFilterConfig.java | 312 +++ .../apache/sample/model/AzureThreshold.java | 86 + .../sample/model/ChatCompletionTool.java | 309 +++ .../apache/sample/model/ChatMessage.java | 36 + .../sample/model/ChatMessageContent.java | 68 + .../apache/sample/model/DPIConfig.java | 545 +++++ .../model/DPIConfigMaskGroundingInput.java | 202 ++ .../apache/sample/model/DPICustomEntity.java | 241 ++ .../apache/sample/model/DPIEntities.java | 130 ++ .../apache/sample/model/DPIEntityConfig.java | 33 + .../sample/model/DPIMethodConstant.java | 309 +++ .../sample/model/DPIMethodFabricatedData.java | 267 +++ .../sample/model/DPIStandardEntity.java | 242 ++ .../DPIStandardEntityReplacementStrategy.java | 33 + .../sample/model/DataRepositoryType.java | 82 + .../sample/model/DeveloperChatMessage.java | 309 +++ .../sample/model/DocumentGroundingFilter.java | 546 +++++ .../apache/sample/model/ErrorResponse.java | 241 ++ .../sample/model/FilteringModuleConfig.java | 241 ++ .../sample/model/FilteringStreamOptions.java | 202 ++ .../apache/sample/model/FunctionObject.java | 370 +++ .../sample/model/GlobalStreamOptions.java | 308 +++ .../GroundingFilterSearchConfiguration.java | 251 ++ .../sample/model/GroundingModuleConfig.java | 309 +++ .../model/GroundingModuleConfigConfig.java | 323 +++ ...oundingModuleConfigConfigFiltersInner.java | 31 + ...oundingModuleConfigConfigPlaceholders.java | 263 +++ .../apache/sample/model/ImageContent.java | 309 +++ .../sample/model/ImageContentImageUrl.java | 241 ++ .../apache/sample/model/ImageContentUrl.java | 241 ++ .../sample/model/InputFilterConfig.java | 33 + .../sample/model/InputFilteringConfig.java | 219 ++ .../apache/sample/model/KeyValueListPair.java | 260 +++ .../apache/sample/model/LLMModelDetails.java | 397 ++++ .../apache/sample/model/LlamaGuard38b.java | 773 +++++++ .../model/LlamaGuard38bFilterConfig.java | 310 +++ .../sample/model/MaskingModuleConfig.java | 33 + .../MaskingModuleConfigMaskingProviders.java | 226 ++ .../model/MaskingModuleConfigProviders.java | 218 ++ .../apache/sample/model/MessageToolCall.java | 352 +++ .../sample/model/MessageToolCallFunction.java | 248 ++ .../apache/sample/model/ModuleConfigs.java | 370 +++ .../apache/sample/model/MultiChatContent.java | 31 + .../sample/model/MultiChatTemplate.java | 260 +++ .../sample/model/OrchestrationConfig.java | 241 ++ .../OrchestrationConfigDeleteResponse.java | 201 ++ .../model/OrchestrationConfigGetResponse.java | 555 +++++ .../OrchestrationConfigListResponse.java | 262 +++ .../model/OrchestrationConfigPostRequest.java | 328 +++ .../OrchestrationConfigPostResponse.java | 372 +++ .../model/OrchestrationConfigResource.java | 555 +++++ .../sample/model/OutputFilterConfig.java | 33 + .../sample/model/OutputFilteringConfig.java | 262 +++ .../apache/sample/model/PromptTemplate.java | 33 + .../model/PromptTemplateDeleteResponse.java | 199 ++ .../model/PromptTemplateGetResponse.java | 555 +++++ .../model/PromptTemplateListResponse.java | 261 +++ .../model/PromptTemplatePostRequest.java | 328 +++ .../model/PromptTemplatePostResponse.java | 372 +++ .../sample/model/PromptTemplateSpec.java | 411 ++++ .../PromptTemplateSpecResponseFormat.java | 35 + .../PromptTemplateSubstitutionRequest.java | 201 ++ .../PromptTemplateSubstitutionResponse.java | 263 +++ .../model/PromptTemplatingModuleConfig.java | 242 ++ .../PromptTemplatingModuleConfigPrompt.java | 32 + .../model/ResponseFormatJsonObject.java | 267 +++ .../model/ResponseFormatJsonSchema.java | 310 +++ .../ResponseFormatJsonSchemaJsonSchema.java | 366 +++ .../sample/model/ResponseFormatText.java | 266 +++ .../model/RuntimeOrchestrationConfigFile.java | 328 +++ .../model/RuntimePromptTemplateFile.java | 328 +++ .../RuntimePromptTemplateFileMetadata.java | 287 +++ ...SAPDocumentTranslationApplyToSelector.java | 384 ++++ .../model/SAPDocumentTranslationInput.java | 355 +++ .../SAPDocumentTranslationInputConfig.java | 308 +++ .../model/SAPDocumentTranslationOutput.java | 310 +++ .../SAPDocumentTranslationOutputConfig.java | 245 ++ ...cumentTranslationOutputTargetLanguage.java | 69 + .../model/SearchDocumentKeyValueListPair.java | 321 +++ .../sample/model/SearchSelectOptionEnum.java | 80 + .../sample/model/SingleChatTemplate.java | 241 ++ .../sample/model/SystemChatMessage.java | 309 +++ .../openapi/apache/sample/model/Template.java | 389 ++++ .../apache/sample/model/TemplateRef.java | 198 ++ .../apache/sample/model/TemplateRefByID.java | 322 +++ .../TemplateRefByScenarioNameVersion.java | 409 ++++ .../sample/model/TemplateRefTemplateRef.java | 33 + .../sample/model/TemplateResponseFormat.java | 34 + .../apache/sample/model/TextContent.java | 309 +++ .../apache/sample/model/ToolChatMessage.java | 352 +++ .../sample/model/TranslationModuleConfig.java | 242 ++ .../apache/sample/model/UserChatMessage.java | 309 +++ .../sample/model/UserChatMessageContent.java | 69 + .../model/UserChatMessageContentItem.java | 358 +++ .../src/main/resources/prompt-registry.yaml | 2026 +++++++++++++++++ datamodel/openapi/pom.xml | 1 + 101 files changed, 27932 insertions(+) create mode 100644 datamodel/openapi/openapi-api-apache-sample/pom.xml create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AssistantChatMessage.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyInput.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyInputFilterConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyOutput.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyOutputFilterConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureThreshold.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatCompletionTool.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatMessage.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatMessageContent.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIConfigMaskGroundingInput.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPICustomEntity.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIEntities.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIEntityConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIMethodConstant.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIMethodFabricatedData.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIStandardEntity.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIStandardEntityReplacementStrategy.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DataRepositoryType.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DeveloperChatMessage.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DocumentGroundingFilter.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ErrorResponse.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FilteringModuleConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FilteringStreamOptions.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FunctionObject.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GlobalStreamOptions.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingFilterSearchConfiguration.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfigFiltersInner.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfigPlaceholders.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContent.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContentImageUrl.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContentUrl.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/InputFilterConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/InputFilteringConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/KeyValueListPair.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LLMModelDetails.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LlamaGuard38b.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LlamaGuard38bFilterConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfigMaskingProviders.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfigProviders.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MessageToolCall.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MessageToolCallFunction.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ModuleConfigs.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MultiChatContent.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MultiChatTemplate.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigDeleteResponse.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigGetResponse.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigListResponse.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigPostRequest.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigPostResponse.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigResource.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OutputFilterConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OutputFilteringConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplate.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateDeleteResponse.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateGetResponse.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateListResponse.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatePostRequest.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatePostResponse.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSpec.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSpecResponseFormat.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSubstitutionRequest.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSubstitutionResponse.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatingModuleConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatingModuleConfigPrompt.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonObject.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonSchema.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonSchemaJsonSchema.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatText.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimeOrchestrationConfigFile.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimePromptTemplateFile.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimePromptTemplateFileMetadata.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationApplyToSelector.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationInput.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationInputConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutput.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutputConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutputTargetLanguage.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SearchDocumentKeyValueListPair.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SearchSelectOptionEnum.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SingleChatTemplate.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SystemChatMessage.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Template.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRef.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefByID.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefByScenarioNameVersion.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefTemplateRef.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateResponseFormat.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TextContent.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ToolChatMessage.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TranslationModuleConfig.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessage.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessageContent.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessageContentItem.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/resources/prompt-registry.yaml diff --git a/datamodel/openapi/openapi-api-apache-sample/pom.xml b/datamodel/openapi/openapi-api-apache-sample/pom.xml new file mode 100644 index 000000000..7cdf574cf --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/pom.xml @@ -0,0 +1,85 @@ + + + 4.0.0 + + com.sap.cloud.sdk.datamodel + openapi-parent + 5.25.0-SNAPSHOT + + + openapi-api-apache-sample + + + 22 + 22 + UTF-8 + + + + + com.sap.cloud.sdk.datamodel + openapi-core + + + com.sap.cloud.sdk.cloudplatform + cloudplatform-connectivity + + + + + + com.sap.cloud.sdk.datamodel + openapi-generator-maven-plugin + + ${project.basedir}/src/main/java + true + true + + + + prompt-registry + + generate + + generate-sources + + ${project.basedir}/src/main/resources/prompt-registry.yaml + com.sap.cloud.sdk.datamodel.openapi.apache.sample.api + com.sap.cloud.sdk.datamodel.openapi.apache.sample.model + + true + + apache-httpclient + false + true + true + true + \. + 3 + + protected + true + + + + + + + net.revelc.code.formatter + formatter-maven-plugin + + + + format + + + + + false + + + + + diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AssistantChatMessage.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AssistantChatMessage.java new file mode 100644 index 000000000..bad1e31cf --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AssistantChatMessage.java @@ -0,0 +1,414 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * AssistantChatMessage + */ + +@Beta // CHECKSTYLE:OFF +public class AssistantChatMessage implements ChatMessage +// CHECKSTYLE:ON +{ + /** + * Gets or Sets role + */ + public enum RoleEnum + { + /** + * The ASSISTANT option of this AssistantChatMessage + */ + ASSISTANT("assistant"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this AssistantChatMessage + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + RoleEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type AssistantChatMessage + */ + @JsonCreator + @Nonnull + public static RoleEnum fromValue( @Nonnull final String value ) + { + for( RoleEnum b : RoleEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "role" ) + private RoleEnum role; + + @JsonProperty( "content" ) + private ChatMessageContent content; + + @JsonProperty( "refusal" ) + private String refusal; + + @JsonProperty( "tool_calls" ) + private List toolCalls = new ArrayList<>(); + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for AssistantChatMessage. + */ + protected AssistantChatMessage() + { + } + + /** + * Set the role of this {@link AssistantChatMessage} instance and return the same instance. + * + * @param role + * The role of this {@link AssistantChatMessage} + * @return The same instance of this {@link AssistantChatMessage} class + */ + @Nonnull + public AssistantChatMessage role( @Nonnull final RoleEnum role ) + { + this.role = role; + return this; + } + + /** + * Get role + * + * @return role The role of this {@link AssistantChatMessage} instance. + */ + @Nonnull + public RoleEnum getRole() + { + return role; + } + + /** + * Set the role of this {@link AssistantChatMessage} instance. + * + * @param role + * The role of this {@link AssistantChatMessage} + */ + public void setRole( @Nonnull final RoleEnum role ) + { + this.role = role; + } + + /** + * Set the content of this {@link AssistantChatMessage} instance and return the same instance. + * + * @param content + * The content of this {@link AssistantChatMessage} + * @return The same instance of this {@link AssistantChatMessage} class + */ + @Nonnull + public AssistantChatMessage content( @Nullable final ChatMessageContent content ) + { + this.content = content; + return this; + } + + /** + * Get content + * + * @return content The content of this {@link AssistantChatMessage} instance. + */ + @Nonnull + public ChatMessageContent getContent() + { + return content; + } + + /** + * Set the content of this {@link AssistantChatMessage} instance. + * + * @param content + * The content of this {@link AssistantChatMessage} + */ + public void setContent( @Nullable final ChatMessageContent content ) + { + this.content = content; + } + + /** + * Set the refusal of this {@link AssistantChatMessage} instance and return the same instance. + * + * @param refusal + * The refusal of this {@link AssistantChatMessage} + * @return The same instance of this {@link AssistantChatMessage} class + */ + @Nonnull + public AssistantChatMessage refusal( @Nullable final String refusal ) + { + this.refusal = refusal; + return this; + } + + /** + * Get refusal + * + * @return refusal The refusal of this {@link AssistantChatMessage} instance. + */ + @Nonnull + public String getRefusal() + { + return refusal; + } + + /** + * Set the refusal of this {@link AssistantChatMessage} instance. + * + * @param refusal + * The refusal of this {@link AssistantChatMessage} + */ + public void setRefusal( @Nullable final String refusal ) + { + this.refusal = refusal; + } + + /** + * Set the toolCalls of this {@link AssistantChatMessage} instance and return the same instance. + * + * @param toolCalls + * The tool calls generated by the model, such as function calls. + * @return The same instance of this {@link AssistantChatMessage} class + */ + @Nonnull + public AssistantChatMessage toolCalls( @Nullable final List toolCalls ) + { + this.toolCalls = toolCalls; + return this; + } + + /** + * Add one toolCalls instance to this {@link AssistantChatMessage}. + * + * @param toolCallsItem + * The toolCalls that should be added + * @return The same instance of type {@link AssistantChatMessage} + */ + @Nonnull + public AssistantChatMessage addToolCallsItem( @Nonnull final MessageToolCall toolCallsItem ) + { + if( this.toolCalls == null ) { + this.toolCalls = new ArrayList<>(); + } + this.toolCalls.add(toolCallsItem); + return this; + } + + /** + * The tool calls generated by the model, such as function calls. + * + * @return toolCalls The toolCalls of this {@link AssistantChatMessage} instance. + */ + @Nonnull + public List getToolCalls() + { + return toolCalls; + } + + /** + * Set the toolCalls of this {@link AssistantChatMessage} instance. + * + * @param toolCalls + * The tool calls generated by the model, such as function calls. + */ + public void setToolCalls( @Nullable final List toolCalls ) + { + this.toolCalls = toolCalls; + } + + /** + * Get the names of the unrecognizable properties of the {@link AssistantChatMessage}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link AssistantChatMessage} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("AssistantChatMessage has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link AssistantChatMessage} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( role != null ) + declaredFields.put("role", role); + if( content != null ) + declaredFields.put("content", content); + if( refusal != null ) + declaredFields.put("refusal", refusal); + if( toolCalls != null ) + declaredFields.put("toolCalls", toolCalls); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link AssistantChatMessage} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final AssistantChatMessage assistantChatMessage = (AssistantChatMessage) o; + return Objects.equals(this.cloudSdkCustomFields, assistantChatMessage.cloudSdkCustomFields) + && Objects.equals(this.role, assistantChatMessage.role) + && Objects.equals(this.content, assistantChatMessage.content) + && Objects.equals(this.refusal, assistantChatMessage.refusal) + && Objects.equals(this.toolCalls, assistantChatMessage.toolCalls); + } + + @Override + public int hashCode() + { + return Objects.hash(role, content, refusal, toolCalls, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class AssistantChatMessage {\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" refusal: ").append(toIndentedString(refusal)).append("\n"); + sb.append(" toolCalls: ").append(toIndentedString(toolCalls)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyInput.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyInput.java new file mode 100644 index 000000000..499774e0a --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyInput.java @@ -0,0 +1,371 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * Filter configuration for Azure Content Safety + */ + +@Beta // CHECKSTYLE:OFF +public class AzureContentSafetyInput +// CHECKSTYLE:ON +{ + @JsonProperty( "hate" ) + private AzureThreshold hate; + + @JsonProperty( "self_harm" ) + private AzureThreshold selfHarm; + + @JsonProperty( "sexual" ) + private AzureThreshold sexual; + + @JsonProperty( "violence" ) + private AzureThreshold violence; + + @JsonProperty( "prompt_shield" ) + private Boolean promptShield = false; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for AzureContentSafetyInput. + */ + protected AzureContentSafetyInput() + { + } + + /** + * Set the hate of this {@link AzureContentSafetyInput} instance and return the same instance. + * + * @param hate + * The hate of this {@link AzureContentSafetyInput} + * @return The same instance of this {@link AzureContentSafetyInput} class + */ + @Nonnull + public AzureContentSafetyInput hate( @Nullable final AzureThreshold hate ) + { + this.hate = hate; + return this; + } + + /** + * Get hate + * + * @return hate The hate of this {@link AzureContentSafetyInput} instance. + */ + @Nonnull + public AzureThreshold getHate() + { + return hate; + } + + /** + * Set the hate of this {@link AzureContentSafetyInput} instance. + * + * @param hate + * The hate of this {@link AzureContentSafetyInput} + */ + public void setHate( @Nullable final AzureThreshold hate ) + { + this.hate = hate; + } + + /** + * Set the selfHarm of this {@link AzureContentSafetyInput} instance and return the same instance. + * + * @param selfHarm + * The selfHarm of this {@link AzureContentSafetyInput} + * @return The same instance of this {@link AzureContentSafetyInput} class + */ + @Nonnull + public AzureContentSafetyInput selfHarm( @Nullable final AzureThreshold selfHarm ) + { + this.selfHarm = selfHarm; + return this; + } + + /** + * Get selfHarm + * + * @return selfHarm The selfHarm of this {@link AzureContentSafetyInput} instance. + */ + @Nonnull + public AzureThreshold getSelfHarm() + { + return selfHarm; + } + + /** + * Set the selfHarm of this {@link AzureContentSafetyInput} instance. + * + * @param selfHarm + * The selfHarm of this {@link AzureContentSafetyInput} + */ + public void setSelfHarm( @Nullable final AzureThreshold selfHarm ) + { + this.selfHarm = selfHarm; + } + + /** + * Set the sexual of this {@link AzureContentSafetyInput} instance and return the same instance. + * + * @param sexual + * The sexual of this {@link AzureContentSafetyInput} + * @return The same instance of this {@link AzureContentSafetyInput} class + */ + @Nonnull + public AzureContentSafetyInput sexual( @Nullable final AzureThreshold sexual ) + { + this.sexual = sexual; + return this; + } + + /** + * Get sexual + * + * @return sexual The sexual of this {@link AzureContentSafetyInput} instance. + */ + @Nonnull + public AzureThreshold getSexual() + { + return sexual; + } + + /** + * Set the sexual of this {@link AzureContentSafetyInput} instance. + * + * @param sexual + * The sexual of this {@link AzureContentSafetyInput} + */ + public void setSexual( @Nullable final AzureThreshold sexual ) + { + this.sexual = sexual; + } + + /** + * Set the violence of this {@link AzureContentSafetyInput} instance and return the same instance. + * + * @param violence + * The violence of this {@link AzureContentSafetyInput} + * @return The same instance of this {@link AzureContentSafetyInput} class + */ + @Nonnull + public AzureContentSafetyInput violence( @Nullable final AzureThreshold violence ) + { + this.violence = violence; + return this; + } + + /** + * Get violence + * + * @return violence The violence of this {@link AzureContentSafetyInput} instance. + */ + @Nonnull + public AzureThreshold getViolence() + { + return violence; + } + + /** + * Set the violence of this {@link AzureContentSafetyInput} instance. + * + * @param violence + * The violence of this {@link AzureContentSafetyInput} + */ + public void setViolence( @Nullable final AzureThreshold violence ) + { + this.violence = violence; + } + + /** + * Set the promptShield of this {@link AzureContentSafetyInput} instance and return the same instance. + * + * @param promptShield + * Filter prompts for harmful content such as jailbreaks and prompt injections. + * @return The same instance of this {@link AzureContentSafetyInput} class + */ + @Nonnull + public AzureContentSafetyInput promptShield( @Nullable final Boolean promptShield ) + { + this.promptShield = promptShield; + return this; + } + + /** + * Filter prompts for harmful content such as jailbreaks and prompt injections. + * + * @return promptShield The promptShield of this {@link AzureContentSafetyInput} instance. + */ + @Nonnull + public Boolean isPromptShield() + { + return promptShield; + } + + /** + * Set the promptShield of this {@link AzureContentSafetyInput} instance. + * + * @param promptShield + * Filter prompts for harmful content such as jailbreaks and prompt injections. + */ + public void setPromptShield( @Nullable final Boolean promptShield ) + { + this.promptShield = promptShield; + } + + /** + * Get the names of the unrecognizable properties of the {@link AzureContentSafetyInput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link AzureContentSafetyInput} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("AzureContentSafetyInput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link AzureContentSafetyInput} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( hate != null ) + declaredFields.put("hate", hate); + if( selfHarm != null ) + declaredFields.put("selfHarm", selfHarm); + if( sexual != null ) + declaredFields.put("sexual", sexual); + if( violence != null ) + declaredFields.put("violence", violence); + if( promptShield != null ) + declaredFields.put("promptShield", promptShield); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link AzureContentSafetyInput} instance. If the map previously contained + * a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final AzureContentSafetyInput azureContentSafetyInput = (AzureContentSafetyInput) o; + return Objects.equals(this.cloudSdkCustomFields, azureContentSafetyInput.cloudSdkCustomFields) + && Objects.equals(this.hate, azureContentSafetyInput.hate) + && Objects.equals(this.selfHarm, azureContentSafetyInput.selfHarm) + && Objects.equals(this.sexual, azureContentSafetyInput.sexual) + && Objects.equals(this.violence, azureContentSafetyInput.violence) + && Objects.equals(this.promptShield, azureContentSafetyInput.promptShield); + } + + @Override + public int hashCode() + { + return Objects.hash(hate, selfHarm, sexual, violence, promptShield, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class AzureContentSafetyInput {\n"); + sb.append(" hate: ").append(toIndentedString(hate)).append("\n"); + sb.append(" selfHarm: ").append(toIndentedString(selfHarm)).append("\n"); + sb.append(" sexual: ").append(toIndentedString(sexual)).append("\n"); + sb.append(" violence: ").append(toIndentedString(violence)).append("\n"); + sb.append(" promptShield: ").append(toIndentedString(promptShield)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyInputFilterConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyInputFilterConfig.java new file mode 100644 index 000000000..d244a4f45 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyInputFilterConfig.java @@ -0,0 +1,312 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * AzureContentSafetyInputFilterConfig + */ + +@Beta // CHECKSTYLE:OFF +public class AzureContentSafetyInputFilterConfig implements InputFilterConfig +// CHECKSTYLE:ON +{ + /** + * Name of the filter provider type + */ + public enum TypeEnum + { + /** + * The AZURE_CONTENT_SAFETY option of this AzureContentSafetyInputFilterConfig + */ + AZURE_CONTENT_SAFETY("azure_content_safety"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this AzureContentSafetyInputFilterConfig + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type AzureContentSafetyInputFilterConfig + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue( @Nonnull final String value ) + { + for( TypeEnum b : TypeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "type" ) + private TypeEnum type; + + @JsonProperty( "config" ) + private AzureContentSafetyInput config; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for AzureContentSafetyInputFilterConfig. + */ + protected AzureContentSafetyInputFilterConfig() + { + } + + /** + * Set the type of this {@link AzureContentSafetyInputFilterConfig} instance and return the same instance. + * + * @param type + * Name of the filter provider type + * @return The same instance of this {@link AzureContentSafetyInputFilterConfig} class + */ + @Nonnull + public AzureContentSafetyInputFilterConfig type( @Nonnull final TypeEnum type ) + { + this.type = type; + return this; + } + + /** + * Name of the filter provider type + * + * @return type The type of this {@link AzureContentSafetyInputFilterConfig} instance. + */ + @Nonnull + public TypeEnum getType() + { + return type; + } + + /** + * Set the type of this {@link AzureContentSafetyInputFilterConfig} instance. + * + * @param type + * Name of the filter provider type + */ + public void setType( @Nonnull final TypeEnum type ) + { + this.type = type; + } + + /** + * Set the config of this {@link AzureContentSafetyInputFilterConfig} instance and return the same instance. + * + * @param config + * The config of this {@link AzureContentSafetyInputFilterConfig} + * @return The same instance of this {@link AzureContentSafetyInputFilterConfig} class + */ + @Nonnull + public AzureContentSafetyInputFilterConfig config( @Nullable final AzureContentSafetyInput config ) + { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config The config of this {@link AzureContentSafetyInputFilterConfig} instance. + */ + @Nonnull + public AzureContentSafetyInput getConfig() + { + return config; + } + + /** + * Set the config of this {@link AzureContentSafetyInputFilterConfig} instance. + * + * @param config + * The config of this {@link AzureContentSafetyInputFilterConfig} + */ + public void setConfig( @Nullable final AzureContentSafetyInput config ) + { + this.config = config; + } + + /** + * Get the names of the unrecognizable properties of the {@link AzureContentSafetyInputFilterConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link AzureContentSafetyInputFilterConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException( + "AzureContentSafetyInputFilterConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link AzureContentSafetyInputFilterConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( type != null ) + declaredFields.put("type", type); + if( config != null ) + declaredFields.put("config", config); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link AzureContentSafetyInputFilterConfig} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final AzureContentSafetyInputFilterConfig azureContentSafetyInputFilterConfig = + (AzureContentSafetyInputFilterConfig) o; + return Objects.equals(this.cloudSdkCustomFields, azureContentSafetyInputFilterConfig.cloudSdkCustomFields) + && Objects.equals(this.type, azureContentSafetyInputFilterConfig.type) + && Objects.equals(this.config, azureContentSafetyInputFilterConfig.config); + } + + @Override + public int hashCode() + { + return Objects.hash(type, config, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class AzureContentSafetyInputFilterConfig {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyOutput.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyOutput.java new file mode 100644 index 000000000..16620fcb6 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyOutput.java @@ -0,0 +1,374 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * Filter configuration for Azure Content Safety + */ + +@Beta // CHECKSTYLE:OFF +public class AzureContentSafetyOutput +// CHECKSTYLE:ON +{ + @JsonProperty( "hate" ) + private AzureThreshold hate; + + @JsonProperty( "self_harm" ) + private AzureThreshold selfHarm; + + @JsonProperty( "sexual" ) + private AzureThreshold sexual; + + @JsonProperty( "violence" ) + private AzureThreshold violence; + + @JsonProperty( "protected_material_code" ) + private Boolean protectedMaterialCode = false; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for AzureContentSafetyOutput. + */ + protected AzureContentSafetyOutput() + { + } + + /** + * Set the hate of this {@link AzureContentSafetyOutput} instance and return the same instance. + * + * @param hate + * The hate of this {@link AzureContentSafetyOutput} + * @return The same instance of this {@link AzureContentSafetyOutput} class + */ + @Nonnull + public AzureContentSafetyOutput hate( @Nullable final AzureThreshold hate ) + { + this.hate = hate; + return this; + } + + /** + * Get hate + * + * @return hate The hate of this {@link AzureContentSafetyOutput} instance. + */ + @Nonnull + public AzureThreshold getHate() + { + return hate; + } + + /** + * Set the hate of this {@link AzureContentSafetyOutput} instance. + * + * @param hate + * The hate of this {@link AzureContentSafetyOutput} + */ + public void setHate( @Nullable final AzureThreshold hate ) + { + this.hate = hate; + } + + /** + * Set the selfHarm of this {@link AzureContentSafetyOutput} instance and return the same instance. + * + * @param selfHarm + * The selfHarm of this {@link AzureContentSafetyOutput} + * @return The same instance of this {@link AzureContentSafetyOutput} class + */ + @Nonnull + public AzureContentSafetyOutput selfHarm( @Nullable final AzureThreshold selfHarm ) + { + this.selfHarm = selfHarm; + return this; + } + + /** + * Get selfHarm + * + * @return selfHarm The selfHarm of this {@link AzureContentSafetyOutput} instance. + */ + @Nonnull + public AzureThreshold getSelfHarm() + { + return selfHarm; + } + + /** + * Set the selfHarm of this {@link AzureContentSafetyOutput} instance. + * + * @param selfHarm + * The selfHarm of this {@link AzureContentSafetyOutput} + */ + public void setSelfHarm( @Nullable final AzureThreshold selfHarm ) + { + this.selfHarm = selfHarm; + } + + /** + * Set the sexual of this {@link AzureContentSafetyOutput} instance and return the same instance. + * + * @param sexual + * The sexual of this {@link AzureContentSafetyOutput} + * @return The same instance of this {@link AzureContentSafetyOutput} class + */ + @Nonnull + public AzureContentSafetyOutput sexual( @Nullable final AzureThreshold sexual ) + { + this.sexual = sexual; + return this; + } + + /** + * Get sexual + * + * @return sexual The sexual of this {@link AzureContentSafetyOutput} instance. + */ + @Nonnull + public AzureThreshold getSexual() + { + return sexual; + } + + /** + * Set the sexual of this {@link AzureContentSafetyOutput} instance. + * + * @param sexual + * The sexual of this {@link AzureContentSafetyOutput} + */ + public void setSexual( @Nullable final AzureThreshold sexual ) + { + this.sexual = sexual; + } + + /** + * Set the violence of this {@link AzureContentSafetyOutput} instance and return the same instance. + * + * @param violence + * The violence of this {@link AzureContentSafetyOutput} + * @return The same instance of this {@link AzureContentSafetyOutput} class + */ + @Nonnull + public AzureContentSafetyOutput violence( @Nullable final AzureThreshold violence ) + { + this.violence = violence; + return this; + } + + /** + * Get violence + * + * @return violence The violence of this {@link AzureContentSafetyOutput} instance. + */ + @Nonnull + public AzureThreshold getViolence() + { + return violence; + } + + /** + * Set the violence of this {@link AzureContentSafetyOutput} instance. + * + * @param violence + * The violence of this {@link AzureContentSafetyOutput} + */ + public void setViolence( @Nullable final AzureThreshold violence ) + { + this.violence = violence; + } + + /** + * Set the protectedMaterialCode of this {@link AzureContentSafetyOutput} instance and return the same instance. + * + * @param protectedMaterialCode + * Detect protected code content from known GitHub repositories. The scan includes software libraries, + * source code, algorithms, and other proprietary programming content. + * @return The same instance of this {@link AzureContentSafetyOutput} class + */ + @Nonnull + public AzureContentSafetyOutput protectedMaterialCode( @Nullable final Boolean protectedMaterialCode ) + { + this.protectedMaterialCode = protectedMaterialCode; + return this; + } + + /** + * Detect protected code content from known GitHub repositories. The scan includes software libraries, source code, + * algorithms, and other proprietary programming content. + * + * @return protectedMaterialCode The protectedMaterialCode of this {@link AzureContentSafetyOutput} instance. + */ + @Nonnull + public Boolean isProtectedMaterialCode() + { + return protectedMaterialCode; + } + + /** + * Set the protectedMaterialCode of this {@link AzureContentSafetyOutput} instance. + * + * @param protectedMaterialCode + * Detect protected code content from known GitHub repositories. The scan includes software libraries, + * source code, algorithms, and other proprietary programming content. + */ + public void setProtectedMaterialCode( @Nullable final Boolean protectedMaterialCode ) + { + this.protectedMaterialCode = protectedMaterialCode; + } + + /** + * Get the names of the unrecognizable properties of the {@link AzureContentSafetyOutput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link AzureContentSafetyOutput} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("AzureContentSafetyOutput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link AzureContentSafetyOutput} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( hate != null ) + declaredFields.put("hate", hate); + if( selfHarm != null ) + declaredFields.put("selfHarm", selfHarm); + if( sexual != null ) + declaredFields.put("sexual", sexual); + if( violence != null ) + declaredFields.put("violence", violence); + if( protectedMaterialCode != null ) + declaredFields.put("protectedMaterialCode", protectedMaterialCode); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link AzureContentSafetyOutput} instance. If the map previously contained + * a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final AzureContentSafetyOutput azureContentSafetyOutput = (AzureContentSafetyOutput) o; + return Objects.equals(this.cloudSdkCustomFields, azureContentSafetyOutput.cloudSdkCustomFields) + && Objects.equals(this.hate, azureContentSafetyOutput.hate) + && Objects.equals(this.selfHarm, azureContentSafetyOutput.selfHarm) + && Objects.equals(this.sexual, azureContentSafetyOutput.sexual) + && Objects.equals(this.violence, azureContentSafetyOutput.violence) + && Objects.equals(this.protectedMaterialCode, azureContentSafetyOutput.protectedMaterialCode); + } + + @Override + public int hashCode() + { + return Objects.hash(hate, selfHarm, sexual, violence, protectedMaterialCode, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class AzureContentSafetyOutput {\n"); + sb.append(" hate: ").append(toIndentedString(hate)).append("\n"); + sb.append(" selfHarm: ").append(toIndentedString(selfHarm)).append("\n"); + sb.append(" sexual: ").append(toIndentedString(sexual)).append("\n"); + sb.append(" violence: ").append(toIndentedString(violence)).append("\n"); + sb.append(" protectedMaterialCode: ").append(toIndentedString(protectedMaterialCode)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyOutputFilterConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyOutputFilterConfig.java new file mode 100644 index 000000000..1353dd435 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyOutputFilterConfig.java @@ -0,0 +1,312 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * AzureContentSafetyOutputFilterConfig + */ + +@Beta // CHECKSTYLE:OFF +public class AzureContentSafetyOutputFilterConfig implements OutputFilterConfig +// CHECKSTYLE:ON +{ + /** + * Name of the filter provider type + */ + public enum TypeEnum + { + /** + * The AZURE_CONTENT_SAFETY option of this AzureContentSafetyOutputFilterConfig + */ + AZURE_CONTENT_SAFETY("azure_content_safety"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this AzureContentSafetyOutputFilterConfig + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type AzureContentSafetyOutputFilterConfig + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue( @Nonnull final String value ) + { + for( TypeEnum b : TypeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "type" ) + private TypeEnum type; + + @JsonProperty( "config" ) + private AzureContentSafetyOutput config; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for AzureContentSafetyOutputFilterConfig. + */ + protected AzureContentSafetyOutputFilterConfig() + { + } + + /** + * Set the type of this {@link AzureContentSafetyOutputFilterConfig} instance and return the same instance. + * + * @param type + * Name of the filter provider type + * @return The same instance of this {@link AzureContentSafetyOutputFilterConfig} class + */ + @Nonnull + public AzureContentSafetyOutputFilterConfig type( @Nonnull final TypeEnum type ) + { + this.type = type; + return this; + } + + /** + * Name of the filter provider type + * + * @return type The type of this {@link AzureContentSafetyOutputFilterConfig} instance. + */ + @Nonnull + public TypeEnum getType() + { + return type; + } + + /** + * Set the type of this {@link AzureContentSafetyOutputFilterConfig} instance. + * + * @param type + * Name of the filter provider type + */ + public void setType( @Nonnull final TypeEnum type ) + { + this.type = type; + } + + /** + * Set the config of this {@link AzureContentSafetyOutputFilterConfig} instance and return the same instance. + * + * @param config + * The config of this {@link AzureContentSafetyOutputFilterConfig} + * @return The same instance of this {@link AzureContentSafetyOutputFilterConfig} class + */ + @Nonnull + public AzureContentSafetyOutputFilterConfig config( @Nullable final AzureContentSafetyOutput config ) + { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config The config of this {@link AzureContentSafetyOutputFilterConfig} instance. + */ + @Nonnull + public AzureContentSafetyOutput getConfig() + { + return config; + } + + /** + * Set the config of this {@link AzureContentSafetyOutputFilterConfig} instance. + * + * @param config + * The config of this {@link AzureContentSafetyOutputFilterConfig} + */ + public void setConfig( @Nullable final AzureContentSafetyOutput config ) + { + this.config = config; + } + + /** + * Get the names of the unrecognizable properties of the {@link AzureContentSafetyOutputFilterConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link AzureContentSafetyOutputFilterConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException( + "AzureContentSafetyOutputFilterConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link AzureContentSafetyOutputFilterConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( type != null ) + declaredFields.put("type", type); + if( config != null ) + declaredFields.put("config", config); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link AzureContentSafetyOutputFilterConfig} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final AzureContentSafetyOutputFilterConfig azureContentSafetyOutputFilterConfig = + (AzureContentSafetyOutputFilterConfig) o; + return Objects.equals(this.cloudSdkCustomFields, azureContentSafetyOutputFilterConfig.cloudSdkCustomFields) + && Objects.equals(this.type, azureContentSafetyOutputFilterConfig.type) + && Objects.equals(this.config, azureContentSafetyOutputFilterConfig.config); + } + + @Override + public int hashCode() + { + return Objects.hash(type, config, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class AzureContentSafetyOutputFilterConfig {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureThreshold.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureThreshold.java new file mode 100644 index 000000000..fb7df9c8d --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureThreshold.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import javax.annotation.Nonnull; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * Gets or Sets AzureThreshold + */ + +@Beta +public enum AzureThreshold +{ + + NUMBER_0(0), + + NUMBER_2(2), + + NUMBER_4(4), + + NUMBER_6(6), + + NUMBER_unknown_default_open_api(11184809); + + private final Integer value; + + AzureThreshold( Integer value ) + { + this.value = value; + } + + /** + * @return The enum value. + */ + @JsonValue + public Integer getValue() + { + return value; + } + + /** + * @return The String representation of the enum value. + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Converts the given value to its enum representation. + * + * @param value + * The input value. + * + * @return The enum representation of the given value. + */ + @JsonCreator + public static AzureThreshold fromValue( @Nonnull final Integer value ) + { + for( final AzureThreshold b : AzureThreshold.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return NUMBER_unknown_default_open_api; + } +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatCompletionTool.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatCompletionTool.java new file mode 100644 index 000000000..803eb5a21 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatCompletionTool.java @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * ChatCompletionTool + */ + +@Beta // CHECKSTYLE:OFF +public class ChatCompletionTool +// CHECKSTYLE:ON +{ + /** + * The type of the tool. Currently, only `function` is supported. + */ + public enum TypeEnum + { + /** + * The FUNCTION option of this ChatCompletionTool + */ + FUNCTION("function"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this ChatCompletionTool + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type ChatCompletionTool + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue( @Nonnull final String value ) + { + for( TypeEnum b : TypeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "type" ) + private TypeEnum type; + + @JsonProperty( "function" ) + private FunctionObject function; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for ChatCompletionTool. + */ + protected ChatCompletionTool() + { + } + + /** + * Set the type of this {@link ChatCompletionTool} instance and return the same instance. + * + * @param type + * The type of the tool. Currently, only `function` is supported. + * @return The same instance of this {@link ChatCompletionTool} class + */ + @Nonnull + public ChatCompletionTool type( @Nonnull final TypeEnum type ) + { + this.type = type; + return this; + } + + /** + * The type of the tool. Currently, only `function` is supported. + * + * @return type The type of this {@link ChatCompletionTool} instance. + */ + @Nonnull + public TypeEnum getType() + { + return type; + } + + /** + * Set the type of this {@link ChatCompletionTool} instance. + * + * @param type + * The type of the tool. Currently, only `function` is supported. + */ + public void setType( @Nonnull final TypeEnum type ) + { + this.type = type; + } + + /** + * Set the function of this {@link ChatCompletionTool} instance and return the same instance. + * + * @param function + * The function of this {@link ChatCompletionTool} + * @return The same instance of this {@link ChatCompletionTool} class + */ + @Nonnull + public ChatCompletionTool function( @Nonnull final FunctionObject function ) + { + this.function = function; + return this; + } + + /** + * Get function + * + * @return function The function of this {@link ChatCompletionTool} instance. + */ + @Nonnull + public FunctionObject getFunction() + { + return function; + } + + /** + * Set the function of this {@link ChatCompletionTool} instance. + * + * @param function + * The function of this {@link ChatCompletionTool} + */ + public void setFunction( @Nonnull final FunctionObject function ) + { + this.function = function; + } + + /** + * Get the names of the unrecognizable properties of the {@link ChatCompletionTool}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ChatCompletionTool} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("ChatCompletionTool has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ChatCompletionTool} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( type != null ) + declaredFields.put("type", type); + if( function != null ) + declaredFields.put("function", function); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ChatCompletionTool} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final ChatCompletionTool chatCompletionTool = (ChatCompletionTool) o; + return Objects.equals(this.cloudSdkCustomFields, chatCompletionTool.cloudSdkCustomFields) + && Objects.equals(this.type, chatCompletionTool.type) + && Objects.equals(this.function, chatCompletionTool.function); + } + + @Override + public int hashCode() + { + return Objects.hash(type, function, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class ChatCompletionTool {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" function: ").append(toIndentedString(function)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatMessage.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatMessage.java new file mode 100644 index 000000000..ac6e70339 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatMessage.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.google.common.annotations.Beta; + +/** + * ChatMessage + */ +@Beta +@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) +@JsonSubTypes( { + @JsonSubTypes.Type( value = AssistantChatMessage.class ), + @JsonSubTypes.Type( value = DeveloperChatMessage.class ), + @JsonSubTypes.Type( value = SystemChatMessage.class ), + @JsonSubTypes.Type( value = ToolChatMessage.class ), + @JsonSubTypes.Type( value = UserChatMessage.class ), } ) + +public interface ChatMessage +{ +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatMessageContent.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatMessageContent.java new file mode 100644 index 000000000..b89cdc2a3 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatMessageContent.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.List; + +import javax.annotation.Nonnull; + +import com.google.common.annotations.Beta; + +/** + * ChatMessageContent + */ +@Beta +public interface ChatMessageContent +{ + /** + * Helper class to create {@code List } that implements {@link ChatMessageContent}. + */ + record ListOfTextContents(@com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) implements ChatMessageContent {} + + /** + * Creator to enable deserialization of {@code List }. + * + * @param val + * the value to use + * @return a new instance of {@link ListOfTextContents}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static ListOfTextContents createListOfTextContents( @Nonnull final List val ) + { + return new ListOfTextContents(val); + } + + /** + * Helper class to create {@code String } that implements {@link ChatMessageContent}. + */ + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) implements ChatMessageContent {} + + /** + * Creator to enable deserialization of {@code String }. + * + * @param val + * the value to use + * @return a new instance of {@link InnerString}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerString create( @Nonnull final String val ) + { + return new InnerString(val); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIConfig.java new file mode 100644 index 000000000..b6a28ae28 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIConfig.java @@ -0,0 +1,545 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * DPIConfig + */ + +@Beta // CHECKSTYLE:OFF +public class DPIConfig +// CHECKSTYLE:ON +{ + /** + * Type of masking service provider + */ + public enum TypeEnum + { + /** + * The SAP_DATA_PRIVACY_INTEGRATION option of this DPIConfig + */ + SAP_DATA_PRIVACY_INTEGRATION("sap_data_privacy_integration"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this DPIConfig + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type DPIConfig + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue( @Nonnull final String value ) + { + for( TypeEnum b : TypeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "type" ) + private TypeEnum type; + + /** + * Type of masking method to be used + */ + public enum MethodEnum + { + /** + * The ANONYMIZATION option of this DPIConfig + */ + ANONYMIZATION("anonymization"), + + /** + * The PSEUDONYMIZATION option of this DPIConfig + */ + PSEUDONYMIZATION("pseudonymization"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this DPIConfig + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + MethodEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type DPIConfig + */ + @JsonCreator + @Nonnull + public static MethodEnum fromValue( @Nonnull final String value ) + { + for( MethodEnum b : MethodEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "method" ) + private MethodEnum method; + + @JsonProperty( "entities" ) + private List entities = new ArrayList<>(); + + @JsonProperty( "allowlist" ) + private List allowlist = new ArrayList<>(); + + @JsonProperty( "mask_grounding_input" ) + private DPIConfigMaskGroundingInput maskGroundingInput; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for DPIConfig. + */ + protected DPIConfig() + { + } + + /** + * Set the type of this {@link DPIConfig} instance and return the same instance. + * + * @param type + * Type of masking service provider + * @return The same instance of this {@link DPIConfig} class + */ + @Nonnull + public DPIConfig type( @Nonnull final TypeEnum type ) + { + this.type = type; + return this; + } + + /** + * Type of masking service provider + * + * @return type The type of this {@link DPIConfig} instance. + */ + @Nonnull + public TypeEnum getType() + { + return type; + } + + /** + * Set the type of this {@link DPIConfig} instance. + * + * @param type + * Type of masking service provider + */ + public void setType( @Nonnull final TypeEnum type ) + { + this.type = type; + } + + /** + * Set the method of this {@link DPIConfig} instance and return the same instance. + * + * @param method + * Type of masking method to be used + * @return The same instance of this {@link DPIConfig} class + */ + @Nonnull + public DPIConfig method( @Nonnull final MethodEnum method ) + { + this.method = method; + return this; + } + + /** + * Type of masking method to be used + * + * @return method The method of this {@link DPIConfig} instance. + */ + @Nonnull + public MethodEnum getMethod() + { + return method; + } + + /** + * Set the method of this {@link DPIConfig} instance. + * + * @param method + * Type of masking method to be used + */ + public void setMethod( @Nonnull final MethodEnum method ) + { + this.method = method; + } + + /** + * Set the entities of this {@link DPIConfig} instance and return the same instance. + * + * @param entities + * List of entities to be masked + * @return The same instance of this {@link DPIConfig} class + */ + @Nonnull + public DPIConfig entities( @Nonnull final List entities ) + { + this.entities = entities; + return this; + } + + /** + * Add one entities instance to this {@link DPIConfig}. + * + * @param entitiesItem + * The entities that should be added + * @return The same instance of type {@link DPIConfig} + */ + @Nonnull + public DPIConfig addEntitiesItem( @Nonnull final DPIEntityConfig entitiesItem ) + { + if( this.entities == null ) { + this.entities = new ArrayList<>(); + } + this.entities.add(entitiesItem); + return this; + } + + /** + * List of entities to be masked + * + * @return entities The entities of this {@link DPIConfig} instance. + */ + @Nonnull + public List getEntities() + { + return entities; + } + + /** + * Set the entities of this {@link DPIConfig} instance. + * + * @param entities + * List of entities to be masked + */ + public void setEntities( @Nonnull final List entities ) + { + this.entities = entities; + } + + /** + * Set the allowlist of this {@link DPIConfig} instance and return the same instance. + * + * @param allowlist + * List of strings that should not be masked + * @return The same instance of this {@link DPIConfig} class + */ + @Nonnull + public DPIConfig allowlist( @Nullable final List allowlist ) + { + this.allowlist = allowlist; + return this; + } + + /** + * Add one allowlist instance to this {@link DPIConfig}. + * + * @param allowlistItem + * The allowlist that should be added + * @return The same instance of type {@link DPIConfig} + */ + @Nonnull + public DPIConfig addAllowlistItem( @Nonnull final String allowlistItem ) + { + if( this.allowlist == null ) { + this.allowlist = new ArrayList<>(); + } + this.allowlist.add(allowlistItem); + return this; + } + + /** + * List of strings that should not be masked + * + * @return allowlist The allowlist of this {@link DPIConfig} instance. + */ + @Nonnull + public List getAllowlist() + { + return allowlist; + } + + /** + * Set the allowlist of this {@link DPIConfig} instance. + * + * @param allowlist + * List of strings that should not be masked + */ + public void setAllowlist( @Nullable final List allowlist ) + { + this.allowlist = allowlist; + } + + /** + * Set the maskGroundingInput of this {@link DPIConfig} instance and return the same instance. + * + * @param maskGroundingInput + * The maskGroundingInput of this {@link DPIConfig} + * @return The same instance of this {@link DPIConfig} class + */ + @Nonnull + public DPIConfig maskGroundingInput( @Nullable final DPIConfigMaskGroundingInput maskGroundingInput ) + { + this.maskGroundingInput = maskGroundingInput; + return this; + } + + /** + * Get maskGroundingInput + * + * @return maskGroundingInput The maskGroundingInput of this {@link DPIConfig} instance. + */ + @Nonnull + public DPIConfigMaskGroundingInput getMaskGroundingInput() + { + return maskGroundingInput; + } + + /** + * Set the maskGroundingInput of this {@link DPIConfig} instance. + * + * @param maskGroundingInput + * The maskGroundingInput of this {@link DPIConfig} + */ + public void setMaskGroundingInput( @Nullable final DPIConfigMaskGroundingInput maskGroundingInput ) + { + this.maskGroundingInput = maskGroundingInput; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPIConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPIConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("DPIConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DPIConfig} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( type != null ) + declaredFields.put("type", type); + if( method != null ) + declaredFields.put("method", method); + if( entities != null ) + declaredFields.put("entities", entities); + if( allowlist != null ) + declaredFields.put("allowlist", allowlist); + if( maskGroundingInput != null ) + declaredFields.put("maskGroundingInput", maskGroundingInput); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DPIConfig} instance. If the map previously contained a mapping for + * the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final DPIConfig dpIConfig = (DPIConfig) o; + return Objects.equals(this.cloudSdkCustomFields, dpIConfig.cloudSdkCustomFields) + && Objects.equals(this.type, dpIConfig.type) + && Objects.equals(this.method, dpIConfig.method) + && Objects.equals(this.entities, dpIConfig.entities) + && Objects.equals(this.allowlist, dpIConfig.allowlist) + && Objects.equals(this.maskGroundingInput, dpIConfig.maskGroundingInput); + } + + @Override + public int hashCode() + { + return Objects.hash(type, method, entities, allowlist, maskGroundingInput, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPIConfig {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" entities: ").append(toIndentedString(entities)).append("\n"); + sb.append(" allowlist: ").append(toIndentedString(allowlist)).append("\n"); + sb.append(" maskGroundingInput: ").append(toIndentedString(maskGroundingInput)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIConfigMaskGroundingInput.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIConfigMaskGroundingInput.java new file mode 100644 index 000000000..6b386e048 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIConfigMaskGroundingInput.java @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * DPIConfigMaskGroundingInput + */ + +@Beta // CHECKSTYLE:OFF +public class DPIConfigMaskGroundingInput +// CHECKSTYLE:ON +{ + @JsonProperty( "enabled" ) + private Boolean enabled = false; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for DPIConfigMaskGroundingInput. + */ + protected DPIConfigMaskGroundingInput() + { + } + + /** + * Set the enabled of this {@link DPIConfigMaskGroundingInput} instance and return the same instance. + * + * @param enabled + * controls whether the input to the grounding module will be masked with the configuration supplied in + * the masking module + * @return The same instance of this {@link DPIConfigMaskGroundingInput} class + */ + @Nonnull + public DPIConfigMaskGroundingInput enabled( @Nullable final Boolean enabled ) + { + this.enabled = enabled; + return this; + } + + /** + * controls whether the input to the grounding module will be masked with the configuration supplied in the masking + * module + * + * @return enabled The enabled of this {@link DPIConfigMaskGroundingInput} instance. + */ + @Nonnull + public Boolean isEnabled() + { + return enabled; + } + + /** + * Set the enabled of this {@link DPIConfigMaskGroundingInput} instance. + * + * @param enabled + * controls whether the input to the grounding module will be masked with the configuration supplied in + * the masking module + */ + public void setEnabled( @Nullable final Boolean enabled ) + { + this.enabled = enabled; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPIConfigMaskGroundingInput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPIConfigMaskGroundingInput} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("DPIConfigMaskGroundingInput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DPIConfigMaskGroundingInput} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( enabled != null ) + declaredFields.put("enabled", enabled); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DPIConfigMaskGroundingInput} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final DPIConfigMaskGroundingInput dpIConfigMaskGroundingInput = (DPIConfigMaskGroundingInput) o; + return Objects.equals(this.cloudSdkCustomFields, dpIConfigMaskGroundingInput.cloudSdkCustomFields) + && Objects.equals(this.enabled, dpIConfigMaskGroundingInput.enabled); + } + + @Override + public int hashCode() + { + return Objects.hash(enabled, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPIConfigMaskGroundingInput {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPICustomEntity.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPICustomEntity.java new file mode 100644 index 000000000..3dad3a337 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPICustomEntity.java @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * DPICustomEntity + */ + +@Beta // CHECKSTYLE:OFF +public class DPICustomEntity implements DPIEntityConfig +// CHECKSTYLE:ON +{ + @JsonProperty( "regex" ) + private String regex; + + @JsonProperty( "replacement_strategy" ) + private DPIMethodConstant replacementStrategy; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for DPICustomEntity. + */ + protected DPICustomEntity() + { + } + + /** + * Set the regex of this {@link DPICustomEntity} instance and return the same instance. + * + * @param regex + * Regular expression to match the entity + * @return The same instance of this {@link DPICustomEntity} class + */ + @Nonnull + public DPICustomEntity regex( @Nonnull final String regex ) + { + this.regex = regex; + return this; + } + + /** + * Regular expression to match the entity + * + * @return regex The regex of this {@link DPICustomEntity} instance. + */ + @Nonnull + public String getRegex() + { + return regex; + } + + /** + * Set the regex of this {@link DPICustomEntity} instance. + * + * @param regex + * Regular expression to match the entity + */ + public void setRegex( @Nonnull final String regex ) + { + this.regex = regex; + } + + /** + * Set the replacementStrategy of this {@link DPICustomEntity} instance and return the same instance. + * + * @param replacementStrategy + * The replacementStrategy of this {@link DPICustomEntity} + * @return The same instance of this {@link DPICustomEntity} class + */ + @Nonnull + public DPICustomEntity replacementStrategy( @Nonnull final DPIMethodConstant replacementStrategy ) + { + this.replacementStrategy = replacementStrategy; + return this; + } + + /** + * Get replacementStrategy + * + * @return replacementStrategy The replacementStrategy of this {@link DPICustomEntity} instance. + */ + @Nonnull + public DPIMethodConstant getReplacementStrategy() + { + return replacementStrategy; + } + + /** + * Set the replacementStrategy of this {@link DPICustomEntity} instance. + * + * @param replacementStrategy + * The replacementStrategy of this {@link DPICustomEntity} + */ + public void setReplacementStrategy( @Nonnull final DPIMethodConstant replacementStrategy ) + { + this.replacementStrategy = replacementStrategy; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPICustomEntity}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPICustomEntity} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("DPICustomEntity has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DPICustomEntity} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( regex != null ) + declaredFields.put("regex", regex); + if( replacementStrategy != null ) + declaredFields.put("replacementStrategy", replacementStrategy); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DPICustomEntity} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final DPICustomEntity dpICustomEntity = (DPICustomEntity) o; + return Objects.equals(this.cloudSdkCustomFields, dpICustomEntity.cloudSdkCustomFields) + && Objects.equals(this.regex, dpICustomEntity.regex) + && Objects.equals(this.replacementStrategy, dpICustomEntity.replacementStrategy); + } + + @Override + public int hashCode() + { + return Objects.hash(regex, replacementStrategy, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPICustomEntity {\n"); + sb.append(" regex: ").append(toIndentedString(regex)).append("\n"); + sb.append(" replacementStrategy: ").append(toIndentedString(replacementStrategy)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIEntities.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIEntities.java new file mode 100644 index 000000000..8c8acdcec --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIEntities.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import javax.annotation.Nonnull; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * Default entities supported by data privacy and integration service + */ + +@Beta +public enum DPIEntities +{ + + PROFILE_PERSON("profile-person"), + + PROFILE_ORG("profile-org"), + + PROFILE_UNIVERSITY("profile-university"), + + PROFILE_LOCATION("profile-location"), + + PROFILE_EMAIL("profile-email"), + + PROFILE_PHONE("profile-phone"), + + PROFILE_ADDRESS("profile-address"), + + PROFILE_SAPIDS_INTERNAL("profile-sapids-internal"), + + PROFILE_SAPIDS_PUBLIC("profile-sapids-public"), + + PROFILE_URL("profile-url"), + + PROFILE_USERNAME_PASSWORD("profile-username-password"), + + PROFILE_NATIONALID("profile-nationalid"), + + PROFILE_IBAN("profile-iban"), + + PROFILE_SSN("profile-ssn"), + + PROFILE_CREDIT_CARD_NUMBER("profile-credit-card-number"), + + PROFILE_PASSPORT("profile-passport"), + + PROFILE_DRIVERLICENSE("profile-driverlicense"), + + PROFILE_NATIONALITY("profile-nationality"), + + PROFILE_RELIGIOUS_GROUP("profile-religious-group"), + + PROFILE_POLITICAL_GROUP("profile-political-group"), + + PROFILE_PRONOUNS_GENDER("profile-pronouns-gender"), + + PROFILE_ETHNICITY("profile-ethnicity"), + + PROFILE_GENDER("profile-gender"), + + PROFILE_SEXUAL_ORIENTATION("profile-sexual-orientation"), + + PROFILE_TRADE_UNION("profile-trade-union"), + + PROFILE_SENSITIVE_DATA("profile-sensitive-data"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private final String value; + + DPIEntities( String value ) + { + this.value = value; + } + + /** + * @return The enum value. + */ + @JsonValue + public String getValue() + { + return value; + } + + /** + * @return The String representation of the enum value. + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Converts the given value to its enum representation. + * + * @param value + * The input value. + * + * @return The enum representation of the given value. + */ + @JsonCreator + public static DPIEntities fromValue( @Nonnull final String value ) + { + for( final DPIEntities b : DPIEntities.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIEntityConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIEntityConfig.java new file mode 100644 index 000000000..cf8526425 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIEntityConfig.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.google.common.annotations.Beta; + +/** + * DPIEntityConfig + */ +@Beta +@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) +@JsonSubTypes( { + @JsonSubTypes.Type( value = DPICustomEntity.class ), + @JsonSubTypes.Type( value = DPIStandardEntity.class ), } ) + +public interface DPIEntityConfig +{ +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIMethodConstant.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIMethodConstant.java new file mode 100644 index 000000000..13d5bc1dc --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIMethodConstant.java @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * Replaces the entity with the specified value followed by an incrementing number + */ + +@Beta // CHECKSTYLE:OFF +public class DPIMethodConstant implements DPIStandardEntityReplacementStrategy +// CHECKSTYLE:ON +{ + /** + * Gets or Sets method + */ + public enum MethodEnum + { + /** + * The CONSTANT option of this DPIMethodConstant + */ + CONSTANT("constant"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this DPIMethodConstant + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + MethodEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type DPIMethodConstant + */ + @JsonCreator + @Nonnull + public static MethodEnum fromValue( @Nonnull final String value ) + { + for( MethodEnum b : MethodEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "method" ) + private MethodEnum method; + + @JsonProperty( "value" ) + private String value; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for DPIMethodConstant. + */ + protected DPIMethodConstant() + { + } + + /** + * Set the method of this {@link DPIMethodConstant} instance and return the same instance. + * + * @param method + * The method of this {@link DPIMethodConstant} + * @return The same instance of this {@link DPIMethodConstant} class + */ + @Nonnull + public DPIMethodConstant method( @Nonnull final MethodEnum method ) + { + this.method = method; + return this; + } + + /** + * Get method + * + * @return method The method of this {@link DPIMethodConstant} instance. + */ + @Nonnull + public MethodEnum getMethod() + { + return method; + } + + /** + * Set the method of this {@link DPIMethodConstant} instance. + * + * @param method + * The method of this {@link DPIMethodConstant} + */ + public void setMethod( @Nonnull final MethodEnum method ) + { + this.method = method; + } + + /** + * Set the value of this {@link DPIMethodConstant} instance and return the same instance. + * + * @param value + * Value to be used for replacement + * @return The same instance of this {@link DPIMethodConstant} class + */ + @Nonnull + public DPIMethodConstant value( @Nonnull final String value ) + { + this.value = value; + return this; + } + + /** + * Value to be used for replacement + * + * @return value The value of this {@link DPIMethodConstant} instance. + */ + @Nonnull + public String getValue() + { + return value; + } + + /** + * Set the value of this {@link DPIMethodConstant} instance. + * + * @param value + * Value to be used for replacement + */ + public void setValue( @Nonnull final String value ) + { + this.value = value; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPIMethodConstant}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPIMethodConstant} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("DPIMethodConstant has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DPIMethodConstant} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( method != null ) + declaredFields.put("method", method); + if( value != null ) + declaredFields.put("value", value); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DPIMethodConstant} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final DPIMethodConstant dpIMethodConstant = (DPIMethodConstant) o; + return Objects.equals(this.cloudSdkCustomFields, dpIMethodConstant.cloudSdkCustomFields) + && Objects.equals(this.method, dpIMethodConstant.method) + && Objects.equals(this.value, dpIMethodConstant.value); + } + + @Override + public int hashCode() + { + return Objects.hash(method, value, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPIMethodConstant {\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIMethodFabricatedData.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIMethodFabricatedData.java new file mode 100644 index 000000000..564581c2b --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIMethodFabricatedData.java @@ -0,0 +1,267 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * Replaces the entity with a randomly generated value appropriate to its type. + */ + +@Beta // CHECKSTYLE:OFF +public class DPIMethodFabricatedData implements DPIStandardEntityReplacementStrategy +// CHECKSTYLE:ON +{ + /** + * Gets or Sets method + */ + public enum MethodEnum + { + /** + * The FABRICATED_DATA option of this DPIMethodFabricatedData + */ + FABRICATED_DATA("fabricated_data"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this DPIMethodFabricatedData + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + MethodEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type DPIMethodFabricatedData + */ + @JsonCreator + @Nonnull + public static MethodEnum fromValue( @Nonnull final String value ) + { + for( MethodEnum b : MethodEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "method" ) + private MethodEnum method; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for DPIMethodFabricatedData. + */ + protected DPIMethodFabricatedData() + { + } + + /** + * Set the method of this {@link DPIMethodFabricatedData} instance and return the same instance. + * + * @param method + * The method of this {@link DPIMethodFabricatedData} + * @return The same instance of this {@link DPIMethodFabricatedData} class + */ + @Nonnull + public DPIMethodFabricatedData method( @Nonnull final MethodEnum method ) + { + this.method = method; + return this; + } + + /** + * Get method + * + * @return method The method of this {@link DPIMethodFabricatedData} instance. + */ + @Nonnull + public MethodEnum getMethod() + { + return method; + } + + /** + * Set the method of this {@link DPIMethodFabricatedData} instance. + * + * @param method + * The method of this {@link DPIMethodFabricatedData} + */ + public void setMethod( @Nonnull final MethodEnum method ) + { + this.method = method; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPIMethodFabricatedData}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPIMethodFabricatedData} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("DPIMethodFabricatedData has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DPIMethodFabricatedData} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( method != null ) + declaredFields.put("method", method); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DPIMethodFabricatedData} instance. If the map previously contained + * a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final DPIMethodFabricatedData dpIMethodFabricatedData = (DPIMethodFabricatedData) o; + return Objects.equals(this.cloudSdkCustomFields, dpIMethodFabricatedData.cloudSdkCustomFields) + && Objects.equals(this.method, dpIMethodFabricatedData.method); + } + + @Override + public int hashCode() + { + return Objects.hash(method, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPIMethodFabricatedData {\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIStandardEntity.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIStandardEntity.java new file mode 100644 index 000000000..64cce67e4 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIStandardEntity.java @@ -0,0 +1,242 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * DPIStandardEntity + */ + +@Beta // CHECKSTYLE:OFF +public class DPIStandardEntity implements DPIEntityConfig +// CHECKSTYLE:ON +{ + @JsonProperty( "type" ) + private DPIEntities type; + + @JsonProperty( "replacement_strategy" ) + private DPIStandardEntityReplacementStrategy replacementStrategy; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for DPIStandardEntity. + */ + protected DPIStandardEntity() + { + } + + /** + * Set the type of this {@link DPIStandardEntity} instance and return the same instance. + * + * @param type + * The type of this {@link DPIStandardEntity} + * @return The same instance of this {@link DPIStandardEntity} class + */ + @Nonnull + public DPIStandardEntity type( @Nonnull final DPIEntities type ) + { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link DPIStandardEntity} instance. + */ + @Nonnull + public DPIEntities getType() + { + return type; + } + + /** + * Set the type of this {@link DPIStandardEntity} instance. + * + * @param type + * The type of this {@link DPIStandardEntity} + */ + public void setType( @Nonnull final DPIEntities type ) + { + this.type = type; + } + + /** + * Set the replacementStrategy of this {@link DPIStandardEntity} instance and return the same instance. + * + * @param replacementStrategy + * The replacementStrategy of this {@link DPIStandardEntity} + * @return The same instance of this {@link DPIStandardEntity} class + */ + @Nonnull + public DPIStandardEntity replacementStrategy( + @Nullable final DPIStandardEntityReplacementStrategy replacementStrategy ) + { + this.replacementStrategy = replacementStrategy; + return this; + } + + /** + * Get replacementStrategy + * + * @return replacementStrategy The replacementStrategy of this {@link DPIStandardEntity} instance. + */ + @Nonnull + public DPIStandardEntityReplacementStrategy getReplacementStrategy() + { + return replacementStrategy; + } + + /** + * Set the replacementStrategy of this {@link DPIStandardEntity} instance. + * + * @param replacementStrategy + * The replacementStrategy of this {@link DPIStandardEntity} + */ + public void setReplacementStrategy( @Nullable final DPIStandardEntityReplacementStrategy replacementStrategy ) + { + this.replacementStrategy = replacementStrategy; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPIStandardEntity}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPIStandardEntity} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("DPIStandardEntity has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DPIStandardEntity} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( type != null ) + declaredFields.put("type", type); + if( replacementStrategy != null ) + declaredFields.put("replacementStrategy", replacementStrategy); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DPIStandardEntity} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final DPIStandardEntity dpIStandardEntity = (DPIStandardEntity) o; + return Objects.equals(this.cloudSdkCustomFields, dpIStandardEntity.cloudSdkCustomFields) + && Objects.equals(this.type, dpIStandardEntity.type) + && Objects.equals(this.replacementStrategy, dpIStandardEntity.replacementStrategy); + } + + @Override + public int hashCode() + { + return Objects.hash(type, replacementStrategy, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPIStandardEntity {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" replacementStrategy: ").append(toIndentedString(replacementStrategy)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIStandardEntityReplacementStrategy.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIStandardEntityReplacementStrategy.java new file mode 100644 index 000000000..64f03bdcf --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIStandardEntityReplacementStrategy.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.google.common.annotations.Beta; + +/** + * Replacement strategy to be used for the entity + */ +@Beta +@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) +@JsonSubTypes( { + @JsonSubTypes.Type( value = DPIMethodConstant.class ), + @JsonSubTypes.Type( value = DPIMethodFabricatedData.class ), } ) + +public interface DPIStandardEntityReplacementStrategy +{ +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DataRepositoryType.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DataRepositoryType.java new file mode 100644 index 000000000..ea712242f --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DataRepositoryType.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import javax.annotation.Nonnull; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * Only include DataRepositories with the given type. + */ + +@Beta +public enum DataRepositoryType +{ + + VECTOR("vector"), + + HELP_SAP_COM("help.sap.com"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private final String value; + + DataRepositoryType( String value ) + { + this.value = value; + } + + /** + * @return The enum value. + */ + @JsonValue + public String getValue() + { + return value; + } + + /** + * @return The String representation of the enum value. + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Converts the given value to its enum representation. + * + * @param value + * The input value. + * + * @return The enum representation of the given value. + */ + @JsonCreator + public static DataRepositoryType fromValue( @Nonnull final String value ) + { + for( final DataRepositoryType b : DataRepositoryType.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DeveloperChatMessage.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DeveloperChatMessage.java new file mode 100644 index 000000000..c3c17e4c8 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DeveloperChatMessage.java @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * DeveloperChatMessage + */ + +@Beta // CHECKSTYLE:OFF +public class DeveloperChatMessage implements ChatMessage +// CHECKSTYLE:ON +{ + /** + * Gets or Sets role + */ + public enum RoleEnum + { + /** + * The DEVELOPER option of this DeveloperChatMessage + */ + DEVELOPER("developer"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this DeveloperChatMessage + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + RoleEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type DeveloperChatMessage + */ + @JsonCreator + @Nonnull + public static RoleEnum fromValue( @Nonnull final String value ) + { + for( RoleEnum b : RoleEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "role" ) + private RoleEnum role; + + @JsonProperty( "content" ) + private ChatMessageContent content; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for DeveloperChatMessage. + */ + protected DeveloperChatMessage() + { + } + + /** + * Set the role of this {@link DeveloperChatMessage} instance and return the same instance. + * + * @param role + * The role of this {@link DeveloperChatMessage} + * @return The same instance of this {@link DeveloperChatMessage} class + */ + @Nonnull + public DeveloperChatMessage role( @Nonnull final RoleEnum role ) + { + this.role = role; + return this; + } + + /** + * Get role + * + * @return role The role of this {@link DeveloperChatMessage} instance. + */ + @Nonnull + public RoleEnum getRole() + { + return role; + } + + /** + * Set the role of this {@link DeveloperChatMessage} instance. + * + * @param role + * The role of this {@link DeveloperChatMessage} + */ + public void setRole( @Nonnull final RoleEnum role ) + { + this.role = role; + } + + /** + * Set the content of this {@link DeveloperChatMessage} instance and return the same instance. + * + * @param content + * The content of this {@link DeveloperChatMessage} + * @return The same instance of this {@link DeveloperChatMessage} class + */ + @Nonnull + public DeveloperChatMessage content( @Nonnull final ChatMessageContent content ) + { + this.content = content; + return this; + } + + /** + * Get content + * + * @return content The content of this {@link DeveloperChatMessage} instance. + */ + @Nonnull + public ChatMessageContent getContent() + { + return content; + } + + /** + * Set the content of this {@link DeveloperChatMessage} instance. + * + * @param content + * The content of this {@link DeveloperChatMessage} + */ + public void setContent( @Nonnull final ChatMessageContent content ) + { + this.content = content; + } + + /** + * Get the names of the unrecognizable properties of the {@link DeveloperChatMessage}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DeveloperChatMessage} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("DeveloperChatMessage has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DeveloperChatMessage} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( role != null ) + declaredFields.put("role", role); + if( content != null ) + declaredFields.put("content", content); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DeveloperChatMessage} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final DeveloperChatMessage developerChatMessage = (DeveloperChatMessage) o; + return Objects.equals(this.cloudSdkCustomFields, developerChatMessage.cloudSdkCustomFields) + && Objects.equals(this.role, developerChatMessage.role) + && Objects.equals(this.content, developerChatMessage.content); + } + + @Override + public int hashCode() + { + return Objects.hash(role, content, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class DeveloperChatMessage {\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DocumentGroundingFilter.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DocumentGroundingFilter.java new file mode 100644 index 000000000..46854776a --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DocumentGroundingFilter.java @@ -0,0 +1,546 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * DocumentGroundingFilter + */ + +@Beta // CHECKSTYLE:OFF +public class DocumentGroundingFilter implements GroundingModuleConfigConfigFiltersInner +// CHECKSTYLE:ON +{ + @JsonProperty( "id" ) + private String id; + + @JsonProperty( "search_config" ) + private GroundingFilterSearchConfiguration searchConfig; + + @JsonProperty( "data_repositories" ) + private List dataRepositories = new ArrayList<>(Arrays.asList("*")); + + @JsonProperty( "data_repository_type" ) + private DataRepositoryType dataRepositoryType; + + @JsonProperty( "data_repository_metadata" ) + private List dataRepositoryMetadata = new ArrayList<>(); + + @JsonProperty( "document_metadata" ) + private List documentMetadata = new ArrayList<>(); + + @JsonProperty( "chunk_metadata" ) + private List chunkMetadata = new ArrayList<>(); + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for DocumentGroundingFilter. + */ + protected DocumentGroundingFilter() + { + } + + /** + * Set the id of this {@link DocumentGroundingFilter} instance and return the same instance. + * + * @param id + * Identifier of this SearchFilter - unique per request. + * @return The same instance of this {@link DocumentGroundingFilter} class + */ + @Nonnull + public DocumentGroundingFilter id( @Nullable final String id ) + { + this.id = id; + return this; + } + + /** + * Identifier of this SearchFilter - unique per request. + * + * @return id The id of this {@link DocumentGroundingFilter} instance. + */ + @Nonnull + public String getId() + { + return id; + } + + /** + * Set the id of this {@link DocumentGroundingFilter} instance. + * + * @param id + * Identifier of this SearchFilter - unique per request. + */ + public void setId( @Nullable final String id ) + { + this.id = id; + } + + /** + * Set the searchConfig of this {@link DocumentGroundingFilter} instance and return the same instance. + * + * @param searchConfig + * The searchConfig of this {@link DocumentGroundingFilter} + * @return The same instance of this {@link DocumentGroundingFilter} class + */ + @Nonnull + public DocumentGroundingFilter searchConfig( @Nullable final GroundingFilterSearchConfiguration searchConfig ) + { + this.searchConfig = searchConfig; + return this; + } + + /** + * Get searchConfig + * + * @return searchConfig The searchConfig of this {@link DocumentGroundingFilter} instance. + */ + @Nonnull + public GroundingFilterSearchConfiguration getSearchConfig() + { + return searchConfig; + } + + /** + * Set the searchConfig of this {@link DocumentGroundingFilter} instance. + * + * @param searchConfig + * The searchConfig of this {@link DocumentGroundingFilter} + */ + public void setSearchConfig( @Nullable final GroundingFilterSearchConfiguration searchConfig ) + { + this.searchConfig = searchConfig; + } + + /** + * Set the dataRepositories of this {@link DocumentGroundingFilter} instance and return the same instance. + * + * @param dataRepositories + * Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository + * ids. + * @return The same instance of this {@link DocumentGroundingFilter} class + */ + @Nonnull + public DocumentGroundingFilter dataRepositories( @Nullable final List dataRepositories ) + { + this.dataRepositories = dataRepositories; + return this; + } + + /** + * Add one dataRepositories instance to this {@link DocumentGroundingFilter}. + * + * @param dataRepositoriesItem + * The dataRepositories that should be added + * @return The same instance of type {@link DocumentGroundingFilter} + */ + @Nonnull + public DocumentGroundingFilter addDataRepositoriesItem( @Nonnull final String dataRepositoriesItem ) + { + if( this.dataRepositories == null ) { + this.dataRepositories = new ArrayList<>(Arrays.asList("*")); + } + this.dataRepositories.add(dataRepositoriesItem); + return this; + } + + /** + * Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids. + * + * @return dataRepositories The dataRepositories of this {@link DocumentGroundingFilter} instance. + */ + @Nonnull + public List getDataRepositories() + { + return dataRepositories; + } + + /** + * Set the dataRepositories of this {@link DocumentGroundingFilter} instance. + * + * @param dataRepositories + * Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository + * ids. + */ + public void setDataRepositories( @Nullable final List dataRepositories ) + { + this.dataRepositories = dataRepositories; + } + + /** + * Set the dataRepositoryType of this {@link DocumentGroundingFilter} instance and return the same instance. + * + * @param dataRepositoryType + * The dataRepositoryType of this {@link DocumentGroundingFilter} + * @return The same instance of this {@link DocumentGroundingFilter} class + */ + @Nonnull + public DocumentGroundingFilter dataRepositoryType( @Nonnull final DataRepositoryType dataRepositoryType ) + { + this.dataRepositoryType = dataRepositoryType; + return this; + } + + /** + * Get dataRepositoryType + * + * @return dataRepositoryType The dataRepositoryType of this {@link DocumentGroundingFilter} instance. + */ + @Nonnull + public DataRepositoryType getDataRepositoryType() + { + return dataRepositoryType; + } + + /** + * Set the dataRepositoryType of this {@link DocumentGroundingFilter} instance. + * + * @param dataRepositoryType + * The dataRepositoryType of this {@link DocumentGroundingFilter} + */ + public void setDataRepositoryType( @Nonnull final DataRepositoryType dataRepositoryType ) + { + this.dataRepositoryType = dataRepositoryType; + } + + /** + * Set the dataRepositoryMetadata of this {@link DocumentGroundingFilter} instance and return the same instance. + * + * @param dataRepositoryMetadata + * Restrict DataRepositories considered during search to those annotated with the given metadata. Useful + * when combined with dataRepositories=['*'] + * @return The same instance of this {@link DocumentGroundingFilter} class + */ + @Nonnull + public DocumentGroundingFilter dataRepositoryMetadata( + @Nullable final List dataRepositoryMetadata ) + { + this.dataRepositoryMetadata = dataRepositoryMetadata; + return this; + } + + /** + * Add one dataRepositoryMetadata instance to this {@link DocumentGroundingFilter}. + * + * @param dataRepositoryMetadataItem + * The dataRepositoryMetadata that should be added + * @return The same instance of type {@link DocumentGroundingFilter} + */ + @Nonnull + public DocumentGroundingFilter addDataRepositoryMetadataItem( + @Nonnull final KeyValueListPair dataRepositoryMetadataItem ) + { + if( this.dataRepositoryMetadata == null ) { + this.dataRepositoryMetadata = new ArrayList<>(); + } + this.dataRepositoryMetadata.add(dataRepositoryMetadataItem); + return this; + } + + /** + * Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when + * combined with dataRepositories=['*'] + * + * @return dataRepositoryMetadata The dataRepositoryMetadata of this {@link DocumentGroundingFilter} instance. + */ + @Nonnull + public List getDataRepositoryMetadata() + { + return dataRepositoryMetadata; + } + + /** + * Set the dataRepositoryMetadata of this {@link DocumentGroundingFilter} instance. + * + * @param dataRepositoryMetadata + * Restrict DataRepositories considered during search to those annotated with the given metadata. Useful + * when combined with dataRepositories=['*'] + */ + public void setDataRepositoryMetadata( @Nullable final List dataRepositoryMetadata ) + { + this.dataRepositoryMetadata = dataRepositoryMetadata; + } + + /** + * Set the documentMetadata of this {@link DocumentGroundingFilter} instance and return the same instance. + * + * @param documentMetadata + * Restrict documents considered during search to those annotated with the given metadata. + * @return The same instance of this {@link DocumentGroundingFilter} class + */ + @Nonnull + public DocumentGroundingFilter documentMetadata( + @Nullable final List documentMetadata ) + { + this.documentMetadata = documentMetadata; + return this; + } + + /** + * Add one documentMetadata instance to this {@link DocumentGroundingFilter}. + * + * @param documentMetadataItem + * The documentMetadata that should be added + * @return The same instance of type {@link DocumentGroundingFilter} + */ + @Nonnull + public DocumentGroundingFilter addDocumentMetadataItem( + @Nonnull final SearchDocumentKeyValueListPair documentMetadataItem ) + { + if( this.documentMetadata == null ) { + this.documentMetadata = new ArrayList<>(); + } + this.documentMetadata.add(documentMetadataItem); + return this; + } + + /** + * Restrict documents considered during search to those annotated with the given metadata. + * + * @return documentMetadata The documentMetadata of this {@link DocumentGroundingFilter} instance. + */ + @Nonnull + public List getDocumentMetadata() + { + return documentMetadata; + } + + /** + * Set the documentMetadata of this {@link DocumentGroundingFilter} instance. + * + * @param documentMetadata + * Restrict documents considered during search to those annotated with the given metadata. + */ + public void setDocumentMetadata( @Nullable final List documentMetadata ) + { + this.documentMetadata = documentMetadata; + } + + /** + * Set the chunkMetadata of this {@link DocumentGroundingFilter} instance and return the same instance. + * + * @param chunkMetadata + * Restrict chunks considered during search to those with the given metadata. + * @return The same instance of this {@link DocumentGroundingFilter} class + */ + @Nonnull + public DocumentGroundingFilter chunkMetadata( @Nullable final List chunkMetadata ) + { + this.chunkMetadata = chunkMetadata; + return this; + } + + /** + * Add one chunkMetadata instance to this {@link DocumentGroundingFilter}. + * + * @param chunkMetadataItem + * The chunkMetadata that should be added + * @return The same instance of type {@link DocumentGroundingFilter} + */ + @Nonnull + public DocumentGroundingFilter addChunkMetadataItem( @Nonnull final KeyValueListPair chunkMetadataItem ) + { + if( this.chunkMetadata == null ) { + this.chunkMetadata = new ArrayList<>(); + } + this.chunkMetadata.add(chunkMetadataItem); + return this; + } + + /** + * Restrict chunks considered during search to those with the given metadata. + * + * @return chunkMetadata The chunkMetadata of this {@link DocumentGroundingFilter} instance. + */ + @Nonnull + public List getChunkMetadata() + { + return chunkMetadata; + } + + /** + * Set the chunkMetadata of this {@link DocumentGroundingFilter} instance. + * + * @param chunkMetadata + * Restrict chunks considered during search to those with the given metadata. + */ + public void setChunkMetadata( @Nullable final List chunkMetadata ) + { + this.chunkMetadata = chunkMetadata; + } + + /** + * Get the names of the unrecognizable properties of the {@link DocumentGroundingFilter}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DocumentGroundingFilter} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("DocumentGroundingFilter has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DocumentGroundingFilter} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( id != null ) + declaredFields.put("id", id); + if( searchConfig != null ) + declaredFields.put("searchConfig", searchConfig); + if( dataRepositories != null ) + declaredFields.put("dataRepositories", dataRepositories); + if( dataRepositoryType != null ) + declaredFields.put("dataRepositoryType", dataRepositoryType); + if( dataRepositoryMetadata != null ) + declaredFields.put("dataRepositoryMetadata", dataRepositoryMetadata); + if( documentMetadata != null ) + declaredFields.put("documentMetadata", documentMetadata); + if( chunkMetadata != null ) + declaredFields.put("chunkMetadata", chunkMetadata); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DocumentGroundingFilter} instance. If the map previously contained + * a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final DocumentGroundingFilter documentGroundingFilter = (DocumentGroundingFilter) o; + return Objects.equals(this.cloudSdkCustomFields, documentGroundingFilter.cloudSdkCustomFields) + && Objects.equals(this.id, documentGroundingFilter.id) + && Objects.equals(this.searchConfig, documentGroundingFilter.searchConfig) + && Objects.equals(this.dataRepositories, documentGroundingFilter.dataRepositories) + && Objects.equals(this.dataRepositoryType, documentGroundingFilter.dataRepositoryType) + && Objects.equals(this.dataRepositoryMetadata, documentGroundingFilter.dataRepositoryMetadata) + && Objects.equals(this.documentMetadata, documentGroundingFilter.documentMetadata) + && Objects.equals(this.chunkMetadata, documentGroundingFilter.chunkMetadata); + } + + @Override + public int hashCode() + { + return Objects + .hash( + id, + searchConfig, + dataRepositories, + dataRepositoryType, + dataRepositoryMetadata, + documentMetadata, + chunkMetadata, + cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class DocumentGroundingFilter {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" searchConfig: ").append(toIndentedString(searchConfig)).append("\n"); + sb.append(" dataRepositories: ").append(toIndentedString(dataRepositories)).append("\n"); + sb.append(" dataRepositoryType: ").append(toIndentedString(dataRepositoryType)).append("\n"); + sb.append(" dataRepositoryMetadata: ").append(toIndentedString(dataRepositoryMetadata)).append("\n"); + sb.append(" documentMetadata: ").append(toIndentedString(documentMetadata)).append("\n"); + sb.append(" chunkMetadata: ").append(toIndentedString(chunkMetadata)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ErrorResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ErrorResponse.java new file mode 100644 index 000000000..449e750ee --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ErrorResponse.java @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * ErrorResponse + */ + +@Beta // CHECKSTYLE:OFF +public class ErrorResponse +// CHECKSTYLE:ON +{ + @JsonProperty( "request_id" ) + private String requestId; + + @JsonProperty( "message" ) + private String message; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for ErrorResponse. + */ + protected ErrorResponse() + { + } + + /** + * Set the requestId of this {@link ErrorResponse} instance and return the same instance. + * + * @param requestId + * The requestId of this {@link ErrorResponse} + * @return The same instance of this {@link ErrorResponse} class + */ + @Nonnull + public ErrorResponse requestId( @Nonnull final String requestId ) + { + this.requestId = requestId; + return this; + } + + /** + * Get requestId + * + * @return requestId The requestId of this {@link ErrorResponse} instance. + */ + @Nonnull + public String getRequestId() + { + return requestId; + } + + /** + * Set the requestId of this {@link ErrorResponse} instance. + * + * @param requestId + * The requestId of this {@link ErrorResponse} + */ + public void setRequestId( @Nonnull final String requestId ) + { + this.requestId = requestId; + } + + /** + * Set the message of this {@link ErrorResponse} instance and return the same instance. + * + * @param message + * The message of this {@link ErrorResponse} + * @return The same instance of this {@link ErrorResponse} class + */ + @Nonnull + public ErrorResponse message( @Nonnull final String message ) + { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link ErrorResponse} instance. + */ + @Nonnull + public String getMessage() + { + return message; + } + + /** + * Set the message of this {@link ErrorResponse} instance. + * + * @param message + * The message of this {@link ErrorResponse} + */ + public void setMessage( @Nonnull final String message ) + { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link ErrorResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ErrorResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("ErrorResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ErrorResponse} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( requestId != null ) + declaredFields.put("requestId", requestId); + if( message != null ) + declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ErrorResponse} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final ErrorResponse errorResponse = (ErrorResponse) o; + return Objects.equals(this.cloudSdkCustomFields, errorResponse.cloudSdkCustomFields) + && Objects.equals(this.requestId, errorResponse.requestId) + && Objects.equals(this.message, errorResponse.message); + } + + @Override + public int hashCode() + { + return Objects.hash(requestId, message, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponse {\n"); + sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FilteringModuleConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FilteringModuleConfig.java new file mode 100644 index 000000000..648ad36f8 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FilteringModuleConfig.java @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * FilteringModuleConfig + */ + +@Beta // CHECKSTYLE:OFF +public class FilteringModuleConfig +// CHECKSTYLE:ON +{ + @JsonProperty( "input" ) + private InputFilteringConfig input; + + @JsonProperty( "output" ) + private OutputFilteringConfig output; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for FilteringModuleConfig. + */ + protected FilteringModuleConfig() + { + } + + /** + * Set the input of this {@link FilteringModuleConfig} instance and return the same instance. + * + * @param input + * List of provider type and filters + * @return The same instance of this {@link FilteringModuleConfig} class + */ + @Nonnull + public FilteringModuleConfig input( @Nullable final InputFilteringConfig input ) + { + this.input = input; + return this; + } + + /** + * List of provider type and filters + * + * @return input The input of this {@link FilteringModuleConfig} instance. + */ + @Nonnull + public InputFilteringConfig getInput() + { + return input; + } + + /** + * Set the input of this {@link FilteringModuleConfig} instance. + * + * @param input + * List of provider type and filters + */ + public void setInput( @Nullable final InputFilteringConfig input ) + { + this.input = input; + } + + /** + * Set the output of this {@link FilteringModuleConfig} instance and return the same instance. + * + * @param output + * List of provider type and filters + * @return The same instance of this {@link FilteringModuleConfig} class + */ + @Nonnull + public FilteringModuleConfig output( @Nullable final OutputFilteringConfig output ) + { + this.output = output; + return this; + } + + /** + * List of provider type and filters + * + * @return output The output of this {@link FilteringModuleConfig} instance. + */ + @Nonnull + public OutputFilteringConfig getOutput() + { + return output; + } + + /** + * Set the output of this {@link FilteringModuleConfig} instance. + * + * @param output + * List of provider type and filters + */ + public void setOutput( @Nullable final OutputFilteringConfig output ) + { + this.output = output; + } + + /** + * Get the names of the unrecognizable properties of the {@link FilteringModuleConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link FilteringModuleConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("FilteringModuleConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link FilteringModuleConfig} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( input != null ) + declaredFields.put("input", input); + if( output != null ) + declaredFields.put("output", output); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link FilteringModuleConfig} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final FilteringModuleConfig filteringModuleConfig = (FilteringModuleConfig) o; + return Objects.equals(this.cloudSdkCustomFields, filteringModuleConfig.cloudSdkCustomFields) + && Objects.equals(this.input, filteringModuleConfig.input) + && Objects.equals(this.output, filteringModuleConfig.output); + } + + @Override + public int hashCode() + { + return Objects.hash(input, output, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class FilteringModuleConfig {\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FilteringStreamOptions.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FilteringStreamOptions.java new file mode 100644 index 000000000..77629a087 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FilteringStreamOptions.java @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * Stream options for output filtering. Will be ignored if stream is false. + */ + +@Beta // CHECKSTYLE:OFF +public class FilteringStreamOptions +// CHECKSTYLE:ON +{ + @JsonProperty( "overlap" ) + private Integer overlap = 0; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for FilteringStreamOptions. + */ + protected FilteringStreamOptions() + { + } + + /** + * Set the overlap of this {@link FilteringStreamOptions} instance and return the same instance. + * + * @param overlap + * Number of characters that should be additionally sent to content filtering services from previous + * chunks as additional context. Minimum: 0 Maximum: 10000 + * @return The same instance of this {@link FilteringStreamOptions} class + */ + @Nonnull + public FilteringStreamOptions overlap( @Nullable final Integer overlap ) + { + this.overlap = overlap; + return this; + } + + /** + * Number of characters that should be additionally sent to content filtering services from previous chunks as + * additional context. minimum: 0 maximum: 10000 + * + * @return overlap The overlap of this {@link FilteringStreamOptions} instance. + */ + @Nonnull + public Integer getOverlap() + { + return overlap; + } + + /** + * Set the overlap of this {@link FilteringStreamOptions} instance. + * + * @param overlap + * Number of characters that should be additionally sent to content filtering services from previous + * chunks as additional context. Minimum: 0 Maximum: 10000 + */ + public void setOverlap( @Nullable final Integer overlap ) + { + this.overlap = overlap; + } + + /** + * Get the names of the unrecognizable properties of the {@link FilteringStreamOptions}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link FilteringStreamOptions} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("FilteringStreamOptions has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link FilteringStreamOptions} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( overlap != null ) + declaredFields.put("overlap", overlap); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link FilteringStreamOptions} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final FilteringStreamOptions filteringStreamOptions = (FilteringStreamOptions) o; + return Objects.equals(this.cloudSdkCustomFields, filteringStreamOptions.cloudSdkCustomFields) + && Objects.equals(this.overlap, filteringStreamOptions.overlap); + } + + @Override + public int hashCode() + { + return Objects.hash(overlap, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class FilteringStreamOptions {\n"); + sb.append(" overlap: ").append(toIndentedString(overlap)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FunctionObject.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FunctionObject.java new file mode 100644 index 000000000..93e7c7882 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FunctionObject.java @@ -0,0 +1,370 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * FunctionObject + */ + +@Beta // CHECKSTYLE:OFF +public class FunctionObject +// CHECKSTYLE:ON +{ + @JsonProperty( "description" ) + private String description; + + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "parameters" ) + private Map parameters = new HashMap<>(); + + @JsonProperty( "strict" ) + private Boolean strict = false; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for FunctionObject. + */ + protected FunctionObject() + { + } + + /** + * Set the description of this {@link FunctionObject} instance and return the same instance. + * + * @param description + * A description of what the function does, used by the model to choose when and how to call the + * function. + * @return The same instance of this {@link FunctionObject} class + */ + @Nonnull + public FunctionObject description( @Nullable final String description ) + { + this.description = description; + return this; + } + + /** + * A description of what the function does, used by the model to choose when and how to call the function. + * + * @return description The description of this {@link FunctionObject} instance. + */ + @Nonnull + public String getDescription() + { + return description; + } + + /** + * Set the description of this {@link FunctionObject} instance. + * + * @param description + * A description of what the function does, used by the model to choose when and how to call the + * function. + */ + public void setDescription( @Nullable final String description ) + { + this.description = description; + } + + /** + * Set the name of this {@link FunctionObject} instance and return the same instance. + * + * @param name + * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with + * a maximum length of 64. + * @return The same instance of this {@link FunctionObject} class + */ + @Nonnull + public FunctionObject name( @Nonnull final String name ) + { + this.name = name; + return this; + } + + /** + * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum + * length of 64. + * + * @return name The name of this {@link FunctionObject} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link FunctionObject} instance. + * + * @param name + * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with + * a maximum length of 64. + */ + public void setName( @Nonnull final String name ) + { + this.name = name; + } + + /** + * Set the parameters of this {@link FunctionObject} instance and return the same instance. + * + * @param parameters + * The parameters the functions accepts, described as a JSON Schema object. See the + * [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema + * reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + * Omitting `parameters` defines a function with an empty parameter list. + * @return The same instance of this {@link FunctionObject} class + */ + @Nonnull + public FunctionObject parameters( @Nullable final Map parameters ) + { + this.parameters = parameters; + return this; + } + + /** + * Put one parameters instance to this {@link FunctionObject} instance. + * + * @param key + * The String key of this parameters instance + * @param parametersItem + * The parameters that should be added under the given key + * @return The same instance of type {@link FunctionObject} + */ + @Nonnull + public FunctionObject putparametersItem( @Nonnull final String key, @Nullable final Object parametersItem ) + { + if( this.parameters == null ) { + this.parameters = new HashMap<>(); + } + this.parameters.put(key, parametersItem); + return this; + } + + /** + * The parameters the functions accepts, described as a JSON Schema object. See the + * [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema + * reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. Omitting + * `parameters` defines a function with an empty parameter list. + * + * @return parameters The parameters of this {@link FunctionObject} instance. + */ + @Nonnull + public Map getParameters() + { + return parameters; + } + + /** + * Set the parameters of this {@link FunctionObject} instance. + * + * @param parameters + * The parameters the functions accepts, described as a JSON Schema object. See the + * [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema + * reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + * Omitting `parameters` defines a function with an empty parameter list. + */ + public void setParameters( @Nullable final Map parameters ) + { + this.parameters = parameters; + } + + /** + * Set the strict of this {@link FunctionObject} instance and return the same instance. + * + * @param strict + * Whether to enable strict schema adherence when generating the function call. If set to true, the model + * will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema + * is supported when `strict` is `true`. Learn more about Structured Outputs in the + * [function calling guide](docs/guides/function-calling). + * @return The same instance of this {@link FunctionObject} class + */ + @Nonnull + public FunctionObject strict( @Nullable final Boolean strict ) + { + this.strict = strict; + return this; + } + + /** + * Whether to enable strict schema adherence when generating the function call. If set to true, the model will + * follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported + * when `strict` is `true`. Learn more about Structured Outputs in the [function calling + * guide](docs/guides/function-calling). + * + * @return strict The strict of this {@link FunctionObject} instance. + */ + @Nullable + public Boolean isStrict() + { + return strict; + } + + /** + * Set the strict of this {@link FunctionObject} instance. + * + * @param strict + * Whether to enable strict schema adherence when generating the function call. If set to true, the model + * will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema + * is supported when `strict` is `true`. Learn more about Structured Outputs in the + * [function calling guide](docs/guides/function-calling). + */ + public void setStrict( @Nullable final Boolean strict ) + { + this.strict = strict; + } + + /** + * Get the names of the unrecognizable properties of the {@link FunctionObject}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link FunctionObject} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("FunctionObject has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link FunctionObject} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( description != null ) + declaredFields.put("description", description); + if( name != null ) + declaredFields.put("name", name); + if( parameters != null ) + declaredFields.put("parameters", parameters); + if( strict != null ) + declaredFields.put("strict", strict); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link FunctionObject} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final FunctionObject functionObject = (FunctionObject) o; + return Objects.equals(this.cloudSdkCustomFields, functionObject.cloudSdkCustomFields) + && Objects.equals(this.description, functionObject.description) + && Objects.equals(this.name, functionObject.name) + && Objects.equals(this.parameters, functionObject.parameters) + && Objects.equals(this.strict, functionObject.strict); + } + + @Override + public int hashCode() + { + return Objects.hash(description, name, parameters, strict, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class FunctionObject {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" strict: ").append(toIndentedString(strict)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GlobalStreamOptions.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GlobalStreamOptions.java new file mode 100644 index 000000000..a79b819ef --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GlobalStreamOptions.java @@ -0,0 +1,308 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * Options for streaming. Will be ignored if enabled is false. + */ + +@Beta // CHECKSTYLE:OFF +public class GlobalStreamOptions +// CHECKSTYLE:ON +{ + @JsonProperty( "enabled" ) + private Boolean enabled = false; + + @JsonProperty( "chunk_size" ) + private Integer chunkSize = 100; + + @JsonProperty( "delimiters" ) + private List delimiters = new ArrayList<>(); + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for GlobalStreamOptions. + */ + protected GlobalStreamOptions() + { + } + + /** + * Set the enabled of this {@link GlobalStreamOptions} instance and return the same instance. + * + * @param enabled + * If true, the response will be streamed back to the client + * @return The same instance of this {@link GlobalStreamOptions} class + */ + @Nonnull + public GlobalStreamOptions enabled( @Nullable final Boolean enabled ) + { + this.enabled = enabled; + return this; + } + + /** + * If true, the response will be streamed back to the client + * + * @return enabled The enabled of this {@link GlobalStreamOptions} instance. + */ + @Nonnull + public Boolean isEnabled() + { + return enabled; + } + + /** + * Set the enabled of this {@link GlobalStreamOptions} instance. + * + * @param enabled + * If true, the response will be streamed back to the client + */ + public void setEnabled( @Nullable final Boolean enabled ) + { + this.enabled = enabled; + } + + /** + * Set the chunkSize of this {@link GlobalStreamOptions} instance and return the same instance. + * + * @param chunkSize + * Minimum number of characters per chunk that post-LLM modules operate on. Minimum: 1 Maximum: 10000 + * @return The same instance of this {@link GlobalStreamOptions} class + */ + @Nonnull + public GlobalStreamOptions chunkSize( @Nullable final Integer chunkSize ) + { + this.chunkSize = chunkSize; + return this; + } + + /** + * Minimum number of characters per chunk that post-LLM modules operate on. minimum: 1 maximum: 10000 + * + * @return chunkSize The chunkSize of this {@link GlobalStreamOptions} instance. + */ + @Nonnull + public Integer getChunkSize() + { + return chunkSize; + } + + /** + * Set the chunkSize of this {@link GlobalStreamOptions} instance. + * + * @param chunkSize + * Minimum number of characters per chunk that post-LLM modules operate on. Minimum: 1 Maximum: 10000 + */ + public void setChunkSize( @Nullable final Integer chunkSize ) + { + this.chunkSize = chunkSize; + } + + /** + * Set the delimiters of this {@link GlobalStreamOptions} instance and return the same instance. + * + * @param delimiters + * List of delimiters to split the input text into chunks.Please note, this is a required parameter when + * `input_translation_module_config` or `output_translation_module_config` are + * configured. + * @return The same instance of this {@link GlobalStreamOptions} class + */ + @Nonnull + public GlobalStreamOptions delimiters( @Nullable final List delimiters ) + { + this.delimiters = delimiters; + return this; + } + + /** + * Add one delimiters instance to this {@link GlobalStreamOptions}. + * + * @param delimitersItem + * The delimiters that should be added + * @return The same instance of type {@link GlobalStreamOptions} + */ + @Nonnull + public GlobalStreamOptions addDelimitersItem( @Nonnull final String delimitersItem ) + { + if( this.delimiters == null ) { + this.delimiters = new ArrayList<>(); + } + this.delimiters.add(delimitersItem); + return this; + } + + /** + * List of delimiters to split the input text into chunks.Please note, this is a required parameter when + * `input_translation_module_config` or `output_translation_module_config` are configured. + * + * @return delimiters The delimiters of this {@link GlobalStreamOptions} instance. + */ + @Nonnull + public List getDelimiters() + { + return delimiters; + } + + /** + * Set the delimiters of this {@link GlobalStreamOptions} instance. + * + * @param delimiters + * List of delimiters to split the input text into chunks.Please note, this is a required parameter when + * `input_translation_module_config` or `output_translation_module_config` are + * configured. + */ + public void setDelimiters( @Nullable final List delimiters ) + { + this.delimiters = delimiters; + } + + /** + * Get the names of the unrecognizable properties of the {@link GlobalStreamOptions}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link GlobalStreamOptions} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("GlobalStreamOptions has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link GlobalStreamOptions} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( enabled != null ) + declaredFields.put("enabled", enabled); + if( chunkSize != null ) + declaredFields.put("chunkSize", chunkSize); + if( delimiters != null ) + declaredFields.put("delimiters", delimiters); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link GlobalStreamOptions} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final GlobalStreamOptions globalStreamOptions = (GlobalStreamOptions) o; + return Objects.equals(this.cloudSdkCustomFields, globalStreamOptions.cloudSdkCustomFields) + && Objects.equals(this.enabled, globalStreamOptions.enabled) + && Objects.equals(this.chunkSize, globalStreamOptions.chunkSize) + && Objects.equals(this.delimiters, globalStreamOptions.delimiters); + } + + @Override + public int hashCode() + { + return Objects.hash(enabled, chunkSize, delimiters, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class GlobalStreamOptions {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" chunkSize: ").append(toIndentedString(chunkSize)).append("\n"); + sb.append(" delimiters: ").append(toIndentedString(delimiters)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingFilterSearchConfiguration.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingFilterSearchConfiguration.java new file mode 100644 index 000000000..0027dac92 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingFilterSearchConfiguration.java @@ -0,0 +1,251 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * GroundingFilterSearchConfiguration + */ + +@Beta // CHECKSTYLE:OFF +public class GroundingFilterSearchConfiguration +// CHECKSTYLE:ON +{ + @JsonProperty( "max_chunk_count" ) + private Integer maxChunkCount; + + @JsonProperty( "max_document_count" ) + private Integer maxDocumentCount; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for GroundingFilterSearchConfiguration. + */ + protected GroundingFilterSearchConfiguration() + { + } + + /** + * Set the maxChunkCount of this {@link GroundingFilterSearchConfiguration} instance and return the same instance. + * + * @param maxChunkCount + * Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. Minimum: 0 + * @return The same instance of this {@link GroundingFilterSearchConfiguration} class + */ + @Nonnull + public GroundingFilterSearchConfiguration maxChunkCount( @Nullable final Integer maxChunkCount ) + { + this.maxChunkCount = maxChunkCount; + return this; + } + + /** + * Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. minimum: 0 + * + * @return maxChunkCount The maxChunkCount of this {@link GroundingFilterSearchConfiguration} instance. + */ + @Nonnull + public Integer getMaxChunkCount() + { + return maxChunkCount; + } + + /** + * Set the maxChunkCount of this {@link GroundingFilterSearchConfiguration} instance. + * + * @param maxChunkCount + * Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. Minimum: 0 + */ + public void setMaxChunkCount( @Nullable final Integer maxChunkCount ) + { + this.maxChunkCount = maxChunkCount; + } + + /** + * Set the maxDocumentCount of this {@link GroundingFilterSearchConfiguration} instance and return the same + * instance. + * + * @param maxDocumentCount + * [Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. + * Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per + * document is returned. Minimum: 0 + * @return The same instance of this {@link GroundingFilterSearchConfiguration} class + */ + @Nonnull + public GroundingFilterSearchConfiguration maxDocumentCount( @Nullable final Integer maxDocumentCount ) + { + this.maxDocumentCount = maxDocumentCount; + return this; + } + + /** + * [Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used + * with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned. + * minimum: 0 + * + * @return maxDocumentCount The maxDocumentCount of this {@link GroundingFilterSearchConfiguration} instance. + */ + @Nonnull + public Integer getMaxDocumentCount() + { + return maxDocumentCount; + } + + /** + * Set the maxDocumentCount of this {@link GroundingFilterSearchConfiguration} instance. + * + * @param maxDocumentCount + * [Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. + * Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per + * document is returned. Minimum: 0 + */ + public void setMaxDocumentCount( @Nullable final Integer maxDocumentCount ) + { + this.maxDocumentCount = maxDocumentCount; + } + + /** + * Get the names of the unrecognizable properties of the {@link GroundingFilterSearchConfiguration}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link GroundingFilterSearchConfiguration} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException( + "GroundingFilterSearchConfiguration has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link GroundingFilterSearchConfiguration} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( maxChunkCount != null ) + declaredFields.put("maxChunkCount", maxChunkCount); + if( maxDocumentCount != null ) + declaredFields.put("maxDocumentCount", maxDocumentCount); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link GroundingFilterSearchConfiguration} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final GroundingFilterSearchConfiguration groundingFilterSearchConfiguration = + (GroundingFilterSearchConfiguration) o; + return Objects.equals(this.cloudSdkCustomFields, groundingFilterSearchConfiguration.cloudSdkCustomFields) + && Objects.equals(this.maxChunkCount, groundingFilterSearchConfiguration.maxChunkCount) + && Objects.equals(this.maxDocumentCount, groundingFilterSearchConfiguration.maxDocumentCount); + } + + @Override + public int hashCode() + { + return Objects.hash(maxChunkCount, maxDocumentCount, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class GroundingFilterSearchConfiguration {\n"); + sb.append(" maxChunkCount: ").append(toIndentedString(maxChunkCount)).append("\n"); + sb.append(" maxDocumentCount: ").append(toIndentedString(maxDocumentCount)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfig.java new file mode 100644 index 000000000..fe17aff6a --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfig.java @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * GroundingModuleConfig + */ + +@Beta // CHECKSTYLE:OFF +public class GroundingModuleConfig +// CHECKSTYLE:ON +{ + /** + * Gets or Sets type + */ + public enum TypeEnum + { + /** + * The DOCUMENT_GROUNDING_SERVICE option of this GroundingModuleConfig + */ + DOCUMENT_GROUNDING_SERVICE("document_grounding_service"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this GroundingModuleConfig + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type GroundingModuleConfig + */ + @JsonCreator + @Nullable + public static TypeEnum fromValue( @Nonnull final String value ) + { + for( TypeEnum b : TypeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return null; + } + } + + @JsonProperty( "type" ) + private TypeEnum type; + + @JsonProperty( "config" ) + private GroundingModuleConfigConfig config; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for GroundingModuleConfig. + */ + protected GroundingModuleConfig() + { + } + + /** + * Set the type of this {@link GroundingModuleConfig} instance and return the same instance. + * + * @param type + * The type of this {@link GroundingModuleConfig} + * @return The same instance of this {@link GroundingModuleConfig} class + */ + @Nonnull + public GroundingModuleConfig type( @Nullable final TypeEnum type ) + { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link GroundingModuleConfig} instance. + */ + @Nullable + public TypeEnum getType() + { + return type; + } + + /** + * Set the type of this {@link GroundingModuleConfig} instance. + * + * @param type + * The type of this {@link GroundingModuleConfig} + */ + public void setType( @Nullable final TypeEnum type ) + { + this.type = type; + } + + /** + * Set the config of this {@link GroundingModuleConfig} instance and return the same instance. + * + * @param config + * The config of this {@link GroundingModuleConfig} + * @return The same instance of this {@link GroundingModuleConfig} class + */ + @Nonnull + public GroundingModuleConfig config( @Nonnull final GroundingModuleConfigConfig config ) + { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config The config of this {@link GroundingModuleConfig} instance. + */ + @Nonnull + public GroundingModuleConfigConfig getConfig() + { + return config; + } + + /** + * Set the config of this {@link GroundingModuleConfig} instance. + * + * @param config + * The config of this {@link GroundingModuleConfig} + */ + public void setConfig( @Nonnull final GroundingModuleConfigConfig config ) + { + this.config = config; + } + + /** + * Get the names of the unrecognizable properties of the {@link GroundingModuleConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link GroundingModuleConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("GroundingModuleConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link GroundingModuleConfig} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( type != null ) + declaredFields.put("type", type); + if( config != null ) + declaredFields.put("config", config); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link GroundingModuleConfig} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final GroundingModuleConfig groundingModuleConfig = (GroundingModuleConfig) o; + return Objects.equals(this.cloudSdkCustomFields, groundingModuleConfig.cloudSdkCustomFields) + && Objects.equals(this.type, groundingModuleConfig.type) + && Objects.equals(this.config, groundingModuleConfig.config); + } + + @Override + public int hashCode() + { + return Objects.hash(type, config, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class GroundingModuleConfig {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfig.java new file mode 100644 index 000000000..d51035d24 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfig.java @@ -0,0 +1,323 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * GroundingModuleConfigConfig + */ + +@Beta // CHECKSTYLE:OFF +public class GroundingModuleConfigConfig +// CHECKSTYLE:ON +{ + @JsonProperty( "filters" ) + private List filters = new ArrayList<>(); + + @JsonProperty( "placeholders" ) + private GroundingModuleConfigConfigPlaceholders placeholders; + + @JsonProperty( "metadata_params" ) + private List metadataParams = new ArrayList<>(); + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for GroundingModuleConfigConfig. + */ + protected GroundingModuleConfigConfig() + { + } + + /** + * Set the filters of this {@link GroundingModuleConfigConfig} instance and return the same instance. + * + * @param filters + * Document grounding service filters to be used + * @return The same instance of this {@link GroundingModuleConfigConfig} class + */ + @Nonnull + public GroundingModuleConfigConfig filters( @Nullable final List filters ) + { + this.filters = filters; + return this; + } + + /** + * Add one filters instance to this {@link GroundingModuleConfigConfig}. + * + * @param filtersItem + * The filters that should be added + * @return The same instance of type {@link GroundingModuleConfigConfig} + */ + @Nonnull + public GroundingModuleConfigConfig addFiltersItem( + @Nonnull final GroundingModuleConfigConfigFiltersInner filtersItem ) + { + if( this.filters == null ) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + return this; + } + + /** + * Document grounding service filters to be used + * + * @return filters The filters of this {@link GroundingModuleConfigConfig} instance. + */ + @Nonnull + public List getFilters() + { + return filters; + } + + /** + * Set the filters of this {@link GroundingModuleConfigConfig} instance. + * + * @param filters + * Document grounding service filters to be used + */ + public void setFilters( @Nullable final List filters ) + { + this.filters = filters; + } + + /** + * Set the placeholders of this {@link GroundingModuleConfigConfig} instance and return the same instance. + * + * @param placeholders + * The placeholders of this {@link GroundingModuleConfigConfig} + * @return The same instance of this {@link GroundingModuleConfigConfig} class + */ + @Nonnull + public GroundingModuleConfigConfig placeholders( + @Nonnull final GroundingModuleConfigConfigPlaceholders placeholders ) + { + this.placeholders = placeholders; + return this; + } + + /** + * Get placeholders + * + * @return placeholders The placeholders of this {@link GroundingModuleConfigConfig} instance. + */ + @Nonnull + public GroundingModuleConfigConfigPlaceholders getPlaceholders() + { + return placeholders; + } + + /** + * Set the placeholders of this {@link GroundingModuleConfigConfig} instance. + * + * @param placeholders + * The placeholders of this {@link GroundingModuleConfigConfig} + */ + public void setPlaceholders( @Nonnull final GroundingModuleConfigConfigPlaceholders placeholders ) + { + this.placeholders = placeholders; + } + + /** + * Set the metadataParams of this {@link GroundingModuleConfigConfig} instance and return the same instance. + * + * @param metadataParams + * Parameter name used for specifying metadata parameters + * @return The same instance of this {@link GroundingModuleConfigConfig} class + */ + @Nonnull + public GroundingModuleConfigConfig metadataParams( @Nullable final List metadataParams ) + { + this.metadataParams = metadataParams; + return this; + } + + /** + * Add one metadataParams instance to this {@link GroundingModuleConfigConfig}. + * + * @param metadataParamsItem + * The metadataParams that should be added + * @return The same instance of type {@link GroundingModuleConfigConfig} + */ + @Nonnull + public GroundingModuleConfigConfig addMetadataParamsItem( @Nonnull final String metadataParamsItem ) + { + if( this.metadataParams == null ) { + this.metadataParams = new ArrayList<>(); + } + this.metadataParams.add(metadataParamsItem); + return this; + } + + /** + * Parameter name used for specifying metadata parameters + * + * @return metadataParams The metadataParams of this {@link GroundingModuleConfigConfig} instance. + */ + @Nonnull + public List getMetadataParams() + { + return metadataParams; + } + + /** + * Set the metadataParams of this {@link GroundingModuleConfigConfig} instance. + * + * @param metadataParams + * Parameter name used for specifying metadata parameters + */ + public void setMetadataParams( @Nullable final List metadataParams ) + { + this.metadataParams = metadataParams; + } + + /** + * Get the names of the unrecognizable properties of the {@link GroundingModuleConfigConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link GroundingModuleConfigConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("GroundingModuleConfigConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link GroundingModuleConfigConfig} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( filters != null ) + declaredFields.put("filters", filters); + if( placeholders != null ) + declaredFields.put("placeholders", placeholders); + if( metadataParams != null ) + declaredFields.put("metadataParams", metadataParams); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link GroundingModuleConfigConfig} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final GroundingModuleConfigConfig groundingModuleConfigConfig = (GroundingModuleConfigConfig) o; + return Objects.equals(this.cloudSdkCustomFields, groundingModuleConfigConfig.cloudSdkCustomFields) + && Objects.equals(this.filters, groundingModuleConfigConfig.filters) + && Objects.equals(this.placeholders, groundingModuleConfigConfig.placeholders) + && Objects.equals(this.metadataParams, groundingModuleConfigConfig.metadataParams); + } + + @Override + public int hashCode() + { + return Objects.hash(filters, placeholders, metadataParams, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class GroundingModuleConfigConfig {\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" placeholders: ").append(toIndentedString(placeholders)).append("\n"); + sb.append(" metadataParams: ").append(toIndentedString(metadataParams)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfigFiltersInner.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfigFiltersInner.java new file mode 100644 index 000000000..7108206c9 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfigFiltersInner.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.google.common.annotations.Beta; + +/** + * GroundingModuleConfigConfigFiltersInner + */ +@Beta +@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) +@JsonSubTypes( { @JsonSubTypes.Type( value = DocumentGroundingFilter.class ), } ) + +public interface GroundingModuleConfigConfigFiltersInner +{ +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfigPlaceholders.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfigPlaceholders.java new file mode 100644 index 000000000..19d4b31fc --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfigPlaceholders.java @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * Placeholders to be used for grounding input questions and output + */ + +@Beta // CHECKSTYLE:OFF +public class GroundingModuleConfigConfigPlaceholders +// CHECKSTYLE:ON +{ + @JsonProperty( "input" ) + private List input = new ArrayList<>(); + + @JsonProperty( "output" ) + private String output; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for GroundingModuleConfigConfigPlaceholders. + */ + protected GroundingModuleConfigConfigPlaceholders() + { + } + + /** + * Set the input of this {@link GroundingModuleConfigConfigPlaceholders} instance and return the same instance. + * + * @param input + * Contains the input parameters used for grounding input questions + * @return The same instance of this {@link GroundingModuleConfigConfigPlaceholders} class + */ + @Nonnull + public GroundingModuleConfigConfigPlaceholders input( @Nonnull final List input ) + { + this.input = input; + return this; + } + + /** + * Add one input instance to this {@link GroundingModuleConfigConfigPlaceholders}. + * + * @param inputItem + * The input that should be added + * @return The same instance of type {@link GroundingModuleConfigConfigPlaceholders} + */ + @Nonnull + public GroundingModuleConfigConfigPlaceholders addInputItem( @Nonnull final String inputItem ) + { + if( this.input == null ) { + this.input = new ArrayList<>(); + } + this.input.add(inputItem); + return this; + } + + /** + * Contains the input parameters used for grounding input questions + * + * @return input The input of this {@link GroundingModuleConfigConfigPlaceholders} instance. + */ + @Nonnull + public List getInput() + { + return input; + } + + /** + * Set the input of this {@link GroundingModuleConfigConfigPlaceholders} instance. + * + * @param input + * Contains the input parameters used for grounding input questions + */ + public void setInput( @Nonnull final List input ) + { + this.input = input; + } + + /** + * Set the output of this {@link GroundingModuleConfigConfigPlaceholders} instance and return the same instance. + * + * @param output + * Placeholder name for grounding output + * @return The same instance of this {@link GroundingModuleConfigConfigPlaceholders} class + */ + @Nonnull + public GroundingModuleConfigConfigPlaceholders output( @Nonnull final String output ) + { + this.output = output; + return this; + } + + /** + * Placeholder name for grounding output + * + * @return output The output of this {@link GroundingModuleConfigConfigPlaceholders} instance. + */ + @Nonnull + public String getOutput() + { + return output; + } + + /** + * Set the output of this {@link GroundingModuleConfigConfigPlaceholders} instance. + * + * @param output + * Placeholder name for grounding output + */ + public void setOutput( @Nonnull final String output ) + { + this.output = output; + } + + /** + * Get the names of the unrecognizable properties of the {@link GroundingModuleConfigConfigPlaceholders}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link GroundingModuleConfigConfigPlaceholders} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException( + "GroundingModuleConfigConfigPlaceholders has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link GroundingModuleConfigConfigPlaceholders} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( input != null ) + declaredFields.put("input", input); + if( output != null ) + declaredFields.put("output", output); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link GroundingModuleConfigConfigPlaceholders} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final GroundingModuleConfigConfigPlaceholders groundingModuleConfigConfigPlaceholders = + (GroundingModuleConfigConfigPlaceholders) o; + return Objects.equals(this.cloudSdkCustomFields, groundingModuleConfigConfigPlaceholders.cloudSdkCustomFields) + && Objects.equals(this.input, groundingModuleConfigConfigPlaceholders.input) + && Objects.equals(this.output, groundingModuleConfigConfigPlaceholders.output); + } + + @Override + public int hashCode() + { + return Objects.hash(input, output, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class GroundingModuleConfigConfigPlaceholders {\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContent.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContent.java new file mode 100644 index 000000000..a36f2d705 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContent.java @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * ImageContent + */ + +@Beta // CHECKSTYLE:OFF +public class ImageContent implements MultiChatContent +// CHECKSTYLE:ON +{ + /** + * Gets or Sets type + */ + public enum TypeEnum + { + /** + * The IMAGE_URL option of this ImageContent + */ + IMAGE_URL("image_url"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this ImageContent + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type ImageContent + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue( @Nonnull final String value ) + { + for( TypeEnum b : TypeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "type" ) + private TypeEnum type; + + @JsonProperty( "image_url" ) + private ImageContentImageUrl imageUrl; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for ImageContent. + */ + protected ImageContent() + { + } + + /** + * Set the type of this {@link ImageContent} instance and return the same instance. + * + * @param type + * The type of this {@link ImageContent} + * @return The same instance of this {@link ImageContent} class + */ + @Nonnull + public ImageContent type( @Nonnull final TypeEnum type ) + { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link ImageContent} instance. + */ + @Nonnull + public TypeEnum getType() + { + return type; + } + + /** + * Set the type of this {@link ImageContent} instance. + * + * @param type + * The type of this {@link ImageContent} + */ + public void setType( @Nonnull final TypeEnum type ) + { + this.type = type; + } + + /** + * Set the imageUrl of this {@link ImageContent} instance and return the same instance. + * + * @param imageUrl + * The imageUrl of this {@link ImageContent} + * @return The same instance of this {@link ImageContent} class + */ + @Nonnull + public ImageContent imageUrl( @Nonnull final ImageContentImageUrl imageUrl ) + { + this.imageUrl = imageUrl; + return this; + } + + /** + * Get imageUrl + * + * @return imageUrl The imageUrl of this {@link ImageContent} instance. + */ + @Nonnull + public ImageContentImageUrl getImageUrl() + { + return imageUrl; + } + + /** + * Set the imageUrl of this {@link ImageContent} instance. + * + * @param imageUrl + * The imageUrl of this {@link ImageContent} + */ + public void setImageUrl( @Nonnull final ImageContentImageUrl imageUrl ) + { + this.imageUrl = imageUrl; + } + + /** + * Get the names of the unrecognizable properties of the {@link ImageContent}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ImageContent} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("ImageContent has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ImageContent} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( type != null ) + declaredFields.put("type", type); + if( imageUrl != null ) + declaredFields.put("imageUrl", imageUrl); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ImageContent} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final ImageContent imageContent = (ImageContent) o; + return Objects.equals(this.cloudSdkCustomFields, imageContent.cloudSdkCustomFields) + && Objects.equals(this.type, imageContent.type) + && Objects.equals(this.imageUrl, imageContent.imageUrl); + } + + @Override + public int hashCode() + { + return Objects.hash(type, imageUrl, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class ImageContent {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" imageUrl: ").append(toIndentedString(imageUrl)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContentImageUrl.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContentImageUrl.java new file mode 100644 index 000000000..dcfd9bc5f --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContentImageUrl.java @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * ImageContentImageUrl + */ + +@Beta // CHECKSTYLE:OFF +public class ImageContentImageUrl +// CHECKSTYLE:ON +{ + @JsonProperty( "url" ) + private String url; + + @JsonProperty( "detail" ) + private String detail = "auto"; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for ImageContentImageUrl. + */ + protected ImageContentImageUrl() + { + } + + /** + * Set the url of this {@link ImageContentImageUrl} instance and return the same instance. + * + * @param url + * The url of this {@link ImageContentImageUrl} + * @return The same instance of this {@link ImageContentImageUrl} class + */ + @Nonnull + public ImageContentImageUrl url( @Nonnull final String url ) + { + this.url = url; + return this; + } + + /** + * Get url + * + * @return url The url of this {@link ImageContentImageUrl} instance. + */ + @Nonnull + public String getUrl() + { + return url; + } + + /** + * Set the url of this {@link ImageContentImageUrl} instance. + * + * @param url + * The url of this {@link ImageContentImageUrl} + */ + public void setUrl( @Nonnull final String url ) + { + this.url = url; + } + + /** + * Set the detail of this {@link ImageContentImageUrl} instance and return the same instance. + * + * @param detail + * The detail of this {@link ImageContentImageUrl} + * @return The same instance of this {@link ImageContentImageUrl} class + */ + @Nonnull + public ImageContentImageUrl detail( @Nullable final String detail ) + { + this.detail = detail; + return this; + } + + /** + * Get detail + * + * @return detail The detail of this {@link ImageContentImageUrl} instance. + */ + @Nonnull + public String getDetail() + { + return detail; + } + + /** + * Set the detail of this {@link ImageContentImageUrl} instance. + * + * @param detail + * The detail of this {@link ImageContentImageUrl} + */ + public void setDetail( @Nullable final String detail ) + { + this.detail = detail; + } + + /** + * Get the names of the unrecognizable properties of the {@link ImageContentImageUrl}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ImageContentImageUrl} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("ImageContentImageUrl has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ImageContentImageUrl} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( url != null ) + declaredFields.put("url", url); + if( detail != null ) + declaredFields.put("detail", detail); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ImageContentImageUrl} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final ImageContentImageUrl imageContentImageUrl = (ImageContentImageUrl) o; + return Objects.equals(this.cloudSdkCustomFields, imageContentImageUrl.cloudSdkCustomFields) + && Objects.equals(this.url, imageContentImageUrl.url) + && Objects.equals(this.detail, imageContentImageUrl.detail); + } + + @Override + public int hashCode() + { + return Objects.hash(url, detail, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class ImageContentImageUrl {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContentUrl.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContentUrl.java new file mode 100644 index 000000000..b06e269e9 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContentUrl.java @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * ImageContentUrl + */ + +@Beta // CHECKSTYLE:OFF +public class ImageContentUrl +// CHECKSTYLE:ON +{ + @JsonProperty( "url" ) + private String url; + + @JsonProperty( "detail" ) + private String detail = "auto"; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for ImageContentUrl. + */ + protected ImageContentUrl() + { + } + + /** + * Set the url of this {@link ImageContentUrl} instance and return the same instance. + * + * @param url + * The url of this {@link ImageContentUrl} + * @return The same instance of this {@link ImageContentUrl} class + */ + @Nonnull + public ImageContentUrl url( @Nonnull final String url ) + { + this.url = url; + return this; + } + + /** + * Get url + * + * @return url The url of this {@link ImageContentUrl} instance. + */ + @Nonnull + public String getUrl() + { + return url; + } + + /** + * Set the url of this {@link ImageContentUrl} instance. + * + * @param url + * The url of this {@link ImageContentUrl} + */ + public void setUrl( @Nonnull final String url ) + { + this.url = url; + } + + /** + * Set the detail of this {@link ImageContentUrl} instance and return the same instance. + * + * @param detail + * The detail of this {@link ImageContentUrl} + * @return The same instance of this {@link ImageContentUrl} class + */ + @Nonnull + public ImageContentUrl detail( @Nullable final String detail ) + { + this.detail = detail; + return this; + } + + /** + * Get detail + * + * @return detail The detail of this {@link ImageContentUrl} instance. + */ + @Nonnull + public String getDetail() + { + return detail; + } + + /** + * Set the detail of this {@link ImageContentUrl} instance. + * + * @param detail + * The detail of this {@link ImageContentUrl} + */ + public void setDetail( @Nullable final String detail ) + { + this.detail = detail; + } + + /** + * Get the names of the unrecognizable properties of the {@link ImageContentUrl}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ImageContentUrl} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("ImageContentUrl has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ImageContentUrl} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( url != null ) + declaredFields.put("url", url); + if( detail != null ) + declaredFields.put("detail", detail); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ImageContentUrl} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final ImageContentUrl imageContentUrl = (ImageContentUrl) o; + return Objects.equals(this.cloudSdkCustomFields, imageContentUrl.cloudSdkCustomFields) + && Objects.equals(this.url, imageContentUrl.url) + && Objects.equals(this.detail, imageContentUrl.detail); + } + + @Override + public int hashCode() + { + return Objects.hash(url, detail, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class ImageContentUrl {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/InputFilterConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/InputFilterConfig.java new file mode 100644 index 000000000..3bb81df8e --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/InputFilterConfig.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.google.common.annotations.Beta; + +/** + * InputFilterConfig + */ +@Beta +@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) +@JsonSubTypes( { + @JsonSubTypes.Type( value = AzureContentSafetyInputFilterConfig.class ), + @JsonSubTypes.Type( value = LlamaGuard38bFilterConfig.class ), } ) + +public interface InputFilterConfig +{ +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/InputFilteringConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/InputFilteringConfig.java new file mode 100644 index 000000000..66a973504 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/InputFilteringConfig.java @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * InputFilteringConfig + */ + +@Beta // CHECKSTYLE:OFF +public class InputFilteringConfig +// CHECKSTYLE:ON +{ + @JsonProperty( "filters" ) + private List filters = new ArrayList<>(); + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for InputFilteringConfig. + */ + protected InputFilteringConfig() + { + } + + /** + * Set the filters of this {@link InputFilteringConfig} instance and return the same instance. + * + * @param filters + * Configuration for content filtering services that should be used for the given filtering step (input + * filtering). + * @return The same instance of this {@link InputFilteringConfig} class + */ + @Nonnull + public InputFilteringConfig filters( @Nonnull final List filters ) + { + this.filters = filters; + return this; + } + + /** + * Add one filters instance to this {@link InputFilteringConfig}. + * + * @param filtersItem + * The filters that should be added + * @return The same instance of type {@link InputFilteringConfig} + */ + @Nonnull + public InputFilteringConfig addFiltersItem( @Nonnull final InputFilterConfig filtersItem ) + { + if( this.filters == null ) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + return this; + } + + /** + * Configuration for content filtering services that should be used for the given filtering step (input filtering). + * + * @return filters The filters of this {@link InputFilteringConfig} instance. + */ + @Nonnull + public List getFilters() + { + return filters; + } + + /** + * Set the filters of this {@link InputFilteringConfig} instance. + * + * @param filters + * Configuration for content filtering services that should be used for the given filtering step (input + * filtering). + */ + public void setFilters( @Nonnull final List filters ) + { + this.filters = filters; + } + + /** + * Get the names of the unrecognizable properties of the {@link InputFilteringConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link InputFilteringConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("InputFilteringConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link InputFilteringConfig} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( filters != null ) + declaredFields.put("filters", filters); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link InputFilteringConfig} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final InputFilteringConfig inputFilteringConfig = (InputFilteringConfig) o; + return Objects.equals(this.cloudSdkCustomFields, inputFilteringConfig.cloudSdkCustomFields) + && Objects.equals(this.filters, inputFilteringConfig.filters); + } + + @Override + public int hashCode() + { + return Objects.hash(filters, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class InputFilteringConfig {\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/KeyValueListPair.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/KeyValueListPair.java new file mode 100644 index 000000000..245f3d533 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/KeyValueListPair.java @@ -0,0 +1,260 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * KeyValueListPair + */ + +@Beta // CHECKSTYLE:OFF +public class KeyValueListPair +// CHECKSTYLE:ON +{ + @JsonProperty( "key" ) + private String key; + + @JsonProperty( "value" ) + private List value = new ArrayList<>(); + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for KeyValueListPair. + */ + protected KeyValueListPair() + { + } + + /** + * Set the key of this {@link KeyValueListPair} instance and return the same instance. + * + * @param key + * The key of this {@link KeyValueListPair} + * @return The same instance of this {@link KeyValueListPair} class + */ + @Nonnull + public KeyValueListPair key( @Nonnull final String key ) + { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link KeyValueListPair} instance. + */ + @Nonnull + public String getKey() + { + return key; + } + + /** + * Set the key of this {@link KeyValueListPair} instance. + * + * @param key + * The key of this {@link KeyValueListPair} + */ + public void setKey( @Nonnull final String key ) + { + this.key = key; + } + + /** + * Set the value of this {@link KeyValueListPair} instance and return the same instance. + * + * @param value + * The value of this {@link KeyValueListPair} + * @return The same instance of this {@link KeyValueListPair} class + */ + @Nonnull + public KeyValueListPair value( @Nonnull final List value ) + { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link KeyValueListPair}. + * + * @param valueItem + * The value that should be added + * @return The same instance of type {@link KeyValueListPair} + */ + @Nonnull + public KeyValueListPair addValueItem( @Nonnull final String valueItem ) + { + if( this.value == null ) { + this.value = new ArrayList<>(); + } + this.value.add(valueItem); + return this; + } + + /** + * Get value + * + * @return value The value of this {@link KeyValueListPair} instance. + */ + @Nonnull + public List getValue() + { + return value; + } + + /** + * Set the value of this {@link KeyValueListPair} instance. + * + * @param value + * The value of this {@link KeyValueListPair} + */ + public void setValue( @Nonnull final List value ) + { + this.value = value; + } + + /** + * Get the names of the unrecognizable properties of the {@link KeyValueListPair}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link KeyValueListPair} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("KeyValueListPair has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link KeyValueListPair} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( key != null ) + declaredFields.put("key", key); + if( value != null ) + declaredFields.put("value", value); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link KeyValueListPair} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final KeyValueListPair keyValueListPair = (KeyValueListPair) o; + return Objects.equals(this.cloudSdkCustomFields, keyValueListPair.cloudSdkCustomFields) + && Objects.equals(this.key, keyValueListPair.key) + && Objects.equals(this.value, keyValueListPair.value); + } + + @Override + public int hashCode() + { + return Objects.hash(key, value, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class KeyValueListPair {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LLMModelDetails.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LLMModelDetails.java new file mode 100644 index 000000000..c5ce5e330 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LLMModelDetails.java @@ -0,0 +1,397 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * The model and parameters to be used for the prompt templating. This is the model that will be used to generate the + * response. + */ + +@Beta // CHECKSTYLE:OFF +public class LLMModelDetails +// CHECKSTYLE:ON +{ + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "version" ) + private String version = "latest"; + + @JsonProperty( "params" ) + private Map params = new HashMap<>(); + + @JsonProperty( "timeout" ) + private Integer timeout = 600; + + @JsonProperty( "max_retries" ) + private Integer maxRetries = 2; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for LLMModelDetails. + */ + protected LLMModelDetails() + { + } + + /** + * Set the name of this {@link LLMModelDetails} instance and return the same instance. + * + * @param name + * Name of the model as in LLM Access configuration + * @return The same instance of this {@link LLMModelDetails} class + */ + @Nonnull + public LLMModelDetails name( @Nonnull final String name ) + { + this.name = name; + return this; + } + + /** + * Name of the model as in LLM Access configuration + * + * @return name The name of this {@link LLMModelDetails} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link LLMModelDetails} instance. + * + * @param name + * Name of the model as in LLM Access configuration + */ + public void setName( @Nonnull final String name ) + { + this.name = name; + } + + /** + * Set the version of this {@link LLMModelDetails} instance and return the same instance. + * + * @param version + * Version of the model to be used + * @return The same instance of this {@link LLMModelDetails} class + */ + @Nonnull + public LLMModelDetails version( @Nullable final String version ) + { + this.version = version; + return this; + } + + /** + * Version of the model to be used + * + * @return version The version of this {@link LLMModelDetails} instance. + */ + @Nonnull + public String getVersion() + { + return version; + } + + /** + * Set the version of this {@link LLMModelDetails} instance. + * + * @param version + * Version of the model to be used + */ + public void setVersion( @Nullable final String version ) + { + this.version = version; + } + + /** + * Set the params of this {@link LLMModelDetails} instance and return the same instance. + * + * @param params + * Additional parameters for the model. Default values are used for mandatory parameters. + * @return The same instance of this {@link LLMModelDetails} class + */ + @Nonnull + public LLMModelDetails params( @Nullable final Map params ) + { + this.params = params; + return this; + } + + /** + * Put one params instance to this {@link LLMModelDetails} instance. + * + * @param key + * The String key of this params instance + * @param paramsItem + * The params that should be added under the given key + * @return The same instance of type {@link LLMModelDetails} + */ + @Nonnull + public LLMModelDetails putparamsItem( @Nonnull final String key, @Nullable final Object paramsItem ) + { + if( this.params == null ) { + this.params = new HashMap<>(); + } + this.params.put(key, paramsItem); + return this; + } + + /** + * Additional parameters for the model. Default values are used for mandatory parameters. + * + * @return params The params of this {@link LLMModelDetails} instance. + */ + @Nonnull + public Map getParams() + { + return params; + } + + /** + * Set the params of this {@link LLMModelDetails} instance. + * + * @param params + * Additional parameters for the model. Default values are used for mandatory parameters. + */ + public void setParams( @Nullable final Map params ) + { + this.params = params; + } + + /** + * Set the timeout of this {@link LLMModelDetails} instance and return the same instance. + * + * @param timeout + * Timeout for the LLM request in seconds. This parameter is currently ignored for Vertex AI models. + * Minimum: 1 Maximum: 600 + * @return The same instance of this {@link LLMModelDetails} class + */ + @Nonnull + public LLMModelDetails timeout( @Nullable final Integer timeout ) + { + this.timeout = timeout; + return this; + } + + /** + * Timeout for the LLM request in seconds. This parameter is currently ignored for Vertex AI models. minimum: 1 + * maximum: 600 + * + * @return timeout The timeout of this {@link LLMModelDetails} instance. + */ + @Nonnull + public Integer getTimeout() + { + return timeout; + } + + /** + * Set the timeout of this {@link LLMModelDetails} instance. + * + * @param timeout + * Timeout for the LLM request in seconds. This parameter is currently ignored for Vertex AI models. + * Minimum: 1 Maximum: 600 + */ + public void setTimeout( @Nullable final Integer timeout ) + { + this.timeout = timeout; + } + + /** + * Set the maxRetries of this {@link LLMModelDetails} instance and return the same instance. + * + * @param maxRetries + * Maximum number of retries for the LLM request. This parameter is currently ignored for Vertex AI + * models. Minimum: 0 Maximum: 5 + * @return The same instance of this {@link LLMModelDetails} class + */ + @Nonnull + public LLMModelDetails maxRetries( @Nullable final Integer maxRetries ) + { + this.maxRetries = maxRetries; + return this; + } + + /** + * Maximum number of retries for the LLM request. This parameter is currently ignored for Vertex AI models. minimum: + * 0 maximum: 5 + * + * @return maxRetries The maxRetries of this {@link LLMModelDetails} instance. + */ + @Nonnull + public Integer getMaxRetries() + { + return maxRetries; + } + + /** + * Set the maxRetries of this {@link LLMModelDetails} instance. + * + * @param maxRetries + * Maximum number of retries for the LLM request. This parameter is currently ignored for Vertex AI + * models. Minimum: 0 Maximum: 5 + */ + public void setMaxRetries( @Nullable final Integer maxRetries ) + { + this.maxRetries = maxRetries; + } + + /** + * Get the names of the unrecognizable properties of the {@link LLMModelDetails}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link LLMModelDetails} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("LLMModelDetails has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link LLMModelDetails} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( name != null ) + declaredFields.put("name", name); + if( version != null ) + declaredFields.put("version", version); + if( params != null ) + declaredFields.put("params", params); + if( timeout != null ) + declaredFields.put("timeout", timeout); + if( maxRetries != null ) + declaredFields.put("maxRetries", maxRetries); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link LLMModelDetails} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final LLMModelDetails llMModelDetails = (LLMModelDetails) o; + return Objects.equals(this.cloudSdkCustomFields, llMModelDetails.cloudSdkCustomFields) + && Objects.equals(this.name, llMModelDetails.name) + && Objects.equals(this.version, llMModelDetails.version) + && Objects.equals(this.params, llMModelDetails.params) + && Objects.equals(this.timeout, llMModelDetails.timeout) + && Objects.equals(this.maxRetries, llMModelDetails.maxRetries); + } + + @Override + public int hashCode() + { + return Objects.hash(name, version, params, timeout, maxRetries, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class LLMModelDetails {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append(" timeout: ").append(toIndentedString(timeout)).append("\n"); + sb.append(" maxRetries: ").append(toIndentedString(maxRetries)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LlamaGuard38b.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LlamaGuard38b.java new file mode 100644 index 000000000..8d2a41130 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LlamaGuard38b.java @@ -0,0 +1,773 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * Filter configuration for Llama Guard 3 8B + */ + +@Beta // CHECKSTYLE:OFF +public class LlamaGuard38b +// CHECKSTYLE:ON +{ + @JsonProperty( "violent_crimes" ) + private Boolean violentCrimes; + + @JsonProperty( "non_violent_crimes" ) + private Boolean nonViolentCrimes; + + @JsonProperty( "sex_crimes" ) + private Boolean sexCrimes; + + @JsonProperty( "child_exploitation" ) + private Boolean childExploitation; + + @JsonProperty( "defamation" ) + private Boolean defamation; + + @JsonProperty( "specialized_advice" ) + private Boolean specializedAdvice; + + @JsonProperty( "privacy" ) + private Boolean privacy; + + @JsonProperty( "intellectual_property" ) + private Boolean intellectualProperty; + + @JsonProperty( "indiscriminate_weapons" ) + private Boolean indiscriminateWeapons; + + @JsonProperty( "hate" ) + private Boolean hate; + + @JsonProperty( "self_harm" ) + private Boolean selfHarm; + + @JsonProperty( "sexual_content" ) + private Boolean sexualContent; + + @JsonProperty( "elections" ) + private Boolean elections; + + @JsonProperty( "code_interpreter_abuse" ) + private Boolean codeInterpreterAbuse; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for LlamaGuard38b. + */ + protected LlamaGuard38b() + { + } + + /** + * Set the violentCrimes of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param violentCrimes + * The violentCrimes of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b violentCrimes( @Nullable final Boolean violentCrimes ) + { + this.violentCrimes = violentCrimes; + return this; + } + + /** + * Get violentCrimes + * + * @return violentCrimes The violentCrimes of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isViolentCrimes() + { + return violentCrimes; + } + + /** + * Set the violentCrimes of this {@link LlamaGuard38b} instance. + * + * @param violentCrimes + * The violentCrimes of this {@link LlamaGuard38b} + */ + public void setViolentCrimes( @Nullable final Boolean violentCrimes ) + { + this.violentCrimes = violentCrimes; + } + + /** + * Set the nonViolentCrimes of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param nonViolentCrimes + * The nonViolentCrimes of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b nonViolentCrimes( @Nullable final Boolean nonViolentCrimes ) + { + this.nonViolentCrimes = nonViolentCrimes; + return this; + } + + /** + * Get nonViolentCrimes + * + * @return nonViolentCrimes The nonViolentCrimes of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isNonViolentCrimes() + { + return nonViolentCrimes; + } + + /** + * Set the nonViolentCrimes of this {@link LlamaGuard38b} instance. + * + * @param nonViolentCrimes + * The nonViolentCrimes of this {@link LlamaGuard38b} + */ + public void setNonViolentCrimes( @Nullable final Boolean nonViolentCrimes ) + { + this.nonViolentCrimes = nonViolentCrimes; + } + + /** + * Set the sexCrimes of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param sexCrimes + * The sexCrimes of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b sexCrimes( @Nullable final Boolean sexCrimes ) + { + this.sexCrimes = sexCrimes; + return this; + } + + /** + * Get sexCrimes + * + * @return sexCrimes The sexCrimes of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isSexCrimes() + { + return sexCrimes; + } + + /** + * Set the sexCrimes of this {@link LlamaGuard38b} instance. + * + * @param sexCrimes + * The sexCrimes of this {@link LlamaGuard38b} + */ + public void setSexCrimes( @Nullable final Boolean sexCrimes ) + { + this.sexCrimes = sexCrimes; + } + + /** + * Set the childExploitation of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param childExploitation + * The childExploitation of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b childExploitation( @Nullable final Boolean childExploitation ) + { + this.childExploitation = childExploitation; + return this; + } + + /** + * Get childExploitation + * + * @return childExploitation The childExploitation of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isChildExploitation() + { + return childExploitation; + } + + /** + * Set the childExploitation of this {@link LlamaGuard38b} instance. + * + * @param childExploitation + * The childExploitation of this {@link LlamaGuard38b} + */ + public void setChildExploitation( @Nullable final Boolean childExploitation ) + { + this.childExploitation = childExploitation; + } + + /** + * Set the defamation of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param defamation + * The defamation of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b defamation( @Nullable final Boolean defamation ) + { + this.defamation = defamation; + return this; + } + + /** + * Get defamation + * + * @return defamation The defamation of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isDefamation() + { + return defamation; + } + + /** + * Set the defamation of this {@link LlamaGuard38b} instance. + * + * @param defamation + * The defamation of this {@link LlamaGuard38b} + */ + public void setDefamation( @Nullable final Boolean defamation ) + { + this.defamation = defamation; + } + + /** + * Set the specializedAdvice of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param specializedAdvice + * The specializedAdvice of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b specializedAdvice( @Nullable final Boolean specializedAdvice ) + { + this.specializedAdvice = specializedAdvice; + return this; + } + + /** + * Get specializedAdvice + * + * @return specializedAdvice The specializedAdvice of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isSpecializedAdvice() + { + return specializedAdvice; + } + + /** + * Set the specializedAdvice of this {@link LlamaGuard38b} instance. + * + * @param specializedAdvice + * The specializedAdvice of this {@link LlamaGuard38b} + */ + public void setSpecializedAdvice( @Nullable final Boolean specializedAdvice ) + { + this.specializedAdvice = specializedAdvice; + } + + /** + * Set the privacy of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param privacy + * The privacy of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b privacy( @Nullable final Boolean privacy ) + { + this.privacy = privacy; + return this; + } + + /** + * Get privacy + * + * @return privacy The privacy of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isPrivacy() + { + return privacy; + } + + /** + * Set the privacy of this {@link LlamaGuard38b} instance. + * + * @param privacy + * The privacy of this {@link LlamaGuard38b} + */ + public void setPrivacy( @Nullable final Boolean privacy ) + { + this.privacy = privacy; + } + + /** + * Set the intellectualProperty of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param intellectualProperty + * The intellectualProperty of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b intellectualProperty( @Nullable final Boolean intellectualProperty ) + { + this.intellectualProperty = intellectualProperty; + return this; + } + + /** + * Get intellectualProperty + * + * @return intellectualProperty The intellectualProperty of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isIntellectualProperty() + { + return intellectualProperty; + } + + /** + * Set the intellectualProperty of this {@link LlamaGuard38b} instance. + * + * @param intellectualProperty + * The intellectualProperty of this {@link LlamaGuard38b} + */ + public void setIntellectualProperty( @Nullable final Boolean intellectualProperty ) + { + this.intellectualProperty = intellectualProperty; + } + + /** + * Set the indiscriminateWeapons of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param indiscriminateWeapons + * The indiscriminateWeapons of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b indiscriminateWeapons( @Nullable final Boolean indiscriminateWeapons ) + { + this.indiscriminateWeapons = indiscriminateWeapons; + return this; + } + + /** + * Get indiscriminateWeapons + * + * @return indiscriminateWeapons The indiscriminateWeapons of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isIndiscriminateWeapons() + { + return indiscriminateWeapons; + } + + /** + * Set the indiscriminateWeapons of this {@link LlamaGuard38b} instance. + * + * @param indiscriminateWeapons + * The indiscriminateWeapons of this {@link LlamaGuard38b} + */ + public void setIndiscriminateWeapons( @Nullable final Boolean indiscriminateWeapons ) + { + this.indiscriminateWeapons = indiscriminateWeapons; + } + + /** + * Set the hate of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param hate + * The hate of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b hate( @Nullable final Boolean hate ) + { + this.hate = hate; + return this; + } + + /** + * Get hate + * + * @return hate The hate of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isHate() + { + return hate; + } + + /** + * Set the hate of this {@link LlamaGuard38b} instance. + * + * @param hate + * The hate of this {@link LlamaGuard38b} + */ + public void setHate( @Nullable final Boolean hate ) + { + this.hate = hate; + } + + /** + * Set the selfHarm of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param selfHarm + * The selfHarm of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b selfHarm( @Nullable final Boolean selfHarm ) + { + this.selfHarm = selfHarm; + return this; + } + + /** + * Get selfHarm + * + * @return selfHarm The selfHarm of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isSelfHarm() + { + return selfHarm; + } + + /** + * Set the selfHarm of this {@link LlamaGuard38b} instance. + * + * @param selfHarm + * The selfHarm of this {@link LlamaGuard38b} + */ + public void setSelfHarm( @Nullable final Boolean selfHarm ) + { + this.selfHarm = selfHarm; + } + + /** + * Set the sexualContent of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param sexualContent + * The sexualContent of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b sexualContent( @Nullable final Boolean sexualContent ) + { + this.sexualContent = sexualContent; + return this; + } + + /** + * Get sexualContent + * + * @return sexualContent The sexualContent of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isSexualContent() + { + return sexualContent; + } + + /** + * Set the sexualContent of this {@link LlamaGuard38b} instance. + * + * @param sexualContent + * The sexualContent of this {@link LlamaGuard38b} + */ + public void setSexualContent( @Nullable final Boolean sexualContent ) + { + this.sexualContent = sexualContent; + } + + /** + * Set the elections of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param elections + * The elections of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b elections( @Nullable final Boolean elections ) + { + this.elections = elections; + return this; + } + + /** + * Get elections + * + * @return elections The elections of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isElections() + { + return elections; + } + + /** + * Set the elections of this {@link LlamaGuard38b} instance. + * + * @param elections + * The elections of this {@link LlamaGuard38b} + */ + public void setElections( @Nullable final Boolean elections ) + { + this.elections = elections; + } + + /** + * Set the codeInterpreterAbuse of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param codeInterpreterAbuse + * The codeInterpreterAbuse of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b codeInterpreterAbuse( @Nullable final Boolean codeInterpreterAbuse ) + { + this.codeInterpreterAbuse = codeInterpreterAbuse; + return this; + } + + /** + * Get codeInterpreterAbuse + * + * @return codeInterpreterAbuse The codeInterpreterAbuse of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isCodeInterpreterAbuse() + { + return codeInterpreterAbuse; + } + + /** + * Set the codeInterpreterAbuse of this {@link LlamaGuard38b} instance. + * + * @param codeInterpreterAbuse + * The codeInterpreterAbuse of this {@link LlamaGuard38b} + */ + public void setCodeInterpreterAbuse( @Nullable final Boolean codeInterpreterAbuse ) + { + this.codeInterpreterAbuse = codeInterpreterAbuse; + } + + /** + * Get the names of the unrecognizable properties of the {@link LlamaGuard38b}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link LlamaGuard38b} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("LlamaGuard38b has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link LlamaGuard38b} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( violentCrimes != null ) + declaredFields.put("violentCrimes", violentCrimes); + if( nonViolentCrimes != null ) + declaredFields.put("nonViolentCrimes", nonViolentCrimes); + if( sexCrimes != null ) + declaredFields.put("sexCrimes", sexCrimes); + if( childExploitation != null ) + declaredFields.put("childExploitation", childExploitation); + if( defamation != null ) + declaredFields.put("defamation", defamation); + if( specializedAdvice != null ) + declaredFields.put("specializedAdvice", specializedAdvice); + if( privacy != null ) + declaredFields.put("privacy", privacy); + if( intellectualProperty != null ) + declaredFields.put("intellectualProperty", intellectualProperty); + if( indiscriminateWeapons != null ) + declaredFields.put("indiscriminateWeapons", indiscriminateWeapons); + if( hate != null ) + declaredFields.put("hate", hate); + if( selfHarm != null ) + declaredFields.put("selfHarm", selfHarm); + if( sexualContent != null ) + declaredFields.put("sexualContent", sexualContent); + if( elections != null ) + declaredFields.put("elections", elections); + if( codeInterpreterAbuse != null ) + declaredFields.put("codeInterpreterAbuse", codeInterpreterAbuse); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link LlamaGuard38b} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final LlamaGuard38b llamaGuard38b = (LlamaGuard38b) o; + return Objects.equals(this.cloudSdkCustomFields, llamaGuard38b.cloudSdkCustomFields) + && Objects.equals(this.violentCrimes, llamaGuard38b.violentCrimes) + && Objects.equals(this.nonViolentCrimes, llamaGuard38b.nonViolentCrimes) + && Objects.equals(this.sexCrimes, llamaGuard38b.sexCrimes) + && Objects.equals(this.childExploitation, llamaGuard38b.childExploitation) + && Objects.equals(this.defamation, llamaGuard38b.defamation) + && Objects.equals(this.specializedAdvice, llamaGuard38b.specializedAdvice) + && Objects.equals(this.privacy, llamaGuard38b.privacy) + && Objects.equals(this.intellectualProperty, llamaGuard38b.intellectualProperty) + && Objects.equals(this.indiscriminateWeapons, llamaGuard38b.indiscriminateWeapons) + && Objects.equals(this.hate, llamaGuard38b.hate) + && Objects.equals(this.selfHarm, llamaGuard38b.selfHarm) + && Objects.equals(this.sexualContent, llamaGuard38b.sexualContent) + && Objects.equals(this.elections, llamaGuard38b.elections) + && Objects.equals(this.codeInterpreterAbuse, llamaGuard38b.codeInterpreterAbuse); + } + + @Override + public int hashCode() + { + return Objects + .hash( + violentCrimes, + nonViolentCrimes, + sexCrimes, + childExploitation, + defamation, + specializedAdvice, + privacy, + intellectualProperty, + indiscriminateWeapons, + hate, + selfHarm, + sexualContent, + elections, + codeInterpreterAbuse, + cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class LlamaGuard38b {\n"); + sb.append(" violentCrimes: ").append(toIndentedString(violentCrimes)).append("\n"); + sb.append(" nonViolentCrimes: ").append(toIndentedString(nonViolentCrimes)).append("\n"); + sb.append(" sexCrimes: ").append(toIndentedString(sexCrimes)).append("\n"); + sb.append(" childExploitation: ").append(toIndentedString(childExploitation)).append("\n"); + sb.append(" defamation: ").append(toIndentedString(defamation)).append("\n"); + sb.append(" specializedAdvice: ").append(toIndentedString(specializedAdvice)).append("\n"); + sb.append(" privacy: ").append(toIndentedString(privacy)).append("\n"); + sb.append(" intellectualProperty: ").append(toIndentedString(intellectualProperty)).append("\n"); + sb.append(" indiscriminateWeapons: ").append(toIndentedString(indiscriminateWeapons)).append("\n"); + sb.append(" hate: ").append(toIndentedString(hate)).append("\n"); + sb.append(" selfHarm: ").append(toIndentedString(selfHarm)).append("\n"); + sb.append(" sexualContent: ").append(toIndentedString(sexualContent)).append("\n"); + sb.append(" elections: ").append(toIndentedString(elections)).append("\n"); + sb.append(" codeInterpreterAbuse: ").append(toIndentedString(codeInterpreterAbuse)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LlamaGuard38bFilterConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LlamaGuard38bFilterConfig.java new file mode 100644 index 000000000..dcd3b3c94 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LlamaGuard38bFilterConfig.java @@ -0,0 +1,310 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * LlamaGuard38bFilterConfig + */ + +@Beta // CHECKSTYLE:OFF +public class LlamaGuard38bFilterConfig implements InputFilterConfig, OutputFilterConfig +// CHECKSTYLE:ON +{ + /** + * Name of the filter provider type + */ + public enum TypeEnum + { + /** + * The LLAMA_GUARD_3_8B option of this LlamaGuard38bFilterConfig + */ + LLAMA_GUARD_3_8B("llama_guard_3_8b"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this LlamaGuard38bFilterConfig + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type LlamaGuard38bFilterConfig + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue( @Nonnull final String value ) + { + for( TypeEnum b : TypeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "type" ) + private TypeEnum type; + + @JsonProperty( "config" ) + private LlamaGuard38b config; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for LlamaGuard38bFilterConfig. + */ + protected LlamaGuard38bFilterConfig() + { + } + + /** + * Set the type of this {@link LlamaGuard38bFilterConfig} instance and return the same instance. + * + * @param type + * Name of the filter provider type + * @return The same instance of this {@link LlamaGuard38bFilterConfig} class + */ + @Nonnull + public LlamaGuard38bFilterConfig type( @Nonnull final TypeEnum type ) + { + this.type = type; + return this; + } + + /** + * Name of the filter provider type + * + * @return type The type of this {@link LlamaGuard38bFilterConfig} instance. + */ + @Nonnull + public TypeEnum getType() + { + return type; + } + + /** + * Set the type of this {@link LlamaGuard38bFilterConfig} instance. + * + * @param type + * Name of the filter provider type + */ + public void setType( @Nonnull final TypeEnum type ) + { + this.type = type; + } + + /** + * Set the config of this {@link LlamaGuard38bFilterConfig} instance and return the same instance. + * + * @param config + * The config of this {@link LlamaGuard38bFilterConfig} + * @return The same instance of this {@link LlamaGuard38bFilterConfig} class + */ + @Nonnull + public LlamaGuard38bFilterConfig config( @Nonnull final LlamaGuard38b config ) + { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config The config of this {@link LlamaGuard38bFilterConfig} instance. + */ + @Nonnull + public LlamaGuard38b getConfig() + { + return config; + } + + /** + * Set the config of this {@link LlamaGuard38bFilterConfig} instance. + * + * @param config + * The config of this {@link LlamaGuard38bFilterConfig} + */ + public void setConfig( @Nonnull final LlamaGuard38b config ) + { + this.config = config; + } + + /** + * Get the names of the unrecognizable properties of the {@link LlamaGuard38bFilterConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link LlamaGuard38bFilterConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("LlamaGuard38bFilterConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link LlamaGuard38bFilterConfig} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( type != null ) + declaredFields.put("type", type); + if( config != null ) + declaredFields.put("config", config); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link LlamaGuard38bFilterConfig} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final LlamaGuard38bFilterConfig llamaGuard38bFilterConfig = (LlamaGuard38bFilterConfig) o; + return Objects.equals(this.cloudSdkCustomFields, llamaGuard38bFilterConfig.cloudSdkCustomFields) + && Objects.equals(this.type, llamaGuard38bFilterConfig.type) + && Objects.equals(this.config, llamaGuard38bFilterConfig.config); + } + + @Override + public int hashCode() + { + return Objects.hash(type, config, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class LlamaGuard38bFilterConfig {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfig.java new file mode 100644 index 000000000..2a4474192 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfig.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.google.common.annotations.Beta; + +/** + * MaskingModuleConfig + */ +@Beta +@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) +@JsonSubTypes( { + @JsonSubTypes.Type( value = MaskingModuleConfigMaskingProviders.class ), + @JsonSubTypes.Type( value = MaskingModuleConfigProviders.class ), } ) + +public interface MaskingModuleConfig +{ +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfigMaskingProviders.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfigMaskingProviders.java new file mode 100644 index 000000000..6ec620150 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfigMaskingProviders.java @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * MaskingModuleConfigMaskingProviders + */ + +@Beta // CHECKSTYLE:OFF +public class MaskingModuleConfigMaskingProviders implements MaskingModuleConfig +// CHECKSTYLE:ON +{ + @JsonProperty( "masking_providers" ) + private List maskingProviders = new ArrayList<>(); + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for MaskingModuleConfigMaskingProviders. + */ + protected MaskingModuleConfigMaskingProviders() + { + } + + /** + * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance and return the same + * instance. + * + * @param maskingProviders + * List of masking service providers. **DEPRECATED**: will be removed Sept 15, 2026. Use + * `providers` property instead. + * @return The same instance of this {@link MaskingModuleConfigMaskingProviders} class + */ + @Nonnull + public MaskingModuleConfigMaskingProviders maskingProviders( @Nonnull final List maskingProviders ) + { + this.maskingProviders = maskingProviders; + return this; + } + + /** + * Add one maskingProviders instance to this {@link MaskingModuleConfigMaskingProviders}. + * + * @param maskingProvidersItem + * The maskingProviders that should be added + * @return The same instance of type {@link MaskingModuleConfigMaskingProviders} + */ + @Nonnull + public MaskingModuleConfigMaskingProviders addMaskingProvidersItem( @Nonnull final DPIConfig maskingProvidersItem ) + { + if( this.maskingProviders == null ) { + this.maskingProviders = new ArrayList<>(); + } + this.maskingProviders.add(maskingProvidersItem); + return this; + } + + /** + * List of masking service providers. **DEPRECATED**: will be removed Sept 15, 2026. Use `providers` + * property instead. + * + * @return maskingProviders The maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance. + * @deprecated + */ + @Deprecated + @Nonnull + public List getMaskingProviders() + { + return maskingProviders; + } + + /** + * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance. + * + * @param maskingProviders + * List of masking service providers. **DEPRECATED**: will be removed Sept 15, 2026. Use + * `providers` property instead. + */ + public void setMaskingProviders( @Nonnull final List maskingProviders ) + { + this.maskingProviders = maskingProviders; + } + + /** + * Get the names of the unrecognizable properties of the {@link MaskingModuleConfigMaskingProviders}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MaskingModuleConfigMaskingProviders} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException( + "MaskingModuleConfigMaskingProviders has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MaskingModuleConfigMaskingProviders} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( maskingProviders != null ) + declaredFields.put("maskingProviders", maskingProviders); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MaskingModuleConfigMaskingProviders} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final MaskingModuleConfigMaskingProviders maskingModuleConfigMaskingProviders = + (MaskingModuleConfigMaskingProviders) o; + return Objects.equals(this.cloudSdkCustomFields, maskingModuleConfigMaskingProviders.cloudSdkCustomFields) + && Objects.equals(this.maskingProviders, maskingModuleConfigMaskingProviders.maskingProviders); + } + + @Override + public int hashCode() + { + return Objects.hash(maskingProviders, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class MaskingModuleConfigMaskingProviders {\n"); + sb.append(" maskingProviders: ").append(toIndentedString(maskingProviders)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfigProviders.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfigProviders.java new file mode 100644 index 000000000..8465d3086 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfigProviders.java @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * MaskingModuleConfigProviders + */ + +@Beta // CHECKSTYLE:OFF +public class MaskingModuleConfigProviders implements MaskingModuleConfig +// CHECKSTYLE:ON +{ + @JsonProperty( "providers" ) + private List providers = new ArrayList<>(); + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for MaskingModuleConfigProviders. + */ + protected MaskingModuleConfigProviders() + { + } + + /** + * Set the providers of this {@link MaskingModuleConfigProviders} instance and return the same instance. + * + * @param providers + * List of masking service providers + * @return The same instance of this {@link MaskingModuleConfigProviders} class + */ + @Nonnull + public MaskingModuleConfigProviders providers( @Nonnull final List providers ) + { + this.providers = providers; + return this; + } + + /** + * Add one providers instance to this {@link MaskingModuleConfigProviders}. + * + * @param providersItem + * The providers that should be added + * @return The same instance of type {@link MaskingModuleConfigProviders} + */ + @Nonnull + public MaskingModuleConfigProviders addProvidersItem( @Nonnull final DPIConfig providersItem ) + { + if( this.providers == null ) { + this.providers = new ArrayList<>(); + } + this.providers.add(providersItem); + return this; + } + + /** + * List of masking service providers + * + * @return providers The providers of this {@link MaskingModuleConfigProviders} instance. + */ + @Nonnull + public List getProviders() + { + return providers; + } + + /** + * Set the providers of this {@link MaskingModuleConfigProviders} instance. + * + * @param providers + * List of masking service providers + */ + public void setProviders( @Nonnull final List providers ) + { + this.providers = providers; + } + + /** + * Get the names of the unrecognizable properties of the {@link MaskingModuleConfigProviders}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MaskingModuleConfigProviders} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("MaskingModuleConfigProviders has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MaskingModuleConfigProviders} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( providers != null ) + declaredFields.put("providers", providers); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MaskingModuleConfigProviders} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final MaskingModuleConfigProviders maskingModuleConfigProviders = (MaskingModuleConfigProviders) o; + return Objects.equals(this.cloudSdkCustomFields, maskingModuleConfigProviders.cloudSdkCustomFields) + && Objects.equals(this.providers, maskingModuleConfigProviders.providers); + } + + @Override + public int hashCode() + { + return Objects.hash(providers, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class MaskingModuleConfigProviders {\n"); + sb.append(" providers: ").append(toIndentedString(providers)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MessageToolCall.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MessageToolCall.java new file mode 100644 index 000000000..54c929f92 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MessageToolCall.java @@ -0,0 +1,352 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * MessageToolCall + */ + +@Beta // CHECKSTYLE:OFF +public class MessageToolCall +// CHECKSTYLE:ON +{ + @JsonProperty( "id" ) + private String id; + + /** + * The type of the tool. Currently, only `function` is supported. + */ + public enum TypeEnum + { + /** + * The FUNCTION option of this MessageToolCall + */ + FUNCTION("function"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this MessageToolCall + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type MessageToolCall + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue( @Nonnull final String value ) + { + for( TypeEnum b : TypeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "type" ) + private TypeEnum type; + + @JsonProperty( "function" ) + private MessageToolCallFunction function; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for MessageToolCall. + */ + protected MessageToolCall() + { + } + + /** + * Set the id of this {@link MessageToolCall} instance and return the same instance. + * + * @param id + * The ID of the tool call. + * @return The same instance of this {@link MessageToolCall} class + */ + @Nonnull + public MessageToolCall id( @Nonnull final String id ) + { + this.id = id; + return this; + } + + /** + * The ID of the tool call. + * + * @return id The id of this {@link MessageToolCall} instance. + */ + @Nonnull + public String getId() + { + return id; + } + + /** + * Set the id of this {@link MessageToolCall} instance. + * + * @param id + * The ID of the tool call. + */ + public void setId( @Nonnull final String id ) + { + this.id = id; + } + + /** + * Set the type of this {@link MessageToolCall} instance and return the same instance. + * + * @param type + * The type of the tool. Currently, only `function` is supported. + * @return The same instance of this {@link MessageToolCall} class + */ + @Nonnull + public MessageToolCall type( @Nonnull final TypeEnum type ) + { + this.type = type; + return this; + } + + /** + * The type of the tool. Currently, only `function` is supported. + * + * @return type The type of this {@link MessageToolCall} instance. + */ + @Nonnull + public TypeEnum getType() + { + return type; + } + + /** + * Set the type of this {@link MessageToolCall} instance. + * + * @param type + * The type of the tool. Currently, only `function` is supported. + */ + public void setType( @Nonnull final TypeEnum type ) + { + this.type = type; + } + + /** + * Set the function of this {@link MessageToolCall} instance and return the same instance. + * + * @param function + * The function of this {@link MessageToolCall} + * @return The same instance of this {@link MessageToolCall} class + */ + @Nonnull + public MessageToolCall function( @Nonnull final MessageToolCallFunction function ) + { + this.function = function; + return this; + } + + /** + * Get function + * + * @return function The function of this {@link MessageToolCall} instance. + */ + @Nonnull + public MessageToolCallFunction getFunction() + { + return function; + } + + /** + * Set the function of this {@link MessageToolCall} instance. + * + * @param function + * The function of this {@link MessageToolCall} + */ + public void setFunction( @Nonnull final MessageToolCallFunction function ) + { + this.function = function; + } + + /** + * Get the names of the unrecognizable properties of the {@link MessageToolCall}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MessageToolCall} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("MessageToolCall has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MessageToolCall} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( id != null ) + declaredFields.put("id", id); + if( type != null ) + declaredFields.put("type", type); + if( function != null ) + declaredFields.put("function", function); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MessageToolCall} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final MessageToolCall messageToolCall = (MessageToolCall) o; + return Objects.equals(this.cloudSdkCustomFields, messageToolCall.cloudSdkCustomFields) + && Objects.equals(this.id, messageToolCall.id) + && Objects.equals(this.type, messageToolCall.type) + && Objects.equals(this.function, messageToolCall.function); + } + + @Override + public int hashCode() + { + return Objects.hash(id, type, function, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class MessageToolCall {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" function: ").append(toIndentedString(function)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MessageToolCallFunction.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MessageToolCallFunction.java new file mode 100644 index 000000000..e6bd2178a --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MessageToolCallFunction.java @@ -0,0 +1,248 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * The function that the model called. + */ + +@Beta // CHECKSTYLE:OFF +public class MessageToolCallFunction +// CHECKSTYLE:ON +{ + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "arguments" ) + private String arguments; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for MessageToolCallFunction. + */ + protected MessageToolCallFunction() + { + } + + /** + * Set the name of this {@link MessageToolCallFunction} instance and return the same instance. + * + * @param name + * The name of the function to call. + * @return The same instance of this {@link MessageToolCallFunction} class + */ + @Nonnull + public MessageToolCallFunction name( @Nonnull final String name ) + { + this.name = name; + return this; + } + + /** + * The name of the function to call. + * + * @return name The name of this {@link MessageToolCallFunction} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link MessageToolCallFunction} instance. + * + * @param name + * The name of the function to call. + */ + public void setName( @Nonnull final String name ) + { + this.name = name; + } + + /** + * Set the arguments of this {@link MessageToolCallFunction} instance and return the same instance. + * + * @param arguments + * The arguments to call the function with, as generated by the model in JSON format. Note that the model + * does not always generate valid JSON, and may hallucinate parameters not defined by your function + * schema. Validate the arguments in your code before calling your function. + * @return The same instance of this {@link MessageToolCallFunction} class + */ + @Nonnull + public MessageToolCallFunction arguments( @Nonnull final String arguments ) + { + this.arguments = arguments; + return this; + } + + /** + * The arguments to call the function with, as generated by the model in JSON format. Note that the model does not + * always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the + * arguments in your code before calling your function. + * + * @return arguments The arguments of this {@link MessageToolCallFunction} instance. + */ + @Nonnull + public String getArguments() + { + return arguments; + } + + /** + * Set the arguments of this {@link MessageToolCallFunction} instance. + * + * @param arguments + * The arguments to call the function with, as generated by the model in JSON format. Note that the model + * does not always generate valid JSON, and may hallucinate parameters not defined by your function + * schema. Validate the arguments in your code before calling your function. + */ + public void setArguments( @Nonnull final String arguments ) + { + this.arguments = arguments; + } + + /** + * Get the names of the unrecognizable properties of the {@link MessageToolCallFunction}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MessageToolCallFunction} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("MessageToolCallFunction has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MessageToolCallFunction} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( name != null ) + declaredFields.put("name", name); + if( arguments != null ) + declaredFields.put("arguments", arguments); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MessageToolCallFunction} instance. If the map previously contained + * a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final MessageToolCallFunction messageToolCallFunction = (MessageToolCallFunction) o; + return Objects.equals(this.cloudSdkCustomFields, messageToolCallFunction.cloudSdkCustomFields) + && Objects.equals(this.name, messageToolCallFunction.name) + && Objects.equals(this.arguments, messageToolCallFunction.arguments); + } + + @Override + public int hashCode() + { + return Objects.hash(name, arguments, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class MessageToolCallFunction {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" arguments: ").append(toIndentedString(arguments)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ModuleConfigs.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ModuleConfigs.java new file mode 100644 index 000000000..51809571b --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ModuleConfigs.java @@ -0,0 +1,370 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * ModuleConfigs + */ + +@Beta // CHECKSTYLE:OFF +public class ModuleConfigs +// CHECKSTYLE:ON +{ + @JsonProperty( "prompt_templating" ) + private PromptTemplatingModuleConfig promptTemplating; + + @JsonProperty( "filtering" ) + private FilteringModuleConfig filtering; + + @JsonProperty( "masking" ) + private MaskingModuleConfig masking; + + @JsonProperty( "grounding" ) + private GroundingModuleConfig grounding; + + @JsonProperty( "translation" ) + private TranslationModuleConfig translation; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for ModuleConfigs. + */ + protected ModuleConfigs() + { + } + + /** + * Set the promptTemplating of this {@link ModuleConfigs} instance and return the same instance. + * + * @param promptTemplating + * The promptTemplating of this {@link ModuleConfigs} + * @return The same instance of this {@link ModuleConfigs} class + */ + @Nonnull + public ModuleConfigs promptTemplating( @Nonnull final PromptTemplatingModuleConfig promptTemplating ) + { + this.promptTemplating = promptTemplating; + return this; + } + + /** + * Get promptTemplating + * + * @return promptTemplating The promptTemplating of this {@link ModuleConfigs} instance. + */ + @Nonnull + public PromptTemplatingModuleConfig getPromptTemplating() + { + return promptTemplating; + } + + /** + * Set the promptTemplating of this {@link ModuleConfigs} instance. + * + * @param promptTemplating + * The promptTemplating of this {@link ModuleConfigs} + */ + public void setPromptTemplating( @Nonnull final PromptTemplatingModuleConfig promptTemplating ) + { + this.promptTemplating = promptTemplating; + } + + /** + * Set the filtering of this {@link ModuleConfigs} instance and return the same instance. + * + * @param filtering + * The filtering of this {@link ModuleConfigs} + * @return The same instance of this {@link ModuleConfigs} class + */ + @Nonnull + public ModuleConfigs filtering( @Nullable final FilteringModuleConfig filtering ) + { + this.filtering = filtering; + return this; + } + + /** + * Get filtering + * + * @return filtering The filtering of this {@link ModuleConfigs} instance. + */ + @Nonnull + public FilteringModuleConfig getFiltering() + { + return filtering; + } + + /** + * Set the filtering of this {@link ModuleConfigs} instance. + * + * @param filtering + * The filtering of this {@link ModuleConfigs} + */ + public void setFiltering( @Nullable final FilteringModuleConfig filtering ) + { + this.filtering = filtering; + } + + /** + * Set the masking of this {@link ModuleConfigs} instance and return the same instance. + * + * @param masking + * The masking of this {@link ModuleConfigs} + * @return The same instance of this {@link ModuleConfigs} class + */ + @Nonnull + public ModuleConfigs masking( @Nullable final MaskingModuleConfig masking ) + { + this.masking = masking; + return this; + } + + /** + * Get masking + * + * @return masking The masking of this {@link ModuleConfigs} instance. + */ + @Nonnull + public MaskingModuleConfig getMasking() + { + return masking; + } + + /** + * Set the masking of this {@link ModuleConfigs} instance. + * + * @param masking + * The masking of this {@link ModuleConfigs} + */ + public void setMasking( @Nullable final MaskingModuleConfig masking ) + { + this.masking = masking; + } + + /** + * Set the grounding of this {@link ModuleConfigs} instance and return the same instance. + * + * @param grounding + * The grounding of this {@link ModuleConfigs} + * @return The same instance of this {@link ModuleConfigs} class + */ + @Nonnull + public ModuleConfigs grounding( @Nullable final GroundingModuleConfig grounding ) + { + this.grounding = grounding; + return this; + } + + /** + * Get grounding + * + * @return grounding The grounding of this {@link ModuleConfigs} instance. + */ + @Nonnull + public GroundingModuleConfig getGrounding() + { + return grounding; + } + + /** + * Set the grounding of this {@link ModuleConfigs} instance. + * + * @param grounding + * The grounding of this {@link ModuleConfigs} + */ + public void setGrounding( @Nullable final GroundingModuleConfig grounding ) + { + this.grounding = grounding; + } + + /** + * Set the translation of this {@link ModuleConfigs} instance and return the same instance. + * + * @param translation + * The translation of this {@link ModuleConfigs} + * @return The same instance of this {@link ModuleConfigs} class + */ + @Nonnull + public ModuleConfigs translation( @Nullable final TranslationModuleConfig translation ) + { + this.translation = translation; + return this; + } + + /** + * Get translation + * + * @return translation The translation of this {@link ModuleConfigs} instance. + */ + @Nonnull + public TranslationModuleConfig getTranslation() + { + return translation; + } + + /** + * Set the translation of this {@link ModuleConfigs} instance. + * + * @param translation + * The translation of this {@link ModuleConfigs} + */ + public void setTranslation( @Nullable final TranslationModuleConfig translation ) + { + this.translation = translation; + } + + /** + * Get the names of the unrecognizable properties of the {@link ModuleConfigs}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ModuleConfigs} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("ModuleConfigs has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ModuleConfigs} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( promptTemplating != null ) + declaredFields.put("promptTemplating", promptTemplating); + if( filtering != null ) + declaredFields.put("filtering", filtering); + if( masking != null ) + declaredFields.put("masking", masking); + if( grounding != null ) + declaredFields.put("grounding", grounding); + if( translation != null ) + declaredFields.put("translation", translation); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ModuleConfigs} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final ModuleConfigs moduleConfigs = (ModuleConfigs) o; + return Objects.equals(this.cloudSdkCustomFields, moduleConfigs.cloudSdkCustomFields) + && Objects.equals(this.promptTemplating, moduleConfigs.promptTemplating) + && Objects.equals(this.filtering, moduleConfigs.filtering) + && Objects.equals(this.masking, moduleConfigs.masking) + && Objects.equals(this.grounding, moduleConfigs.grounding) + && Objects.equals(this.translation, moduleConfigs.translation); + } + + @Override + public int hashCode() + { + return Objects.hash(promptTemplating, filtering, masking, grounding, translation, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class ModuleConfigs {\n"); + sb.append(" promptTemplating: ").append(toIndentedString(promptTemplating)).append("\n"); + sb.append(" filtering: ").append(toIndentedString(filtering)).append("\n"); + sb.append(" masking: ").append(toIndentedString(masking)).append("\n"); + sb.append(" grounding: ").append(toIndentedString(grounding)).append("\n"); + sb.append(" translation: ").append(toIndentedString(translation)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MultiChatContent.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MultiChatContent.java new file mode 100644 index 000000000..1c48f4e11 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MultiChatContent.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.google.common.annotations.Beta; + +/** + * MultiChatContent + */ +@Beta +@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) +@JsonSubTypes( { @JsonSubTypes.Type( value = ImageContent.class ), @JsonSubTypes.Type( value = TextContent.class ), } ) + +public interface MultiChatContent +{ +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MultiChatTemplate.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MultiChatTemplate.java new file mode 100644 index 000000000..63a5be7fd --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MultiChatTemplate.java @@ -0,0 +1,260 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * MultiChatTemplate + */ + +@Beta // CHECKSTYLE:OFF +public class MultiChatTemplate implements PromptTemplate +// CHECKSTYLE:ON +{ + @JsonProperty( "role" ) + private String role; + + @JsonProperty( "content" ) + private List content = new ArrayList<>(); + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for MultiChatTemplate. + */ + protected MultiChatTemplate() + { + } + + /** + * Set the role of this {@link MultiChatTemplate} instance and return the same instance. + * + * @param role + * The role of this {@link MultiChatTemplate} + * @return The same instance of this {@link MultiChatTemplate} class + */ + @Nonnull + public MultiChatTemplate role( @Nonnull final String role ) + { + this.role = role; + return this; + } + + /** + * Get role + * + * @return role The role of this {@link MultiChatTemplate} instance. + */ + @Nonnull + public String getRole() + { + return role; + } + + /** + * Set the role of this {@link MultiChatTemplate} instance. + * + * @param role + * The role of this {@link MultiChatTemplate} + */ + public void setRole( @Nonnull final String role ) + { + this.role = role; + } + + /** + * Set the content of this {@link MultiChatTemplate} instance and return the same instance. + * + * @param content + * The content of this {@link MultiChatTemplate} + * @return The same instance of this {@link MultiChatTemplate} class + */ + @Nonnull + public MultiChatTemplate content( @Nonnull final List content ) + { + this.content = content; + return this; + } + + /** + * Add one content instance to this {@link MultiChatTemplate}. + * + * @param contentItem + * The content that should be added + * @return The same instance of type {@link MultiChatTemplate} + */ + @Nonnull + public MultiChatTemplate addContentItem( @Nonnull final MultiChatContent contentItem ) + { + if( this.content == null ) { + this.content = new ArrayList<>(); + } + this.content.add(contentItem); + return this; + } + + /** + * Get content + * + * @return content The content of this {@link MultiChatTemplate} instance. + */ + @Nonnull + public List getContent() + { + return content; + } + + /** + * Set the content of this {@link MultiChatTemplate} instance. + * + * @param content + * The content of this {@link MultiChatTemplate} + */ + public void setContent( @Nonnull final List content ) + { + this.content = content; + } + + /** + * Get the names of the unrecognizable properties of the {@link MultiChatTemplate}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MultiChatTemplate} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("MultiChatTemplate has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MultiChatTemplate} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( role != null ) + declaredFields.put("role", role); + if( content != null ) + declaredFields.put("content", content); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MultiChatTemplate} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final MultiChatTemplate multiChatTemplate = (MultiChatTemplate) o; + return Objects.equals(this.cloudSdkCustomFields, multiChatTemplate.cloudSdkCustomFields) + && Objects.equals(this.role, multiChatTemplate.role) + && Objects.equals(this.content, multiChatTemplate.content); + } + + @Override + public int hashCode() + { + return Objects.hash(role, content, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class MultiChatTemplate {\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfig.java new file mode 100644 index 000000000..41863b943 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfig.java @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * OrchestrationConfig + */ + +@Beta // CHECKSTYLE:OFF +public class OrchestrationConfig +// CHECKSTYLE:ON +{ + @JsonProperty( "modules" ) + private ModuleConfigs modules; + + @JsonProperty( "stream" ) + private GlobalStreamOptions stream; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for OrchestrationConfig. + */ + protected OrchestrationConfig() + { + } + + /** + * Set the modules of this {@link OrchestrationConfig} instance and return the same instance. + * + * @param modules + * The modules of this {@link OrchestrationConfig} + * @return The same instance of this {@link OrchestrationConfig} class + */ + @Nonnull + public OrchestrationConfig modules( @Nonnull final ModuleConfigs modules ) + { + this.modules = modules; + return this; + } + + /** + * Get modules + * + * @return modules The modules of this {@link OrchestrationConfig} instance. + */ + @Nonnull + public ModuleConfigs getModules() + { + return modules; + } + + /** + * Set the modules of this {@link OrchestrationConfig} instance. + * + * @param modules + * The modules of this {@link OrchestrationConfig} + */ + public void setModules( @Nonnull final ModuleConfigs modules ) + { + this.modules = modules; + } + + /** + * Set the stream of this {@link OrchestrationConfig} instance and return the same instance. + * + * @param stream + * The stream of this {@link OrchestrationConfig} + * @return The same instance of this {@link OrchestrationConfig} class + */ + @Nonnull + public OrchestrationConfig stream( @Nullable final GlobalStreamOptions stream ) + { + this.stream = stream; + return this; + } + + /** + * Get stream + * + * @return stream The stream of this {@link OrchestrationConfig} instance. + */ + @Nonnull + public GlobalStreamOptions getStream() + { + return stream; + } + + /** + * Set the stream of this {@link OrchestrationConfig} instance. + * + * @param stream + * The stream of this {@link OrchestrationConfig} + */ + public void setStream( @Nullable final GlobalStreamOptions stream ) + { + this.stream = stream; + } + + /** + * Get the names of the unrecognizable properties of the {@link OrchestrationConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link OrchestrationConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("OrchestrationConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link OrchestrationConfig} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( modules != null ) + declaredFields.put("modules", modules); + if( stream != null ) + declaredFields.put("stream", stream); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link OrchestrationConfig} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final OrchestrationConfig orchestrationConfig = (OrchestrationConfig) o; + return Objects.equals(this.cloudSdkCustomFields, orchestrationConfig.cloudSdkCustomFields) + && Objects.equals(this.modules, orchestrationConfig.modules) + && Objects.equals(this.stream, orchestrationConfig.stream); + } + + @Override + public int hashCode() + { + return Objects.hash(modules, stream, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class OrchestrationConfig {\n"); + sb.append(" modules: ").append(toIndentedString(modules)).append("\n"); + sb.append(" stream: ").append(toIndentedString(stream)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigDeleteResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigDeleteResponse.java new file mode 100644 index 000000000..220347c72 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigDeleteResponse.java @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * OrchestrationConfigDeleteResponse + */ + +@Beta // CHECKSTYLE:OFF +public class OrchestrationConfigDeleteResponse +// CHECKSTYLE:ON +{ + @JsonProperty( "message" ) + private String message; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for OrchestrationConfigDeleteResponse. + */ + protected OrchestrationConfigDeleteResponse() + { + } + + /** + * Set the message of this {@link OrchestrationConfigDeleteResponse} instance and return the same instance. + * + * @param message + * The message of this {@link OrchestrationConfigDeleteResponse} + * @return The same instance of this {@link OrchestrationConfigDeleteResponse} class + */ + @Nonnull + public OrchestrationConfigDeleteResponse message( @Nonnull final String message ) + { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link OrchestrationConfigDeleteResponse} instance. + */ + @Nonnull + public String getMessage() + { + return message; + } + + /** + * Set the message of this {@link OrchestrationConfigDeleteResponse} instance. + * + * @param message + * The message of this {@link OrchestrationConfigDeleteResponse} + */ + public void setMessage( @Nonnull final String message ) + { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link OrchestrationConfigDeleteResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link OrchestrationConfigDeleteResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException( + "OrchestrationConfigDeleteResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link OrchestrationConfigDeleteResponse} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( message != null ) + declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link OrchestrationConfigDeleteResponse} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final OrchestrationConfigDeleteResponse orchestrationConfigDeleteResponse = + (OrchestrationConfigDeleteResponse) o; + return Objects.equals(this.cloudSdkCustomFields, orchestrationConfigDeleteResponse.cloudSdkCustomFields) + && Objects.equals(this.message, orchestrationConfigDeleteResponse.message); + } + + @Override + public int hashCode() + { + return Objects.hash(message, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class OrchestrationConfigDeleteResponse {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigGetResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigGetResponse.java new file mode 100644 index 000000000..4981e48cc --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigGetResponse.java @@ -0,0 +1,555 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * OrchestrationConfigGetResponse + */ + +@Beta // CHECKSTYLE:OFF +public class OrchestrationConfigGetResponse +// CHECKSTYLE:ON +{ + @JsonProperty( "id" ) + private UUID id; + + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "version" ) + private String version; + + @JsonProperty( "scenario" ) + private String scenario; + + @JsonProperty( "creation_timestamp" ) + private String creationTimestamp; + + @JsonProperty( "managed_by" ) + private String managedBy; + + @JsonProperty( "is_version_head" ) + private Boolean isVersionHead; + + @JsonProperty( "resource_group_id" ) + private String resourceGroupId; + + @JsonProperty( "spec" ) + private OrchestrationConfig spec; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for OrchestrationConfigGetResponse. + */ + protected OrchestrationConfigGetResponse() + { + } + + /** + * Set the id of this {@link OrchestrationConfigGetResponse} instance and return the same instance. + * + * @param id + * The id of this {@link OrchestrationConfigGetResponse} + * @return The same instance of this {@link OrchestrationConfigGetResponse} class + */ + @Nonnull + public OrchestrationConfigGetResponse id( @Nullable final UUID id ) + { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link OrchestrationConfigGetResponse} instance. + */ + @Nonnull + public UUID getId() + { + return id; + } + + /** + * Set the id of this {@link OrchestrationConfigGetResponse} instance. + * + * @param id + * The id of this {@link OrchestrationConfigGetResponse} + */ + public void setId( @Nullable final UUID id ) + { + this.id = id; + } + + /** + * Set the name of this {@link OrchestrationConfigGetResponse} instance and return the same instance. + * + * @param name + * The name of this {@link OrchestrationConfigGetResponse} + * @return The same instance of this {@link OrchestrationConfigGetResponse} class + */ + @Nonnull + public OrchestrationConfigGetResponse name( @Nullable final String name ) + { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name The name of this {@link OrchestrationConfigGetResponse} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link OrchestrationConfigGetResponse} instance. + * + * @param name + * The name of this {@link OrchestrationConfigGetResponse} + */ + public void setName( @Nullable final String name ) + { + this.name = name; + } + + /** + * Set the version of this {@link OrchestrationConfigGetResponse} instance and return the same instance. + * + * @param version + * The version of this {@link OrchestrationConfigGetResponse} + * @return The same instance of this {@link OrchestrationConfigGetResponse} class + */ + @Nonnull + public OrchestrationConfigGetResponse version( @Nullable final String version ) + { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version The version of this {@link OrchestrationConfigGetResponse} instance. + */ + @Nonnull + public String getVersion() + { + return version; + } + + /** + * Set the version of this {@link OrchestrationConfigGetResponse} instance. + * + * @param version + * The version of this {@link OrchestrationConfigGetResponse} + */ + public void setVersion( @Nullable final String version ) + { + this.version = version; + } + + /** + * Set the scenario of this {@link OrchestrationConfigGetResponse} instance and return the same instance. + * + * @param scenario + * The scenario of this {@link OrchestrationConfigGetResponse} + * @return The same instance of this {@link OrchestrationConfigGetResponse} class + */ + @Nonnull + public OrchestrationConfigGetResponse scenario( @Nullable final String scenario ) + { + this.scenario = scenario; + return this; + } + + /** + * Get scenario + * + * @return scenario The scenario of this {@link OrchestrationConfigGetResponse} instance. + */ + @Nonnull + public String getScenario() + { + return scenario; + } + + /** + * Set the scenario of this {@link OrchestrationConfigGetResponse} instance. + * + * @param scenario + * The scenario of this {@link OrchestrationConfigGetResponse} + */ + public void setScenario( @Nullable final String scenario ) + { + this.scenario = scenario; + } + + /** + * Set the creationTimestamp of this {@link OrchestrationConfigGetResponse} instance and return the same instance. + * + * @param creationTimestamp + * The creationTimestamp of this {@link OrchestrationConfigGetResponse} + * @return The same instance of this {@link OrchestrationConfigGetResponse} class + */ + @Nonnull + public OrchestrationConfigGetResponse creationTimestamp( @Nullable final String creationTimestamp ) + { + this.creationTimestamp = creationTimestamp; + return this; + } + + /** + * Get creationTimestamp + * + * @return creationTimestamp The creationTimestamp of this {@link OrchestrationConfigGetResponse} instance. + */ + @Nonnull + public String getCreationTimestamp() + { + return creationTimestamp; + } + + /** + * Set the creationTimestamp of this {@link OrchestrationConfigGetResponse} instance. + * + * @param creationTimestamp + * The creationTimestamp of this {@link OrchestrationConfigGetResponse} + */ + public void setCreationTimestamp( @Nullable final String creationTimestamp ) + { + this.creationTimestamp = creationTimestamp; + } + + /** + * Set the managedBy of this {@link OrchestrationConfigGetResponse} instance and return the same instance. + * + * @param managedBy + * The managedBy of this {@link OrchestrationConfigGetResponse} + * @return The same instance of this {@link OrchestrationConfigGetResponse} class + */ + @Nonnull + public OrchestrationConfigGetResponse managedBy( @Nullable final String managedBy ) + { + this.managedBy = managedBy; + return this; + } + + /** + * Get managedBy + * + * @return managedBy The managedBy of this {@link OrchestrationConfigGetResponse} instance. + */ + @Nonnull + public String getManagedBy() + { + return managedBy; + } + + /** + * Set the managedBy of this {@link OrchestrationConfigGetResponse} instance. + * + * @param managedBy + * The managedBy of this {@link OrchestrationConfigGetResponse} + */ + public void setManagedBy( @Nullable final String managedBy ) + { + this.managedBy = managedBy; + } + + /** + * Set the isVersionHead of this {@link OrchestrationConfigGetResponse} instance and return the same instance. + * + * @param isVersionHead + * The isVersionHead of this {@link OrchestrationConfigGetResponse} + * @return The same instance of this {@link OrchestrationConfigGetResponse} class + */ + @Nonnull + public OrchestrationConfigGetResponse isVersionHead( @Nullable final Boolean isVersionHead ) + { + this.isVersionHead = isVersionHead; + return this; + } + + /** + * Get isVersionHead + * + * @return isVersionHead The isVersionHead of this {@link OrchestrationConfigGetResponse} instance. + */ + @Nonnull + public Boolean isIsVersionHead() + { + return isVersionHead; + } + + /** + * Set the isVersionHead of this {@link OrchestrationConfigGetResponse} instance. + * + * @param isVersionHead + * The isVersionHead of this {@link OrchestrationConfigGetResponse} + */ + public void setIsVersionHead( @Nullable final Boolean isVersionHead ) + { + this.isVersionHead = isVersionHead; + } + + /** + * Set the resourceGroupId of this {@link OrchestrationConfigGetResponse} instance and return the same instance. + * + * @param resourceGroupId + * The resourceGroupId of this {@link OrchestrationConfigGetResponse} + * @return The same instance of this {@link OrchestrationConfigGetResponse} class + */ + @Nonnull + public OrchestrationConfigGetResponse resourceGroupId( @Nullable final String resourceGroupId ) + { + this.resourceGroupId = resourceGroupId; + return this; + } + + /** + * Get resourceGroupId + * + * @return resourceGroupId The resourceGroupId of this {@link OrchestrationConfigGetResponse} instance. + */ + @Nonnull + public String getResourceGroupId() + { + return resourceGroupId; + } + + /** + * Set the resourceGroupId of this {@link OrchestrationConfigGetResponse} instance. + * + * @param resourceGroupId + * The resourceGroupId of this {@link OrchestrationConfigGetResponse} + */ + public void setResourceGroupId( @Nullable final String resourceGroupId ) + { + this.resourceGroupId = resourceGroupId; + } + + /** + * Set the spec of this {@link OrchestrationConfigGetResponse} instance and return the same instance. + * + * @param spec + * The spec of this {@link OrchestrationConfigGetResponse} + * @return The same instance of this {@link OrchestrationConfigGetResponse} class + */ + @Nonnull + public OrchestrationConfigGetResponse spec( @Nullable final OrchestrationConfig spec ) + { + this.spec = spec; + return this; + } + + /** + * Get spec + * + * @return spec The spec of this {@link OrchestrationConfigGetResponse} instance. + */ + @Nonnull + public OrchestrationConfig getSpec() + { + return spec; + } + + /** + * Set the spec of this {@link OrchestrationConfigGetResponse} instance. + * + * @param spec + * The spec of this {@link OrchestrationConfigGetResponse} + */ + public void setSpec( @Nullable final OrchestrationConfig spec ) + { + this.spec = spec; + } + + /** + * Get the names of the unrecognizable properties of the {@link OrchestrationConfigGetResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link OrchestrationConfigGetResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("OrchestrationConfigGetResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link OrchestrationConfigGetResponse} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( id != null ) + declaredFields.put("id", id); + if( name != null ) + declaredFields.put("name", name); + if( version != null ) + declaredFields.put("version", version); + if( scenario != null ) + declaredFields.put("scenario", scenario); + if( creationTimestamp != null ) + declaredFields.put("creationTimestamp", creationTimestamp); + if( managedBy != null ) + declaredFields.put("managedBy", managedBy); + if( isVersionHead != null ) + declaredFields.put("isVersionHead", isVersionHead); + if( resourceGroupId != null ) + declaredFields.put("resourceGroupId", resourceGroupId); + if( spec != null ) + declaredFields.put("spec", spec); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link OrchestrationConfigGetResponse} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final OrchestrationConfigGetResponse orchestrationConfigGetResponse = (OrchestrationConfigGetResponse) o; + return Objects.equals(this.cloudSdkCustomFields, orchestrationConfigGetResponse.cloudSdkCustomFields) + && Objects.equals(this.id, orchestrationConfigGetResponse.id) + && Objects.equals(this.name, orchestrationConfigGetResponse.name) + && Objects.equals(this.version, orchestrationConfigGetResponse.version) + && Objects.equals(this.scenario, orchestrationConfigGetResponse.scenario) + && Objects.equals(this.creationTimestamp, orchestrationConfigGetResponse.creationTimestamp) + && Objects.equals(this.managedBy, orchestrationConfigGetResponse.managedBy) + && Objects.equals(this.isVersionHead, orchestrationConfigGetResponse.isVersionHead) + && Objects.equals(this.resourceGroupId, orchestrationConfigGetResponse.resourceGroupId) + && Objects.equals(this.spec, orchestrationConfigGetResponse.spec); + } + + @Override + public int hashCode() + { + return Objects + .hash( + id, + name, + version, + scenario, + creationTimestamp, + managedBy, + isVersionHead, + resourceGroupId, + spec, + cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class OrchestrationConfigGetResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); + sb.append(" creationTimestamp: ").append(toIndentedString(creationTimestamp)).append("\n"); + sb.append(" managedBy: ").append(toIndentedString(managedBy)).append("\n"); + sb.append(" isVersionHead: ").append(toIndentedString(isVersionHead)).append("\n"); + sb.append(" resourceGroupId: ").append(toIndentedString(resourceGroupId)).append("\n"); + sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigListResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigListResponse.java new file mode 100644 index 000000000..bbb96af9f --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigListResponse.java @@ -0,0 +1,262 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * OrchestrationConfigListResponse + */ + +@Beta // CHECKSTYLE:OFF +public class OrchestrationConfigListResponse +// CHECKSTYLE:ON +{ + @JsonProperty( "count" ) + private Integer count; + + @JsonProperty( "resources" ) + private List resources = new ArrayList<>(); + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for OrchestrationConfigListResponse. + */ + protected OrchestrationConfigListResponse() + { + } + + /** + * Set the count of this {@link OrchestrationConfigListResponse} instance and return the same instance. + * + * @param count + * The count of this {@link OrchestrationConfigListResponse} + * @return The same instance of this {@link OrchestrationConfigListResponse} class + */ + @Nonnull + public OrchestrationConfigListResponse count( @Nonnull final Integer count ) + { + this.count = count; + return this; + } + + /** + * Get count + * + * @return count The count of this {@link OrchestrationConfigListResponse} instance. + */ + @Nonnull + public Integer getCount() + { + return count; + } + + /** + * Set the count of this {@link OrchestrationConfigListResponse} instance. + * + * @param count + * The count of this {@link OrchestrationConfigListResponse} + */ + public void setCount( @Nonnull final Integer count ) + { + this.count = count; + } + + /** + * Set the resources of this {@link OrchestrationConfigListResponse} instance and return the same instance. + * + * @param resources + * The resources of this {@link OrchestrationConfigListResponse} + * @return The same instance of this {@link OrchestrationConfigListResponse} class + */ + @Nonnull + public OrchestrationConfigListResponse resources( @Nonnull final List resources ) + { + this.resources = resources; + return this; + } + + /** + * Add one resources instance to this {@link OrchestrationConfigListResponse}. + * + * @param resourcesItem + * The resources that should be added + * @return The same instance of type {@link OrchestrationConfigListResponse} + */ + @Nonnull + public OrchestrationConfigListResponse addResourcesItem( + @Nonnull final OrchestrationConfigGetResponse resourcesItem ) + { + if( this.resources == null ) { + this.resources = new ArrayList<>(); + } + this.resources.add(resourcesItem); + return this; + } + + /** + * Get resources + * + * @return resources The resources of this {@link OrchestrationConfigListResponse} instance. + */ + @Nonnull + public List getResources() + { + return resources; + } + + /** + * Set the resources of this {@link OrchestrationConfigListResponse} instance. + * + * @param resources + * The resources of this {@link OrchestrationConfigListResponse} + */ + public void setResources( @Nonnull final List resources ) + { + this.resources = resources; + } + + /** + * Get the names of the unrecognizable properties of the {@link OrchestrationConfigListResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link OrchestrationConfigListResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("OrchestrationConfigListResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link OrchestrationConfigListResponse} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( count != null ) + declaredFields.put("count", count); + if( resources != null ) + declaredFields.put("resources", resources); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link OrchestrationConfigListResponse} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final OrchestrationConfigListResponse orchestrationConfigListResponse = (OrchestrationConfigListResponse) o; + return Objects.equals(this.cloudSdkCustomFields, orchestrationConfigListResponse.cloudSdkCustomFields) + && Objects.equals(this.count, orchestrationConfigListResponse.count) + && Objects.equals(this.resources, orchestrationConfigListResponse.resources); + } + + @Override + public int hashCode() + { + return Objects.hash(count, resources, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class OrchestrationConfigListResponse {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" resources: ").append(toIndentedString(resources)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigPostRequest.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigPostRequest.java new file mode 100644 index 000000000..3d13ac2ac --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigPostRequest.java @@ -0,0 +1,328 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * OrchestrationConfigPostRequest + */ + +@Beta // CHECKSTYLE:OFF +public class OrchestrationConfigPostRequest +// CHECKSTYLE:ON +{ + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "version" ) + private String version; + + @JsonProperty( "scenario" ) + private String scenario; + + @JsonProperty( "spec" ) + private OrchestrationConfig spec; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for OrchestrationConfigPostRequest. + */ + protected OrchestrationConfigPostRequest() + { + } + + /** + * Set the name of this {@link OrchestrationConfigPostRequest} instance and return the same instance. + * + * @param name + * The name of this {@link OrchestrationConfigPostRequest} + * @return The same instance of this {@link OrchestrationConfigPostRequest} class + */ + @Nonnull + public OrchestrationConfigPostRequest name( @Nonnull final String name ) + { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name The name of this {@link OrchestrationConfigPostRequest} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link OrchestrationConfigPostRequest} instance. + * + * @param name + * The name of this {@link OrchestrationConfigPostRequest} + */ + public void setName( @Nonnull final String name ) + { + this.name = name; + } + + /** + * Set the version of this {@link OrchestrationConfigPostRequest} instance and return the same instance. + * + * @param version + * The version of this {@link OrchestrationConfigPostRequest} + * @return The same instance of this {@link OrchestrationConfigPostRequest} class + */ + @Nonnull + public OrchestrationConfigPostRequest version( @Nonnull final String version ) + { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version The version of this {@link OrchestrationConfigPostRequest} instance. + */ + @Nonnull + public String getVersion() + { + return version; + } + + /** + * Set the version of this {@link OrchestrationConfigPostRequest} instance. + * + * @param version + * The version of this {@link OrchestrationConfigPostRequest} + */ + public void setVersion( @Nonnull final String version ) + { + this.version = version; + } + + /** + * Set the scenario of this {@link OrchestrationConfigPostRequest} instance and return the same instance. + * + * @param scenario + * The scenario of this {@link OrchestrationConfigPostRequest} + * @return The same instance of this {@link OrchestrationConfigPostRequest} class + */ + @Nonnull + public OrchestrationConfigPostRequest scenario( @Nonnull final String scenario ) + { + this.scenario = scenario; + return this; + } + + /** + * Get scenario + * + * @return scenario The scenario of this {@link OrchestrationConfigPostRequest} instance. + */ + @Nonnull + public String getScenario() + { + return scenario; + } + + /** + * Set the scenario of this {@link OrchestrationConfigPostRequest} instance. + * + * @param scenario + * The scenario of this {@link OrchestrationConfigPostRequest} + */ + public void setScenario( @Nonnull final String scenario ) + { + this.scenario = scenario; + } + + /** + * Set the spec of this {@link OrchestrationConfigPostRequest} instance and return the same instance. + * + * @param spec + * The spec of this {@link OrchestrationConfigPostRequest} + * @return The same instance of this {@link OrchestrationConfigPostRequest} class + */ + @Nonnull + public OrchestrationConfigPostRequest spec( @Nonnull final OrchestrationConfig spec ) + { + this.spec = spec; + return this; + } + + /** + * Get spec + * + * @return spec The spec of this {@link OrchestrationConfigPostRequest} instance. + */ + @Nonnull + public OrchestrationConfig getSpec() + { + return spec; + } + + /** + * Set the spec of this {@link OrchestrationConfigPostRequest} instance. + * + * @param spec + * The spec of this {@link OrchestrationConfigPostRequest} + */ + public void setSpec( @Nonnull final OrchestrationConfig spec ) + { + this.spec = spec; + } + + /** + * Get the names of the unrecognizable properties of the {@link OrchestrationConfigPostRequest}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link OrchestrationConfigPostRequest} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("OrchestrationConfigPostRequest has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link OrchestrationConfigPostRequest} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( name != null ) + declaredFields.put("name", name); + if( version != null ) + declaredFields.put("version", version); + if( scenario != null ) + declaredFields.put("scenario", scenario); + if( spec != null ) + declaredFields.put("spec", spec); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link OrchestrationConfigPostRequest} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final OrchestrationConfigPostRequest orchestrationConfigPostRequest = (OrchestrationConfigPostRequest) o; + return Objects.equals(this.cloudSdkCustomFields, orchestrationConfigPostRequest.cloudSdkCustomFields) + && Objects.equals(this.name, orchestrationConfigPostRequest.name) + && Objects.equals(this.version, orchestrationConfigPostRequest.version) + && Objects.equals(this.scenario, orchestrationConfigPostRequest.scenario) + && Objects.equals(this.spec, orchestrationConfigPostRequest.spec); + } + + @Override + public int hashCode() + { + return Objects.hash(name, version, scenario, spec, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class OrchestrationConfigPostRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); + sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigPostResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigPostResponse.java new file mode 100644 index 000000000..55b98baba --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigPostResponse.java @@ -0,0 +1,372 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * OrchestrationConfigPostResponse + */ + +@Beta // CHECKSTYLE:OFF +public class OrchestrationConfigPostResponse +// CHECKSTYLE:ON +{ + @JsonProperty( "message" ) + private String message; + + @JsonProperty( "id" ) + private UUID id; + + @JsonProperty( "scenario" ) + private String scenario; + + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "version" ) + private String version; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for OrchestrationConfigPostResponse. + */ + protected OrchestrationConfigPostResponse() + { + } + + /** + * Set the message of this {@link OrchestrationConfigPostResponse} instance and return the same instance. + * + * @param message + * The message of this {@link OrchestrationConfigPostResponse} + * @return The same instance of this {@link OrchestrationConfigPostResponse} class + */ + @Nonnull + public OrchestrationConfigPostResponse message( @Nonnull final String message ) + { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link OrchestrationConfigPostResponse} instance. + */ + @Nonnull + public String getMessage() + { + return message; + } + + /** + * Set the message of this {@link OrchestrationConfigPostResponse} instance. + * + * @param message + * The message of this {@link OrchestrationConfigPostResponse} + */ + public void setMessage( @Nonnull final String message ) + { + this.message = message; + } + + /** + * Set the id of this {@link OrchestrationConfigPostResponse} instance and return the same instance. + * + * @param id + * The id of this {@link OrchestrationConfigPostResponse} + * @return The same instance of this {@link OrchestrationConfigPostResponse} class + */ + @Nonnull + public OrchestrationConfigPostResponse id( @Nonnull final UUID id ) + { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link OrchestrationConfigPostResponse} instance. + */ + @Nonnull + public UUID getId() + { + return id; + } + + /** + * Set the id of this {@link OrchestrationConfigPostResponse} instance. + * + * @param id + * The id of this {@link OrchestrationConfigPostResponse} + */ + public void setId( @Nonnull final UUID id ) + { + this.id = id; + } + + /** + * Set the scenario of this {@link OrchestrationConfigPostResponse} instance and return the same instance. + * + * @param scenario + * The scenario of this {@link OrchestrationConfigPostResponse} + * @return The same instance of this {@link OrchestrationConfigPostResponse} class + */ + @Nonnull + public OrchestrationConfigPostResponse scenario( @Nonnull final String scenario ) + { + this.scenario = scenario; + return this; + } + + /** + * Get scenario + * + * @return scenario The scenario of this {@link OrchestrationConfigPostResponse} instance. + */ + @Nonnull + public String getScenario() + { + return scenario; + } + + /** + * Set the scenario of this {@link OrchestrationConfigPostResponse} instance. + * + * @param scenario + * The scenario of this {@link OrchestrationConfigPostResponse} + */ + public void setScenario( @Nonnull final String scenario ) + { + this.scenario = scenario; + } + + /** + * Set the name of this {@link OrchestrationConfigPostResponse} instance and return the same instance. + * + * @param name + * The name of this {@link OrchestrationConfigPostResponse} + * @return The same instance of this {@link OrchestrationConfigPostResponse} class + */ + @Nonnull + public OrchestrationConfigPostResponse name( @Nonnull final String name ) + { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name The name of this {@link OrchestrationConfigPostResponse} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link OrchestrationConfigPostResponse} instance. + * + * @param name + * The name of this {@link OrchestrationConfigPostResponse} + */ + public void setName( @Nonnull final String name ) + { + this.name = name; + } + + /** + * Set the version of this {@link OrchestrationConfigPostResponse} instance and return the same instance. + * + * @param version + * The version of this {@link OrchestrationConfigPostResponse} + * @return The same instance of this {@link OrchestrationConfigPostResponse} class + */ + @Nonnull + public OrchestrationConfigPostResponse version( @Nonnull final String version ) + { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version The version of this {@link OrchestrationConfigPostResponse} instance. + */ + @Nonnull + public String getVersion() + { + return version; + } + + /** + * Set the version of this {@link OrchestrationConfigPostResponse} instance. + * + * @param version + * The version of this {@link OrchestrationConfigPostResponse} + */ + public void setVersion( @Nonnull final String version ) + { + this.version = version; + } + + /** + * Get the names of the unrecognizable properties of the {@link OrchestrationConfigPostResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link OrchestrationConfigPostResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("OrchestrationConfigPostResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link OrchestrationConfigPostResponse} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( message != null ) + declaredFields.put("message", message); + if( id != null ) + declaredFields.put("id", id); + if( scenario != null ) + declaredFields.put("scenario", scenario); + if( name != null ) + declaredFields.put("name", name); + if( version != null ) + declaredFields.put("version", version); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link OrchestrationConfigPostResponse} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final OrchestrationConfigPostResponse orchestrationConfigPostResponse = (OrchestrationConfigPostResponse) o; + return Objects.equals(this.cloudSdkCustomFields, orchestrationConfigPostResponse.cloudSdkCustomFields) + && Objects.equals(this.message, orchestrationConfigPostResponse.message) + && Objects.equals(this.id, orchestrationConfigPostResponse.id) + && Objects.equals(this.scenario, orchestrationConfigPostResponse.scenario) + && Objects.equals(this.name, orchestrationConfigPostResponse.name) + && Objects.equals(this.version, orchestrationConfigPostResponse.version); + } + + @Override + public int hashCode() + { + return Objects.hash(message, id, scenario, name, version, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class OrchestrationConfigPostResponse {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigResource.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigResource.java new file mode 100644 index 000000000..a5850409a --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigResource.java @@ -0,0 +1,555 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * OrchestrationConfigResource + */ + +@Beta // CHECKSTYLE:OFF +public class OrchestrationConfigResource +// CHECKSTYLE:ON +{ + @JsonProperty( "id" ) + private UUID id; + + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "version" ) + private String version; + + @JsonProperty( "scenario" ) + private String scenario; + + @JsonProperty( "creation_timestamp" ) + private String creationTimestamp; + + @JsonProperty( "managed_by" ) + private String managedBy; + + @JsonProperty( "is_version_head" ) + private Boolean isVersionHead; + + @JsonProperty( "resource_group_id" ) + private String resourceGroupId; + + @JsonProperty( "spec" ) + private OrchestrationConfig spec; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for OrchestrationConfigResource. + */ + protected OrchestrationConfigResource() + { + } + + /** + * Set the id of this {@link OrchestrationConfigResource} instance and return the same instance. + * + * @param id + * The id of this {@link OrchestrationConfigResource} + * @return The same instance of this {@link OrchestrationConfigResource} class + */ + @Nonnull + public OrchestrationConfigResource id( @Nullable final UUID id ) + { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link OrchestrationConfigResource} instance. + */ + @Nonnull + public UUID getId() + { + return id; + } + + /** + * Set the id of this {@link OrchestrationConfigResource} instance. + * + * @param id + * The id of this {@link OrchestrationConfigResource} + */ + public void setId( @Nullable final UUID id ) + { + this.id = id; + } + + /** + * Set the name of this {@link OrchestrationConfigResource} instance and return the same instance. + * + * @param name + * The name of this {@link OrchestrationConfigResource} + * @return The same instance of this {@link OrchestrationConfigResource} class + */ + @Nonnull + public OrchestrationConfigResource name( @Nullable final String name ) + { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name The name of this {@link OrchestrationConfigResource} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link OrchestrationConfigResource} instance. + * + * @param name + * The name of this {@link OrchestrationConfigResource} + */ + public void setName( @Nullable final String name ) + { + this.name = name; + } + + /** + * Set the version of this {@link OrchestrationConfigResource} instance and return the same instance. + * + * @param version + * The version of this {@link OrchestrationConfigResource} + * @return The same instance of this {@link OrchestrationConfigResource} class + */ + @Nonnull + public OrchestrationConfigResource version( @Nullable final String version ) + { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version The version of this {@link OrchestrationConfigResource} instance. + */ + @Nonnull + public String getVersion() + { + return version; + } + + /** + * Set the version of this {@link OrchestrationConfigResource} instance. + * + * @param version + * The version of this {@link OrchestrationConfigResource} + */ + public void setVersion( @Nullable final String version ) + { + this.version = version; + } + + /** + * Set the scenario of this {@link OrchestrationConfigResource} instance and return the same instance. + * + * @param scenario + * The scenario of this {@link OrchestrationConfigResource} + * @return The same instance of this {@link OrchestrationConfigResource} class + */ + @Nonnull + public OrchestrationConfigResource scenario( @Nullable final String scenario ) + { + this.scenario = scenario; + return this; + } + + /** + * Get scenario + * + * @return scenario The scenario of this {@link OrchestrationConfigResource} instance. + */ + @Nonnull + public String getScenario() + { + return scenario; + } + + /** + * Set the scenario of this {@link OrchestrationConfigResource} instance. + * + * @param scenario + * The scenario of this {@link OrchestrationConfigResource} + */ + public void setScenario( @Nullable final String scenario ) + { + this.scenario = scenario; + } + + /** + * Set the creationTimestamp of this {@link OrchestrationConfigResource} instance and return the same instance. + * + * @param creationTimestamp + * The creationTimestamp of this {@link OrchestrationConfigResource} + * @return The same instance of this {@link OrchestrationConfigResource} class + */ + @Nonnull + public OrchestrationConfigResource creationTimestamp( @Nullable final String creationTimestamp ) + { + this.creationTimestamp = creationTimestamp; + return this; + } + + /** + * Get creationTimestamp + * + * @return creationTimestamp The creationTimestamp of this {@link OrchestrationConfigResource} instance. + */ + @Nonnull + public String getCreationTimestamp() + { + return creationTimestamp; + } + + /** + * Set the creationTimestamp of this {@link OrchestrationConfigResource} instance. + * + * @param creationTimestamp + * The creationTimestamp of this {@link OrchestrationConfigResource} + */ + public void setCreationTimestamp( @Nullable final String creationTimestamp ) + { + this.creationTimestamp = creationTimestamp; + } + + /** + * Set the managedBy of this {@link OrchestrationConfigResource} instance and return the same instance. + * + * @param managedBy + * The managedBy of this {@link OrchestrationConfigResource} + * @return The same instance of this {@link OrchestrationConfigResource} class + */ + @Nonnull + public OrchestrationConfigResource managedBy( @Nullable final String managedBy ) + { + this.managedBy = managedBy; + return this; + } + + /** + * Get managedBy + * + * @return managedBy The managedBy of this {@link OrchestrationConfigResource} instance. + */ + @Nonnull + public String getManagedBy() + { + return managedBy; + } + + /** + * Set the managedBy of this {@link OrchestrationConfigResource} instance. + * + * @param managedBy + * The managedBy of this {@link OrchestrationConfigResource} + */ + public void setManagedBy( @Nullable final String managedBy ) + { + this.managedBy = managedBy; + } + + /** + * Set the isVersionHead of this {@link OrchestrationConfigResource} instance and return the same instance. + * + * @param isVersionHead + * The isVersionHead of this {@link OrchestrationConfigResource} + * @return The same instance of this {@link OrchestrationConfigResource} class + */ + @Nonnull + public OrchestrationConfigResource isVersionHead( @Nullable final Boolean isVersionHead ) + { + this.isVersionHead = isVersionHead; + return this; + } + + /** + * Get isVersionHead + * + * @return isVersionHead The isVersionHead of this {@link OrchestrationConfigResource} instance. + */ + @Nonnull + public Boolean isIsVersionHead() + { + return isVersionHead; + } + + /** + * Set the isVersionHead of this {@link OrchestrationConfigResource} instance. + * + * @param isVersionHead + * The isVersionHead of this {@link OrchestrationConfigResource} + */ + public void setIsVersionHead( @Nullable final Boolean isVersionHead ) + { + this.isVersionHead = isVersionHead; + } + + /** + * Set the resourceGroupId of this {@link OrchestrationConfigResource} instance and return the same instance. + * + * @param resourceGroupId + * The resourceGroupId of this {@link OrchestrationConfigResource} + * @return The same instance of this {@link OrchestrationConfigResource} class + */ + @Nonnull + public OrchestrationConfigResource resourceGroupId( @Nullable final String resourceGroupId ) + { + this.resourceGroupId = resourceGroupId; + return this; + } + + /** + * Get resourceGroupId + * + * @return resourceGroupId The resourceGroupId of this {@link OrchestrationConfigResource} instance. + */ + @Nonnull + public String getResourceGroupId() + { + return resourceGroupId; + } + + /** + * Set the resourceGroupId of this {@link OrchestrationConfigResource} instance. + * + * @param resourceGroupId + * The resourceGroupId of this {@link OrchestrationConfigResource} + */ + public void setResourceGroupId( @Nullable final String resourceGroupId ) + { + this.resourceGroupId = resourceGroupId; + } + + /** + * Set the spec of this {@link OrchestrationConfigResource} instance and return the same instance. + * + * @param spec + * The spec of this {@link OrchestrationConfigResource} + * @return The same instance of this {@link OrchestrationConfigResource} class + */ + @Nonnull + public OrchestrationConfigResource spec( @Nullable final OrchestrationConfig spec ) + { + this.spec = spec; + return this; + } + + /** + * Get spec + * + * @return spec The spec of this {@link OrchestrationConfigResource} instance. + */ + @Nonnull + public OrchestrationConfig getSpec() + { + return spec; + } + + /** + * Set the spec of this {@link OrchestrationConfigResource} instance. + * + * @param spec + * The spec of this {@link OrchestrationConfigResource} + */ + public void setSpec( @Nullable final OrchestrationConfig spec ) + { + this.spec = spec; + } + + /** + * Get the names of the unrecognizable properties of the {@link OrchestrationConfigResource}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link OrchestrationConfigResource} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("OrchestrationConfigResource has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link OrchestrationConfigResource} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( id != null ) + declaredFields.put("id", id); + if( name != null ) + declaredFields.put("name", name); + if( version != null ) + declaredFields.put("version", version); + if( scenario != null ) + declaredFields.put("scenario", scenario); + if( creationTimestamp != null ) + declaredFields.put("creationTimestamp", creationTimestamp); + if( managedBy != null ) + declaredFields.put("managedBy", managedBy); + if( isVersionHead != null ) + declaredFields.put("isVersionHead", isVersionHead); + if( resourceGroupId != null ) + declaredFields.put("resourceGroupId", resourceGroupId); + if( spec != null ) + declaredFields.put("spec", spec); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link OrchestrationConfigResource} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final OrchestrationConfigResource orchestrationConfigResource = (OrchestrationConfigResource) o; + return Objects.equals(this.cloudSdkCustomFields, orchestrationConfigResource.cloudSdkCustomFields) + && Objects.equals(this.id, orchestrationConfigResource.id) + && Objects.equals(this.name, orchestrationConfigResource.name) + && Objects.equals(this.version, orchestrationConfigResource.version) + && Objects.equals(this.scenario, orchestrationConfigResource.scenario) + && Objects.equals(this.creationTimestamp, orchestrationConfigResource.creationTimestamp) + && Objects.equals(this.managedBy, orchestrationConfigResource.managedBy) + && Objects.equals(this.isVersionHead, orchestrationConfigResource.isVersionHead) + && Objects.equals(this.resourceGroupId, orchestrationConfigResource.resourceGroupId) + && Objects.equals(this.spec, orchestrationConfigResource.spec); + } + + @Override + public int hashCode() + { + return Objects + .hash( + id, + name, + version, + scenario, + creationTimestamp, + managedBy, + isVersionHead, + resourceGroupId, + spec, + cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class OrchestrationConfigResource {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); + sb.append(" creationTimestamp: ").append(toIndentedString(creationTimestamp)).append("\n"); + sb.append(" managedBy: ").append(toIndentedString(managedBy)).append("\n"); + sb.append(" isVersionHead: ").append(toIndentedString(isVersionHead)).append("\n"); + sb.append(" resourceGroupId: ").append(toIndentedString(resourceGroupId)).append("\n"); + sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OutputFilterConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OutputFilterConfig.java new file mode 100644 index 000000000..ee970066b --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OutputFilterConfig.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.google.common.annotations.Beta; + +/** + * OutputFilterConfig + */ +@Beta +@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) +@JsonSubTypes( { + @JsonSubTypes.Type( value = AzureContentSafetyOutputFilterConfig.class ), + @JsonSubTypes.Type( value = LlamaGuard38bFilterConfig.class ), } ) + +public interface OutputFilterConfig +{ +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OutputFilteringConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OutputFilteringConfig.java new file mode 100644 index 000000000..e36747309 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OutputFilteringConfig.java @@ -0,0 +1,262 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * OutputFilteringConfig + */ + +@Beta // CHECKSTYLE:OFF +public class OutputFilteringConfig +// CHECKSTYLE:ON +{ + @JsonProperty( "filters" ) + private List filters = new ArrayList<>(); + + @JsonProperty( "stream_options" ) + private FilteringStreamOptions streamOptions; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for OutputFilteringConfig. + */ + protected OutputFilteringConfig() + { + } + + /** + * Set the filters of this {@link OutputFilteringConfig} instance and return the same instance. + * + * @param filters + * Configuration for content filtering services that should be used for the given filtering step (output + * filtering). + * @return The same instance of this {@link OutputFilteringConfig} class + */ + @Nonnull + public OutputFilteringConfig filters( @Nonnull final List filters ) + { + this.filters = filters; + return this; + } + + /** + * Add one filters instance to this {@link OutputFilteringConfig}. + * + * @param filtersItem + * The filters that should be added + * @return The same instance of type {@link OutputFilteringConfig} + */ + @Nonnull + public OutputFilteringConfig addFiltersItem( @Nonnull final OutputFilterConfig filtersItem ) + { + if( this.filters == null ) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + return this; + } + + /** + * Configuration for content filtering services that should be used for the given filtering step (output filtering). + * + * @return filters The filters of this {@link OutputFilteringConfig} instance. + */ + @Nonnull + public List getFilters() + { + return filters; + } + + /** + * Set the filters of this {@link OutputFilteringConfig} instance. + * + * @param filters + * Configuration for content filtering services that should be used for the given filtering step (output + * filtering). + */ + public void setFilters( @Nonnull final List filters ) + { + this.filters = filters; + } + + /** + * Set the streamOptions of this {@link OutputFilteringConfig} instance and return the same instance. + * + * @param streamOptions + * The streamOptions of this {@link OutputFilteringConfig} + * @return The same instance of this {@link OutputFilteringConfig} class + */ + @Nonnull + public OutputFilteringConfig streamOptions( @Nullable final FilteringStreamOptions streamOptions ) + { + this.streamOptions = streamOptions; + return this; + } + + /** + * Get streamOptions + * + * @return streamOptions The streamOptions of this {@link OutputFilteringConfig} instance. + */ + @Nonnull + public FilteringStreamOptions getStreamOptions() + { + return streamOptions; + } + + /** + * Set the streamOptions of this {@link OutputFilteringConfig} instance. + * + * @param streamOptions + * The streamOptions of this {@link OutputFilteringConfig} + */ + public void setStreamOptions( @Nullable final FilteringStreamOptions streamOptions ) + { + this.streamOptions = streamOptions; + } + + /** + * Get the names of the unrecognizable properties of the {@link OutputFilteringConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link OutputFilteringConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("OutputFilteringConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link OutputFilteringConfig} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( filters != null ) + declaredFields.put("filters", filters); + if( streamOptions != null ) + declaredFields.put("streamOptions", streamOptions); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link OutputFilteringConfig} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final OutputFilteringConfig outputFilteringConfig = (OutputFilteringConfig) o; + return Objects.equals(this.cloudSdkCustomFields, outputFilteringConfig.cloudSdkCustomFields) + && Objects.equals(this.filters, outputFilteringConfig.filters) + && Objects.equals(this.streamOptions, outputFilteringConfig.streamOptions); + } + + @Override + public int hashCode() + { + return Objects.hash(filters, streamOptions, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class OutputFilteringConfig {\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" streamOptions: ").append(toIndentedString(streamOptions)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplate.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplate.java new file mode 100644 index 000000000..3f75bd4e6 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplate.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.google.common.annotations.Beta; + +/** + * PromptTemplate + */ +@Beta +@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) +@JsonSubTypes( { + @JsonSubTypes.Type( value = MultiChatTemplate.class ), + @JsonSubTypes.Type( value = SingleChatTemplate.class ), } ) + +public interface PromptTemplate +{ +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateDeleteResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateDeleteResponse.java new file mode 100644 index 000000000..8eab815bf --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateDeleteResponse.java @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * PromptTemplateDeleteResponse + */ + +@Beta // CHECKSTYLE:OFF +public class PromptTemplateDeleteResponse +// CHECKSTYLE:ON +{ + @JsonProperty( "message" ) + private String message; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for PromptTemplateDeleteResponse. + */ + protected PromptTemplateDeleteResponse() + { + } + + /** + * Set the message of this {@link PromptTemplateDeleteResponse} instance and return the same instance. + * + * @param message + * The message of this {@link PromptTemplateDeleteResponse} + * @return The same instance of this {@link PromptTemplateDeleteResponse} class + */ + @Nonnull + public PromptTemplateDeleteResponse message( @Nonnull final String message ) + { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link PromptTemplateDeleteResponse} instance. + */ + @Nonnull + public String getMessage() + { + return message; + } + + /** + * Set the message of this {@link PromptTemplateDeleteResponse} instance. + * + * @param message + * The message of this {@link PromptTemplateDeleteResponse} + */ + public void setMessage( @Nonnull final String message ) + { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link PromptTemplateDeleteResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PromptTemplateDeleteResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("PromptTemplateDeleteResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PromptTemplateDeleteResponse} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( message != null ) + declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PromptTemplateDeleteResponse} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final PromptTemplateDeleteResponse promptTemplateDeleteResponse = (PromptTemplateDeleteResponse) o; + return Objects.equals(this.cloudSdkCustomFields, promptTemplateDeleteResponse.cloudSdkCustomFields) + && Objects.equals(this.message, promptTemplateDeleteResponse.message); + } + + @Override + public int hashCode() + { + return Objects.hash(message, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class PromptTemplateDeleteResponse {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateGetResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateGetResponse.java new file mode 100644 index 000000000..62eb8761d --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateGetResponse.java @@ -0,0 +1,555 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * PromptTemplateGetResponse + */ + +@Beta // CHECKSTYLE:OFF +public class PromptTemplateGetResponse +// CHECKSTYLE:ON +{ + @JsonProperty( "id" ) + private UUID id; + + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "version" ) + private String version; + + @JsonProperty( "scenario" ) + private String scenario; + + @JsonProperty( "creationTimestamp" ) + private String creationTimestamp; + + @JsonProperty( "managedBy" ) + private String managedBy; + + @JsonProperty( "isVersionHead" ) + private Boolean isVersionHead; + + @JsonProperty( "resourceGroupId" ) + private String resourceGroupId; + + @JsonProperty( "spec" ) + private PromptTemplateSpec spec; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for PromptTemplateGetResponse. + */ + protected PromptTemplateGetResponse() + { + } + + /** + * Set the id of this {@link PromptTemplateGetResponse} instance and return the same instance. + * + * @param id + * The id of this {@link PromptTemplateGetResponse} + * @return The same instance of this {@link PromptTemplateGetResponse} class + */ + @Nonnull + public PromptTemplateGetResponse id( @Nullable final UUID id ) + { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link PromptTemplateGetResponse} instance. + */ + @Nonnull + public UUID getId() + { + return id; + } + + /** + * Set the id of this {@link PromptTemplateGetResponse} instance. + * + * @param id + * The id of this {@link PromptTemplateGetResponse} + */ + public void setId( @Nullable final UUID id ) + { + this.id = id; + } + + /** + * Set the name of this {@link PromptTemplateGetResponse} instance and return the same instance. + * + * @param name + * The name of this {@link PromptTemplateGetResponse} + * @return The same instance of this {@link PromptTemplateGetResponse} class + */ + @Nonnull + public PromptTemplateGetResponse name( @Nullable final String name ) + { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name The name of this {@link PromptTemplateGetResponse} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link PromptTemplateGetResponse} instance. + * + * @param name + * The name of this {@link PromptTemplateGetResponse} + */ + public void setName( @Nullable final String name ) + { + this.name = name; + } + + /** + * Set the version of this {@link PromptTemplateGetResponse} instance and return the same instance. + * + * @param version + * The version of this {@link PromptTemplateGetResponse} + * @return The same instance of this {@link PromptTemplateGetResponse} class + */ + @Nonnull + public PromptTemplateGetResponse version( @Nullable final String version ) + { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version The version of this {@link PromptTemplateGetResponse} instance. + */ + @Nonnull + public String getVersion() + { + return version; + } + + /** + * Set the version of this {@link PromptTemplateGetResponse} instance. + * + * @param version + * The version of this {@link PromptTemplateGetResponse} + */ + public void setVersion( @Nullable final String version ) + { + this.version = version; + } + + /** + * Set the scenario of this {@link PromptTemplateGetResponse} instance and return the same instance. + * + * @param scenario + * The scenario of this {@link PromptTemplateGetResponse} + * @return The same instance of this {@link PromptTemplateGetResponse} class + */ + @Nonnull + public PromptTemplateGetResponse scenario( @Nullable final String scenario ) + { + this.scenario = scenario; + return this; + } + + /** + * Get scenario + * + * @return scenario The scenario of this {@link PromptTemplateGetResponse} instance. + */ + @Nonnull + public String getScenario() + { + return scenario; + } + + /** + * Set the scenario of this {@link PromptTemplateGetResponse} instance. + * + * @param scenario + * The scenario of this {@link PromptTemplateGetResponse} + */ + public void setScenario( @Nullable final String scenario ) + { + this.scenario = scenario; + } + + /** + * Set the creationTimestamp of this {@link PromptTemplateGetResponse} instance and return the same instance. + * + * @param creationTimestamp + * The creationTimestamp of this {@link PromptTemplateGetResponse} + * @return The same instance of this {@link PromptTemplateGetResponse} class + */ + @Nonnull + public PromptTemplateGetResponse creationTimestamp( @Nullable final String creationTimestamp ) + { + this.creationTimestamp = creationTimestamp; + return this; + } + + /** + * Get creationTimestamp + * + * @return creationTimestamp The creationTimestamp of this {@link PromptTemplateGetResponse} instance. + */ + @Nonnull + public String getCreationTimestamp() + { + return creationTimestamp; + } + + /** + * Set the creationTimestamp of this {@link PromptTemplateGetResponse} instance. + * + * @param creationTimestamp + * The creationTimestamp of this {@link PromptTemplateGetResponse} + */ + public void setCreationTimestamp( @Nullable final String creationTimestamp ) + { + this.creationTimestamp = creationTimestamp; + } + + /** + * Set the managedBy of this {@link PromptTemplateGetResponse} instance and return the same instance. + * + * @param managedBy + * The managedBy of this {@link PromptTemplateGetResponse} + * @return The same instance of this {@link PromptTemplateGetResponse} class + */ + @Nonnull + public PromptTemplateGetResponse managedBy( @Nullable final String managedBy ) + { + this.managedBy = managedBy; + return this; + } + + /** + * Get managedBy + * + * @return managedBy The managedBy of this {@link PromptTemplateGetResponse} instance. + */ + @Nonnull + public String getManagedBy() + { + return managedBy; + } + + /** + * Set the managedBy of this {@link PromptTemplateGetResponse} instance. + * + * @param managedBy + * The managedBy of this {@link PromptTemplateGetResponse} + */ + public void setManagedBy( @Nullable final String managedBy ) + { + this.managedBy = managedBy; + } + + /** + * Set the isVersionHead of this {@link PromptTemplateGetResponse} instance and return the same instance. + * + * @param isVersionHead + * The isVersionHead of this {@link PromptTemplateGetResponse} + * @return The same instance of this {@link PromptTemplateGetResponse} class + */ + @Nonnull + public PromptTemplateGetResponse isVersionHead( @Nullable final Boolean isVersionHead ) + { + this.isVersionHead = isVersionHead; + return this; + } + + /** + * Get isVersionHead + * + * @return isVersionHead The isVersionHead of this {@link PromptTemplateGetResponse} instance. + */ + @Nonnull + public Boolean isIsVersionHead() + { + return isVersionHead; + } + + /** + * Set the isVersionHead of this {@link PromptTemplateGetResponse} instance. + * + * @param isVersionHead + * The isVersionHead of this {@link PromptTemplateGetResponse} + */ + public void setIsVersionHead( @Nullable final Boolean isVersionHead ) + { + this.isVersionHead = isVersionHead; + } + + /** + * Set the resourceGroupId of this {@link PromptTemplateGetResponse} instance and return the same instance. + * + * @param resourceGroupId + * The resourceGroupId of this {@link PromptTemplateGetResponse} + * @return The same instance of this {@link PromptTemplateGetResponse} class + */ + @Nonnull + public PromptTemplateGetResponse resourceGroupId( @Nullable final String resourceGroupId ) + { + this.resourceGroupId = resourceGroupId; + return this; + } + + /** + * Get resourceGroupId + * + * @return resourceGroupId The resourceGroupId of this {@link PromptTemplateGetResponse} instance. + */ + @Nonnull + public String getResourceGroupId() + { + return resourceGroupId; + } + + /** + * Set the resourceGroupId of this {@link PromptTemplateGetResponse} instance. + * + * @param resourceGroupId + * The resourceGroupId of this {@link PromptTemplateGetResponse} + */ + public void setResourceGroupId( @Nullable final String resourceGroupId ) + { + this.resourceGroupId = resourceGroupId; + } + + /** + * Set the spec of this {@link PromptTemplateGetResponse} instance and return the same instance. + * + * @param spec + * The spec of this {@link PromptTemplateGetResponse} + * @return The same instance of this {@link PromptTemplateGetResponse} class + */ + @Nonnull + public PromptTemplateGetResponse spec( @Nullable final PromptTemplateSpec spec ) + { + this.spec = spec; + return this; + } + + /** + * Get spec + * + * @return spec The spec of this {@link PromptTemplateGetResponse} instance. + */ + @Nonnull + public PromptTemplateSpec getSpec() + { + return spec; + } + + /** + * Set the spec of this {@link PromptTemplateGetResponse} instance. + * + * @param spec + * The spec of this {@link PromptTemplateGetResponse} + */ + public void setSpec( @Nullable final PromptTemplateSpec spec ) + { + this.spec = spec; + } + + /** + * Get the names of the unrecognizable properties of the {@link PromptTemplateGetResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PromptTemplateGetResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("PromptTemplateGetResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PromptTemplateGetResponse} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( id != null ) + declaredFields.put("id", id); + if( name != null ) + declaredFields.put("name", name); + if( version != null ) + declaredFields.put("version", version); + if( scenario != null ) + declaredFields.put("scenario", scenario); + if( creationTimestamp != null ) + declaredFields.put("creationTimestamp", creationTimestamp); + if( managedBy != null ) + declaredFields.put("managedBy", managedBy); + if( isVersionHead != null ) + declaredFields.put("isVersionHead", isVersionHead); + if( resourceGroupId != null ) + declaredFields.put("resourceGroupId", resourceGroupId); + if( spec != null ) + declaredFields.put("spec", spec); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PromptTemplateGetResponse} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final PromptTemplateGetResponse promptTemplateGetResponse = (PromptTemplateGetResponse) o; + return Objects.equals(this.cloudSdkCustomFields, promptTemplateGetResponse.cloudSdkCustomFields) + && Objects.equals(this.id, promptTemplateGetResponse.id) + && Objects.equals(this.name, promptTemplateGetResponse.name) + && Objects.equals(this.version, promptTemplateGetResponse.version) + && Objects.equals(this.scenario, promptTemplateGetResponse.scenario) + && Objects.equals(this.creationTimestamp, promptTemplateGetResponse.creationTimestamp) + && Objects.equals(this.managedBy, promptTemplateGetResponse.managedBy) + && Objects.equals(this.isVersionHead, promptTemplateGetResponse.isVersionHead) + && Objects.equals(this.resourceGroupId, promptTemplateGetResponse.resourceGroupId) + && Objects.equals(this.spec, promptTemplateGetResponse.spec); + } + + @Override + public int hashCode() + { + return Objects + .hash( + id, + name, + version, + scenario, + creationTimestamp, + managedBy, + isVersionHead, + resourceGroupId, + spec, + cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class PromptTemplateGetResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); + sb.append(" creationTimestamp: ").append(toIndentedString(creationTimestamp)).append("\n"); + sb.append(" managedBy: ").append(toIndentedString(managedBy)).append("\n"); + sb.append(" isVersionHead: ").append(toIndentedString(isVersionHead)).append("\n"); + sb.append(" resourceGroupId: ").append(toIndentedString(resourceGroupId)).append("\n"); + sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateListResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateListResponse.java new file mode 100644 index 000000000..52fb91df9 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateListResponse.java @@ -0,0 +1,261 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * PromptTemplateListResponse + */ + +@Beta // CHECKSTYLE:OFF +public class PromptTemplateListResponse +// CHECKSTYLE:ON +{ + @JsonProperty( "count" ) + private Integer count; + + @JsonProperty( "resources" ) + private List resources = new ArrayList<>(); + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for PromptTemplateListResponse. + */ + protected PromptTemplateListResponse() + { + } + + /** + * Set the count of this {@link PromptTemplateListResponse} instance and return the same instance. + * + * @param count + * The count of this {@link PromptTemplateListResponse} + * @return The same instance of this {@link PromptTemplateListResponse} class + */ + @Nonnull + public PromptTemplateListResponse count( @Nonnull final Integer count ) + { + this.count = count; + return this; + } + + /** + * Get count + * + * @return count The count of this {@link PromptTemplateListResponse} instance. + */ + @Nonnull + public Integer getCount() + { + return count; + } + + /** + * Set the count of this {@link PromptTemplateListResponse} instance. + * + * @param count + * The count of this {@link PromptTemplateListResponse} + */ + public void setCount( @Nonnull final Integer count ) + { + this.count = count; + } + + /** + * Set the resources of this {@link PromptTemplateListResponse} instance and return the same instance. + * + * @param resources + * The resources of this {@link PromptTemplateListResponse} + * @return The same instance of this {@link PromptTemplateListResponse} class + */ + @Nonnull + public PromptTemplateListResponse resources( @Nonnull final List resources ) + { + this.resources = resources; + return this; + } + + /** + * Add one resources instance to this {@link PromptTemplateListResponse}. + * + * @param resourcesItem + * The resources that should be added + * @return The same instance of type {@link PromptTemplateListResponse} + */ + @Nonnull + public PromptTemplateListResponse addResourcesItem( @Nonnull final PromptTemplateGetResponse resourcesItem ) + { + if( this.resources == null ) { + this.resources = new ArrayList<>(); + } + this.resources.add(resourcesItem); + return this; + } + + /** + * Get resources + * + * @return resources The resources of this {@link PromptTemplateListResponse} instance. + */ + @Nonnull + public List getResources() + { + return resources; + } + + /** + * Set the resources of this {@link PromptTemplateListResponse} instance. + * + * @param resources + * The resources of this {@link PromptTemplateListResponse} + */ + public void setResources( @Nonnull final List resources ) + { + this.resources = resources; + } + + /** + * Get the names of the unrecognizable properties of the {@link PromptTemplateListResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PromptTemplateListResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("PromptTemplateListResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PromptTemplateListResponse} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( count != null ) + declaredFields.put("count", count); + if( resources != null ) + declaredFields.put("resources", resources); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PromptTemplateListResponse} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final PromptTemplateListResponse promptTemplateListResponse = (PromptTemplateListResponse) o; + return Objects.equals(this.cloudSdkCustomFields, promptTemplateListResponse.cloudSdkCustomFields) + && Objects.equals(this.count, promptTemplateListResponse.count) + && Objects.equals(this.resources, promptTemplateListResponse.resources); + } + + @Override + public int hashCode() + { + return Objects.hash(count, resources, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class PromptTemplateListResponse {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" resources: ").append(toIndentedString(resources)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatePostRequest.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatePostRequest.java new file mode 100644 index 000000000..dde36cd5d --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatePostRequest.java @@ -0,0 +1,328 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * PromptTemplatePostRequest + */ + +@Beta // CHECKSTYLE:OFF +public class PromptTemplatePostRequest +// CHECKSTYLE:ON +{ + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "version" ) + private String version; + + @JsonProperty( "scenario" ) + private String scenario; + + @JsonProperty( "spec" ) + private PromptTemplateSpec spec; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for PromptTemplatePostRequest. + */ + protected PromptTemplatePostRequest() + { + } + + /** + * Set the name of this {@link PromptTemplatePostRequest} instance and return the same instance. + * + * @param name + * The name of this {@link PromptTemplatePostRequest} + * @return The same instance of this {@link PromptTemplatePostRequest} class + */ + @Nonnull + public PromptTemplatePostRequest name( @Nonnull final String name ) + { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name The name of this {@link PromptTemplatePostRequest} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link PromptTemplatePostRequest} instance. + * + * @param name + * The name of this {@link PromptTemplatePostRequest} + */ + public void setName( @Nonnull final String name ) + { + this.name = name; + } + + /** + * Set the version of this {@link PromptTemplatePostRequest} instance and return the same instance. + * + * @param version + * The version of this {@link PromptTemplatePostRequest} + * @return The same instance of this {@link PromptTemplatePostRequest} class + */ + @Nonnull + public PromptTemplatePostRequest version( @Nonnull final String version ) + { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version The version of this {@link PromptTemplatePostRequest} instance. + */ + @Nonnull + public String getVersion() + { + return version; + } + + /** + * Set the version of this {@link PromptTemplatePostRequest} instance. + * + * @param version + * The version of this {@link PromptTemplatePostRequest} + */ + public void setVersion( @Nonnull final String version ) + { + this.version = version; + } + + /** + * Set the scenario of this {@link PromptTemplatePostRequest} instance and return the same instance. + * + * @param scenario + * The scenario of this {@link PromptTemplatePostRequest} + * @return The same instance of this {@link PromptTemplatePostRequest} class + */ + @Nonnull + public PromptTemplatePostRequest scenario( @Nonnull final String scenario ) + { + this.scenario = scenario; + return this; + } + + /** + * Get scenario + * + * @return scenario The scenario of this {@link PromptTemplatePostRequest} instance. + */ + @Nonnull + public String getScenario() + { + return scenario; + } + + /** + * Set the scenario of this {@link PromptTemplatePostRequest} instance. + * + * @param scenario + * The scenario of this {@link PromptTemplatePostRequest} + */ + public void setScenario( @Nonnull final String scenario ) + { + this.scenario = scenario; + } + + /** + * Set the spec of this {@link PromptTemplatePostRequest} instance and return the same instance. + * + * @param spec + * The spec of this {@link PromptTemplatePostRequest} + * @return The same instance of this {@link PromptTemplatePostRequest} class + */ + @Nonnull + public PromptTemplatePostRequest spec( @Nonnull final PromptTemplateSpec spec ) + { + this.spec = spec; + return this; + } + + /** + * Get spec + * + * @return spec The spec of this {@link PromptTemplatePostRequest} instance. + */ + @Nonnull + public PromptTemplateSpec getSpec() + { + return spec; + } + + /** + * Set the spec of this {@link PromptTemplatePostRequest} instance. + * + * @param spec + * The spec of this {@link PromptTemplatePostRequest} + */ + public void setSpec( @Nonnull final PromptTemplateSpec spec ) + { + this.spec = spec; + } + + /** + * Get the names of the unrecognizable properties of the {@link PromptTemplatePostRequest}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PromptTemplatePostRequest} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("PromptTemplatePostRequest has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PromptTemplatePostRequest} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( name != null ) + declaredFields.put("name", name); + if( version != null ) + declaredFields.put("version", version); + if( scenario != null ) + declaredFields.put("scenario", scenario); + if( spec != null ) + declaredFields.put("spec", spec); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PromptTemplatePostRequest} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final PromptTemplatePostRequest promptTemplatePostRequest = (PromptTemplatePostRequest) o; + return Objects.equals(this.cloudSdkCustomFields, promptTemplatePostRequest.cloudSdkCustomFields) + && Objects.equals(this.name, promptTemplatePostRequest.name) + && Objects.equals(this.version, promptTemplatePostRequest.version) + && Objects.equals(this.scenario, promptTemplatePostRequest.scenario) + && Objects.equals(this.spec, promptTemplatePostRequest.spec); + } + + @Override + public int hashCode() + { + return Objects.hash(name, version, scenario, spec, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class PromptTemplatePostRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); + sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatePostResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatePostResponse.java new file mode 100644 index 000000000..11507bb3f --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatePostResponse.java @@ -0,0 +1,372 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * PromptTemplatePostResponse + */ + +@Beta // CHECKSTYLE:OFF +public class PromptTemplatePostResponse +// CHECKSTYLE:ON +{ + @JsonProperty( "message" ) + private String message; + + @JsonProperty( "id" ) + private UUID id; + + @JsonProperty( "scenario" ) + private String scenario; + + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "version" ) + private String version; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for PromptTemplatePostResponse. + */ + protected PromptTemplatePostResponse() + { + } + + /** + * Set the message of this {@link PromptTemplatePostResponse} instance and return the same instance. + * + * @param message + * The message of this {@link PromptTemplatePostResponse} + * @return The same instance of this {@link PromptTemplatePostResponse} class + */ + @Nonnull + public PromptTemplatePostResponse message( @Nonnull final String message ) + { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link PromptTemplatePostResponse} instance. + */ + @Nonnull + public String getMessage() + { + return message; + } + + /** + * Set the message of this {@link PromptTemplatePostResponse} instance. + * + * @param message + * The message of this {@link PromptTemplatePostResponse} + */ + public void setMessage( @Nonnull final String message ) + { + this.message = message; + } + + /** + * Set the id of this {@link PromptTemplatePostResponse} instance and return the same instance. + * + * @param id + * The id of this {@link PromptTemplatePostResponse} + * @return The same instance of this {@link PromptTemplatePostResponse} class + */ + @Nonnull + public PromptTemplatePostResponse id( @Nonnull final UUID id ) + { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link PromptTemplatePostResponse} instance. + */ + @Nonnull + public UUID getId() + { + return id; + } + + /** + * Set the id of this {@link PromptTemplatePostResponse} instance. + * + * @param id + * The id of this {@link PromptTemplatePostResponse} + */ + public void setId( @Nonnull final UUID id ) + { + this.id = id; + } + + /** + * Set the scenario of this {@link PromptTemplatePostResponse} instance and return the same instance. + * + * @param scenario + * The scenario of this {@link PromptTemplatePostResponse} + * @return The same instance of this {@link PromptTemplatePostResponse} class + */ + @Nonnull + public PromptTemplatePostResponse scenario( @Nonnull final String scenario ) + { + this.scenario = scenario; + return this; + } + + /** + * Get scenario + * + * @return scenario The scenario of this {@link PromptTemplatePostResponse} instance. + */ + @Nonnull + public String getScenario() + { + return scenario; + } + + /** + * Set the scenario of this {@link PromptTemplatePostResponse} instance. + * + * @param scenario + * The scenario of this {@link PromptTemplatePostResponse} + */ + public void setScenario( @Nonnull final String scenario ) + { + this.scenario = scenario; + } + + /** + * Set the name of this {@link PromptTemplatePostResponse} instance and return the same instance. + * + * @param name + * The name of this {@link PromptTemplatePostResponse} + * @return The same instance of this {@link PromptTemplatePostResponse} class + */ + @Nonnull + public PromptTemplatePostResponse name( @Nonnull final String name ) + { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name The name of this {@link PromptTemplatePostResponse} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link PromptTemplatePostResponse} instance. + * + * @param name + * The name of this {@link PromptTemplatePostResponse} + */ + public void setName( @Nonnull final String name ) + { + this.name = name; + } + + /** + * Set the version of this {@link PromptTemplatePostResponse} instance and return the same instance. + * + * @param version + * The version of this {@link PromptTemplatePostResponse} + * @return The same instance of this {@link PromptTemplatePostResponse} class + */ + @Nonnull + public PromptTemplatePostResponse version( @Nonnull final String version ) + { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version The version of this {@link PromptTemplatePostResponse} instance. + */ + @Nonnull + public String getVersion() + { + return version; + } + + /** + * Set the version of this {@link PromptTemplatePostResponse} instance. + * + * @param version + * The version of this {@link PromptTemplatePostResponse} + */ + public void setVersion( @Nonnull final String version ) + { + this.version = version; + } + + /** + * Get the names of the unrecognizable properties of the {@link PromptTemplatePostResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PromptTemplatePostResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("PromptTemplatePostResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PromptTemplatePostResponse} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( message != null ) + declaredFields.put("message", message); + if( id != null ) + declaredFields.put("id", id); + if( scenario != null ) + declaredFields.put("scenario", scenario); + if( name != null ) + declaredFields.put("name", name); + if( version != null ) + declaredFields.put("version", version); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PromptTemplatePostResponse} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final PromptTemplatePostResponse promptTemplatePostResponse = (PromptTemplatePostResponse) o; + return Objects.equals(this.cloudSdkCustomFields, promptTemplatePostResponse.cloudSdkCustomFields) + && Objects.equals(this.message, promptTemplatePostResponse.message) + && Objects.equals(this.id, promptTemplatePostResponse.id) + && Objects.equals(this.scenario, promptTemplatePostResponse.scenario) + && Objects.equals(this.name, promptTemplatePostResponse.name) + && Objects.equals(this.version, promptTemplatePostResponse.version); + } + + @Override + public int hashCode() + { + return Objects.hash(message, id, scenario, name, version, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class PromptTemplatePostResponse {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSpec.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSpec.java new file mode 100644 index 000000000..fc354f94c --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSpec.java @@ -0,0 +1,411 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * PromptTemplateSpec + */ + +@Beta // CHECKSTYLE:OFF +public class PromptTemplateSpec +// CHECKSTYLE:ON +{ + @JsonProperty( "template" ) + private List template = new ArrayList<>(); + + @JsonProperty( "defaults" ) + private Object defaults; + + @JsonProperty( "additionalFields" ) + private Object additionalFields; + + @JsonProperty( "response_format" ) + private PromptTemplateSpecResponseFormat responseFormat; + + @JsonProperty( "tools" ) + private List tools = new ArrayList<>(); + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for PromptTemplateSpec. + */ + protected PromptTemplateSpec() + { + } + + /** + * Set the template of this {@link PromptTemplateSpec} instance and return the same instance. + * + * @param template + * The template of this {@link PromptTemplateSpec} + * @return The same instance of this {@link PromptTemplateSpec} class + */ + @Nonnull + public PromptTemplateSpec template( @Nonnull final List template ) + { + this.template = template; + return this; + } + + /** + * Add one template instance to this {@link PromptTemplateSpec}. + * + * @param templateItem + * The template that should be added + * @return The same instance of type {@link PromptTemplateSpec} + */ + @Nonnull + public PromptTemplateSpec addTemplateItem( @Nonnull final PromptTemplate templateItem ) + { + if( this.template == null ) { + this.template = new ArrayList<>(); + } + this.template.add(templateItem); + return this; + } + + /** + * Get template + * + * @return template The template of this {@link PromptTemplateSpec} instance. + */ + @Nonnull + public List getTemplate() + { + return template; + } + + /** + * Set the template of this {@link PromptTemplateSpec} instance. + * + * @param template + * The template of this {@link PromptTemplateSpec} + */ + public void setTemplate( @Nonnull final List template ) + { + this.template = template; + } + + /** + * Set the defaults of this {@link PromptTemplateSpec} instance and return the same instance. + * + * @param defaults + * The defaults of this {@link PromptTemplateSpec} + * @return The same instance of this {@link PromptTemplateSpec} class + */ + @Nonnull + public PromptTemplateSpec defaults( @Nullable final Object defaults ) + { + this.defaults = defaults; + return this; + } + + /** + * Get defaults + * + * @return defaults The defaults of this {@link PromptTemplateSpec} instance. + */ + @Nonnull + public Object getDefaults() + { + return defaults; + } + + /** + * Set the defaults of this {@link PromptTemplateSpec} instance. + * + * @param defaults + * The defaults of this {@link PromptTemplateSpec} + */ + public void setDefaults( @Nullable final Object defaults ) + { + this.defaults = defaults; + } + + /** + * Set the additionalFields of this {@link PromptTemplateSpec} instance and return the same instance. + * + * @param additionalFields + * DEPRECATED. Please use additional_fields instead. + * @return The same instance of this {@link PromptTemplateSpec} class + */ + @Nonnull + public PromptTemplateSpec additionalFields( @Nullable final Object additionalFields ) + { + this.additionalFields = additionalFields; + return this; + } + + /** + * DEPRECATED. Please use additional_fields instead. + * + * @return additionalFields The additionalFields of this {@link PromptTemplateSpec} instance. + * @deprecated + */ + @Deprecated + @Nonnull + public Object getAdditionalFields() + { + return additionalFields; + } + + /** + * Set the additionalFields of this {@link PromptTemplateSpec} instance. + * + * @param additionalFields + * DEPRECATED. Please use additional_fields instead. + */ + public void setAdditionalFields( @Nullable final Object additionalFields ) + { + this.additionalFields = additionalFields; + } + + /** + * Set the responseFormat of this {@link PromptTemplateSpec} instance and return the same instance. + * + * @param responseFormat + * The responseFormat of this {@link PromptTemplateSpec} + * @return The same instance of this {@link PromptTemplateSpec} class + */ + @Nonnull + public PromptTemplateSpec responseFormat( @Nullable final PromptTemplateSpecResponseFormat responseFormat ) + { + this.responseFormat = responseFormat; + return this; + } + + /** + * Get responseFormat + * + * @return responseFormat The responseFormat of this {@link PromptTemplateSpec} instance. + */ + @Nonnull + public PromptTemplateSpecResponseFormat getResponseFormat() + { + return responseFormat; + } + + /** + * Set the responseFormat of this {@link PromptTemplateSpec} instance. + * + * @param responseFormat + * The responseFormat of this {@link PromptTemplateSpec} + */ + public void setResponseFormat( @Nullable final PromptTemplateSpecResponseFormat responseFormat ) + { + this.responseFormat = responseFormat; + } + + /** + * Set the tools of this {@link PromptTemplateSpec} instance and return the same instance. + * + * @param tools + * A list of tools the model may call. Used to provide a list of functions the model may generate JSON + * inputs for. This is the same as the OpenAI definition. + * @return The same instance of this {@link PromptTemplateSpec} class + */ + @Nonnull + public PromptTemplateSpec tools( @Nullable final List tools ) + { + this.tools = tools; + return this; + } + + /** + * Add one tools instance to this {@link PromptTemplateSpec}. + * + * @param toolsItem + * The tools that should be added + * @return The same instance of type {@link PromptTemplateSpec} + */ + @Nonnull + public PromptTemplateSpec addToolsItem( @Nonnull final ChatCompletionTool toolsItem ) + { + if( this.tools == null ) { + this.tools = new ArrayList<>(); + } + this.tools.add(toolsItem); + return this; + } + + /** + * A list of tools the model may call. Used to provide a list of functions the model may generate JSON inputs for. + * This is the same as the OpenAI definition. + * + * @return tools The tools of this {@link PromptTemplateSpec} instance. + */ + @Nonnull + public List getTools() + { + return tools; + } + + /** + * Set the tools of this {@link PromptTemplateSpec} instance. + * + * @param tools + * A list of tools the model may call. Used to provide a list of functions the model may generate JSON + * inputs for. This is the same as the OpenAI definition. + */ + public void setTools( @Nullable final List tools ) + { + this.tools = tools; + } + + /** + * Get the names of the unrecognizable properties of the {@link PromptTemplateSpec}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PromptTemplateSpec} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("PromptTemplateSpec has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PromptTemplateSpec} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( template != null ) + declaredFields.put("template", template); + if( defaults != null ) + declaredFields.put("defaults", defaults); + if( additionalFields != null ) + declaredFields.put("additionalFields", additionalFields); + if( responseFormat != null ) + declaredFields.put("responseFormat", responseFormat); + if( tools != null ) + declaredFields.put("tools", tools); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PromptTemplateSpec} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final PromptTemplateSpec promptTemplateSpec = (PromptTemplateSpec) o; + return Objects.equals(this.cloudSdkCustomFields, promptTemplateSpec.cloudSdkCustomFields) + && Objects.equals(this.template, promptTemplateSpec.template) + && Objects.equals(this.defaults, promptTemplateSpec.defaults) + && Objects.equals(this.additionalFields, promptTemplateSpec.additionalFields) + && Objects.equals(this.responseFormat, promptTemplateSpec.responseFormat) + && Objects.equals(this.tools, promptTemplateSpec.tools); + } + + @Override + public int hashCode() + { + return Objects.hash(template, defaults, additionalFields, responseFormat, tools, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class PromptTemplateSpec {\n"); + sb.append(" template: ").append(toIndentedString(template)).append("\n"); + sb.append(" defaults: ").append(toIndentedString(defaults)).append("\n"); + sb.append(" additionalFields: ").append(toIndentedString(additionalFields)).append("\n"); + sb.append(" responseFormat: ").append(toIndentedString(responseFormat)).append("\n"); + sb.append(" tools: ").append(toIndentedString(tools)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSpecResponseFormat.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSpecResponseFormat.java new file mode 100644 index 000000000..0472f96ec --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSpecResponseFormat.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.google.common.annotations.Beta; + +/** + * Response format that the model output should adhere to. This is the same as the OpenAI definition. Compatible with + * GPT-4o, GPT-4o mini, GPT-4 (Turbo) and all GPT-3.5 Turbo models newer than gpt-3.5-turbo-1106. + */ +@Beta +@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) +@JsonSubTypes( { + @JsonSubTypes.Type( value = ResponseFormatJsonObject.class ), + @JsonSubTypes.Type( value = ResponseFormatJsonSchema.class ), + @JsonSubTypes.Type( value = ResponseFormatText.class ), } ) + +public interface PromptTemplateSpecResponseFormat +{ +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSubstitutionRequest.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSubstitutionRequest.java new file mode 100644 index 000000000..dbd20f8ba --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSubstitutionRequest.java @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * PromptTemplateSubstitutionRequest + */ + +@Beta // CHECKSTYLE:OFF +public class PromptTemplateSubstitutionRequest +// CHECKSTYLE:ON +{ + @JsonProperty( "inputParams" ) + private Object inputParams; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for PromptTemplateSubstitutionRequest. + */ + protected PromptTemplateSubstitutionRequest() + { + } + + /** + * Set the inputParams of this {@link PromptTemplateSubstitutionRequest} instance and return the same instance. + * + * @param inputParams + * The inputParams of this {@link PromptTemplateSubstitutionRequest} + * @return The same instance of this {@link PromptTemplateSubstitutionRequest} class + */ + @Nonnull + public PromptTemplateSubstitutionRequest inputParams( @Nullable final Object inputParams ) + { + this.inputParams = inputParams; + return this; + } + + /** + * Get inputParams + * + * @return inputParams The inputParams of this {@link PromptTemplateSubstitutionRequest} instance. + */ + @Nonnull + public Object getInputParams() + { + return inputParams; + } + + /** + * Set the inputParams of this {@link PromptTemplateSubstitutionRequest} instance. + * + * @param inputParams + * The inputParams of this {@link PromptTemplateSubstitutionRequest} + */ + public void setInputParams( @Nullable final Object inputParams ) + { + this.inputParams = inputParams; + } + + /** + * Get the names of the unrecognizable properties of the {@link PromptTemplateSubstitutionRequest}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PromptTemplateSubstitutionRequest} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException( + "PromptTemplateSubstitutionRequest has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PromptTemplateSubstitutionRequest} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( inputParams != null ) + declaredFields.put("inputParams", inputParams); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PromptTemplateSubstitutionRequest} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final PromptTemplateSubstitutionRequest promptTemplateSubstitutionRequest = + (PromptTemplateSubstitutionRequest) o; + return Objects.equals(this.cloudSdkCustomFields, promptTemplateSubstitutionRequest.cloudSdkCustomFields) + && Objects.equals(this.inputParams, promptTemplateSubstitutionRequest.inputParams); + } + + @Override + public int hashCode() + { + return Objects.hash(inputParams, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class PromptTemplateSubstitutionRequest {\n"); + sb.append(" inputParams: ").append(toIndentedString(inputParams)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSubstitutionResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSubstitutionResponse.java new file mode 100644 index 000000000..dcf52de93 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSubstitutionResponse.java @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * PromptTemplateSubstitutionResponse + */ + +@Beta // CHECKSTYLE:OFF +public class PromptTemplateSubstitutionResponse +// CHECKSTYLE:ON +{ + @JsonProperty( "parsedPrompt" ) + private List parsedPrompt = new ArrayList<>(); + + @JsonProperty( "resource" ) + private PromptTemplateGetResponse resource; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for PromptTemplateSubstitutionResponse. + */ + protected PromptTemplateSubstitutionResponse() + { + } + + /** + * Set the parsedPrompt of this {@link PromptTemplateSubstitutionResponse} instance and return the same instance. + * + * @param parsedPrompt + * The parsedPrompt of this {@link PromptTemplateSubstitutionResponse} + * @return The same instance of this {@link PromptTemplateSubstitutionResponse} class + */ + @Nonnull + public PromptTemplateSubstitutionResponse parsedPrompt( @Nullable final List parsedPrompt ) + { + this.parsedPrompt = parsedPrompt; + return this; + } + + /** + * Add one parsedPrompt instance to this {@link PromptTemplateSubstitutionResponse}. + * + * @param parsedPromptItem + * The parsedPrompt that should be added + * @return The same instance of type {@link PromptTemplateSubstitutionResponse} + */ + @Nonnull + public PromptTemplateSubstitutionResponse addParsedPromptItem( @Nonnull final PromptTemplate parsedPromptItem ) + { + if( this.parsedPrompt == null ) { + this.parsedPrompt = new ArrayList<>(); + } + this.parsedPrompt.add(parsedPromptItem); + return this; + } + + /** + * Get parsedPrompt + * + * @return parsedPrompt The parsedPrompt of this {@link PromptTemplateSubstitutionResponse} instance. + */ + @Nonnull + public List getParsedPrompt() + { + return parsedPrompt; + } + + /** + * Set the parsedPrompt of this {@link PromptTemplateSubstitutionResponse} instance. + * + * @param parsedPrompt + * The parsedPrompt of this {@link PromptTemplateSubstitutionResponse} + */ + public void setParsedPrompt( @Nullable final List parsedPrompt ) + { + this.parsedPrompt = parsedPrompt; + } + + /** + * Set the resource of this {@link PromptTemplateSubstitutionResponse} instance and return the same instance. + * + * @param resource + * The resource of this {@link PromptTemplateSubstitutionResponse} + * @return The same instance of this {@link PromptTemplateSubstitutionResponse} class + */ + @Nonnull + public PromptTemplateSubstitutionResponse resource( @Nullable final PromptTemplateGetResponse resource ) + { + this.resource = resource; + return this; + } + + /** + * Get resource + * + * @return resource The resource of this {@link PromptTemplateSubstitutionResponse} instance. + */ + @Nonnull + public PromptTemplateGetResponse getResource() + { + return resource; + } + + /** + * Set the resource of this {@link PromptTemplateSubstitutionResponse} instance. + * + * @param resource + * The resource of this {@link PromptTemplateSubstitutionResponse} + */ + public void setResource( @Nullable final PromptTemplateGetResponse resource ) + { + this.resource = resource; + } + + /** + * Get the names of the unrecognizable properties of the {@link PromptTemplateSubstitutionResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PromptTemplateSubstitutionResponse} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException( + "PromptTemplateSubstitutionResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PromptTemplateSubstitutionResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( parsedPrompt != null ) + declaredFields.put("parsedPrompt", parsedPrompt); + if( resource != null ) + declaredFields.put("resource", resource); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PromptTemplateSubstitutionResponse} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final PromptTemplateSubstitutionResponse promptTemplateSubstitutionResponse = + (PromptTemplateSubstitutionResponse) o; + return Objects.equals(this.cloudSdkCustomFields, promptTemplateSubstitutionResponse.cloudSdkCustomFields) + && Objects.equals(this.parsedPrompt, promptTemplateSubstitutionResponse.parsedPrompt) + && Objects.equals(this.resource, promptTemplateSubstitutionResponse.resource); + } + + @Override + public int hashCode() + { + return Objects.hash(parsedPrompt, resource, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class PromptTemplateSubstitutionResponse {\n"); + sb.append(" parsedPrompt: ").append(toIndentedString(parsedPrompt)).append("\n"); + sb.append(" resource: ").append(toIndentedString(resource)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatingModuleConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatingModuleConfig.java new file mode 100644 index 000000000..926da7f49 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatingModuleConfig.java @@ -0,0 +1,242 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * PromptTemplatingModuleConfig + */ + +@Beta // CHECKSTYLE:OFF +public class PromptTemplatingModuleConfig +// CHECKSTYLE:ON +{ + @JsonProperty( "prompt" ) + private PromptTemplatingModuleConfigPrompt prompt; + + @JsonProperty( "model" ) + private LLMModelDetails model; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for PromptTemplatingModuleConfig. + */ + protected PromptTemplatingModuleConfig() + { + } + + /** + * Set the prompt of this {@link PromptTemplatingModuleConfig} instance and return the same instance. + * + * @param prompt + * The prompt of this {@link PromptTemplatingModuleConfig} + * @return The same instance of this {@link PromptTemplatingModuleConfig} class + */ + @Nonnull + public PromptTemplatingModuleConfig prompt( @Nonnull final PromptTemplatingModuleConfigPrompt prompt ) + { + this.prompt = prompt; + return this; + } + + /** + * Get prompt + * + * @return prompt The prompt of this {@link PromptTemplatingModuleConfig} instance. + */ + @Nonnull + public PromptTemplatingModuleConfigPrompt getPrompt() + { + return prompt; + } + + /** + * Set the prompt of this {@link PromptTemplatingModuleConfig} instance. + * + * @param prompt + * The prompt of this {@link PromptTemplatingModuleConfig} + */ + public void setPrompt( @Nonnull final PromptTemplatingModuleConfigPrompt prompt ) + { + this.prompt = prompt; + } + + /** + * Set the model of this {@link PromptTemplatingModuleConfig} instance and return the same instance. + * + * @param model + * The model of this {@link PromptTemplatingModuleConfig} + * @return The same instance of this {@link PromptTemplatingModuleConfig} class + */ + @Nonnull + public PromptTemplatingModuleConfig model( @Nonnull final LLMModelDetails model ) + { + this.model = model; + return this; + } + + /** + * Get model + * + * @return model The model of this {@link PromptTemplatingModuleConfig} instance. + */ + @Nonnull + public LLMModelDetails getModel() + { + return model; + } + + /** + * Set the model of this {@link PromptTemplatingModuleConfig} instance. + * + * @param model + * The model of this {@link PromptTemplatingModuleConfig} + */ + public void setModel( @Nonnull final LLMModelDetails model ) + { + this.model = model; + } + + /** + * Get the names of the unrecognizable properties of the {@link PromptTemplatingModuleConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PromptTemplatingModuleConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("PromptTemplatingModuleConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PromptTemplatingModuleConfig} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( prompt != null ) + declaredFields.put("prompt", prompt); + if( model != null ) + declaredFields.put("model", model); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PromptTemplatingModuleConfig} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final PromptTemplatingModuleConfig promptTemplatingModuleConfig = (PromptTemplatingModuleConfig) o; + return Objects.equals(this.cloudSdkCustomFields, promptTemplatingModuleConfig.cloudSdkCustomFields) + && Objects.equals(this.prompt, promptTemplatingModuleConfig.prompt) + && Objects.equals(this.model, promptTemplatingModuleConfig.model); + } + + @Override + public int hashCode() + { + return Objects.hash(prompt, model, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class PromptTemplatingModuleConfig {\n"); + sb.append(" prompt: ").append(toIndentedString(prompt)).append("\n"); + sb.append(" model: ").append(toIndentedString(model)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatingModuleConfigPrompt.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatingModuleConfigPrompt.java new file mode 100644 index 000000000..63cdc26e7 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatingModuleConfigPrompt.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.google.common.annotations.Beta; + +/** + * The prompt template to be used. Can be either a user defined template or a reference to a template in the prompt + * registry. + */ +@Beta +@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) +@JsonSubTypes( { @JsonSubTypes.Type( value = Template.class ), @JsonSubTypes.Type( value = TemplateRef.class ), } ) + +public interface PromptTemplatingModuleConfigPrompt +{ +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonObject.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonObject.java new file mode 100644 index 000000000..9cd995069 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonObject.java @@ -0,0 +1,267 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * ResponseFormatJsonObject + */ + +@Beta // CHECKSTYLE:OFF +public class ResponseFormatJsonObject implements PromptTemplateSpecResponseFormat, TemplateResponseFormat +// CHECKSTYLE:ON +{ + /** + * The type of response format being defined: `json_object` + */ + public enum TypeEnum + { + /** + * The JSON_OBJECT option of this ResponseFormatJsonObject + */ + JSON_OBJECT("json_object"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this ResponseFormatJsonObject + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type ResponseFormatJsonObject + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue( @Nonnull final String value ) + { + for( TypeEnum b : TypeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "type" ) + private TypeEnum type; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for ResponseFormatJsonObject. + */ + protected ResponseFormatJsonObject() + { + } + + /** + * Set the type of this {@link ResponseFormatJsonObject} instance and return the same instance. + * + * @param type + * The type of response format being defined: `json_object` + * @return The same instance of this {@link ResponseFormatJsonObject} class + */ + @Nonnull + public ResponseFormatJsonObject type( @Nonnull final TypeEnum type ) + { + this.type = type; + return this; + } + + /** + * The type of response format being defined: `json_object` + * + * @return type The type of this {@link ResponseFormatJsonObject} instance. + */ + @Nonnull + public TypeEnum getType() + { + return type; + } + + /** + * Set the type of this {@link ResponseFormatJsonObject} instance. + * + * @param type + * The type of response format being defined: `json_object` + */ + public void setType( @Nonnull final TypeEnum type ) + { + this.type = type; + } + + /** + * Get the names of the unrecognizable properties of the {@link ResponseFormatJsonObject}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ResponseFormatJsonObject} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("ResponseFormatJsonObject has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ResponseFormatJsonObject} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( type != null ) + declaredFields.put("type", type); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ResponseFormatJsonObject} instance. If the map previously contained + * a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final ResponseFormatJsonObject responseFormatJsonObject = (ResponseFormatJsonObject) o; + return Objects.equals(this.cloudSdkCustomFields, responseFormatJsonObject.cloudSdkCustomFields) + && Objects.equals(this.type, responseFormatJsonObject.type); + } + + @Override + public int hashCode() + { + return Objects.hash(type, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class ResponseFormatJsonObject {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonSchema.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonSchema.java new file mode 100644 index 000000000..f43b74801 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonSchema.java @@ -0,0 +1,310 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * ResponseFormatJsonSchema + */ + +@Beta // CHECKSTYLE:OFF +public class ResponseFormatJsonSchema implements PromptTemplateSpecResponseFormat, TemplateResponseFormat +// CHECKSTYLE:ON +{ + /** + * The type of response format being defined: `json_schema` + */ + public enum TypeEnum + { + /** + * The JSON_SCHEMA option of this ResponseFormatJsonSchema + */ + JSON_SCHEMA("json_schema"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this ResponseFormatJsonSchema + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type ResponseFormatJsonSchema + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue( @Nonnull final String value ) + { + for( TypeEnum b : TypeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "type" ) + private TypeEnum type; + + @JsonProperty( "json_schema" ) + private ResponseFormatJsonSchemaJsonSchema jsonSchema; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for ResponseFormatJsonSchema. + */ + protected ResponseFormatJsonSchema() + { + } + + /** + * Set the type of this {@link ResponseFormatJsonSchema} instance and return the same instance. + * + * @param type + * The type of response format being defined: `json_schema` + * @return The same instance of this {@link ResponseFormatJsonSchema} class + */ + @Nonnull + public ResponseFormatJsonSchema type( @Nonnull final TypeEnum type ) + { + this.type = type; + return this; + } + + /** + * The type of response format being defined: `json_schema` + * + * @return type The type of this {@link ResponseFormatJsonSchema} instance. + */ + @Nonnull + public TypeEnum getType() + { + return type; + } + + /** + * Set the type of this {@link ResponseFormatJsonSchema} instance. + * + * @param type + * The type of response format being defined: `json_schema` + */ + public void setType( @Nonnull final TypeEnum type ) + { + this.type = type; + } + + /** + * Set the jsonSchema of this {@link ResponseFormatJsonSchema} instance and return the same instance. + * + * @param jsonSchema + * The jsonSchema of this {@link ResponseFormatJsonSchema} + * @return The same instance of this {@link ResponseFormatJsonSchema} class + */ + @Nonnull + public ResponseFormatJsonSchema jsonSchema( @Nonnull final ResponseFormatJsonSchemaJsonSchema jsonSchema ) + { + this.jsonSchema = jsonSchema; + return this; + } + + /** + * Get jsonSchema + * + * @return jsonSchema The jsonSchema of this {@link ResponseFormatJsonSchema} instance. + */ + @Nonnull + public ResponseFormatJsonSchemaJsonSchema getJsonSchema() + { + return jsonSchema; + } + + /** + * Set the jsonSchema of this {@link ResponseFormatJsonSchema} instance. + * + * @param jsonSchema + * The jsonSchema of this {@link ResponseFormatJsonSchema} + */ + public void setJsonSchema( @Nonnull final ResponseFormatJsonSchemaJsonSchema jsonSchema ) + { + this.jsonSchema = jsonSchema; + } + + /** + * Get the names of the unrecognizable properties of the {@link ResponseFormatJsonSchema}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ResponseFormatJsonSchema} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("ResponseFormatJsonSchema has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ResponseFormatJsonSchema} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( type != null ) + declaredFields.put("type", type); + if( jsonSchema != null ) + declaredFields.put("jsonSchema", jsonSchema); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ResponseFormatJsonSchema} instance. If the map previously contained + * a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final ResponseFormatJsonSchema responseFormatJsonSchema = (ResponseFormatJsonSchema) o; + return Objects.equals(this.cloudSdkCustomFields, responseFormatJsonSchema.cloudSdkCustomFields) + && Objects.equals(this.type, responseFormatJsonSchema.type) + && Objects.equals(this.jsonSchema, responseFormatJsonSchema.jsonSchema); + } + + @Override + public int hashCode() + { + return Objects.hash(type, jsonSchema, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class ResponseFormatJsonSchema {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" jsonSchema: ").append(toIndentedString(jsonSchema)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonSchemaJsonSchema.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonSchemaJsonSchema.java new file mode 100644 index 000000000..37f9ed0c9 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonSchemaJsonSchema.java @@ -0,0 +1,366 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * ResponseFormatJsonSchemaJsonSchema + */ + +@Beta // CHECKSTYLE:OFF +public class ResponseFormatJsonSchemaJsonSchema +// CHECKSTYLE:ON +{ + @JsonProperty( "description" ) + private String description; + + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "schema" ) + private Map schema = new HashMap<>(); + + @JsonProperty( "strict" ) + private Boolean strict = false; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for ResponseFormatJsonSchemaJsonSchema. + */ + protected ResponseFormatJsonSchemaJsonSchema() + { + } + + /** + * Set the description of this {@link ResponseFormatJsonSchemaJsonSchema} instance and return the same instance. + * + * @param description + * A description of what the response format is for, used by the model to determine how to respond in the + * format. + * @return The same instance of this {@link ResponseFormatJsonSchemaJsonSchema} class + */ + @Nonnull + public ResponseFormatJsonSchemaJsonSchema description( @Nullable final String description ) + { + this.description = description; + return this; + } + + /** + * A description of what the response format is for, used by the model to determine how to respond in the format. + * + * @return description The description of this {@link ResponseFormatJsonSchemaJsonSchema} instance. + */ + @Nonnull + public String getDescription() + { + return description; + } + + /** + * Set the description of this {@link ResponseFormatJsonSchemaJsonSchema} instance. + * + * @param description + * A description of what the response format is for, used by the model to determine how to respond in the + * format. + */ + public void setDescription( @Nullable final String description ) + { + this.description = description; + } + + /** + * Set the name of this {@link ResponseFormatJsonSchemaJsonSchema} instance and return the same instance. + * + * @param name + * The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a + * maximum length of 64. + * @return The same instance of this {@link ResponseFormatJsonSchemaJsonSchema} class + */ + @Nonnull + public ResponseFormatJsonSchemaJsonSchema name( @Nonnull final String name ) + { + this.name = name; + return this; + } + + /** + * The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length + * of 64. + * + * @return name The name of this {@link ResponseFormatJsonSchemaJsonSchema} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link ResponseFormatJsonSchemaJsonSchema} instance. + * + * @param name + * The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a + * maximum length of 64. + */ + public void setName( @Nonnull final String name ) + { + this.name = name; + } + + /** + * Set the schema of this {@link ResponseFormatJsonSchemaJsonSchema} instance and return the same instance. + * + * @param schema + * The schema for the response format, described as a JSON Schema object. + * @return The same instance of this {@link ResponseFormatJsonSchemaJsonSchema} class + */ + @Nonnull + public ResponseFormatJsonSchemaJsonSchema schema( @Nullable final Map schema ) + { + this.schema = schema; + return this; + } + + /** + * Put one schema instance to this {@link ResponseFormatJsonSchemaJsonSchema} instance. + * + * @param key + * The String key of this schema instance + * @param schemaItem + * The schema that should be added under the given key + * @return The same instance of type {@link ResponseFormatJsonSchemaJsonSchema} + */ + @Nonnull + public + ResponseFormatJsonSchemaJsonSchema + putschemaItem( @Nonnull final String key, @Nullable final Object schemaItem ) + { + if( this.schema == null ) { + this.schema = new HashMap<>(); + } + this.schema.put(key, schemaItem); + return this; + } + + /** + * The schema for the response format, described as a JSON Schema object. + * + * @return schema The schema of this {@link ResponseFormatJsonSchemaJsonSchema} instance. + */ + @Nonnull + public Map getSchema() + { + return schema; + } + + /** + * Set the schema of this {@link ResponseFormatJsonSchemaJsonSchema} instance. + * + * @param schema + * The schema for the response format, described as a JSON Schema object. + */ + public void setSchema( @Nullable final Map schema ) + { + this.schema = schema; + } + + /** + * Set the strict of this {@link ResponseFormatJsonSchemaJsonSchema} instance and return the same instance. + * + * @param strict + * Whether to enable strict schema adherence when generating the output. If set to true, the model will + * always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema + * is supported when `strict` is `true`. To learn more, read the [Structured Outputs + * guide](https://platform.openai.com/docs/guides/structured-outputs). + * @return The same instance of this {@link ResponseFormatJsonSchemaJsonSchema} class + */ + @Nonnull + public ResponseFormatJsonSchemaJsonSchema strict( @Nullable final Boolean strict ) + { + this.strict = strict; + return this; + } + + /** + * Whether to enable strict schema adherence when generating the output. If set to true, the model will always + * follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when + * `strict` is `true`. To learn more, read the [Structured Outputs + * guide](https://platform.openai.com/docs/guides/structured-outputs). + * + * @return strict The strict of this {@link ResponseFormatJsonSchemaJsonSchema} instance. + */ + @Nullable + public Boolean isStrict() + { + return strict; + } + + /** + * Set the strict of this {@link ResponseFormatJsonSchemaJsonSchema} instance. + * + * @param strict + * Whether to enable strict schema adherence when generating the output. If set to true, the model will + * always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema + * is supported when `strict` is `true`. To learn more, read the [Structured Outputs + * guide](https://platform.openai.com/docs/guides/structured-outputs). + */ + public void setStrict( @Nullable final Boolean strict ) + { + this.strict = strict; + } + + /** + * Get the names of the unrecognizable properties of the {@link ResponseFormatJsonSchemaJsonSchema}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ResponseFormatJsonSchemaJsonSchema} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException( + "ResponseFormatJsonSchemaJsonSchema has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ResponseFormatJsonSchemaJsonSchema} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( description != null ) + declaredFields.put("description", description); + if( name != null ) + declaredFields.put("name", name); + if( schema != null ) + declaredFields.put("schema", schema); + if( strict != null ) + declaredFields.put("strict", strict); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ResponseFormatJsonSchemaJsonSchema} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final ResponseFormatJsonSchemaJsonSchema responseFormatJsonSchemaJsonSchema = + (ResponseFormatJsonSchemaJsonSchema) o; + return Objects.equals(this.cloudSdkCustomFields, responseFormatJsonSchemaJsonSchema.cloudSdkCustomFields) + && Objects.equals(this.description, responseFormatJsonSchemaJsonSchema.description) + && Objects.equals(this.name, responseFormatJsonSchemaJsonSchema.name) + && Objects.equals(this.schema, responseFormatJsonSchemaJsonSchema.schema) + && Objects.equals(this.strict, responseFormatJsonSchemaJsonSchema.strict); + } + + @Override + public int hashCode() + { + return Objects.hash(description, name, schema, strict, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class ResponseFormatJsonSchemaJsonSchema {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" schema: ").append(toIndentedString(schema)).append("\n"); + sb.append(" strict: ").append(toIndentedString(strict)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatText.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatText.java new file mode 100644 index 000000000..f7e94b815 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatText.java @@ -0,0 +1,266 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * ResponseFormatText + */ + +@Beta // CHECKSTYLE:OFF +public class ResponseFormatText implements PromptTemplateSpecResponseFormat, TemplateResponseFormat +// CHECKSTYLE:ON +{ + /** + * The type of response format being defined: `text` + */ + public enum TypeEnum + { + /** + * The TEXT option of this ResponseFormatText + */ + TEXT("text"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this ResponseFormatText + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type ResponseFormatText + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue( @Nonnull final String value ) + { + for( TypeEnum b : TypeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "type" ) + private TypeEnum type; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for ResponseFormatText. + */ + protected ResponseFormatText() + { + } + + /** + * Set the type of this {@link ResponseFormatText} instance and return the same instance. + * + * @param type + * The type of response format being defined: `text` + * @return The same instance of this {@link ResponseFormatText} class + */ + @Nonnull + public ResponseFormatText type( @Nonnull final TypeEnum type ) + { + this.type = type; + return this; + } + + /** + * The type of response format being defined: `text` + * + * @return type The type of this {@link ResponseFormatText} instance. + */ + @Nonnull + public TypeEnum getType() + { + return type; + } + + /** + * Set the type of this {@link ResponseFormatText} instance. + * + * @param type + * The type of response format being defined: `text` + */ + public void setType( @Nonnull final TypeEnum type ) + { + this.type = type; + } + + /** + * Get the names of the unrecognizable properties of the {@link ResponseFormatText}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ResponseFormatText} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("ResponseFormatText has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ResponseFormatText} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( type != null ) + declaredFields.put("type", type); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ResponseFormatText} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final ResponseFormatText responseFormatText = (ResponseFormatText) o; + return Objects.equals(this.cloudSdkCustomFields, responseFormatText.cloudSdkCustomFields) + && Objects.equals(this.type, responseFormatText.type); + } + + @Override + public int hashCode() + { + return Objects.hash(type, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class ResponseFormatText {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimeOrchestrationConfigFile.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimeOrchestrationConfigFile.java new file mode 100644 index 000000000..be9336af5 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimeOrchestrationConfigFile.java @@ -0,0 +1,328 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * RuntimeOrchestrationConfigFile + */ + +@Beta // CHECKSTYLE:OFF +public class RuntimeOrchestrationConfigFile +// CHECKSTYLE:ON +{ + @JsonProperty( "apiVersion" ) + private String apiVersion; + + @JsonProperty( "kind" ) + private String kind; + + @JsonProperty( "metadata" ) + private RuntimePromptTemplateFileMetadata metadata; + + @JsonProperty( "spec" ) + private OrchestrationConfig spec; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for RuntimeOrchestrationConfigFile. + */ + protected RuntimeOrchestrationConfigFile() + { + } + + /** + * Set the apiVersion of this {@link RuntimeOrchestrationConfigFile} instance and return the same instance. + * + * @param apiVersion + * The apiVersion of this {@link RuntimeOrchestrationConfigFile} + * @return The same instance of this {@link RuntimeOrchestrationConfigFile} class + */ + @Nonnull + public RuntimeOrchestrationConfigFile apiVersion( @Nullable final String apiVersion ) + { + this.apiVersion = apiVersion; + return this; + } + + /** + * Get apiVersion + * + * @return apiVersion The apiVersion of this {@link RuntimeOrchestrationConfigFile} instance. + */ + @Nonnull + public String getApiVersion() + { + return apiVersion; + } + + /** + * Set the apiVersion of this {@link RuntimeOrchestrationConfigFile} instance. + * + * @param apiVersion + * The apiVersion of this {@link RuntimeOrchestrationConfigFile} + */ + public void setApiVersion( @Nullable final String apiVersion ) + { + this.apiVersion = apiVersion; + } + + /** + * Set the kind of this {@link RuntimeOrchestrationConfigFile} instance and return the same instance. + * + * @param kind + * The kind of this {@link RuntimeOrchestrationConfigFile} + * @return The same instance of this {@link RuntimeOrchestrationConfigFile} class + */ + @Nonnull + public RuntimeOrchestrationConfigFile kind( @Nullable final String kind ) + { + this.kind = kind; + return this; + } + + /** + * Get kind + * + * @return kind The kind of this {@link RuntimeOrchestrationConfigFile} instance. + */ + @Nonnull + public String getKind() + { + return kind; + } + + /** + * Set the kind of this {@link RuntimeOrchestrationConfigFile} instance. + * + * @param kind + * The kind of this {@link RuntimeOrchestrationConfigFile} + */ + public void setKind( @Nullable final String kind ) + { + this.kind = kind; + } + + /** + * Set the metadata of this {@link RuntimeOrchestrationConfigFile} instance and return the same instance. + * + * @param metadata + * The metadata of this {@link RuntimeOrchestrationConfigFile} + * @return The same instance of this {@link RuntimeOrchestrationConfigFile} class + */ + @Nonnull + public RuntimeOrchestrationConfigFile metadata( @Nullable final RuntimePromptTemplateFileMetadata metadata ) + { + this.metadata = metadata; + return this; + } + + /** + * Get metadata + * + * @return metadata The metadata of this {@link RuntimeOrchestrationConfigFile} instance. + */ + @Nonnull + public RuntimePromptTemplateFileMetadata getMetadata() + { + return metadata; + } + + /** + * Set the metadata of this {@link RuntimeOrchestrationConfigFile} instance. + * + * @param metadata + * The metadata of this {@link RuntimeOrchestrationConfigFile} + */ + public void setMetadata( @Nullable final RuntimePromptTemplateFileMetadata metadata ) + { + this.metadata = metadata; + } + + /** + * Set the spec of this {@link RuntimeOrchestrationConfigFile} instance and return the same instance. + * + * @param spec + * The spec of this {@link RuntimeOrchestrationConfigFile} + * @return The same instance of this {@link RuntimeOrchestrationConfigFile} class + */ + @Nonnull + public RuntimeOrchestrationConfigFile spec( @Nullable final OrchestrationConfig spec ) + { + this.spec = spec; + return this; + } + + /** + * Get spec + * + * @return spec The spec of this {@link RuntimeOrchestrationConfigFile} instance. + */ + @Nonnull + public OrchestrationConfig getSpec() + { + return spec; + } + + /** + * Set the spec of this {@link RuntimeOrchestrationConfigFile} instance. + * + * @param spec + * The spec of this {@link RuntimeOrchestrationConfigFile} + */ + public void setSpec( @Nullable final OrchestrationConfig spec ) + { + this.spec = spec; + } + + /** + * Get the names of the unrecognizable properties of the {@link RuntimeOrchestrationConfigFile}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link RuntimeOrchestrationConfigFile} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("RuntimeOrchestrationConfigFile has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link RuntimeOrchestrationConfigFile} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( apiVersion != null ) + declaredFields.put("apiVersion", apiVersion); + if( kind != null ) + declaredFields.put("kind", kind); + if( metadata != null ) + declaredFields.put("metadata", metadata); + if( spec != null ) + declaredFields.put("spec", spec); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link RuntimeOrchestrationConfigFile} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final RuntimeOrchestrationConfigFile runtimeOrchestrationConfigFile = (RuntimeOrchestrationConfigFile) o; + return Objects.equals(this.cloudSdkCustomFields, runtimeOrchestrationConfigFile.cloudSdkCustomFields) + && Objects.equals(this.apiVersion, runtimeOrchestrationConfigFile.apiVersion) + && Objects.equals(this.kind, runtimeOrchestrationConfigFile.kind) + && Objects.equals(this.metadata, runtimeOrchestrationConfigFile.metadata) + && Objects.equals(this.spec, runtimeOrchestrationConfigFile.spec); + } + + @Override + public int hashCode() + { + return Objects.hash(apiVersion, kind, metadata, spec, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class RuntimeOrchestrationConfigFile {\n"); + sb.append(" apiVersion: ").append(toIndentedString(apiVersion)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimePromptTemplateFile.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimePromptTemplateFile.java new file mode 100644 index 000000000..e83eb630b --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimePromptTemplateFile.java @@ -0,0 +1,328 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * RuntimePromptTemplateFile + */ + +@Beta // CHECKSTYLE:OFF +public class RuntimePromptTemplateFile +// CHECKSTYLE:ON +{ + @JsonProperty( "apiVersion" ) + private String apiVersion; + + @JsonProperty( "kind" ) + private String kind; + + @JsonProperty( "metadata" ) + private RuntimePromptTemplateFileMetadata metadata; + + @JsonProperty( "spec" ) + private PromptTemplateSpec spec; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for RuntimePromptTemplateFile. + */ + protected RuntimePromptTemplateFile() + { + } + + /** + * Set the apiVersion of this {@link RuntimePromptTemplateFile} instance and return the same instance. + * + * @param apiVersion + * The apiVersion of this {@link RuntimePromptTemplateFile} + * @return The same instance of this {@link RuntimePromptTemplateFile} class + */ + @Nonnull + public RuntimePromptTemplateFile apiVersion( @Nullable final String apiVersion ) + { + this.apiVersion = apiVersion; + return this; + } + + /** + * Get apiVersion + * + * @return apiVersion The apiVersion of this {@link RuntimePromptTemplateFile} instance. + */ + @Nonnull + public String getApiVersion() + { + return apiVersion; + } + + /** + * Set the apiVersion of this {@link RuntimePromptTemplateFile} instance. + * + * @param apiVersion + * The apiVersion of this {@link RuntimePromptTemplateFile} + */ + public void setApiVersion( @Nullable final String apiVersion ) + { + this.apiVersion = apiVersion; + } + + /** + * Set the kind of this {@link RuntimePromptTemplateFile} instance and return the same instance. + * + * @param kind + * The kind of this {@link RuntimePromptTemplateFile} + * @return The same instance of this {@link RuntimePromptTemplateFile} class + */ + @Nonnull + public RuntimePromptTemplateFile kind( @Nullable final String kind ) + { + this.kind = kind; + return this; + } + + /** + * Get kind + * + * @return kind The kind of this {@link RuntimePromptTemplateFile} instance. + */ + @Nonnull + public String getKind() + { + return kind; + } + + /** + * Set the kind of this {@link RuntimePromptTemplateFile} instance. + * + * @param kind + * The kind of this {@link RuntimePromptTemplateFile} + */ + public void setKind( @Nullable final String kind ) + { + this.kind = kind; + } + + /** + * Set the metadata of this {@link RuntimePromptTemplateFile} instance and return the same instance. + * + * @param metadata + * The metadata of this {@link RuntimePromptTemplateFile} + * @return The same instance of this {@link RuntimePromptTemplateFile} class + */ + @Nonnull + public RuntimePromptTemplateFile metadata( @Nullable final RuntimePromptTemplateFileMetadata metadata ) + { + this.metadata = metadata; + return this; + } + + /** + * Get metadata + * + * @return metadata The metadata of this {@link RuntimePromptTemplateFile} instance. + */ + @Nonnull + public RuntimePromptTemplateFileMetadata getMetadata() + { + return metadata; + } + + /** + * Set the metadata of this {@link RuntimePromptTemplateFile} instance. + * + * @param metadata + * The metadata of this {@link RuntimePromptTemplateFile} + */ + public void setMetadata( @Nullable final RuntimePromptTemplateFileMetadata metadata ) + { + this.metadata = metadata; + } + + /** + * Set the spec of this {@link RuntimePromptTemplateFile} instance and return the same instance. + * + * @param spec + * The spec of this {@link RuntimePromptTemplateFile} + * @return The same instance of this {@link RuntimePromptTemplateFile} class + */ + @Nonnull + public RuntimePromptTemplateFile spec( @Nullable final PromptTemplateSpec spec ) + { + this.spec = spec; + return this; + } + + /** + * Get spec + * + * @return spec The spec of this {@link RuntimePromptTemplateFile} instance. + */ + @Nonnull + public PromptTemplateSpec getSpec() + { + return spec; + } + + /** + * Set the spec of this {@link RuntimePromptTemplateFile} instance. + * + * @param spec + * The spec of this {@link RuntimePromptTemplateFile} + */ + public void setSpec( @Nullable final PromptTemplateSpec spec ) + { + this.spec = spec; + } + + /** + * Get the names of the unrecognizable properties of the {@link RuntimePromptTemplateFile}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link RuntimePromptTemplateFile} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("RuntimePromptTemplateFile has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link RuntimePromptTemplateFile} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( apiVersion != null ) + declaredFields.put("apiVersion", apiVersion); + if( kind != null ) + declaredFields.put("kind", kind); + if( metadata != null ) + declaredFields.put("metadata", metadata); + if( spec != null ) + declaredFields.put("spec", spec); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link RuntimePromptTemplateFile} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final RuntimePromptTemplateFile runtimePromptTemplateFile = (RuntimePromptTemplateFile) o; + return Objects.equals(this.cloudSdkCustomFields, runtimePromptTemplateFile.cloudSdkCustomFields) + && Objects.equals(this.apiVersion, runtimePromptTemplateFile.apiVersion) + && Objects.equals(this.kind, runtimePromptTemplateFile.kind) + && Objects.equals(this.metadata, runtimePromptTemplateFile.metadata) + && Objects.equals(this.spec, runtimePromptTemplateFile.spec); + } + + @Override + public int hashCode() + { + return Objects.hash(apiVersion, kind, metadata, spec, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class RuntimePromptTemplateFile {\n"); + sb.append(" apiVersion: ").append(toIndentedString(apiVersion)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimePromptTemplateFileMetadata.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimePromptTemplateFileMetadata.java new file mode 100644 index 000000000..c9aff79ee --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimePromptTemplateFileMetadata.java @@ -0,0 +1,287 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * RuntimePromptTemplateFileMetadata + */ + +@Beta // CHECKSTYLE:OFF +public class RuntimePromptTemplateFileMetadata +// CHECKSTYLE:ON +{ + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "version" ) + private String version; + + @JsonProperty( "scenario" ) + private String scenario; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for RuntimePromptTemplateFileMetadata. + */ + protected RuntimePromptTemplateFileMetadata() + { + } + + /** + * Set the name of this {@link RuntimePromptTemplateFileMetadata} instance and return the same instance. + * + * @param name + * The name of this {@link RuntimePromptTemplateFileMetadata} + * @return The same instance of this {@link RuntimePromptTemplateFileMetadata} class + */ + @Nonnull + public RuntimePromptTemplateFileMetadata name( @Nullable final String name ) + { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name The name of this {@link RuntimePromptTemplateFileMetadata} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link RuntimePromptTemplateFileMetadata} instance. + * + * @param name + * The name of this {@link RuntimePromptTemplateFileMetadata} + */ + public void setName( @Nullable final String name ) + { + this.name = name; + } + + /** + * Set the version of this {@link RuntimePromptTemplateFileMetadata} instance and return the same instance. + * + * @param version + * The version of this {@link RuntimePromptTemplateFileMetadata} + * @return The same instance of this {@link RuntimePromptTemplateFileMetadata} class + */ + @Nonnull + public RuntimePromptTemplateFileMetadata version( @Nullable final String version ) + { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version The version of this {@link RuntimePromptTemplateFileMetadata} instance. + */ + @Nonnull + public String getVersion() + { + return version; + } + + /** + * Set the version of this {@link RuntimePromptTemplateFileMetadata} instance. + * + * @param version + * The version of this {@link RuntimePromptTemplateFileMetadata} + */ + public void setVersion( @Nullable final String version ) + { + this.version = version; + } + + /** + * Set the scenario of this {@link RuntimePromptTemplateFileMetadata} instance and return the same instance. + * + * @param scenario + * The scenario of this {@link RuntimePromptTemplateFileMetadata} + * @return The same instance of this {@link RuntimePromptTemplateFileMetadata} class + */ + @Nonnull + public RuntimePromptTemplateFileMetadata scenario( @Nullable final String scenario ) + { + this.scenario = scenario; + return this; + } + + /** + * Get scenario + * + * @return scenario The scenario of this {@link RuntimePromptTemplateFileMetadata} instance. + */ + @Nonnull + public String getScenario() + { + return scenario; + } + + /** + * Set the scenario of this {@link RuntimePromptTemplateFileMetadata} instance. + * + * @param scenario + * The scenario of this {@link RuntimePromptTemplateFileMetadata} + */ + public void setScenario( @Nullable final String scenario ) + { + this.scenario = scenario; + } + + /** + * Get the names of the unrecognizable properties of the {@link RuntimePromptTemplateFileMetadata}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link RuntimePromptTemplateFileMetadata} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException( + "RuntimePromptTemplateFileMetadata has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link RuntimePromptTemplateFileMetadata} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( name != null ) + declaredFields.put("name", name); + if( version != null ) + declaredFields.put("version", version); + if( scenario != null ) + declaredFields.put("scenario", scenario); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link RuntimePromptTemplateFileMetadata} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final RuntimePromptTemplateFileMetadata runtimePromptTemplateFileMetadata = + (RuntimePromptTemplateFileMetadata) o; + return Objects.equals(this.cloudSdkCustomFields, runtimePromptTemplateFileMetadata.cloudSdkCustomFields) + && Objects.equals(this.name, runtimePromptTemplateFileMetadata.name) + && Objects.equals(this.version, runtimePromptTemplateFileMetadata.version) + && Objects.equals(this.scenario, runtimePromptTemplateFileMetadata.scenario); + } + + @Override + public int hashCode() + { + return Objects.hash(name, version, scenario, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class RuntimePromptTemplateFileMetadata {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationApplyToSelector.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationApplyToSelector.java new file mode 100644 index 000000000..9371a8ab2 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationApplyToSelector.java @@ -0,0 +1,384 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * This selector allows you to define the scope of translation, such as specific placeholders or messages with specific + * roles. For example, `{\"category\": \"placeholders\", \"items\": + * [\"user_input\"], \"source_language\": \"de-DE\"}` targets the value of + * \"user_input\" in `placeholder_values` specified in the request payload; and considers the value + * to be in German. + */ + +@Beta // CHECKSTYLE:OFF +public class SAPDocumentTranslationApplyToSelector +// CHECKSTYLE:ON +{ + /** + * Category to apply translation to. + */ + public enum CategoryEnum + { + /** + * The PLACEHOLDERS option of this SAPDocumentTranslationApplyToSelector + */ + PLACEHOLDERS("placeholders"), + + /** + * The TEMPLATE_ROLES option of this SAPDocumentTranslationApplyToSelector + */ + TEMPLATE_ROLES("template_roles"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this SAPDocumentTranslationApplyToSelector + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + CategoryEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type SAPDocumentTranslationApplyToSelector + */ + @JsonCreator + @Nonnull + public static CategoryEnum fromValue( @Nonnull final String value ) + { + for( CategoryEnum b : CategoryEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "category" ) + private CategoryEnum category; + + @JsonProperty( "items" ) + private List items = new ArrayList<>(); + + @JsonProperty( "source_language" ) + private String sourceLanguage; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for SAPDocumentTranslationApplyToSelector. + */ + protected SAPDocumentTranslationApplyToSelector() + { + } + + /** + * Set the category of this {@link SAPDocumentTranslationApplyToSelector} instance and return the same instance. + * + * @param category + * Category to apply translation to. + * @return The same instance of this {@link SAPDocumentTranslationApplyToSelector} class + */ + @Nonnull + public SAPDocumentTranslationApplyToSelector category( @Nonnull final CategoryEnum category ) + { + this.category = category; + return this; + } + + /** + * Category to apply translation to. + * + * @return category The category of this {@link SAPDocumentTranslationApplyToSelector} instance. + */ + @Nonnull + public CategoryEnum getCategory() + { + return category; + } + + /** + * Set the category of this {@link SAPDocumentTranslationApplyToSelector} instance. + * + * @param category + * Category to apply translation to. + */ + public void setCategory( @Nonnull final CategoryEnum category ) + { + this.category = category; + } + + /** + * Set the items of this {@link SAPDocumentTranslationApplyToSelector} instance and return the same instance. + * + * @param items + * List of placeholders or roles to apply translation to + * @return The same instance of this {@link SAPDocumentTranslationApplyToSelector} class + */ + @Nonnull + public SAPDocumentTranslationApplyToSelector items( @Nonnull final List items ) + { + this.items = items; + return this; + } + + /** + * Add one items instance to this {@link SAPDocumentTranslationApplyToSelector}. + * + * @param itemsItem + * The items that should be added + * @return The same instance of type {@link SAPDocumentTranslationApplyToSelector} + */ + @Nonnull + public SAPDocumentTranslationApplyToSelector addItemsItem( @Nonnull final String itemsItem ) + { + if( this.items == null ) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * List of placeholders or roles to apply translation to + * + * @return items The items of this {@link SAPDocumentTranslationApplyToSelector} instance. + */ + @Nonnull + public List getItems() + { + return items; + } + + /** + * Set the items of this {@link SAPDocumentTranslationApplyToSelector} instance. + * + * @param items + * List of placeholders or roles to apply translation to + */ + public void setItems( @Nonnull final List items ) + { + this.items = items; + } + + /** + * Set the sourceLanguage of this {@link SAPDocumentTranslationApplyToSelector} instance and return the same + * instance. + * + * @param sourceLanguage + * Language of the text to be translated. + * @return The same instance of this {@link SAPDocumentTranslationApplyToSelector} class + */ + @Nonnull + public SAPDocumentTranslationApplyToSelector sourceLanguage( @Nullable final String sourceLanguage ) + { + this.sourceLanguage = sourceLanguage; + return this; + } + + /** + * Language of the text to be translated. + * + * @return sourceLanguage The sourceLanguage of this {@link SAPDocumentTranslationApplyToSelector} instance. + */ + @Nonnull + public String getSourceLanguage() + { + return sourceLanguage; + } + + /** + * Set the sourceLanguage of this {@link SAPDocumentTranslationApplyToSelector} instance. + * + * @param sourceLanguage + * Language of the text to be translated. + */ + public void setSourceLanguage( @Nullable final String sourceLanguage ) + { + this.sourceLanguage = sourceLanguage; + } + + /** + * Get the names of the unrecognizable properties of the {@link SAPDocumentTranslationApplyToSelector}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SAPDocumentTranslationApplyToSelector} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException( + "SAPDocumentTranslationApplyToSelector has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SAPDocumentTranslationApplyToSelector} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( category != null ) + declaredFields.put("category", category); + if( items != null ) + declaredFields.put("items", items); + if( sourceLanguage != null ) + declaredFields.put("sourceLanguage", sourceLanguage); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SAPDocumentTranslationApplyToSelector} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final SAPDocumentTranslationApplyToSelector saPDocumentTranslationApplyToSelector = + (SAPDocumentTranslationApplyToSelector) o; + return Objects.equals(this.cloudSdkCustomFields, saPDocumentTranslationApplyToSelector.cloudSdkCustomFields) + && Objects.equals(this.category, saPDocumentTranslationApplyToSelector.category) + && Objects.equals(this.items, saPDocumentTranslationApplyToSelector.items) + && Objects.equals(this.sourceLanguage, saPDocumentTranslationApplyToSelector.sourceLanguage); + } + + @Override + public int hashCode() + { + return Objects.hash(category, items, sourceLanguage, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class SAPDocumentTranslationApplyToSelector {\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" sourceLanguage: ").append(toIndentedString(sourceLanguage)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationInput.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationInput.java new file mode 100644 index 000000000..b8cff778a --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationInput.java @@ -0,0 +1,355 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * SAPDocumentTranslationInput + */ + +@Beta // CHECKSTYLE:OFF +public class SAPDocumentTranslationInput +// CHECKSTYLE:ON +{ + /** + * Type of document translation provider + */ + public enum TypeEnum + { + /** + * The SAP_DOCUMENT_TRANSLATION option of this SAPDocumentTranslationInput + */ + SAP_DOCUMENT_TRANSLATION("sap_document_translation"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this SAPDocumentTranslationInput + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type SAPDocumentTranslationInput + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue( @Nonnull final String value ) + { + for( TypeEnum b : TypeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "type" ) + private TypeEnum type; + + @JsonProperty( "translate_messages_history" ) + private Boolean translateMessagesHistory = true; + + @JsonProperty( "config" ) + private SAPDocumentTranslationInputConfig config; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for SAPDocumentTranslationInput. + */ + protected SAPDocumentTranslationInput() + { + } + + /** + * Set the type of this {@link SAPDocumentTranslationInput} instance and return the same instance. + * + * @param type + * Type of document translation provider + * @return The same instance of this {@link SAPDocumentTranslationInput} class + */ + @Nonnull + public SAPDocumentTranslationInput type( @Nonnull final TypeEnum type ) + { + this.type = type; + return this; + } + + /** + * Type of document translation provider + * + * @return type The type of this {@link SAPDocumentTranslationInput} instance. + */ + @Nonnull + public TypeEnum getType() + { + return type; + } + + /** + * Set the type of this {@link SAPDocumentTranslationInput} instance. + * + * @param type + * Type of document translation provider + */ + public void setType( @Nonnull final TypeEnum type ) + { + this.type = type; + } + + /** + * Set the translateMessagesHistory of this {@link SAPDocumentTranslationInput} instance and return the same + * instance. + * + * @param translateMessagesHistory + * If true, the messages history will be translated as well. + * @return The same instance of this {@link SAPDocumentTranslationInput} class + */ + @Nonnull + public SAPDocumentTranslationInput translateMessagesHistory( @Nullable final Boolean translateMessagesHistory ) + { + this.translateMessagesHistory = translateMessagesHistory; + return this; + } + + /** + * If true, the messages history will be translated as well. + * + * @return translateMessagesHistory The translateMessagesHistory of this {@link SAPDocumentTranslationInput} + * instance. + */ + @Nonnull + public Boolean isTranslateMessagesHistory() + { + return translateMessagesHistory; + } + + /** + * Set the translateMessagesHistory of this {@link SAPDocumentTranslationInput} instance. + * + * @param translateMessagesHistory + * If true, the messages history will be translated as well. + */ + public void setTranslateMessagesHistory( @Nullable final Boolean translateMessagesHistory ) + { + this.translateMessagesHistory = translateMessagesHistory; + } + + /** + * Set the config of this {@link SAPDocumentTranslationInput} instance and return the same instance. + * + * @param config + * The config of this {@link SAPDocumentTranslationInput} + * @return The same instance of this {@link SAPDocumentTranslationInput} class + */ + @Nonnull + public SAPDocumentTranslationInput config( @Nonnull final SAPDocumentTranslationInputConfig config ) + { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config The config of this {@link SAPDocumentTranslationInput} instance. + */ + @Nonnull + public SAPDocumentTranslationInputConfig getConfig() + { + return config; + } + + /** + * Set the config of this {@link SAPDocumentTranslationInput} instance. + * + * @param config + * The config of this {@link SAPDocumentTranslationInput} + */ + public void setConfig( @Nonnull final SAPDocumentTranslationInputConfig config ) + { + this.config = config; + } + + /** + * Get the names of the unrecognizable properties of the {@link SAPDocumentTranslationInput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SAPDocumentTranslationInput} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("SAPDocumentTranslationInput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SAPDocumentTranslationInput} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( type != null ) + declaredFields.put("type", type); + if( translateMessagesHistory != null ) + declaredFields.put("translateMessagesHistory", translateMessagesHistory); + if( config != null ) + declaredFields.put("config", config); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SAPDocumentTranslationInput} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final SAPDocumentTranslationInput saPDocumentTranslationInput = (SAPDocumentTranslationInput) o; + return Objects.equals(this.cloudSdkCustomFields, saPDocumentTranslationInput.cloudSdkCustomFields) + && Objects.equals(this.type, saPDocumentTranslationInput.type) + && Objects.equals(this.translateMessagesHistory, saPDocumentTranslationInput.translateMessagesHistory) + && Objects.equals(this.config, saPDocumentTranslationInput.config); + } + + @Override + public int hashCode() + { + return Objects.hash(type, translateMessagesHistory, config, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class SAPDocumentTranslationInput {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" translateMessagesHistory: ").append(toIndentedString(translateMessagesHistory)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationInputConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationInputConfig.java new file mode 100644 index 000000000..a07a1cc70 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationInputConfig.java @@ -0,0 +1,308 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * Configuration for `sap_document_translation` translation provider. + */ + +@Beta // CHECKSTYLE:OFF +public class SAPDocumentTranslationInputConfig +// CHECKSTYLE:ON +{ + @JsonProperty( "source_language" ) + private String sourceLanguage; + + @JsonProperty( "apply_to" ) + private List applyTo = new ArrayList<>(); + + @JsonProperty( "target_language" ) + private String targetLanguage; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for SAPDocumentTranslationInputConfig. + */ + protected SAPDocumentTranslationInputConfig() + { + } + + /** + * Set the sourceLanguage of this {@link SAPDocumentTranslationInputConfig} instance and return the same instance. + * + * @param sourceLanguage + * Language of the text to be translated. + * @return The same instance of this {@link SAPDocumentTranslationInputConfig} class + */ + @Nonnull + public SAPDocumentTranslationInputConfig sourceLanguage( @Nullable final String sourceLanguage ) + { + this.sourceLanguage = sourceLanguage; + return this; + } + + /** + * Language of the text to be translated. + * + * @return sourceLanguage The sourceLanguage of this {@link SAPDocumentTranslationInputConfig} instance. + */ + @Nonnull + public String getSourceLanguage() + { + return sourceLanguage; + } + + /** + * Set the sourceLanguage of this {@link SAPDocumentTranslationInputConfig} instance. + * + * @param sourceLanguage + * Language of the text to be translated. + */ + public void setSourceLanguage( @Nullable final String sourceLanguage ) + { + this.sourceLanguage = sourceLanguage; + } + + /** + * Set the applyTo of this {@link SAPDocumentTranslationInputConfig} instance and return the same instance. + * + * @param applyTo + * The applyTo of this {@link SAPDocumentTranslationInputConfig} + * @return The same instance of this {@link SAPDocumentTranslationInputConfig} class + */ + @Nonnull + public SAPDocumentTranslationInputConfig applyTo( + @Nullable final List applyTo ) + { + this.applyTo = applyTo; + return this; + } + + /** + * Add one applyTo instance to this {@link SAPDocumentTranslationInputConfig}. + * + * @param applyToItem + * The applyTo that should be added + * @return The same instance of type {@link SAPDocumentTranslationInputConfig} + */ + @Nonnull + public SAPDocumentTranslationInputConfig addApplyToItem( + @Nonnull final SAPDocumentTranslationApplyToSelector applyToItem ) + { + if( this.applyTo == null ) { + this.applyTo = new ArrayList<>(); + } + this.applyTo.add(applyToItem); + return this; + } + + /** + * Get applyTo + * + * @return applyTo The applyTo of this {@link SAPDocumentTranslationInputConfig} instance. + */ + @Nonnull + public List getApplyTo() + { + return applyTo; + } + + /** + * Set the applyTo of this {@link SAPDocumentTranslationInputConfig} instance. + * + * @param applyTo + * The applyTo of this {@link SAPDocumentTranslationInputConfig} + */ + public void setApplyTo( @Nullable final List applyTo ) + { + this.applyTo = applyTo; + } + + /** + * Set the targetLanguage of this {@link SAPDocumentTranslationInputConfig} instance and return the same instance. + * + * @param targetLanguage + * Language to which the text should be translated. + * @return The same instance of this {@link SAPDocumentTranslationInputConfig} class + */ + @Nonnull + public SAPDocumentTranslationInputConfig targetLanguage( @Nonnull final String targetLanguage ) + { + this.targetLanguage = targetLanguage; + return this; + } + + /** + * Language to which the text should be translated. + * + * @return targetLanguage The targetLanguage of this {@link SAPDocumentTranslationInputConfig} instance. + */ + @Nonnull + public String getTargetLanguage() + { + return targetLanguage; + } + + /** + * Set the targetLanguage of this {@link SAPDocumentTranslationInputConfig} instance. + * + * @param targetLanguage + * Language to which the text should be translated. + */ + public void setTargetLanguage( @Nonnull final String targetLanguage ) + { + this.targetLanguage = targetLanguage; + } + + /** + * Get the names of the unrecognizable properties of the {@link SAPDocumentTranslationInputConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SAPDocumentTranslationInputConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException( + "SAPDocumentTranslationInputConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SAPDocumentTranslationInputConfig} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( sourceLanguage != null ) + declaredFields.put("sourceLanguage", sourceLanguage); + if( applyTo != null ) + declaredFields.put("applyTo", applyTo); + if( targetLanguage != null ) + declaredFields.put("targetLanguage", targetLanguage); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SAPDocumentTranslationInputConfig} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final SAPDocumentTranslationInputConfig saPDocumentTranslationInputConfig = + (SAPDocumentTranslationInputConfig) o; + return Objects.equals(this.cloudSdkCustomFields, saPDocumentTranslationInputConfig.cloudSdkCustomFields) + && Objects.equals(this.sourceLanguage, saPDocumentTranslationInputConfig.sourceLanguage) + && Objects.equals(this.applyTo, saPDocumentTranslationInputConfig.applyTo) + && Objects.equals(this.targetLanguage, saPDocumentTranslationInputConfig.targetLanguage); + } + + @Override + public int hashCode() + { + return Objects.hash(sourceLanguage, applyTo, targetLanguage, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class SAPDocumentTranslationInputConfig {\n"); + sb.append(" sourceLanguage: ").append(toIndentedString(sourceLanguage)).append("\n"); + sb.append(" applyTo: ").append(toIndentedString(applyTo)).append("\n"); + sb.append(" targetLanguage: ").append(toIndentedString(targetLanguage)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutput.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutput.java new file mode 100644 index 000000000..a9fbe4525 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutput.java @@ -0,0 +1,310 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * SAPDocumentTranslationOutput + */ + +@Beta // CHECKSTYLE:OFF +public class SAPDocumentTranslationOutput +// CHECKSTYLE:ON +{ + /** + * Configuration for `sap_document_translation` translation provider. + */ + public enum TypeEnum + { + /** + * The SAP_DOCUMENT_TRANSLATION option of this SAPDocumentTranslationOutput + */ + SAP_DOCUMENT_TRANSLATION("sap_document_translation"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this SAPDocumentTranslationOutput + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type SAPDocumentTranslationOutput + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue( @Nonnull final String value ) + { + for( TypeEnum b : TypeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "type" ) + private TypeEnum type; + + @JsonProperty( "config" ) + private SAPDocumentTranslationOutputConfig config; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for SAPDocumentTranslationOutput. + */ + protected SAPDocumentTranslationOutput() + { + } + + /** + * Set the type of this {@link SAPDocumentTranslationOutput} instance and return the same instance. + * + * @param type + * Configuration for `sap_document_translation` translation provider. + * @return The same instance of this {@link SAPDocumentTranslationOutput} class + */ + @Nonnull + public SAPDocumentTranslationOutput type( @Nonnull final TypeEnum type ) + { + this.type = type; + return this; + } + + /** + * Configuration for `sap_document_translation` translation provider. + * + * @return type The type of this {@link SAPDocumentTranslationOutput} instance. + */ + @Nonnull + public TypeEnum getType() + { + return type; + } + + /** + * Set the type of this {@link SAPDocumentTranslationOutput} instance. + * + * @param type + * Configuration for `sap_document_translation` translation provider. + */ + public void setType( @Nonnull final TypeEnum type ) + { + this.type = type; + } + + /** + * Set the config of this {@link SAPDocumentTranslationOutput} instance and return the same instance. + * + * @param config + * The config of this {@link SAPDocumentTranslationOutput} + * @return The same instance of this {@link SAPDocumentTranslationOutput} class + */ + @Nonnull + public SAPDocumentTranslationOutput config( @Nonnull final SAPDocumentTranslationOutputConfig config ) + { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config The config of this {@link SAPDocumentTranslationOutput} instance. + */ + @Nonnull + public SAPDocumentTranslationOutputConfig getConfig() + { + return config; + } + + /** + * Set the config of this {@link SAPDocumentTranslationOutput} instance. + * + * @param config + * The config of this {@link SAPDocumentTranslationOutput} + */ + public void setConfig( @Nonnull final SAPDocumentTranslationOutputConfig config ) + { + this.config = config; + } + + /** + * Get the names of the unrecognizable properties of the {@link SAPDocumentTranslationOutput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SAPDocumentTranslationOutput} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("SAPDocumentTranslationOutput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SAPDocumentTranslationOutput} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( type != null ) + declaredFields.put("type", type); + if( config != null ) + declaredFields.put("config", config); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SAPDocumentTranslationOutput} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final SAPDocumentTranslationOutput saPDocumentTranslationOutput = (SAPDocumentTranslationOutput) o; + return Objects.equals(this.cloudSdkCustomFields, saPDocumentTranslationOutput.cloudSdkCustomFields) + && Objects.equals(this.type, saPDocumentTranslationOutput.type) + && Objects.equals(this.config, saPDocumentTranslationOutput.config); + } + + @Override + public int hashCode() + { + return Objects.hash(type, config, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class SAPDocumentTranslationOutput {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutputConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutputConfig.java new file mode 100644 index 000000000..15d1e1891 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutputConfig.java @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * SAPDocumentTranslationOutputConfig + */ + +@Beta // CHECKSTYLE:OFF +public class SAPDocumentTranslationOutputConfig +// CHECKSTYLE:ON +{ + @JsonProperty( "source_language" ) + private String sourceLanguage; + + @JsonProperty( "target_language" ) + private SAPDocumentTranslationOutputTargetLanguage targetLanguage; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for SAPDocumentTranslationOutputConfig. + */ + protected SAPDocumentTranslationOutputConfig() + { + } + + /** + * Set the sourceLanguage of this {@link SAPDocumentTranslationOutputConfig} instance and return the same instance. + * + * @param sourceLanguage + * Language of the text to be translated. + * @return The same instance of this {@link SAPDocumentTranslationOutputConfig} class + */ + @Nonnull + public SAPDocumentTranslationOutputConfig sourceLanguage( @Nullable final String sourceLanguage ) + { + this.sourceLanguage = sourceLanguage; + return this; + } + + /** + * Language of the text to be translated. + * + * @return sourceLanguage The sourceLanguage of this {@link SAPDocumentTranslationOutputConfig} instance. + */ + @Nonnull + public String getSourceLanguage() + { + return sourceLanguage; + } + + /** + * Set the sourceLanguage of this {@link SAPDocumentTranslationOutputConfig} instance. + * + * @param sourceLanguage + * Language of the text to be translated. + */ + public void setSourceLanguage( @Nullable final String sourceLanguage ) + { + this.sourceLanguage = sourceLanguage; + } + + /** + * Set the targetLanguage of this {@link SAPDocumentTranslationOutputConfig} instance and return the same instance. + * + * @param targetLanguage + * The targetLanguage of this {@link SAPDocumentTranslationOutputConfig} + * @return The same instance of this {@link SAPDocumentTranslationOutputConfig} class + */ + @Nonnull + public SAPDocumentTranslationOutputConfig targetLanguage( + @Nonnull final SAPDocumentTranslationOutputTargetLanguage targetLanguage ) + { + this.targetLanguage = targetLanguage; + return this; + } + + /** + * Get targetLanguage + * + * @return targetLanguage The targetLanguage of this {@link SAPDocumentTranslationOutputConfig} instance. + */ + @Nonnull + public SAPDocumentTranslationOutputTargetLanguage getTargetLanguage() + { + return targetLanguage; + } + + /** + * Set the targetLanguage of this {@link SAPDocumentTranslationOutputConfig} instance. + * + * @param targetLanguage + * The targetLanguage of this {@link SAPDocumentTranslationOutputConfig} + */ + public void setTargetLanguage( @Nonnull final SAPDocumentTranslationOutputTargetLanguage targetLanguage ) + { + this.targetLanguage = targetLanguage; + } + + /** + * Get the names of the unrecognizable properties of the {@link SAPDocumentTranslationOutputConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SAPDocumentTranslationOutputConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException( + "SAPDocumentTranslationOutputConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SAPDocumentTranslationOutputConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( sourceLanguage != null ) + declaredFields.put("sourceLanguage", sourceLanguage); + if( targetLanguage != null ) + declaredFields.put("targetLanguage", targetLanguage); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SAPDocumentTranslationOutputConfig} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final SAPDocumentTranslationOutputConfig saPDocumentTranslationOutputConfig = + (SAPDocumentTranslationOutputConfig) o; + return Objects.equals(this.cloudSdkCustomFields, saPDocumentTranslationOutputConfig.cloudSdkCustomFields) + && Objects.equals(this.sourceLanguage, saPDocumentTranslationOutputConfig.sourceLanguage) + && Objects.equals(this.targetLanguage, saPDocumentTranslationOutputConfig.targetLanguage); + } + + @Override + public int hashCode() + { + return Objects.hash(sourceLanguage, targetLanguage, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class SAPDocumentTranslationOutputConfig {\n"); + sb.append(" sourceLanguage: ").append(toIndentedString(sourceLanguage)).append("\n"); + sb.append(" targetLanguage: ").append(toIndentedString(targetLanguage)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutputTargetLanguage.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutputTargetLanguage.java new file mode 100644 index 000000000..d5996e42c --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutputTargetLanguage.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import javax.annotation.Nonnull; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * SAPDocumentTranslationOutputTargetLanguage + */ +@Beta +public interface SAPDocumentTranslationOutputTargetLanguage +{ + /** + * Helper class to create {@code String } that implements {@link SAPDocumentTranslationOutputTargetLanguage}. + */ + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) implements SAPDocumentTranslationOutputTargetLanguage {} + + /** + * Creator to enable deserialization of {@code String }. + * + * @param val + * the value to use + * @return a new instance of {@link InnerString}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerString create( @Nonnull final String val ) + { + return new InnerString(val); + } + + /** + * Helper class to create {@code SAPDocumentTranslationApplyToSelector } that implements {@link SAPDocumentTranslationOutputTargetLanguage}. + */ + record InnerSAPDocumentTranslationApplyToSelector(@com.fasterxml.jackson.annotation.JsonValue @Nonnull SAPDocumentTranslationApplyToSelector value) implements SAPDocumentTranslationOutputTargetLanguage {} + + /** + * Creator to enable deserialization of {@code SAPDocumentTranslationApplyToSelector }. + * + * @param val + * the value to use + * @return a new instance of {@link InnerSAPDocumentTranslationApplyToSelector}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerSAPDocumentTranslationApplyToSelector createInnerSAPDocumentTranslationApplyToSelector( + @Nonnull final SAPDocumentTranslationApplyToSelector val ) + { + return new InnerSAPDocumentTranslationApplyToSelector(val); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SearchDocumentKeyValueListPair.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SearchDocumentKeyValueListPair.java new file mode 100644 index 000000000..889ec4c43 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SearchDocumentKeyValueListPair.java @@ -0,0 +1,321 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * SearchDocumentKeyValueListPair + */ + +@Beta // CHECKSTYLE:OFF +public class SearchDocumentKeyValueListPair +// CHECKSTYLE:ON +{ + @JsonProperty( "key" ) + private String key; + + @JsonProperty( "value" ) + private List value = new ArrayList<>(); + + @JsonProperty( "select_mode" ) + private List selectMode = new ArrayList<>(); + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for SearchDocumentKeyValueListPair. + */ + protected SearchDocumentKeyValueListPair() + { + } + + /** + * Set the key of this {@link SearchDocumentKeyValueListPair} instance and return the same instance. + * + * @param key + * The key of this {@link SearchDocumentKeyValueListPair} + * @return The same instance of this {@link SearchDocumentKeyValueListPair} class + */ + @Nonnull + public SearchDocumentKeyValueListPair key( @Nonnull final String key ) + { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link SearchDocumentKeyValueListPair} instance. + */ + @Nonnull + public String getKey() + { + return key; + } + + /** + * Set the key of this {@link SearchDocumentKeyValueListPair} instance. + * + * @param key + * The key of this {@link SearchDocumentKeyValueListPair} + */ + public void setKey( @Nonnull final String key ) + { + this.key = key; + } + + /** + * Set the value of this {@link SearchDocumentKeyValueListPair} instance and return the same instance. + * + * @param value + * The value of this {@link SearchDocumentKeyValueListPair} + * @return The same instance of this {@link SearchDocumentKeyValueListPair} class + */ + @Nonnull + public SearchDocumentKeyValueListPair value( @Nonnull final List value ) + { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link SearchDocumentKeyValueListPair}. + * + * @param valueItem + * The value that should be added + * @return The same instance of type {@link SearchDocumentKeyValueListPair} + */ + @Nonnull + public SearchDocumentKeyValueListPair addValueItem( @Nonnull final String valueItem ) + { + if( this.value == null ) { + this.value = new ArrayList<>(); + } + this.value.add(valueItem); + return this; + } + + /** + * Get value + * + * @return value The value of this {@link SearchDocumentKeyValueListPair} instance. + */ + @Nonnull + public List getValue() + { + return value; + } + + /** + * Set the value of this {@link SearchDocumentKeyValueListPair} instance. + * + * @param value + * The value of this {@link SearchDocumentKeyValueListPair} + */ + public void setValue( @Nonnull final List value ) + { + this.value = value; + } + + /** + * Set the selectMode of this {@link SearchDocumentKeyValueListPair} instance and return the same instance. + * + * @param selectMode + * Select mode for search filters + * @return The same instance of this {@link SearchDocumentKeyValueListPair} class + */ + @Nonnull + public SearchDocumentKeyValueListPair selectMode( @Nullable final List selectMode ) + { + this.selectMode = selectMode; + return this; + } + + /** + * Add one selectMode instance to this {@link SearchDocumentKeyValueListPair}. + * + * @param selectModeItem + * The selectMode that should be added + * @return The same instance of type {@link SearchDocumentKeyValueListPair} + */ + @Nonnull + public SearchDocumentKeyValueListPair addSelectModeItem( @Nonnull final SearchSelectOptionEnum selectModeItem ) + { + if( this.selectMode == null ) { + this.selectMode = new ArrayList<>(); + } + this.selectMode.add(selectModeItem); + return this; + } + + /** + * Select mode for search filters + * + * @return selectMode The selectMode of this {@link SearchDocumentKeyValueListPair} instance. + */ + @Nonnull + public List getSelectMode() + { + return selectMode; + } + + /** + * Set the selectMode of this {@link SearchDocumentKeyValueListPair} instance. + * + * @param selectMode + * Select mode for search filters + */ + public void setSelectMode( @Nullable final List selectMode ) + { + this.selectMode = selectMode; + } + + /** + * Get the names of the unrecognizable properties of the {@link SearchDocumentKeyValueListPair}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SearchDocumentKeyValueListPair} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("SearchDocumentKeyValueListPair has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SearchDocumentKeyValueListPair} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( key != null ) + declaredFields.put("key", key); + if( value != null ) + declaredFields.put("value", value); + if( selectMode != null ) + declaredFields.put("selectMode", selectMode); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SearchDocumentKeyValueListPair} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final SearchDocumentKeyValueListPair searchDocumentKeyValueListPair = (SearchDocumentKeyValueListPair) o; + return Objects.equals(this.cloudSdkCustomFields, searchDocumentKeyValueListPair.cloudSdkCustomFields) + && Objects.equals(this.key, searchDocumentKeyValueListPair.key) + && Objects.equals(this.value, searchDocumentKeyValueListPair.value) + && Objects.equals(this.selectMode, searchDocumentKeyValueListPair.selectMode); + } + + @Override + public int hashCode() + { + return Objects.hash(key, value, selectMode, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class SearchDocumentKeyValueListPair {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" selectMode: ").append(toIndentedString(selectMode)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SearchSelectOptionEnum.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SearchSelectOptionEnum.java new file mode 100644 index 000000000..32b7bbe38 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SearchSelectOptionEnum.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import javax.annotation.Nonnull; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * Gets or Sets SearchSelectOptionEnum + */ + +@Beta +public enum SearchSelectOptionEnum +{ + + IGNORE_IF_KEY_ABSENT("ignoreIfKeyAbsent"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private final String value; + + SearchSelectOptionEnum( String value ) + { + this.value = value; + } + + /** + * @return The enum value. + */ + @JsonValue + public String getValue() + { + return value; + } + + /** + * @return The String representation of the enum value. + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Converts the given value to its enum representation. + * + * @param value + * The input value. + * + * @return The enum representation of the given value. + */ + @JsonCreator + public static SearchSelectOptionEnum fromValue( @Nonnull final String value ) + { + for( final SearchSelectOptionEnum b : SearchSelectOptionEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SingleChatTemplate.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SingleChatTemplate.java new file mode 100644 index 000000000..d8bac9d11 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SingleChatTemplate.java @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * SingleChatTemplate + */ + +@Beta // CHECKSTYLE:OFF +public class SingleChatTemplate implements PromptTemplate +// CHECKSTYLE:ON +{ + @JsonProperty( "role" ) + private String role; + + @JsonProperty( "content" ) + private String content; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for SingleChatTemplate. + */ + protected SingleChatTemplate() + { + } + + /** + * Set the role of this {@link SingleChatTemplate} instance and return the same instance. + * + * @param role + * The role of this {@link SingleChatTemplate} + * @return The same instance of this {@link SingleChatTemplate} class + */ + @Nonnull + public SingleChatTemplate role( @Nonnull final String role ) + { + this.role = role; + return this; + } + + /** + * Get role + * + * @return role The role of this {@link SingleChatTemplate} instance. + */ + @Nonnull + public String getRole() + { + return role; + } + + /** + * Set the role of this {@link SingleChatTemplate} instance. + * + * @param role + * The role of this {@link SingleChatTemplate} + */ + public void setRole( @Nonnull final String role ) + { + this.role = role; + } + + /** + * Set the content of this {@link SingleChatTemplate} instance and return the same instance. + * + * @param content + * The content of this {@link SingleChatTemplate} + * @return The same instance of this {@link SingleChatTemplate} class + */ + @Nonnull + public SingleChatTemplate content( @Nonnull final String content ) + { + this.content = content; + return this; + } + + /** + * Get content + * + * @return content The content of this {@link SingleChatTemplate} instance. + */ + @Nonnull + public String getContent() + { + return content; + } + + /** + * Set the content of this {@link SingleChatTemplate} instance. + * + * @param content + * The content of this {@link SingleChatTemplate} + */ + public void setContent( @Nonnull final String content ) + { + this.content = content; + } + + /** + * Get the names of the unrecognizable properties of the {@link SingleChatTemplate}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SingleChatTemplate} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("SingleChatTemplate has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SingleChatTemplate} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( role != null ) + declaredFields.put("role", role); + if( content != null ) + declaredFields.put("content", content); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SingleChatTemplate} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final SingleChatTemplate singleChatTemplate = (SingleChatTemplate) o; + return Objects.equals(this.cloudSdkCustomFields, singleChatTemplate.cloudSdkCustomFields) + && Objects.equals(this.role, singleChatTemplate.role) + && Objects.equals(this.content, singleChatTemplate.content); + } + + @Override + public int hashCode() + { + return Objects.hash(role, content, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class SingleChatTemplate {\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SystemChatMessage.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SystemChatMessage.java new file mode 100644 index 000000000..5e9e203e2 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SystemChatMessage.java @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * SystemChatMessage + */ + +@Beta // CHECKSTYLE:OFF +public class SystemChatMessage implements ChatMessage +// CHECKSTYLE:ON +{ + /** + * Gets or Sets role + */ + public enum RoleEnum + { + /** + * The SYSTEM option of this SystemChatMessage + */ + SYSTEM("system"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this SystemChatMessage + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + RoleEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type SystemChatMessage + */ + @JsonCreator + @Nonnull + public static RoleEnum fromValue( @Nonnull final String value ) + { + for( RoleEnum b : RoleEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "role" ) + private RoleEnum role; + + @JsonProperty( "content" ) + private ChatMessageContent content; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for SystemChatMessage. + */ + protected SystemChatMessage() + { + } + + /** + * Set the role of this {@link SystemChatMessage} instance and return the same instance. + * + * @param role + * The role of this {@link SystemChatMessage} + * @return The same instance of this {@link SystemChatMessage} class + */ + @Nonnull + public SystemChatMessage role( @Nonnull final RoleEnum role ) + { + this.role = role; + return this; + } + + /** + * Get role + * + * @return role The role of this {@link SystemChatMessage} instance. + */ + @Nonnull + public RoleEnum getRole() + { + return role; + } + + /** + * Set the role of this {@link SystemChatMessage} instance. + * + * @param role + * The role of this {@link SystemChatMessage} + */ + public void setRole( @Nonnull final RoleEnum role ) + { + this.role = role; + } + + /** + * Set the content of this {@link SystemChatMessage} instance and return the same instance. + * + * @param content + * The content of this {@link SystemChatMessage} + * @return The same instance of this {@link SystemChatMessage} class + */ + @Nonnull + public SystemChatMessage content( @Nonnull final ChatMessageContent content ) + { + this.content = content; + return this; + } + + /** + * Get content + * + * @return content The content of this {@link SystemChatMessage} instance. + */ + @Nonnull + public ChatMessageContent getContent() + { + return content; + } + + /** + * Set the content of this {@link SystemChatMessage} instance. + * + * @param content + * The content of this {@link SystemChatMessage} + */ + public void setContent( @Nonnull final ChatMessageContent content ) + { + this.content = content; + } + + /** + * Get the names of the unrecognizable properties of the {@link SystemChatMessage}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SystemChatMessage} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("SystemChatMessage has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SystemChatMessage} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( role != null ) + declaredFields.put("role", role); + if( content != null ) + declaredFields.put("content", content); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SystemChatMessage} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final SystemChatMessage systemChatMessage = (SystemChatMessage) o; + return Objects.equals(this.cloudSdkCustomFields, systemChatMessage.cloudSdkCustomFields) + && Objects.equals(this.role, systemChatMessage.role) + && Objects.equals(this.content, systemChatMessage.content); + } + + @Override + public int hashCode() + { + return Objects.hash(role, content, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class SystemChatMessage {\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Template.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Template.java new file mode 100644 index 000000000..7b39b3d5a --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Template.java @@ -0,0 +1,389 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * Template + */ + +@Beta // CHECKSTYLE:OFF +public class Template implements PromptTemplatingModuleConfigPrompt +// CHECKSTYLE:ON +{ + @JsonProperty( "template" ) + private List template; + + @JsonProperty( "defaults" ) + private Map defaults = new HashMap<>(); + + @JsonProperty( "response_format" ) + private TemplateResponseFormat responseFormat; + + @JsonProperty( "tools" ) + private List tools = new ArrayList<>(); + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for Template. + */ + protected Template() + { + } + + /** + * Set the template of this {@link Template} instance and return the same instance. + * + * @param template + * A chat message array to be formatted with values from placeholder_values. Both role and content can be + * templated. If messages_history is provided, the templated messages will be appended. + * @return The same instance of this {@link Template} class + */ + @Nonnull + public Template template( @Nonnull final List template ) + { + this.template = template; + return this; + } + + /** + * Add one template instance to this {@link Template}. + * + * @param templateItem + * The template that should be added + * @return The same instance of type {@link Template} + */ + @Nonnull + public Template addTemplateItem( @Nonnull final ChatMessage templateItem ) + { + if( this.template == null ) { + this.template = new ArrayList<>(); + } + this.template.add(templateItem); + return this; + } + + /** + * A chat message array to be formatted with values from placeholder_values. Both role and content can be templated. + * If messages_history is provided, the templated messages will be appended. + * + * @return template The template of this {@link Template} instance. + */ + @Nonnull + public List getTemplate() + { + return template; + } + + /** + * Set the template of this {@link Template} instance. + * + * @param template + * A chat message array to be formatted with values from placeholder_values. Both role and content can be + * templated. If messages_history is provided, the templated messages will be appended. + */ + public void setTemplate( @Nonnull final List template ) + { + this.template = template; + } + + /** + * Set the defaults of this {@link Template} instance and return the same instance. + * + * @param defaults + * Optional default values for the template. If a parameter has no default it is required. + * @return The same instance of this {@link Template} class + */ + @Nonnull + public Template defaults( @Nullable final Map defaults ) + { + this.defaults = defaults; + return this; + } + + /** + * Put one defaults instance to this {@link Template} instance. + * + * @param key + * The String key of this defaults instance + * @param defaultsItem + * The defaults that should be added under the given key + * @return The same instance of type {@link Template} + */ + @Nonnull + public Template putdefaultsItem( @Nonnull final String key, @Nonnull final String defaultsItem ) + { + if( this.defaults == null ) { + this.defaults = new HashMap<>(); + } + this.defaults.put(key, defaultsItem); + return this; + } + + /** + * Optional default values for the template. If a parameter has no default it is required. + * + * @return defaults The defaults of this {@link Template} instance. + */ + @Nonnull + public Map getDefaults() + { + return defaults; + } + + /** + * Set the defaults of this {@link Template} instance. + * + * @param defaults + * Optional default values for the template. If a parameter has no default it is required. + */ + public void setDefaults( @Nullable final Map defaults ) + { + this.defaults = defaults; + } + + /** + * Set the responseFormat of this {@link Template} instance and return the same instance. + * + * @param responseFormat + * The responseFormat of this {@link Template} + * @return The same instance of this {@link Template} class + */ + @Nonnull + public Template responseFormat( @Nullable final TemplateResponseFormat responseFormat ) + { + this.responseFormat = responseFormat; + return this; + } + + /** + * Get responseFormat + * + * @return responseFormat The responseFormat of this {@link Template} instance. + */ + @Nonnull + public TemplateResponseFormat getResponseFormat() + { + return responseFormat; + } + + /** + * Set the responseFormat of this {@link Template} instance. + * + * @param responseFormat + * The responseFormat of this {@link Template} + */ + public void setResponseFormat( @Nullable final TemplateResponseFormat responseFormat ) + { + this.responseFormat = responseFormat; + } + + /** + * Set the tools of this {@link Template} instance and return the same instance. + * + * @param tools + * A list of tools the model may call. Used to provide a list of functions the model may generate JSON + * inputs for. This is the same as the OpenAI definition. + * @return The same instance of this {@link Template} class + */ + @Nonnull + public Template tools( @Nullable final List tools ) + { + this.tools = tools; + return this; + } + + /** + * Add one tools instance to this {@link Template}. + * + * @param toolsItem + * The tools that should be added + * @return The same instance of type {@link Template} + */ + @Nonnull + public Template addToolsItem( @Nonnull final ChatCompletionTool toolsItem ) + { + if( this.tools == null ) { + this.tools = new ArrayList<>(); + } + this.tools.add(toolsItem); + return this; + } + + /** + * A list of tools the model may call. Used to provide a list of functions the model may generate JSON inputs for. + * This is the same as the OpenAI definition. + * + * @return tools The tools of this {@link Template} instance. + */ + @Nonnull + public List getTools() + { + return tools; + } + + /** + * Set the tools of this {@link Template} instance. + * + * @param tools + * A list of tools the model may call. Used to provide a list of functions the model may generate JSON + * inputs for. This is the same as the OpenAI definition. + */ + public void setTools( @Nullable final List tools ) + { + this.tools = tools; + } + + /** + * Get the names of the unrecognizable properties of the {@link Template}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Template} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("Template has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Template} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( template != null ) + declaredFields.put("template", template); + if( defaults != null ) + declaredFields.put("defaults", defaults); + if( responseFormat != null ) + declaredFields.put("responseFormat", responseFormat); + if( tools != null ) + declaredFields.put("tools", tools); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Template} instance. If the map previously contained a mapping for + * the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final Template template = (Template) o; + return Objects.equals(this.cloudSdkCustomFields, template.cloudSdkCustomFields) + && Objects.equals(this.template, template.template) + && Objects.equals(this.defaults, template.defaults) + && Objects.equals(this.responseFormat, template.responseFormat) + && Objects.equals(this.tools, template.tools); + } + + @Override + public int hashCode() + { + return Objects.hash(template, defaults, responseFormat, tools, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class Template {\n"); + sb.append(" template: ").append(toIndentedString(template)).append("\n"); + sb.append(" defaults: ").append(toIndentedString(defaults)).append("\n"); + sb.append(" responseFormat: ").append(toIndentedString(responseFormat)).append("\n"); + sb.append(" tools: ").append(toIndentedString(tools)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRef.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRef.java new file mode 100644 index 000000000..52cc602df --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRef.java @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * TemplateRef + */ + +@Beta // CHECKSTYLE:OFF +public class TemplateRef implements PromptTemplatingModuleConfigPrompt +// CHECKSTYLE:ON +{ + @JsonProperty( "template_ref" ) + private TemplateRefTemplateRef templateRef; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for TemplateRef. + */ + protected TemplateRef() + { + } + + /** + * Set the templateRef of this {@link TemplateRef} instance and return the same instance. + * + * @param templateRef + * The templateRef of this {@link TemplateRef} + * @return The same instance of this {@link TemplateRef} class + */ + @Nonnull + public TemplateRef templateRef( @Nonnull final TemplateRefTemplateRef templateRef ) + { + this.templateRef = templateRef; + return this; + } + + /** + * Get templateRef + * + * @return templateRef The templateRef of this {@link TemplateRef} instance. + */ + @Nonnull + public TemplateRefTemplateRef getTemplateRef() + { + return templateRef; + } + + /** + * Set the templateRef of this {@link TemplateRef} instance. + * + * @param templateRef + * The templateRef of this {@link TemplateRef} + */ + public void setTemplateRef( @Nonnull final TemplateRefTemplateRef templateRef ) + { + this.templateRef = templateRef; + } + + /** + * Get the names of the unrecognizable properties of the {@link TemplateRef}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link TemplateRef} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("TemplateRef has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link TemplateRef} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( templateRef != null ) + declaredFields.put("templateRef", templateRef); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link TemplateRef} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final TemplateRef templateRef = (TemplateRef) o; + return Objects.equals(this.cloudSdkCustomFields, templateRef.cloudSdkCustomFields) + && Objects.equals(this.templateRef, templateRef.templateRef); + } + + @Override + public int hashCode() + { + return Objects.hash(templateRef, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class TemplateRef {\n"); + sb.append(" templateRef: ").append(toIndentedString(templateRef)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefByID.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefByID.java new file mode 100644 index 000000000..31764a273 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefByID.java @@ -0,0 +1,322 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * TemplateRefByID + */ + +@Beta // CHECKSTYLE:OFF +public class TemplateRefByID implements TemplateRefTemplateRef +// CHECKSTYLE:ON +{ + @JsonProperty( "id" ) + private String id; + + /** + * Defines the scope that is searched for the referenced template. 'tenant' indicates the template is shared + * across all resource groups within the tenant, while 'resource_group' indicates the template is only + * accessible within the specific resource group. + */ + public enum ScopeEnum + { + /** + * The RESOURCE_GROUP option of this TemplateRefByID + */ + RESOURCE_GROUP("resource_group"), + + /** + * The TENANT option of this TemplateRefByID + */ + TENANT("tenant"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this TemplateRefByID + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ScopeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type TemplateRefByID + */ + @JsonCreator + @Nonnull + public static ScopeEnum fromValue( @Nonnull final String value ) + { + for( ScopeEnum b : ScopeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "scope" ) + private ScopeEnum scope = ScopeEnum.TENANT; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for TemplateRefByID. + */ + protected TemplateRefByID() + { + } + + /** + * Set the id of this {@link TemplateRefByID} instance and return the same instance. + * + * @param id + * ID of the template in prompt registry + * @return The same instance of this {@link TemplateRefByID} class + */ + @Nonnull + public TemplateRefByID id( @Nonnull final String id ) + { + this.id = id; + return this; + } + + /** + * ID of the template in prompt registry + * + * @return id The id of this {@link TemplateRefByID} instance. + */ + @Nonnull + public String getId() + { + return id; + } + + /** + * Set the id of this {@link TemplateRefByID} instance. + * + * @param id + * ID of the template in prompt registry + */ + public void setId( @Nonnull final String id ) + { + this.id = id; + } + + /** + * Set the scope of this {@link TemplateRefByID} instance and return the same instance. + * + * @param scope + * Defines the scope that is searched for the referenced template. 'tenant' indicates the + * template is shared across all resource groups within the tenant, while 'resource_group' + * indicates the template is only accessible within the specific resource group. + * @return The same instance of this {@link TemplateRefByID} class + */ + @Nonnull + public TemplateRefByID scope( @Nullable final ScopeEnum scope ) + { + this.scope = scope; + return this; + } + + /** + * Defines the scope that is searched for the referenced template. 'tenant' indicates the template is shared + * across all resource groups within the tenant, while 'resource_group' indicates the template is only + * accessible within the specific resource group. + * + * @return scope The scope of this {@link TemplateRefByID} instance. + */ + @Nonnull + public ScopeEnum getScope() + { + return scope; + } + + /** + * Set the scope of this {@link TemplateRefByID} instance. + * + * @param scope + * Defines the scope that is searched for the referenced template. 'tenant' indicates the + * template is shared across all resource groups within the tenant, while 'resource_group' + * indicates the template is only accessible within the specific resource group. + */ + public void setScope( @Nullable final ScopeEnum scope ) + { + this.scope = scope; + } + + /** + * Get the names of the unrecognizable properties of the {@link TemplateRefByID}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link TemplateRefByID} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("TemplateRefByID has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link TemplateRefByID} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( id != null ) + declaredFields.put("id", id); + if( scope != null ) + declaredFields.put("scope", scope); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link TemplateRefByID} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final TemplateRefByID templateRefByID = (TemplateRefByID) o; + return Objects.equals(this.cloudSdkCustomFields, templateRefByID.cloudSdkCustomFields) + && Objects.equals(this.id, templateRefByID.id) + && Objects.equals(this.scope, templateRefByID.scope); + } + + @Override + public int hashCode() + { + return Objects.hash(id, scope, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class TemplateRefByID {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefByScenarioNameVersion.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefByScenarioNameVersion.java new file mode 100644 index 000000000..67ff64d40 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefByScenarioNameVersion.java @@ -0,0 +1,409 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * TemplateRefByScenarioNameVersion + */ + +@Beta // CHECKSTYLE:OFF +public class TemplateRefByScenarioNameVersion implements TemplateRefTemplateRef +// CHECKSTYLE:ON +{ + @JsonProperty( "scenario" ) + private String scenario; + + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "version" ) + private String version; + + /** + * Defines the scope that is searched for the referenced template. 'tenant' indicates the template is shared + * across all resource groups within the tenant, while 'resource_group' indicates the template is only + * accessible within the specific resource group. + */ + public enum ScopeEnum + { + /** + * The RESOURCE_GROUP option of this TemplateRefByScenarioNameVersion + */ + RESOURCE_GROUP("resource_group"), + + /** + * The TENANT option of this TemplateRefByScenarioNameVersion + */ + TENANT("tenant"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this TemplateRefByScenarioNameVersion + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ScopeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type TemplateRefByScenarioNameVersion + */ + @JsonCreator + @Nonnull + public static ScopeEnum fromValue( @Nonnull final String value ) + { + for( ScopeEnum b : ScopeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "scope" ) + private ScopeEnum scope = ScopeEnum.TENANT; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for TemplateRefByScenarioNameVersion. + */ + protected TemplateRefByScenarioNameVersion() + { + } + + /** + * Set the scenario of this {@link TemplateRefByScenarioNameVersion} instance and return the same instance. + * + * @param scenario + * Scenario name + * @return The same instance of this {@link TemplateRefByScenarioNameVersion} class + */ + @Nonnull + public TemplateRefByScenarioNameVersion scenario( @Nonnull final String scenario ) + { + this.scenario = scenario; + return this; + } + + /** + * Scenario name + * + * @return scenario The scenario of this {@link TemplateRefByScenarioNameVersion} instance. + */ + @Nonnull + public String getScenario() + { + return scenario; + } + + /** + * Set the scenario of this {@link TemplateRefByScenarioNameVersion} instance. + * + * @param scenario + * Scenario name + */ + public void setScenario( @Nonnull final String scenario ) + { + this.scenario = scenario; + } + + /** + * Set the name of this {@link TemplateRefByScenarioNameVersion} instance and return the same instance. + * + * @param name + * Name of the template + * @return The same instance of this {@link TemplateRefByScenarioNameVersion} class + */ + @Nonnull + public TemplateRefByScenarioNameVersion name( @Nonnull final String name ) + { + this.name = name; + return this; + } + + /** + * Name of the template + * + * @return name The name of this {@link TemplateRefByScenarioNameVersion} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link TemplateRefByScenarioNameVersion} instance. + * + * @param name + * Name of the template + */ + public void setName( @Nonnull final String name ) + { + this.name = name; + } + + /** + * Set the version of this {@link TemplateRefByScenarioNameVersion} instance and return the same instance. + * + * @param version + * Version of the template + * @return The same instance of this {@link TemplateRefByScenarioNameVersion} class + */ + @Nonnull + public TemplateRefByScenarioNameVersion version( @Nonnull final String version ) + { + this.version = version; + return this; + } + + /** + * Version of the template + * + * @return version The version of this {@link TemplateRefByScenarioNameVersion} instance. + */ + @Nonnull + public String getVersion() + { + return version; + } + + /** + * Set the version of this {@link TemplateRefByScenarioNameVersion} instance. + * + * @param version + * Version of the template + */ + public void setVersion( @Nonnull final String version ) + { + this.version = version; + } + + /** + * Set the scope of this {@link TemplateRefByScenarioNameVersion} instance and return the same instance. + * + * @param scope + * Defines the scope that is searched for the referenced template. 'tenant' indicates the + * template is shared across all resource groups within the tenant, while 'resource_group' + * indicates the template is only accessible within the specific resource group. + * @return The same instance of this {@link TemplateRefByScenarioNameVersion} class + */ + @Nonnull + public TemplateRefByScenarioNameVersion scope( @Nullable final ScopeEnum scope ) + { + this.scope = scope; + return this; + } + + /** + * Defines the scope that is searched for the referenced template. 'tenant' indicates the template is shared + * across all resource groups within the tenant, while 'resource_group' indicates the template is only + * accessible within the specific resource group. + * + * @return scope The scope of this {@link TemplateRefByScenarioNameVersion} instance. + */ + @Nonnull + public ScopeEnum getScope() + { + return scope; + } + + /** + * Set the scope of this {@link TemplateRefByScenarioNameVersion} instance. + * + * @param scope + * Defines the scope that is searched for the referenced template. 'tenant' indicates the + * template is shared across all resource groups within the tenant, while 'resource_group' + * indicates the template is only accessible within the specific resource group. + */ + public void setScope( @Nullable final ScopeEnum scope ) + { + this.scope = scope; + } + + /** + * Get the names of the unrecognizable properties of the {@link TemplateRefByScenarioNameVersion}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link TemplateRefByScenarioNameVersion} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("TemplateRefByScenarioNameVersion has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link TemplateRefByScenarioNameVersion} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( scenario != null ) + declaredFields.put("scenario", scenario); + if( name != null ) + declaredFields.put("name", name); + if( version != null ) + declaredFields.put("version", version); + if( scope != null ) + declaredFields.put("scope", scope); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link TemplateRefByScenarioNameVersion} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final TemplateRefByScenarioNameVersion templateRefByScenarioNameVersion = (TemplateRefByScenarioNameVersion) o; + return Objects.equals(this.cloudSdkCustomFields, templateRefByScenarioNameVersion.cloudSdkCustomFields) + && Objects.equals(this.scenario, templateRefByScenarioNameVersion.scenario) + && Objects.equals(this.name, templateRefByScenarioNameVersion.name) + && Objects.equals(this.version, templateRefByScenarioNameVersion.version) + && Objects.equals(this.scope, templateRefByScenarioNameVersion.scope); + } + + @Override + public int hashCode() + { + return Objects.hash(scenario, name, version, scope, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class TemplateRefByScenarioNameVersion {\n"); + sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefTemplateRef.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefTemplateRef.java new file mode 100644 index 000000000..d9831432d --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefTemplateRef.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.google.common.annotations.Beta; + +/** + * Reference to a template in the prompt registry by ID or by scenario, name and version + */ +@Beta +@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) +@JsonSubTypes( { + @JsonSubTypes.Type( value = TemplateRefByID.class ), + @JsonSubTypes.Type( value = TemplateRefByScenarioNameVersion.class ), } ) + +public interface TemplateRefTemplateRef +{ +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateResponseFormat.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateResponseFormat.java new file mode 100644 index 000000000..205025c94 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateResponseFormat.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.google.common.annotations.Beta; + +/** + * Response format that the model output should adhere to. This is the same as the OpenAI definition. + */ +@Beta +@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) +@JsonSubTypes( { + @JsonSubTypes.Type( value = ResponseFormatJsonObject.class ), + @JsonSubTypes.Type( value = ResponseFormatJsonSchema.class ), + @JsonSubTypes.Type( value = ResponseFormatText.class ), } ) + +public interface TemplateResponseFormat +{ +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TextContent.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TextContent.java new file mode 100644 index 000000000..96480f22f --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TextContent.java @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * TextContent + */ + +@Beta // CHECKSTYLE:OFF +public class TextContent implements MultiChatContent +// CHECKSTYLE:ON +{ + /** + * Gets or Sets type + */ + public enum TypeEnum + { + /** + * The TEXT option of this TextContent + */ + TEXT("text"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this TextContent + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type TextContent + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue( @Nonnull final String value ) + { + for( TypeEnum b : TypeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "type" ) + private TypeEnum type; + + @JsonProperty( "text" ) + private String text; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for TextContent. + */ + protected TextContent() + { + } + + /** + * Set the type of this {@link TextContent} instance and return the same instance. + * + * @param type + * The type of this {@link TextContent} + * @return The same instance of this {@link TextContent} class + */ + @Nonnull + public TextContent type( @Nonnull final TypeEnum type ) + { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link TextContent} instance. + */ + @Nonnull + public TypeEnum getType() + { + return type; + } + + /** + * Set the type of this {@link TextContent} instance. + * + * @param type + * The type of this {@link TextContent} + */ + public void setType( @Nonnull final TypeEnum type ) + { + this.type = type; + } + + /** + * Set the text of this {@link TextContent} instance and return the same instance. + * + * @param text + * The text of this {@link TextContent} + * @return The same instance of this {@link TextContent} class + */ + @Nonnull + public TextContent text( @Nonnull final String text ) + { + this.text = text; + return this; + } + + /** + * Get text + * + * @return text The text of this {@link TextContent} instance. + */ + @Nonnull + public String getText() + { + return text; + } + + /** + * Set the text of this {@link TextContent} instance. + * + * @param text + * The text of this {@link TextContent} + */ + public void setText( @Nonnull final String text ) + { + this.text = text; + } + + /** + * Get the names of the unrecognizable properties of the {@link TextContent}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link TextContent} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("TextContent has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link TextContent} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( type != null ) + declaredFields.put("type", type); + if( text != null ) + declaredFields.put("text", text); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link TextContent} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final TextContent textContent = (TextContent) o; + return Objects.equals(this.cloudSdkCustomFields, textContent.cloudSdkCustomFields) + && Objects.equals(this.type, textContent.type) + && Objects.equals(this.text, textContent.text); + } + + @Override + public int hashCode() + { + return Objects.hash(type, text, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class TextContent {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ToolChatMessage.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ToolChatMessage.java new file mode 100644 index 000000000..585e72ad4 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ToolChatMessage.java @@ -0,0 +1,352 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * ToolChatMessage + */ + +@Beta // CHECKSTYLE:OFF +public class ToolChatMessage implements ChatMessage +// CHECKSTYLE:ON +{ + /** + * Gets or Sets role + */ + public enum RoleEnum + { + /** + * The TOOL option of this ToolChatMessage + */ + TOOL("tool"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this ToolChatMessage + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + RoleEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type ToolChatMessage + */ + @JsonCreator + @Nonnull + public static RoleEnum fromValue( @Nonnull final String value ) + { + for( RoleEnum b : RoleEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "role" ) + private RoleEnum role; + + @JsonProperty( "tool_call_id" ) + private String toolCallId; + + @JsonProperty( "content" ) + private ChatMessageContent content; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for ToolChatMessage. + */ + protected ToolChatMessage() + { + } + + /** + * Set the role of this {@link ToolChatMessage} instance and return the same instance. + * + * @param role + * The role of this {@link ToolChatMessage} + * @return The same instance of this {@link ToolChatMessage} class + */ + @Nonnull + public ToolChatMessage role( @Nonnull final RoleEnum role ) + { + this.role = role; + return this; + } + + /** + * Get role + * + * @return role The role of this {@link ToolChatMessage} instance. + */ + @Nonnull + public RoleEnum getRole() + { + return role; + } + + /** + * Set the role of this {@link ToolChatMessage} instance. + * + * @param role + * The role of this {@link ToolChatMessage} + */ + public void setRole( @Nonnull final RoleEnum role ) + { + this.role = role; + } + + /** + * Set the toolCallId of this {@link ToolChatMessage} instance and return the same instance. + * + * @param toolCallId + * The toolCallId of this {@link ToolChatMessage} + * @return The same instance of this {@link ToolChatMessage} class + */ + @Nonnull + public ToolChatMessage toolCallId( @Nonnull final String toolCallId ) + { + this.toolCallId = toolCallId; + return this; + } + + /** + * Get toolCallId + * + * @return toolCallId The toolCallId of this {@link ToolChatMessage} instance. + */ + @Nonnull + public String getToolCallId() + { + return toolCallId; + } + + /** + * Set the toolCallId of this {@link ToolChatMessage} instance. + * + * @param toolCallId + * The toolCallId of this {@link ToolChatMessage} + */ + public void setToolCallId( @Nonnull final String toolCallId ) + { + this.toolCallId = toolCallId; + } + + /** + * Set the content of this {@link ToolChatMessage} instance and return the same instance. + * + * @param content + * The content of this {@link ToolChatMessage} + * @return The same instance of this {@link ToolChatMessage} class + */ + @Nonnull + public ToolChatMessage content( @Nonnull final ChatMessageContent content ) + { + this.content = content; + return this; + } + + /** + * Get content + * + * @return content The content of this {@link ToolChatMessage} instance. + */ + @Nonnull + public ChatMessageContent getContent() + { + return content; + } + + /** + * Set the content of this {@link ToolChatMessage} instance. + * + * @param content + * The content of this {@link ToolChatMessage} + */ + public void setContent( @Nonnull final ChatMessageContent content ) + { + this.content = content; + } + + /** + * Get the names of the unrecognizable properties of the {@link ToolChatMessage}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ToolChatMessage} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("ToolChatMessage has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ToolChatMessage} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( role != null ) + declaredFields.put("role", role); + if( toolCallId != null ) + declaredFields.put("toolCallId", toolCallId); + if( content != null ) + declaredFields.put("content", content); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ToolChatMessage} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final ToolChatMessage toolChatMessage = (ToolChatMessage) o; + return Objects.equals(this.cloudSdkCustomFields, toolChatMessage.cloudSdkCustomFields) + && Objects.equals(this.role, toolChatMessage.role) + && Objects.equals(this.toolCallId, toolChatMessage.toolCallId) + && Objects.equals(this.content, toolChatMessage.content); + } + + @Override + public int hashCode() + { + return Objects.hash(role, toolCallId, content, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class ToolChatMessage {\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" toolCallId: ").append(toIndentedString(toolCallId)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TranslationModuleConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TranslationModuleConfig.java new file mode 100644 index 000000000..4c0723b27 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TranslationModuleConfig.java @@ -0,0 +1,242 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * Configuration for translation module + */ + +@Beta // CHECKSTYLE:OFF +public class TranslationModuleConfig +// CHECKSTYLE:ON +{ + @JsonProperty( "input" ) + private SAPDocumentTranslationInput input; + + @JsonProperty( "output" ) + private SAPDocumentTranslationOutput output; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for TranslationModuleConfig. + */ + protected TranslationModuleConfig() + { + } + + /** + * Set the input of this {@link TranslationModuleConfig} instance and return the same instance. + * + * @param input + * The input of this {@link TranslationModuleConfig} + * @return The same instance of this {@link TranslationModuleConfig} class + */ + @Nonnull + public TranslationModuleConfig input( @Nullable final SAPDocumentTranslationInput input ) + { + this.input = input; + return this; + } + + /** + * Get input + * + * @return input The input of this {@link TranslationModuleConfig} instance. + */ + @Nonnull + public SAPDocumentTranslationInput getInput() + { + return input; + } + + /** + * Set the input of this {@link TranslationModuleConfig} instance. + * + * @param input + * The input of this {@link TranslationModuleConfig} + */ + public void setInput( @Nullable final SAPDocumentTranslationInput input ) + { + this.input = input; + } + + /** + * Set the output of this {@link TranslationModuleConfig} instance and return the same instance. + * + * @param output + * The output of this {@link TranslationModuleConfig} + * @return The same instance of this {@link TranslationModuleConfig} class + */ + @Nonnull + public TranslationModuleConfig output( @Nullable final SAPDocumentTranslationOutput output ) + { + this.output = output; + return this; + } + + /** + * Get output + * + * @return output The output of this {@link TranslationModuleConfig} instance. + */ + @Nonnull + public SAPDocumentTranslationOutput getOutput() + { + return output; + } + + /** + * Set the output of this {@link TranslationModuleConfig} instance. + * + * @param output + * The output of this {@link TranslationModuleConfig} + */ + public void setOutput( @Nullable final SAPDocumentTranslationOutput output ) + { + this.output = output; + } + + /** + * Get the names of the unrecognizable properties of the {@link TranslationModuleConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link TranslationModuleConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("TranslationModuleConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link TranslationModuleConfig} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( input != null ) + declaredFields.put("input", input); + if( output != null ) + declaredFields.put("output", output); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link TranslationModuleConfig} instance. If the map previously contained + * a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final TranslationModuleConfig translationModuleConfig = (TranslationModuleConfig) o; + return Objects.equals(this.cloudSdkCustomFields, translationModuleConfig.cloudSdkCustomFields) + && Objects.equals(this.input, translationModuleConfig.input) + && Objects.equals(this.output, translationModuleConfig.output); + } + + @Override + public int hashCode() + { + return Objects.hash(input, output, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class TranslationModuleConfig {\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessage.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessage.java new file mode 100644 index 000000000..3d99d01a6 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessage.java @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * UserChatMessage + */ + +@Beta // CHECKSTYLE:OFF +public class UserChatMessage implements ChatMessage +// CHECKSTYLE:ON +{ + @JsonProperty( "content" ) + private UserChatMessageContent content; + + /** + * Gets or Sets role + */ + public enum RoleEnum + { + /** + * The USER option of this UserChatMessage + */ + USER("user"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this UserChatMessage + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + RoleEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type UserChatMessage + */ + @JsonCreator + @Nonnull + public static RoleEnum fromValue( @Nonnull final String value ) + { + for( RoleEnum b : RoleEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "role" ) + private RoleEnum role; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for UserChatMessage. + */ + protected UserChatMessage() + { + } + + /** + * Set the content of this {@link UserChatMessage} instance and return the same instance. + * + * @param content + * The content of this {@link UserChatMessage} + * @return The same instance of this {@link UserChatMessage} class + */ + @Nonnull + public UserChatMessage content( @Nonnull final UserChatMessageContent content ) + { + this.content = content; + return this; + } + + /** + * Get content + * + * @return content The content of this {@link UserChatMessage} instance. + */ + @Nonnull + public UserChatMessageContent getContent() + { + return content; + } + + /** + * Set the content of this {@link UserChatMessage} instance. + * + * @param content + * The content of this {@link UserChatMessage} + */ + public void setContent( @Nonnull final UserChatMessageContent content ) + { + this.content = content; + } + + /** + * Set the role of this {@link UserChatMessage} instance and return the same instance. + * + * @param role + * The role of this {@link UserChatMessage} + * @return The same instance of this {@link UserChatMessage} class + */ + @Nonnull + public UserChatMessage role( @Nonnull final RoleEnum role ) + { + this.role = role; + return this; + } + + /** + * Get role + * + * @return role The role of this {@link UserChatMessage} instance. + */ + @Nonnull + public RoleEnum getRole() + { + return role; + } + + /** + * Set the role of this {@link UserChatMessage} instance. + * + * @param role + * The role of this {@link UserChatMessage} + */ + public void setRole( @Nonnull final RoleEnum role ) + { + this.role = role; + } + + /** + * Get the names of the unrecognizable properties of the {@link UserChatMessage}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link UserChatMessage} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("UserChatMessage has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link UserChatMessage} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( content != null ) + declaredFields.put("content", content); + if( role != null ) + declaredFields.put("role", role); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link UserChatMessage} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final UserChatMessage userChatMessage = (UserChatMessage) o; + return Objects.equals(this.cloudSdkCustomFields, userChatMessage.cloudSdkCustomFields) + && Objects.equals(this.content, userChatMessage.content) + && Objects.equals(this.role, userChatMessage.role); + } + + @Override + public int hashCode() + { + return Objects.hash(content, role, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class UserChatMessage {\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessageContent.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessageContent.java new file mode 100644 index 000000000..8ebd2fb23 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessageContent.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.List; + +import javax.annotation.Nonnull; + +import com.google.common.annotations.Beta; + +/** + * UserChatMessageContent + */ +@Beta +public interface UserChatMessageContent +{ + /** + * Helper class to create {@code List } that implements {@link UserChatMessageContent}. + */ + record ListOfUserChatMessageContentItems(@com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) implements UserChatMessageContent {} + + /** + * Creator to enable deserialization of {@code List }. + * + * @param val + * the value to use + * @return a new instance of {@link ListOfUserChatMessageContentItems}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static ListOfUserChatMessageContentItems createListOfUserChatMessageContentItems( + @Nonnull final List val ) + { + return new ListOfUserChatMessageContentItems(val); + } + + /** + * Helper class to create {@code String } that implements {@link UserChatMessageContent}. + */ + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) implements UserChatMessageContent {} + + /** + * Creator to enable deserialization of {@code String }. + * + * @param val + * the value to use + * @return a new instance of {@link InnerString}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerString create( @Nonnull final String val ) + { + return new InnerString(val); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessageContentItem.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessageContentItem.java new file mode 100644 index 000000000..d9730e468 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessageContentItem.java @@ -0,0 +1,358 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * UserChatMessageContentItem + */ + +@Beta // CHECKSTYLE:OFF +public class UserChatMessageContentItem +// CHECKSTYLE:ON +{ + /** + * Gets or Sets type + */ + public enum TypeEnum + { + /** + * The TEXT option of this UserChatMessageContentItem + */ + TEXT("text"), + + /** + * The IMAGE_URL option of this UserChatMessageContentItem + */ + IMAGE_URL("image_url"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this UserChatMessageContentItem + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type UserChatMessageContentItem + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue( @Nonnull final String value ) + { + for( TypeEnum b : TypeEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "type" ) + private TypeEnum type; + + @JsonProperty( "text" ) + private String text; + + @JsonProperty( "image_url" ) + private ImageContentUrl imageUrl; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for UserChatMessageContentItem. + */ + protected UserChatMessageContentItem() + { + } + + /** + * Set the type of this {@link UserChatMessageContentItem} instance and return the same instance. + * + * @param type + * The type of this {@link UserChatMessageContentItem} + * @return The same instance of this {@link UserChatMessageContentItem} class + */ + @Nonnull + public UserChatMessageContentItem type( @Nonnull final TypeEnum type ) + { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link UserChatMessageContentItem} instance. + */ + @Nonnull + public TypeEnum getType() + { + return type; + } + + /** + * Set the type of this {@link UserChatMessageContentItem} instance. + * + * @param type + * The type of this {@link UserChatMessageContentItem} + */ + public void setType( @Nonnull final TypeEnum type ) + { + this.type = type; + } + + /** + * Set the text of this {@link UserChatMessageContentItem} instance and return the same instance. + * + * @param text + * The text of this {@link UserChatMessageContentItem} + * @return The same instance of this {@link UserChatMessageContentItem} class + */ + @Nonnull + public UserChatMessageContentItem text( @Nullable final String text ) + { + this.text = text; + return this; + } + + /** + * Get text + * + * @return text The text of this {@link UserChatMessageContentItem} instance. + */ + @Nonnull + public String getText() + { + return text; + } + + /** + * Set the text of this {@link UserChatMessageContentItem} instance. + * + * @param text + * The text of this {@link UserChatMessageContentItem} + */ + public void setText( @Nullable final String text ) + { + this.text = text; + } + + /** + * Set the imageUrl of this {@link UserChatMessageContentItem} instance and return the same instance. + * + * @param imageUrl + * The imageUrl of this {@link UserChatMessageContentItem} + * @return The same instance of this {@link UserChatMessageContentItem} class + */ + @Nonnull + public UserChatMessageContentItem imageUrl( @Nullable final ImageContentUrl imageUrl ) + { + this.imageUrl = imageUrl; + return this; + } + + /** + * Get imageUrl + * + * @return imageUrl The imageUrl of this {@link UserChatMessageContentItem} instance. + */ + @Nonnull + public ImageContentUrl getImageUrl() + { + return imageUrl; + } + + /** + * Set the imageUrl of this {@link UserChatMessageContentItem} instance. + * + * @param imageUrl + * The imageUrl of this {@link UserChatMessageContentItem} + */ + public void setImageUrl( @Nullable final ImageContentUrl imageUrl ) + { + this.imageUrl = imageUrl; + } + + /** + * Get the names of the unrecognizable properties of the {@link UserChatMessageContentItem}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link UserChatMessageContentItem} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("UserChatMessageContentItem has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link UserChatMessageContentItem} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( type != null ) + declaredFields.put("type", type); + if( text != null ) + declaredFields.put("text", text); + if( imageUrl != null ) + declaredFields.put("imageUrl", imageUrl); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link UserChatMessageContentItem} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final UserChatMessageContentItem userChatMessageContentItem = (UserChatMessageContentItem) o; + return Objects.equals(this.cloudSdkCustomFields, userChatMessageContentItem.cloudSdkCustomFields) + && Objects.equals(this.type, userChatMessageContentItem.type) + && Objects.equals(this.text, userChatMessageContentItem.text) + && Objects.equals(this.imageUrl, userChatMessageContentItem.imageUrl); + } + + @Override + public int hashCode() + { + return Objects.hash(type, text, imageUrl, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class UserChatMessageContentItem {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" imageUrl: ").append(toIndentedString(imageUrl)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/resources/prompt-registry.yaml b/datamodel/openapi/openapi-api-apache-sample/src/main/resources/prompt-registry.yaml new file mode 100644 index 000000000..dc137966e --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/resources/prompt-registry.yaml @@ -0,0 +1,2026 @@ +openapi: 3.0.0 +info: + version: 0.0.1 + title: Prompt Registry API + description: Prompt Storage service for Design time & Runtime prompt templates. +tags: + - name: prompt templates + description: Tag for prompt templates operations + - name: orchestration configs + description: Tag for orchestration configs operations +paths: + /lm/promptTemplates: + post: + operationId: registry.controller.prompt_controller.create_update_prompt_template + x-sap-cloud-sdk-operation-name: createUpdatePromptTemplate + description: Create or update a prompt template + tags: + - prompt templates + parameters: + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PromptTemplatePostRequest' + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/PromptTemplatePostResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' + default: + $ref: '#/components/responses/CommonError' + get: + operationId: registry.controller.prompt_controller.list_prompt_templates + x-sap-cloud-sdk-operation-name: listPromptTemplates + description: List prompt templates + tags: + - prompt templates + parameters: + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' + - name: scenario + in: query + schema: + type: string + - name: name + in: query + schema: + type: string + - name: version + in: query + schema: + type: string + - name: retrieve + in: query + schema: + type: string + default: both + - name: includeSpec + in: query + schema: + type: boolean + default: false + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/PromptTemplateListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' + default: + $ref: '#/components/responses/CommonError' + /lm/scenarios/{scenario}/promptTemplates/{name}/versions/{version}/history: + get: + operationId: registry.controller.prompt_controller.list_prompt_template_history + x-sap-cloud-sdk-operation-name: listPromptTemplateHistory + description: List prompt template history + tags: + - prompt templates + parameters: + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' + - name: scenario + in: path + required: true + schema: + type: string + - name: version + in: path + required: true + schema: + type: string + - name: name + in: path + required: true + schema: + type: string + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/PromptTemplateListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' + default: + $ref: '#/components/responses/CommonError' + /lm/promptTemplates/{promptTemplateId}: + get: + operationId: registry.controller.prompt_controller.get_prompt_template_by_uuid + x-sap-cloud-sdk-operation-name: getPromptTemplateByUuid + description: Get prompt template by UUID + tags: + - prompt templates + parameters: + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' + - name: promptTemplateId + in: path + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/PromptTemplateGetResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' + default: + $ref: '#/components/responses/CommonError' + delete: + operationId: registry.controller.prompt_controller.delete_prompt_template + x-sap-cloud-sdk-operation-name: deletePromptTemplate + description: Delete prompt template + tags: + - prompt templates + parameters: + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' + - name: promptTemplateId + in: path + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/PromptTemplateDeleteResponse' + '403': + $ref: '#/components/responses/ForbiddenError' + '404': + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/CommonError' + /lm/promptTemplates/import: + post: + operationId: registry.controller.prompt_controller.import_prompt_template + x-sap-cloud-sdk-operation-name: importPromptTemplate + description: Import prompt template + tags: + - prompt templates + parameters: + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/PromptTemplatePostResponse' + '400': + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/CommonError' + /lm/promptTemplates/{promptTemplateId}/export: + get: + operationId: registry.controller.prompt_controller.export_prompt_template + x-sap-cloud-sdk-operation-name: exportPromptTemplate + description: Export prompt template + tags: + - prompt templates + parameters: + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' + - name: promptTemplateId + in: path + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Successful response + content: + application/octet-stream: + schema: + type: string + format: binary + '400': + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/CommonError' + /lm/promptTemplates/{promptTemplateId}/substitution: + post: + operationId: registry.controller.prompt_controller.parse_prompt_template_by_id + x-sap-cloud-sdk-operation-name: parsePromptTemplateById + description: Parse prompt template by ID + tags: + - prompt templates + parameters: + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' + - name: promptTemplateId + in: path + required: true + schema: + type: string + format: uuid + - name: metadata + in: query + schema: + type: boolean + default: false + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PromptTemplateSubstitutionRequest' + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/PromptTemplateSubstitutionResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' + default: + $ref: '#/components/responses/CommonError' + /lm/scenarios/{scenario}/promptTemplates/{name}/versions/{version}/substitution: + post: + operationId: registry.controller.prompt_controller.parse_prompt_template_by_name_version + x-sap-cloud-sdk-operation-name: parsePromptTemplateByNameVersion + description: Parse prompt template by name and version + tags: + - prompt templates + parameters: + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' + - name: scenario + in: path + required: true + schema: + type: string + - name: version + in: path + required: true + schema: + type: string + - name: name + in: path + required: true + schema: + type: string + - name: metadata + in: query + schema: + type: boolean + default: false + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PromptTemplateSubstitutionRequest' + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/PromptTemplateSubstitutionResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' + default: + $ref: '#/components/responses/CommonError' + /registry/v2/orchestrationConfigs: + post: + operationId: registry.controller.orchestration_config_controller.create_update_orchestration_config + x-sap-cloud-sdk-operation-name: createUpdateOrchestrationConfig + description: Create or update an orchestration config + tags: + - orchestration configs + parameters: + - $ref: '#/components/parameters/ai-resource-group' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/OrchestrationConfigPostRequest' + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/OrchestrationConfigPostResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' + default: + $ref: '#/components/responses/CommonError' + get: + operationId: registry.controller.orchestration_config_controller.list_orchestration_configs + x-sap-cloud-sdk-operation-name: listOrchestrationConfigs + description: List orchestration configs + tags: + - orchestration configs + parameters: + - $ref: '#/components/parameters/ai-resource-group' + - name: scenario + in: query + schema: + type: string + - name: name + in: query + schema: + type: string + - name: version + in: query + schema: + type: string + - name: retrieve + in: query + schema: + type: string + default: both + enum: + - both + - imperative + - declarative + - name: include_spec + in: query + schema: + type: boolean + default: false + - name: resolve_template_ref + in: query + schema: + type: boolean + default: false + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/OrchestrationConfigListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' + default: + $ref: '#/components/responses/CommonError' + /registry/v2/scenarios/{scenario}/orchestrationConfigs/{name}/versions/{version}/history: + get: + operationId: registry.controller.orchestration_config_controller.list_orchestration_config_history + x-sap-cloud-sdk-operation-name: listOrchestrationConfigHistory + description: List orchestration config history + tags: + - orchestration configs + parameters: + - $ref: '#/components/parameters/ai-resource-group' + - name: scenario + in: path + required: true + schema: + type: string + - name: version + in: path + required: true + schema: + type: string + - name: name + in: path + required: true + schema: + type: string + - name: include_spec + in: query + schema: + type: boolean + default: false + - name: resolve_template_ref + in: query + schema: + type: boolean + default: false + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/OrchestrationConfigListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' + default: + $ref: '#/components/responses/CommonError' + /registry/v2/orchestrationConfigs/{orchestrationConfigId}: + get: + operationId: registry.controller.orchestration_config_controller.get_orchestration_config_by_uuid + x-sap-cloud-sdk-operation-name: getOrchestrationConfigByUuid + description: Get orchestration config by UUID + tags: + - orchestration configs + parameters: + - $ref: '#/components/parameters/ai-resource-group' + - name: orchestrationConfigId + in: path + required: true + schema: + type: string + format: uuid + - name: resolve_template_ref + in: query + schema: + type: boolean + default: false + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/OrchestrationConfigGetResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' + default: + $ref: '#/components/responses/CommonError' + delete: + operationId: registry.controller.orchestration_config_controller.delete_orchestration_config + x-sap-cloud-sdk-operation-name: deleteOrchestrationConfig + description: Delete orchestration config + tags: + - orchestration configs + parameters: + - $ref: '#/components/parameters/ai-resource-group' + - name: orchestrationConfigId + in: path + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/OrchestrationConfigDeleteResponse' + '403': + $ref: '#/components/responses/ForbiddenError' + '404': + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/CommonError' + /registry/v2/orchestrationConfigs/import: + post: + operationId: registry.controller.orchestration_config_controller.import_orchestration_config + x-sap-cloud-sdk-operation-name: importOrchestrationConfig + description: Import orchestration config + tags: + - orchestration configs + parameters: + - $ref: '#/components/parameters/ai-resource-group' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/OrchestrationConfigPostResponse' + '400': + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/CommonError' + /registry/v2/orchestrationConfigs/{orchestrationConfigId}/export: + get: + operationId: registry.controller.orchestration_config_controller.export_orchestration_config + x-sap-cloud-sdk-operation-name: exportOrchestrationConfig + description: Export orchestration config + tags: + - orchestration configs + parameters: + - $ref: '#/components/parameters/ai-resource-group' + - name: orchestrationConfigId + in: path + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Successful response + content: + application/octet-stream: + schema: + type: string + format: binary + '400': + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/CommonError' +components: + schemas: + PromptTemplate: + oneOf: + - $ref: '#/components/schemas/SingleChatTemplate' + - $ref: '#/components/schemas/MultiChatTemplate' + SingleChatTemplate: + type: object + required: + - role + - content + additionalProperties: false + properties: + role: + type: string + content: + type: string + MultiChatTemplate: + type: object + required: + - role + - content + additionalProperties: false + properties: + role: + type: string + content: + type: array + items: + $ref: '#/components/schemas/MultiChatContent' + MultiChatContent: + oneOf: + - $ref: '#/components/schemas/ImageContent' + - $ref: '#/components/schemas/TextContent' + TextContent: + type: object + required: + - type + - text + additionalProperties: false + properties: + type: + type: string + enum: + - text + text: + type: string + ImageContent: + type: object + required: + - type + - image_url + properties: + type: + type: string + enum: + - image_url + image_url: + type: object + required: + - url + additionalProperties: false + properties: + url: + type: string + detail: + type: string + default: auto + PromptTemplateSpec: + type: object + required: + - template + additionalProperties: + type: object + properties: + template: + type: array + items: + $ref: '#/components/schemas/PromptTemplate' + defaults: + type: object + additionalFields: + type: object + description: | + DEPRECATED. Please use additional_fields instead. + deprecated: true + response_format: + description: | + Response format that the model output should adhere to. This is the same as the OpenAI definition. + Compatible with GPT-4o, GPT-4o mini, GPT-4 (Turbo) and all GPT-3.5 Turbo models newer than gpt-3.5-turbo-1106. + oneOf: + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/ResponseFormatJsonObject' + - $ref: '#/components/schemas/ResponseFormatJsonSchema' + tools: + type: array + description: | + A list of tools the model may call. Used to provide a list of functions the model may generate JSON inputs for. This is the same as the OpenAI definition. + items: + $ref: '#/components/schemas/ChatCompletionTool' + ResponseFormatText: + type: object + additionalProperties: false + properties: + type: + type: string + description: 'The type of response format being defined: `text`' + enum: + - text + required: + - type + ResponseFormatJsonObject: + type: object + additionalProperties: false + properties: + type: + type: string + description: 'The type of response format being defined: `json_object`' + enum: + - json_object + required: + - type + ResponseFormatJsonSchema: + type: object + additionalProperties: false + properties: + type: + type: string + description: 'The type of response format being defined: `json_schema`' + enum: + - json_schema + json_schema: + type: object + additionalProperties: false + properties: + description: + type: string + description: A description of what the response format is for, used by the model to determine how to respond in the format. + name: + type: string + description: The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + pattern: ^[a-zA-Z0-9-_]+$ + maxLength: 64 + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + type: boolean + nullable: true + default: false + description: Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`. To learn more, read the [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). + required: + - name + required: + - type + - json_schema + ResponseFormatJsonSchemaSchema: + type: object + description: The schema for the response format, described as a JSON Schema object. + additionalProperties: true + ChatCompletionTool: + type: object + additionalProperties: false + properties: + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + $ref: '#/components/schemas/FunctionObject' + required: + - type + - function + FunctionObject: + type: object + additionalProperties: false + properties: + description: + type: string + description: A description of what the function does, used by the model to choose when and how to call the function. + name: + type: string + description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + pattern: ^[a-zA-Z0-9-_]+$ + maxLength: 64 + parameters: + $ref: '#/components/schemas/FunctionParameters' + strict: + type: boolean + nullable: true + default: false + description: Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling). + required: + - name + FunctionParameters: + type: object + description: The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. Omitting `parameters` defines a function with an empty parameter list. + additionalProperties: true + PromptTemplatePostRequest: + type: object + required: + - name + - version + - scenario + - spec + properties: + name: + type: string + maxLength: 120 + pattern: ^[a-zA-Z0-9_-]+$ + version: + type: string + maxLength: 10 + pattern: ^[a-zA-Z0-9._-]+$ + scenario: + type: string + maxLength: 120 + pattern: ^[a-zA-Z0-9_-]+$ + spec: + $ref: '#/components/schemas/PromptTemplateSpec' + PromptTemplatePostResponse: + type: object + required: + - message + - id + - scenario + - name + - version + properties: + message: + type: string + id: + type: string + format: uuid + scenario: + type: string + name: + type: string + version: + type: string + PromptTemplateGetResponse: + type: object + properties: + id: + type: string + format: uuid + name: + type: string + version: + type: string + scenario: + type: string + creationTimestamp: + type: string + format: timestamp + managedBy: + type: string + isVersionHead: + type: boolean + resourceGroupId: + type: string + spec: + $ref: '#/components/schemas/PromptTemplateSpec' + PromptTemplateListResponse: + type: object + required: + - count + - resources + properties: + count: + type: integer + resources: + type: array + items: + $ref: '#/components/schemas/PromptTemplateGetResponse' + PromptTemplateDeleteResponse: + type: object + required: + - message + properties: + message: + type: string + RuntimePromptTemplateFile: + type: object + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + properties: + name: + type: string + version: + type: string + scenario: + type: string + spec: + $ref: '#/components/schemas/PromptTemplateSpec' + PromptTemplateSubstitutionRequest: + type: object + properties: + inputParams: + type: object + PromptTemplateSubstitutionResponse: + type: object + properties: + parsedPrompt: + type: array + items: + $ref: '#/components/schemas/PromptTemplate' + resource: + $ref: '#/components/schemas/PromptTemplateGetResponse' + ErrorResponse: + type: object + required: + - request_id + - message + properties: + request_id: + type: string + message: + type: string + OrchestrationConfigResource: + type: object + properties: + id: + type: string + format: uuid + name: + type: string + version: + type: string + scenario: + type: string + creation_timestamp: + type: string + format: timestamp + managed_by: + type: string + is_version_head: + type: boolean + resource_group_id: + type: string + spec: + $ref: '#/components/schemas/OrchestrationConfig' + OrchestrationConfigListResponse: + type: object + required: + - count + - resources + properties: + count: + type: integer + resources: + type: array + items: + $ref: '#/components/schemas/OrchestrationConfigGetResponse' + OrchestrationConfigPostRequest: + type: object + required: + - name + - version + - scenario + - spec + properties: + name: + type: string + maxLength: 120 + pattern: ^[a-zA-Z0-9_-]+$ + version: + type: string + maxLength: 10 + pattern: ^[a-zA-Z0-9._-]+$ + scenario: + type: string + maxLength: 120 + pattern: ^[a-zA-Z0-9_-]+$ + spec: + $ref: '#/components/schemas/OrchestrationConfig' + OrchestrationConfigPostResponse: + type: object + required: + - message + - id + - scenario + - name + - version + properties: + message: + type: string + id: + type: string + format: uuid + scenario: + type: string + name: + type: string + version: + type: string + OrchestrationConfigGetResponse: + type: object + properties: + id: + type: string + format: uuid + name: + type: string + version: + type: string + scenario: + type: string + creation_timestamp: + type: string + format: timestamp + managed_by: + type: string + is_version_head: + type: boolean + resource_group_id: + type: string + spec: + $ref: '#/components/schemas/OrchestrationConfig' + OrchestrationConfigDeleteResponse: + type: object + required: + - message + properties: + message: + type: string + RuntimeOrchestrationConfigFile: + type: object + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + properties: + name: + type: string + version: + type: string + scenario: + type: string + spec: + $ref: '#/components/schemas/OrchestrationConfig' + ChatMessageContent: + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/TextContent' + minItems: 1 + SystemChatMessage: + type: object + additionalProperties: false + properties: + role: + type: string + enum: + - system + content: + $ref: '#/components/schemas/ChatMessageContent' + required: + - role + - content + ImageContentUrl: + type: object + required: + - url + additionalProperties: false + properties: + url: + type: string + detail: + type: string + default: auto + UserChatMessageContentItem: + type: object + additionalProperties: false + properties: + type: + type: string + enum: + - text + - image_url + text: + type: string + image_url: + $ref: '#/components/schemas/ImageContentUrl' + required: + - type + UserChatMessageContent: + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/UserChatMessageContentItem' + minItems: 1 + UserChatMessage: + type: object + additionalProperties: false + properties: + content: + $ref: '#/components/schemas/UserChatMessageContent' + role: + type: string + enum: + - user + required: + - content + - role + MessageToolCall: + type: object + properties: + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + type: object + description: The function that the model called. + properties: + name: + type: string + description: The name of the function to call. + arguments: + type: string + description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + required: + - name + - arguments + required: + - id + - type + - function + MessageToolCalls: + type: array + description: The tool calls generated by the model, such as function calls. + items: + $ref: '#/components/schemas/MessageToolCall' + AssistantChatMessage: + type: object + additionalProperties: false + properties: + role: + type: string + enum: + - assistant + content: + $ref: '#/components/schemas/ChatMessageContent' + refusal: + type: string + tool_calls: + $ref: '#/components/schemas/MessageToolCalls' + required: + - role + ToolChatMessage: + type: object + additionalProperties: false + properties: + role: + type: string + enum: + - tool + example: tool + tool_call_id: + type: string + content: + $ref: '#/components/schemas/ChatMessageContent' + required: + - role + - content + - tool_call_id + DeveloperChatMessage: + type: object + additionalProperties: false + properties: + role: + type: string + enum: + - developer + content: + $ref: '#/components/schemas/ChatMessageContent' + required: + - role + - content + ChatMessage: + oneOf: + - $ref: '#/components/schemas/SystemChatMessage' + - $ref: '#/components/schemas/UserChatMessage' + - $ref: '#/components/schemas/AssistantChatMessage' + - $ref: '#/components/schemas/ToolChatMessage' + - $ref: '#/components/schemas/DeveloperChatMessage' + TemplatingChatMessage: + type: array + minItems: 1 + items: + $ref: '#/components/schemas/ChatMessage' + Template: + type: object + required: + - template + additionalProperties: false + properties: + template: + allOf: + - $ref: '#/components/schemas/TemplatingChatMessage' + description: A chat message array to be formatted with values from placeholder_values. Both role and content can be templated. If messages_history is provided, the templated messages will be appended. + defaults: + description: Optional default values for the template. If a parameter has no default it is required. + type: object + additionalProperties: + type: string + response_format: + description: | + Response format that the model output should adhere to. This is the same as the OpenAI definition. + oneOf: + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/ResponseFormatJsonObject' + - $ref: '#/components/schemas/ResponseFormatJsonSchema' + tools: + type: array + description: | + A list of tools the model may call. Used to provide a list of functions the model may generate JSON inputs for. This is the same as the OpenAI definition. + items: + $ref: '#/components/schemas/ChatCompletionTool' + example: + template: + - role: user + content: How can the features of AI in SAP BTP specifically {{'{{?groundingOutput}}'}}, be applied to {{'{{?inputContext}}'}} + defaults: + inputContext: The default text that will be used in the template if inputContext is not set + TemplateRefByID: + type: object + required: + - id + additionalProperties: false + properties: + id: + type: string + description: ID of the template in prompt registry + example: template_id + scope: + type: string + description: | + Defines the scope that is searched for the referenced template. 'tenant' indicates the template is shared across all resource groups within the tenant, while 'resource_group' indicates the template is only accessible within the specific resource group. + enum: + - resource_group + - tenant + default: tenant + TemplateRefByScenarioNameVersion: + type: object + required: + - scenario + - name + - version + additionalProperties: false + properties: + scenario: + type: string + description: Scenario name + example: some-scenario + name: + type: string + description: Name of the template + example: some-template-name + version: + type: string + description: Version of the template + example: some version, can be `latest` + scope: + type: string + description: | + Defines the scope that is searched for the referenced template. 'tenant' indicates the template is shared across all resource groups within the tenant, while 'resource_group' indicates the template is only accessible within the specific resource group. + enum: + - resource_group + - tenant + default: tenant + TemplateRef: + type: object + required: + - template_ref + additionalProperties: false + properties: + template_ref: + description: Reference to a template in the prompt registry by ID or by scenario, name and version + oneOf: + - $ref: '#/components/schemas/TemplateRefByID' + - $ref: '#/components/schemas/TemplateRefByScenarioNameVersion' + LLMModelDetails: + type: object + description: | + The model and parameters to be used for the prompt templating. This is the model that will be used to generate the response. + required: + - name + additionalProperties: false + properties: + name: + type: string + description: Name of the model as in LLM Access configuration + example: gpt-4o-mini + version: + type: string + description: Version of the model to be used + default: latest + params: + type: object + description: Additional parameters for the model. Default values are used for mandatory parameters. + additionalProperties: true + example: + max_tokens: 300 + temperature: 0.1 + frequency_penalty: 0 + presence_penalty: 0 + 'n': 2 + stream_options: + include_usage: true + timeout: + description: Timeout for the LLM request in seconds. This parameter is currently ignored for Vertex AI models. + type: integer + default: 600 + minimum: 1 + maximum: 600 + max_retries: + description: Maximum number of retries for the LLM request. This parameter is currently ignored for Vertex AI models. + type: integer + default: 2 + minimum: 0 + maximum: 5 + PromptTemplatingModuleConfig: + type: object + required: + - prompt + - model + additionalProperties: false + properties: + prompt: + description: | + The prompt template to be used. Can be either a user defined template or a reference to a template in the prompt registry. + oneOf: + - $ref: '#/components/schemas/Template' + - $ref: '#/components/schemas/TemplateRef' + model: + $ref: '#/components/schemas/LLMModelDetails' + AzureThreshold: + type: integer + enum: + - 0 + - 2 + - 4 + - 6 + example: 0 + AzureContentSafetyInput: + description: Filter configuration for Azure Content Safety + type: object + additionalProperties: false + properties: + hate: + $ref: '#/components/schemas/AzureThreshold' + self_harm: + $ref: '#/components/schemas/AzureThreshold' + sexual: + $ref: '#/components/schemas/AzureThreshold' + violence: + $ref: '#/components/schemas/AzureThreshold' + prompt_shield: + type: boolean + description: Filter prompts for harmful content such as jailbreaks and prompt injections. + default: false + AzureContentSafetyInputFilterConfig: + type: object + required: + - type + additionalProperties: false + properties: + type: + description: Name of the filter provider type + type: string + enum: + - azure_content_safety + example: azure_content_safety + config: + $ref: '#/components/schemas/AzureContentSafetyInput' + LlamaGuard38b: + description: Filter configuration for Llama Guard 3 8B + type: object + additionalProperties: false + minProperties: 1 + properties: + violent_crimes: + type: boolean + non_violent_crimes: + type: boolean + sex_crimes: + type: boolean + child_exploitation: + type: boolean + defamation: + type: boolean + specialized_advice: + type: boolean + privacy: + type: boolean + intellectual_property: + type: boolean + indiscriminate_weapons: + type: boolean + hate: + type: boolean + self_harm: + type: boolean + sexual_content: + type: boolean + elections: + type: boolean + code_interpreter_abuse: + type: boolean + LlamaGuard38bFilterConfig: + type: object + required: + - type + - config + additionalProperties: false + properties: + type: + description: Name of the filter provider type + type: string + enum: + - llama_guard_3_8b + example: llama_guard_3_8b + config: + $ref: '#/components/schemas/LlamaGuard38b' + InputFilterConfig: + oneOf: + - $ref: '#/components/schemas/AzureContentSafetyInputFilterConfig' + - $ref: '#/components/schemas/LlamaGuard38bFilterConfig' + InputFilteringConfig: + type: object + required: + - filters + additionalProperties: false + properties: + filters: + description: Configuration for content filtering services that should be used for the given filtering step (input filtering). + type: array + minItems: 1 + items: + $ref: '#/components/schemas/InputFilterConfig' + AzureContentSafetyOutput: + description: Filter configuration for Azure Content Safety + type: object + additionalProperties: false + properties: + hate: + $ref: '#/components/schemas/AzureThreshold' + self_harm: + $ref: '#/components/schemas/AzureThreshold' + sexual: + $ref: '#/components/schemas/AzureThreshold' + violence: + $ref: '#/components/schemas/AzureThreshold' + protected_material_code: + type: boolean + description: Detect protected code content from known GitHub repositories. The scan includes software libraries, source code, algorithms, and other proprietary programming content. + default: false + AzureContentSafetyOutputFilterConfig: + type: object + required: + - type + additionalProperties: false + properties: + type: + description: Name of the filter provider type + type: string + enum: + - azure_content_safety + example: azure_content_safety + config: + $ref: '#/components/schemas/AzureContentSafetyOutput' + OutputFilterConfig: + oneOf: + - $ref: '#/components/schemas/AzureContentSafetyOutputFilterConfig' + - $ref: '#/components/schemas/LlamaGuard38bFilterConfig' + FilteringStreamOptions: + description: Stream options for output filtering. Will be ignored if stream is false. + type: object + additionalProperties: false + properties: + overlap: + type: integer + description: Number of characters that should be additionally sent to content filtering services from previous chunks as additional context. + default: 0 + minimum: 0 + maximum: 10000 + OutputFilteringConfig: + type: object + required: + - filters + additionalProperties: false + properties: + filters: + description: Configuration for content filtering services that should be used for the given filtering step (output filtering). + type: array + minItems: 1 + items: + $ref: '#/components/schemas/OutputFilterConfig' + stream_options: + $ref: '#/components/schemas/FilteringStreamOptions' + FilteringModuleConfig: + type: object + additionalProperties: false + properties: + input: + allOf: + - $ref: '#/components/schemas/InputFilteringConfig' + description: List of provider type and filters + output: + allOf: + - $ref: '#/components/schemas/OutputFilteringConfig' + description: List of provider type and filters + minProperties: 1 + DPIEntities: + description: Default entities supported by data privacy and integration service + type: string + enum: + - profile-person + - profile-org + - profile-university + - profile-location + - profile-email + - profile-phone + - profile-address + - profile-sapids-internal + - profile-sapids-public + - profile-url + - profile-username-password + - profile-nationalid + - profile-iban + - profile-ssn + - profile-credit-card-number + - profile-passport + - profile-driverlicense + - profile-nationality + - profile-religious-group + - profile-political-group + - profile-pronouns-gender + - profile-ethnicity + - profile-gender + - profile-sexual-orientation + - profile-trade-union + - profile-sensitive-data + DPIMethodConstant: + description: Replaces the entity with the specified value followed by an incrementing number + type: object + required: + - method + - value + additionalProperties: false + properties: + method: + type: string + enum: + - constant + value: + description: Value to be used for replacement + example: NAME_REDACTED + type: string + DPIMethodFabricatedData: + description: Replaces the entity with a randomly generated value appropriate to its type. + type: object + required: + - method + additionalProperties: false + properties: + method: + type: string + enum: + - fabricated_data + DPIStandardEntity: + type: object + required: + - type + additionalProperties: false + properties: + type: + $ref: '#/components/schemas/DPIEntities' + replacement_strategy: + description: Replacement strategy to be used for the entity + oneOf: + - $ref: '#/components/schemas/DPIMethodConstant' + - $ref: '#/components/schemas/DPIMethodFabricatedData' + DPICustomEntity: + type: object + required: + - regex + - replacement_strategy + additionalProperties: false + properties: + regex: + description: Regular expression to match the entity + type: string + replacement_strategy: + description: Replacement strategy to be used for the entity + oneOf: + - $ref: '#/components/schemas/DPIMethodConstant' + DPIEntityConfig: + oneOf: + - $ref: '#/components/schemas/DPIStandardEntity' + - $ref: '#/components/schemas/DPICustomEntity' + DPIConfig: + type: object + required: + - type + - method + - entities + additionalProperties: false + properties: + type: + description: Type of masking service provider + type: string + enum: + - sap_data_privacy_integration + method: + description: Type of masking method to be used + type: string + enum: + - anonymization + - pseudonymization + entities: + description: List of entities to be masked + type: array + minItems: 1 + items: + $ref: '#/components/schemas/DPIEntityConfig' + allowlist: + description: List of strings that should not be masked + type: array + example: + - SAP + - Joule + items: + type: string + mask_grounding_input: + type: object + additionalProperties: false + properties: + enabled: + type: boolean + default: false + description: controls whether the input to the grounding module will be masked with the configuration supplied in the masking module + MaskingProviderConfig: + oneOf: + - $ref: '#/components/schemas/DPIConfig' + MaskingModuleConfig: + oneOf: + - type: object + title: MaskingModuleConfigProviders + properties: + providers: + description: List of masking service providers + type: array + minItems: 1 + items: + $ref: '#/components/schemas/MaskingProviderConfig' + required: + - providers + additionalProperties: false + - type: object + title: MaskingModuleConfigMaskingProviders + properties: + masking_providers: + deprecated: true + description: 'List of masking service providers. **DEPRECATED**: will be removed Sept 15, 2026. Use `providers` property instead.' + type: array + minItems: 1 + items: + $ref: '#/components/schemas/MaskingProviderConfig' + required: + - masking_providers + additionalProperties: false + GroundingFilterId: + title: Id + description: Identifier of this SearchFilter - unique per request. + type: string + GroundingFilterSearchConfiguration: + additionalProperties: false + properties: + max_chunk_count: + type: integer + minimum: 0 + exclusiveMinimum: true + title: Maxchunkcount + description: Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. + max_document_count: + type: integer + minimum: 0 + exclusiveMinimum: true + title: Maxdocumentcount + description: '[Only supports ''vector'' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with ''maxChunkCount''. If maxDocumentCount is given, then only one chunk per document is returned.' + title: SearchConfiguration + minProperties: 0 + maxProperties: 1 + DataRepositoryType: + type: string + description: Only include DataRepositories with the given type. + enum: + - vector + - help.sap.com + title: DataRepositoryType + KeyValueListPair: + additionalProperties: false + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + type: object + required: + - key + - value + title: KeyValueListPair + SearchSelectOptionEnum: + type: string + enum: + - ignoreIfKeyAbsent + title: SearchSelectOptionEnum + SearchDocumentKeyValueListPair: + additionalProperties: false + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + select_mode: + type: array + items: + $ref: '#/components/schemas/SearchSelectOptionEnum' + title: Selectmode + description: Select mode for search filters + type: object + required: + - key + - value + title: SearchDocumentKeyValueListPair + DocumentGroundingFilter: + type: object + required: + - data_repository_type + additionalProperties: false + properties: + id: + $ref: '#/components/schemas/GroundingFilterId' + search_config: + $ref: '#/components/schemas/GroundingFilterSearchConfiguration' + data_repositories: + type: array + items: + type: string + title: DataRepositories + description: Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids. + default: + - '*' + data_repository_type: + $ref: '#/components/schemas/DataRepositoryType' + data_repository_metadata: + type: array + items: + $ref: '#/components/schemas/KeyValueListPair' + title: Datarepositorymetadata + description: Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*'] + document_metadata: + type: array + items: + $ref: '#/components/schemas/SearchDocumentKeyValueListPair' + title: Documentmetadata + description: Restrict documents considered during search to those annotated with the given metadata. + chunk_metadata: + type: array + items: + $ref: '#/components/schemas/KeyValueListPair' + title: Chunkmetadata + description: Restrict chunks considered during search to those with the given metadata. + minProperties: 1 + GroundingModuleConfig: + type: object + required: + - type + - config + additionalProperties: false + properties: + type: + type: string + anyOf: + - enum: + - document_grounding_service + - {} + example: document_grounding_service + config: + type: object + required: + - placeholders + additionalProperties: false + properties: + filters: + type: array + items: + oneOf: + - $ref: '#/components/schemas/DocumentGroundingFilter' + description: Document grounding service filters to be used + placeholders: + type: object + additionalProperties: false + required: + - input + - output + properties: + input: + type: array + minItems: 1 + items: + type: string + example: groundingInput + description: Contains the input parameters used for grounding input questions + output: + type: string + description: Placeholder name for grounding output + example: groundingOutput + description: Placeholders to be used for grounding input questions and output + metadata_params: + type: array + items: + type: string + description: Parameter name used for specifying metadata parameters + SAPDocumentTranslationApplyToSelector: + type: object + description: | + This selector allows you to define the scope of translation, such as specific placeholders or messages with specific roles. For example, `{"category": "placeholders", "items": ["user_input"], "source_language": "de-DE"}` targets the value of "user_input" in `placeholder_values` specified in the request payload; and considers the value to be in German. + required: + - category + - items + additionalProperties: false + properties: + category: + type: string + description: Category to apply translation to. + enum: + - placeholders + - template_roles + items: + type: array + description: List of placeholders or roles to apply translation to + items: + type: string + example: + - groundingInput + - inputContext + source_language: + type: string + description: Language of the text to be translated. + example: de-DE + SAPDocumentTranslationInput: + type: object + required: + - type + - config + additionalProperties: false + properties: + type: + description: Type of document translation provider + type: string + enum: + - sap_document_translation + example: sap_document_translation + translate_messages_history: + type: boolean + description: If true, the messages history will be translated as well. + default: true + config: + description: Configuration for `sap_document_translation` translation provider. + type: object + additionalProperties: false + required: + - target_language + properties: + source_language: + type: string + description: Language of the text to be translated. + example: de-DE + apply_to: + type: array + minItems: 1 + items: + $ref: '#/components/schemas/SAPDocumentTranslationApplyToSelector' + target_language: + type: string + description: Language to which the text should be translated. + example: en-US + SAPDocumentTranslationOutputTargetLanguage: + oneOf: + - type: string + description: Language to which the text should be translated. + example: en-US + - $ref: '#/components/schemas/SAPDocumentTranslationApplyToSelector' + SAPDocumentTranslationOutput: + type: object + required: + - type + - config + additionalProperties: false + properties: + type: + description: Configuration for `sap_document_translation` translation provider. + type: string + enum: + - sap_document_translation + example: sap_document_translation + config: + type: object + additionalProperties: false + required: + - target_language + properties: + source_language: + type: string + description: Language of the text to be translated. + example: de-DE + target_language: + $ref: '#/components/schemas/SAPDocumentTranslationOutputTargetLanguage' + TranslationModuleConfig: + type: object + description: Configuration for translation module + additionalProperties: false + properties: + input: + description: Configuration for input translation + oneOf: + - $ref: '#/components/schemas/SAPDocumentTranslationInput' + output: + description: Configuration for output translation + oneOf: + - $ref: '#/components/schemas/SAPDocumentTranslationOutput' + ModuleConfigs: + type: object + required: + - prompt_templating + additionalProperties: false + properties: + prompt_templating: + $ref: '#/components/schemas/PromptTemplatingModuleConfig' + filtering: + $ref: '#/components/schemas/FilteringModuleConfig' + masking: + $ref: '#/components/schemas/MaskingModuleConfig' + grounding: + $ref: '#/components/schemas/GroundingModuleConfig' + translation: + $ref: '#/components/schemas/TranslationModuleConfig' + GlobalStreamOptions: + description: Options for streaming. Will be ignored if enabled is false. + type: object + additionalProperties: false + properties: + enabled: + type: boolean + description: If true, the response will be streamed back to the client + default: false + chunk_size: + type: integer + description: Minimum number of characters per chunk that post-LLM modules operate on. + default: 100 + minimum: 1 + maximum: 10000 + delimiters: + type: array + minItems: 1 + description: List of delimiters to split the input text into chunks.Please note, this is a required parameter when `input_translation_module_config` or `output_translation_module_config` are configured. + items: + type: string + example: + - |+ + + - . + - '?' + - '!' + OrchestrationConfig: + type: object + required: + - modules + additionalProperties: false + properties: + modules: + $ref: '#/components/schemas/ModuleConfigs' + stream: + $ref: '#/components/schemas/GlobalStreamOptions' + responses: + BadRequest: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + CommonError: + description: Common Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + ForbiddenError: + description: Forbidden Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + NotFound: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + parameters: + ai-resource-group: + name: AI-Resource-Group + in: header + description: Specify a resource group id to use + required: false + schema: + type: string + ai-resource-group-scope: + name: AI-Resource-Group-Scope + in: header + description: Specify whether the resource group scope is to be used + required: false + schema: + type: string + enum: + - 'true' + - 'True' + - 'false' + - 'False' diff --git a/datamodel/openapi/pom.xml b/datamodel/openapi/pom.xml index abb59a174..91c49d902 100644 --- a/datamodel/openapi/pom.xml +++ b/datamodel/openapi/pom.xml @@ -34,6 +34,7 @@ openapi-generator openapi-generator-maven-plugin openapi-api-sample + openapi-api-apache-sample scm:git:git://github.com/SAP/cloud-sdk-java.git From c08ceb6404319d35a01c23395fb475756202f451 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Thu, 11 Dec 2025 13:33:03 +0100 Subject: [PATCH 05/26] remove ``@Generated` --- .../mustache-templates/libraries/apache-httpclient/api.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache index 14d806bb0..becb08a14 100644 --- a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache +++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache @@ -29,7 +29,7 @@ import java.util.StringJoiner; import {{javaxPackage}}.validation.Valid; {{/useBeanValidation}} -{{>generatedAnnotation}} +{{!>generatedAnnotation}} {{#operations}} public class {{classname}} extends BaseApi { From a697b6e8094123224add93282175c85e7bccab7f Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Thu, 11 Dec 2025 13:33:44 +0100 Subject: [PATCH 06/26] Add apache-client common generated classes and dependency --- datamodel/openapi/openapi-core/pom.xml | 4 + .../services/openapi/apache/ApiClient.java | 988 ++++++++++++++++++ .../services/openapi/apache/ApiException.java | 101 ++ .../sdk/services/openapi/apache/BaseApi.java | 120 +++ .../openapi/apache/Configuration.java | 62 ++ .../sdk/services/openapi/apache/Pair.java | 36 + .../openapi/apache/ServerConfiguration.java | 71 ++ .../openapi/apache/ServerVariable.java | 36 + .../openapi/apache/auth/ApiKeyAuth.java | 76 ++ .../openapi/apache/auth/Authentication.java | 30 + .../openapi/apache/auth/HttpBasicAuth.java | 52 + .../openapi/apache/auth/HttpBearerAuth.java | 69 ++ 12 files changed, 1645 insertions(+) create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiException.java create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/BaseApi.java create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Configuration.java create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Pair.java create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerConfiguration.java create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerVariable.java create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/ApiKeyAuth.java create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/Authentication.java create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBasicAuth.java create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBearerAuth.java diff --git a/datamodel/openapi/openapi-core/pom.xml b/datamodel/openapi/openapi-core/pom.xml index 44d87216d..9fadce84e 100644 --- a/datamodel/openapi/openapi-core/pom.xml +++ b/datamodel/openapi/openapi-core/pom.xml @@ -68,6 +68,10 @@ com.fasterxml.jackson.core jackson-core + + org.apache.httpcomponents.client5 + httpclient5 + org.projectlombok diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java new file mode 100644 index 000000000..3420b106e --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java @@ -0,0 +1,988 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.openapi.apache; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.time.OffsetDateTime; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JavaType; + +import org.apache.hc.client5.http.cookie.BasicCookieStore; +import org.apache.hc.client5.http.cookie.Cookie; +import org.apache.hc.client5.http.entity.UrlEncodedFormEntity; +import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.client5.http.impl.cookie.BasicClientCookie; +import org.apache.hc.client5.http.protocol.HttpClientContext; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.Header; +import org.apache.hc.core5.http.HttpEntity; +import org.apache.hc.core5.http.HttpResponse; +import org.apache.hc.core5.http.HttpStatus; +import org.apache.hc.core5.http.NameValuePair; +import org.apache.hc.core5.http.ParseException; +import org.apache.hc.core5.http.io.entity.ByteArrayEntity; +import org.apache.hc.core5.http.io.entity.EntityUtils; +import org.apache.hc.core5.http.io.entity.FileEntity; +import org.apache.hc.core5.http.io.entity.StringEntity; +import org.apache.hc.core5.http.io.support.ClassicRequestBuilder; +import org.apache.hc.core5.http.message.BasicNameValuePair; + +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.Map.Entry; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.Date; +import java.util.function.Supplier; +import java.util.TimeZone; +import java.util.Locale; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import java.net.URLEncoder; + +import java.io.File; +import java.io.InputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.nio.charset.UnsupportedCharsetException; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.nio.file.Paths; +import java.lang.reflect.Type; +import java.net.URI; + +import java.text.DateFormat; + +import com.sap.cloud.sdk.services.openapi.apache.auth.Authentication; + +public class ApiClient { + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String basePath = "http://localhost"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected int connectionTimeout = 0; + + protected CloseableHttpClient httpClient; + protected ObjectMapper objectMapper; + protected String tempFolderPath = null; + + protected Map authentications; + + protected ThreadLocal lastStatusCode = new ThreadLocal<>(); + protected ThreadLocal>> lastResponseHeaders = new ThreadLocal<>(); + + protected DateFormat dateFormat; + + // Methods that can have a request body + protected static List bodyMethods = Arrays.asList("POST", "PUT", "DELETE", "PATCH"); + + public ApiClient(CloseableHttpClient httpClient) { + objectMapper = new ObjectMapper(); + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + objectMapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); + objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + objectMapper.registerModule(new JavaTimeModule()); + objectMapper.registerModule(new RFC3339JavaTimeModule()); + objectMapper.setDateFormat(ApiClient.buildDefaultDateFormat()); + + dateFormat = ApiClient.buildDefaultDateFormat(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/0.0.1/java"); + + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap(); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + + this.httpClient = httpClient; + } + + public ApiClient() { + this(HttpClients.createDefault()); + } + + public static DateFormat buildDefaultDateFormat() { + return new RFC3339DateFormat(); + } + + /** + * Returns the current object mapper used for JSON serialization/deserialization. + *

+ * Note: If you make changes to the object mapper, remember to set it back via + * setObjectMapper in order to trigger HTTP client rebuilding. + *

+ * @return Object mapper + */ + public ObjectMapper getObjectMapper() { + return objectMapper; + } + + /** + * Sets the object mapper. + * + * @param objectMapper object mapper + * @return API client + */ + public ApiClient setObjectMapper(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + return this; + } + + public CloseableHttpClient getHttpClient() { + return httpClient; + } + + /** + * Sets the HTTP client. + * + * @param httpClient HTTP client + * @return API client + */ + public ApiClient setHttpClient(CloseableHttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + public String getBasePath() { + return basePath; + } + + /** + * Sets the base path. + * + * @param basePath base path + * @return API client + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + /** + * Sets the server. + * + * @param servers a list of server configuration + * @return API client + */ + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + /** + * Sets the server index. + * + * @param serverIndex server index + * @return API client + */ + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + /** + * Sets the server variables. + * + * @param serverVariables server variables + * @return API client + */ + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Gets the status code of the previous request + * + * @return Status code + */ + @Deprecated + public int getStatusCode() { + return lastStatusCode.get(); + } + + /** + * Gets the response headers of the previous request + * @return Response headers + */ + @Deprecated + public Map> getResponseHeaders() { + return lastResponseHeaders.get(); + } + + /** + * Get authentications (key: authentication name, value: authentication). + * @return Map of authentication + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default temporary folder. + * + * @return Temp folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + + + + + /** + * Set the User-Agent header's value (by adding to the default header map). + * @param userAgent User agent + * @return API client + */ + public final ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Set temp folder path + * @param tempFolderPath Temp folder path + * @return API client + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return API client + */ + public final ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return API client + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * @return True if debugging is on + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return API client + */ + public ApiClient setDebugging(boolean debugging) { + // TODO: implement debugging mode + this.debugging = debugging; + return this; + } + + /** + * Connect timeout (in milliseconds). + * @return Connection timeout + */ + public int getConnectTimeout() { + return connectionTimeout; + } + + /** + * Set the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * @param connectionTimeout Connection timeout in milliseconds + * @return API client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + this.connectionTimeout = connectionTimeout; + return this; + } + + /** + * Get the date format used to parse/format date parameters. + * @return Date format + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + * Set the date format used to parse/format date parameters. + * @param dateFormat Date format + * @return API client + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + // Also set the date format for model (de)serialization with Date properties. + this.objectMapper.setDateFormat((DateFormat) dateFormat.clone()); + return this; + } + + /** + * Parse the given string into Date object. + * @param str String + * @return Date + */ + public Date parseDate(String str) { + try { + return dateFormat.parse(str); + } catch (java.text.ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * Format the given Date object into string. + * @param date Date + * @return Date in string format + */ + public String formatDate(Date date) { + return dateFormat.format(date); + } + + /** + * Format the given parameter object into string. + * @param param Object + * @return Object in string format + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date) { + return formatDate((Date) param); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for(Object o : (Collection)param) { + if(b.length() > 0) { + b.append(','); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, escapeString(parameterToString(value)))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime MIME + * @return True if MIME type is boolean + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * or matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * @param str String + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Transforms response headers into map. + * + * @param headers HTTP headers + * @return a map of string array + */ + protected Map> transformResponseHeaders(Header[] headers) { + Map> headersMap = new HashMap<>(); + for (Header header : headers) { + List valuesList = headersMap.get(header.getName()); + if (valuesList != null) { + valuesList.add(header.getValue()); + } else { + valuesList = new ArrayList<>(); + valuesList.add(header.getValue()); + headersMap.put(header.getName(), valuesList); + } + } + return headersMap; + } + + /** + * Parse content type object from header value + */ + protected ContentType getContentType(String headerValue) throws ApiException { + try { + return ContentType.parse(headerValue); + } catch (UnsupportedCharsetException e) { + throw new ApiException("Could not parse content type " + headerValue); + } + } + + /** + * Get content type of a response or null if one was not provided + */ + protected String getResponseMimeType(HttpResponse response) throws ApiException { + Header contentTypeHeader = response.getFirstHeader("Content-Type"); + if (contentTypeHeader != null) { + return getContentType(contentTypeHeader.getValue()).getMimeType(); + } + return null; + } + + /** + * Serialize the given Java object into string according the given + * Content-Type (only JSON is supported for now). + * @param obj Object + * @param contentType Content type + * @param formParams Form parameters + * @return Object + * @throws ApiException API exception + */ + public HttpEntity serialize(Object obj, Map formParams, ContentType contentType) throws ApiException { + String mimeType = contentType.getMimeType(); + if (isJsonMime(mimeType)) { + try { + return new StringEntity(objectMapper.writeValueAsString(obj), contentType.withCharset(StandardCharsets.UTF_8)); + } catch (JsonProcessingException e) { + throw new ApiException(e); + } + } else if (mimeType.equals(ContentType.MULTIPART_FORM_DATA.getMimeType())) { + MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create(); + for (Entry paramEntry : formParams.entrySet()) { + Object value = paramEntry.getValue(); + if (value instanceof File) { + multiPartBuilder.addBinaryBody(paramEntry.getKey(), (File) value); + } else if (value instanceof byte[]) { + multiPartBuilder.addBinaryBody(paramEntry.getKey(), (byte[]) value); + } else { + Charset charset = contentType.getCharset(); + if (charset != null) { + ContentType customContentType = ContentType.create(ContentType.TEXT_PLAIN.getMimeType(), charset); + multiPartBuilder.addTextBody(paramEntry.getKey(), parameterToString(paramEntry.getValue()), + customContentType); + } else { + multiPartBuilder.addTextBody(paramEntry.getKey(), parameterToString(paramEntry.getValue())); + } + } + } + return multiPartBuilder.build(); + } else if (mimeType.equals(ContentType.APPLICATION_FORM_URLENCODED.getMimeType())) { + List formValues = new ArrayList<>(); + for (Entry paramEntry : formParams.entrySet()) { + formValues.add(new BasicNameValuePair(paramEntry.getKey(), parameterToString(paramEntry.getValue()))); + } + return new UrlEncodedFormEntity(formValues, contentType.getCharset()); + } else { + // Handle files with unknown content type + if (obj instanceof File) { + return new FileEntity((File) obj, contentType); + } else if (obj instanceof byte[]) { + return new ByteArrayEntity((byte[]) obj, contentType); + } + throw new ApiException("Serialization for content type '" + contentType + "' not supported"); + } + } + + /** + * Deserialize response body to Java object according to the Content-Type. + * + * @param Type + * @param response Response + * @param valueType Return type + * @return Deserialized object + * @throws ApiException API exception + * @throws IOException IO exception + */ + @SuppressWarnings("unchecked") + public T deserialize(CloseableHttpResponse response, TypeReference valueType) throws ApiException, IOException, ParseException { + if (valueType == null) { + return null; + } + HttpEntity entity = response.getEntity(); + Type valueRawType = valueType.getType(); + if (valueRawType.equals(byte[].class)) { + return (T) EntityUtils.toByteArray(entity); + } else if (valueRawType.equals(File.class)) { + return (T) downloadFileFromResponse(response); + } + String mimeType = getResponseMimeType(response); + if (mimeType == null || isJsonMime(mimeType)) { + // Assume json if no mime type + // convert input stream to string + String content = EntityUtils.toString(entity); + + if ("".equals(content)) { // returns null for empty body + return null; + } + + return objectMapper.readValue(content, valueType); + } else if (mimeType.toLowerCase().startsWith("text/")) { + // convert input stream to string + return (T) EntityUtils.toString(entity); + } else { + Map> responseHeaders = transformResponseHeaders(response.getHeaders()); + throw new ApiException( + "Deserialization for content type '" + mimeType + "' not supported for type '" + valueType + "'", + response.getCode(), + responseHeaders, + EntityUtils.toString(entity) + ); + } + } + + protected File downloadFileFromResponse(CloseableHttpResponse response) throws IOException { + Header contentDispositionHeader = response.getFirstHeader("Content-Disposition"); + String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue(); + File file = prepareDownloadFile(contentDisposition); + Files.copy(response.getEntity().getContent(), file.toPath(), StandardCopyOption.REPLACE_EXISTING); + return file; + } + + protected File prepareDownloadFile(String contentDisposition) throws IOException { + String filename = null; + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) + filename = matcher.group(1); + } + + String prefix; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf('.'); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * Returns the URL of the client as defined by the server (if exists) or the base path. + * + * @return The URL for the client. + */ + public String getBaseURL() { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + return baseURL; + } + + /** + * Build full URL by concatenating base URL, the given sub path and query parameters. + * + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param urlQueryDeepObject URL query string of the deep object parameters + * @return The full URL + */ + protected String buildUrl(String path, List queryParams, List collectionQueryParams, String urlQueryDeepObject) { + String baseURL = getBaseURL(); + + final StringBuilder url = new StringBuilder(); + url.append(baseURL).append(path); + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // query parameter value already escaped as part of parameterToPair + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + if (urlQueryDeepObject != null && urlQueryDeepObject.length() > 0) { + url.append(url.toString().contains("?") ? "&" : "?"); + url.append(urlQueryDeepObject); + } + + return url.toString(); + } + + protected boolean isSuccessfulStatus(int statusCode) { + return statusCode >= 200 && statusCode < 300; + } + + protected boolean isBodyAllowed(String method) { + return bodyMethods.contains(method); + } + + protected Cookie buildCookie(String key, String value, URI uri) { + BasicClientCookie cookie = new BasicClientCookie(key, value); + cookie.setDomain(uri.getHost()); + cookie.setPath("/"); + return cookie; + } + + protected T processResponse(CloseableHttpResponse response, TypeReference returnType) throws ApiException, IOException, ParseException { + int statusCode = response.getCode(); + lastStatusCode.set(statusCode); + if (statusCode == HttpStatus.SC_NO_CONTENT) { + return null; + } + + Map> responseHeaders = transformResponseHeaders(response.getHeaders()); + lastResponseHeaders.set(responseHeaders); + + if (isSuccessfulStatus(statusCode)) { + return this.deserialize(response, returnType); + } else { + String message = EntityUtils.toString(response.getEntity()); + throw new ApiException(message, statusCode, responseHeaders, message); + } + } + + /** + * Invoke API by sending HTTP request with the given options. + * + * @param Type + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "POST", "PUT", and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param urlQueryDeepObject A URL query string for deep object parameters + * @param body The request body object - if it is not binary, otherwise null + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param accept The request's Accept header + * @param contentType The request's Content-Type header + * @param authNames The authentications to apply + * @param returnType Return type + * @return The response body in type of string + * @throws ApiException API exception + */ + public T invokeAPI( + String path, + String method, + List queryParams, + List collectionQueryParams, + String urlQueryDeepObject, + Object body, + Map headerParams, + Map cookieParams, + Map formParams, + String accept, + String contentType, + String[] authNames, + TypeReference returnType) throws ApiException { + if (body != null && !formParams.isEmpty()) { + throw new ApiException("Cannot have body and form params"); + } + + updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); + final String url = buildUrl(path, queryParams, collectionQueryParams, urlQueryDeepObject); + + ClassicRequestBuilder builder = ClassicRequestBuilder.create(method); + builder.setUri(url); + + if (accept != null) { + builder.addHeader("Accept", accept); + } + for (Entry keyValue : headerParams.entrySet()) { + builder.addHeader(keyValue.getKey(), keyValue.getValue()); + } + for (Map.Entry keyValue : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(keyValue.getKey())) { + builder.addHeader(keyValue.getKey(), keyValue.getValue()); + } + } + + BasicCookieStore store = new BasicCookieStore(); + for (Entry keyValue : cookieParams.entrySet()) { + store.addCookie(buildCookie(keyValue.getKey(), keyValue.getValue(), builder.getUri())); + } + for (Entry keyValue : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(keyValue.getKey())) { + store.addCookie(buildCookie(keyValue.getKey(), keyValue.getValue(), builder.getUri())); + } + } + + HttpClientContext context = HttpClientContext.create(); + context.setCookieStore(store); + + ContentType contentTypeObj = getContentType(contentType); + if (body != null || !formParams.isEmpty()) { + if (isBodyAllowed(method)) { + // Add entity if we have content and a valid method + builder.setEntity(serialize(body, formParams, contentTypeObj)); + } else { + throw new ApiException("method " + method + " does not support a request body"); + } + } else { + // for empty body + builder.setEntity(new StringEntity("", contentTypeObj)); + } + + try (CloseableHttpResponse response = httpClient.execute(builder.build(), context)) { + return processResponse(response, returnType); + } catch (IOException | ParseException e) { + throw new ApiException(e); + } + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams Query parameters + * @param headerParams Header parameters + * @param cookieParams Cookie parameters + */ + protected void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, Map cookieParams) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + auth.applyToParams(queryParams, headerParams, cookieParams); + } + } +} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiException.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiException.java new file mode 100644 index 000000000..8680974b4 --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiException.java @@ -0,0 +1,101 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.sap.cloud.sdk.services.openapi.apache; + +import java.util.List; +import java.util.Map; + +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } + + @Override + public String toString() { + return "ApiException{" + + "code=" + code + + ", responseHeaders=" + responseHeaders + + ", responseBody='" + responseBody + '\'' + + '}'; + } +} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/BaseApi.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/BaseApi.java new file mode 100644 index 000000000..6dd81521a --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/BaseApi.java @@ -0,0 +1,120 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.openapi.apache; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.util.Collections; +import java.util.Map; + +public abstract class BaseApi { + + protected ApiClient apiClient; + + public BaseApi() { + this(Configuration.getDefaultApiClient()); + } + + public BaseApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @throws ApiException if fails to make API call. + */ + public void invokeAPI(String url, String method) throws ApiException { + invokeAPI(url, method, null, null, Collections.emptyMap()); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @param additionalHeaders Additional headers for the request. + * @throws ApiException if fails to make API call. + */ + public void invokeAPI(String url, String method, Map additionalHeaders) throws ApiException { + invokeAPI(url, method, null, null, additionalHeaders); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @param request The request object. + * @throws ApiException if fails to make API call. + */ + public void invokeAPI(String url, String method, Object request) throws ApiException { + invokeAPI(url, method, request, null, Collections.emptyMap()); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @param request The request object. + * @param additionalHeaders Additional headers for the request. + * @throws ApiException if fails to make API call. + */ + public void invokeAPI(String url, String method, Object request, Map additionalHeaders) throws ApiException { + invokeAPI(url, method, request, null, additionalHeaders); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @param returnType The return type. + * @return The API response in the specified type. + * @throws ApiException if fails to make API call. + */ + public T invokeAPI(String url, String method, TypeReference returnType) throws ApiException { + return invokeAPI(url, method, null, returnType, Collections.emptyMap()); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @param request The request object. + * @param returnType The return type. + * @return The API response in the specified type. + * @throws ApiException if fails to make API call. + */ + public T invokeAPI(String url, String method, Object request, TypeReference returnType) throws ApiException { + return invokeAPI(url, method, request, returnType, Collections.emptyMap()); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @param request The request object. + * @param returnType The return type. + * @param additionalHeaders Additional headers for the request. + * @return The API response in the specified type. + * @throws ApiException if fails to make API call. + */ + public abstract T invokeAPI(String url, String method, Object request, TypeReference returnType, Map additionalHeaders) throws ApiException; +} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Configuration.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Configuration.java new file mode 100644 index 000000000..6b02a53e0 --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Configuration.java @@ -0,0 +1,62 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.sap.cloud.sdk.services.openapi.apache; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +public class Configuration { + public static final String VERSION = "0.0.1"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * Get the default API client, which would be used when creating API instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * Set the default API client, which would be used when creating API instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Pair.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Pair.java new file mode 100644 index 000000000..3723451ee --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Pair.java @@ -0,0 +1,36 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.sap.cloud.sdk.services.openapi.apache; + +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerConfiguration.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerConfiguration.java new file mode 100644 index 000000000..e7ffd6eee --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerConfiguration.java @@ -0,0 +1,71 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.sap.cloud.sdk.services.openapi.apache; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerVariable.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerVariable.java new file mode 100644 index 000000000..5b5cf2e9f --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerVariable.java @@ -0,0 +1,36 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.sap.cloud.sdk.services.openapi.apache; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/ApiKeyAuth.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/ApiKeyAuth.java new file mode 100644 index 000000000..22adc7d24 --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/ApiKeyAuth.java @@ -0,0 +1,76 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.sap.cloud.sdk.services.openapi.apache.auth; + +import com.sap.cloud.sdk.services.openapi.apache.Pair; + +import java.util.Map; +import java.util.List; + +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } else if ("cookie".equals(location)) { + cookieParams.put(paramName, value); + } + } +} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/Authentication.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/Authentication.java new file mode 100644 index 000000000..20fd12cf2 --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/Authentication.java @@ -0,0 +1,30 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.sap.cloud.sdk.services.openapi.apache.auth; + +import com.sap.cloud.sdk.services.openapi.apache.Pair; + +import java.util.Map; +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams); +} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBasicAuth.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBasicAuth.java new file mode 100644 index 000000000..ac286f9e0 --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBasicAuth.java @@ -0,0 +1,52 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.sap.cloud.sdk.services.openapi.apache.auth; + +import com.sap.cloud.sdk.services.openapi.apache.Pair; + +import java.util.Base64; +import java.nio.charset.StandardCharsets; + +import java.util.Map; +import java.util.List; + +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { + if (username == null && password == null) { + return; + } + String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + headerParams.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); + } +} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBearerAuth.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBearerAuth.java new file mode 100644 index 000000000..1b2c04676 --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBearerAuth.java @@ -0,0 +1,69 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.sap.cloud.sdk.services.openapi.apache.auth; + +import com.sap.cloud.sdk.services.openapi.apache.Pair; + +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; + +public class HttpBearerAuth implements Authentication { + private final String scheme; + private Supplier tokenSupplier; + + public HttpBearerAuth(String scheme) { + this.scheme = upperCaseBearer(scheme); + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() { + return tokenSupplier.get(); + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ + public void setBearerToken(String bearerToken) { + this.tokenSupplier = () -> bearerToken; + } + + /** + * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header + */ + public void setBearerToken(Supplier tokenSupplier) { + this.tokenSupplier = tokenSupplier; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { + String bearerToken = tokenSupplier != null ? tokenSupplier.get() : null; + if (bearerToken == null) { + return; + } + headerParams.put("Authorization", (scheme != null ? scheme + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return "bearer".equalsIgnoreCase(scheme) ? "Bearer" : scheme; + } +} From 28e8135580a8edaf6a2865430b87e22df334295e Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Thu, 11 Dec 2025 13:37:57 +0100 Subject: [PATCH 07/26] dependency and formatting --- datamodel/openapi/openapi-core/pom.xml | 4 +- .../services/openapi/apache/ApiClient.java | 2021 +++++++++-------- .../services/openapi/apache/ApiException.java | 72 +- .../sdk/services/openapi/apache/BaseApi.java | 267 ++- .../openapi/apache/Configuration.java | 91 +- .../sdk/services/openapi/apache/Pair.java | 40 +- .../openapi/apache/ServerConfiguration.java | 37 +- .../openapi/apache/ServerVariable.java | 18 +- .../openapi/apache/auth/ApiKeyAuth.java | 108 +- .../openapi/apache/auth/Authentication.java | 31 +- .../openapi/apache/auth/HttpBasicAuth.java | 65 +- .../openapi/apache/auth/HttpBearerAuth.java | 99 +- 12 files changed, 1566 insertions(+), 1287 deletions(-) diff --git a/datamodel/openapi/openapi-core/pom.xml b/datamodel/openapi/openapi-core/pom.xml index 9fadce84e..f33fda715 100644 --- a/datamodel/openapi/openapi-core/pom.xml +++ b/datamodel/openapi/openapi-core/pom.xml @@ -69,8 +69,8 @@ jackson-core
- org.apache.httpcomponents.client5 - httpclient5 + org.apache.httpcomponents.core5 + httpcore5 diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java index 3420b106e..a9e673078 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java @@ -12,13 +12,31 @@ package com.sap.cloud.sdk.services.openapi.apache; -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import java.time.OffsetDateTime; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JavaType; +import java.io.File; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLEncoder; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.nio.charset.UnsupportedCharsetException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.text.DateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Map.Entry; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.hc.client5.http.cookie.BasicCookieStore; import org.apache.hc.client5.http.cookie.Cookie; @@ -43,946 +61,1065 @@ import org.apache.hc.core5.http.io.support.ClassicRequestBuilder; import org.apache.hc.core5.http.message.BasicNameValuePair; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; -import java.util.Map.Entry; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Arrays; -import java.util.ArrayList; -import java.util.Date; -import java.util.function.Supplier; -import java.util.TimeZone; -import java.util.Locale; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.sap.cloud.sdk.services.openapi.apache.auth.Authentication; -import java.net.URLEncoder; +public class ApiClient +{ + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String basePath = "http://localhost"; + protected List servers = + new ArrayList( + Arrays + .asList(new ServerConfiguration("", "No description provided", new HashMap()))); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected int connectionTimeout = 0; + + protected CloseableHttpClient httpClient; + protected ObjectMapper objectMapper; + protected String tempFolderPath = null; + + protected Map authentications; + + protected ThreadLocal lastStatusCode = new ThreadLocal<>(); + protected ThreadLocal>> lastResponseHeaders = new ThreadLocal<>(); + + protected DateFormat dateFormat; + + // Methods that can have a request body + protected static List bodyMethods = Arrays.asList("POST", "PUT", "DELETE", "PATCH"); + + public ApiClient( CloseableHttpClient httpClient ) + { + objectMapper = new ObjectMapper(); + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + objectMapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); + objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + objectMapper.registerModule(new JavaTimeModule()); + objectMapper.registerModule(new RFC3339JavaTimeModule()); + objectMapper.setDateFormat(ApiClient.buildDefaultDateFormat()); + + dateFormat = ApiClient.buildDefaultDateFormat(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/0.0.1/java"); + + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap(); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + + this.httpClient = httpClient; + } -import java.io.File; -import java.io.InputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.nio.charset.UnsupportedCharsetException; -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; -import java.nio.file.Paths; -import java.lang.reflect.Type; -import java.net.URI; + public ApiClient() + { + this(HttpClients.createDefault()); + } -import java.text.DateFormat; + public static DateFormat buildDefaultDateFormat() + { + return new RFC3339DateFormat(); + } -import com.sap.cloud.sdk.services.openapi.apache.auth.Authentication; + /** + * Returns the current object mapper used for JSON serialization/deserialization. + *

+ * Note: If you make changes to the object mapper, remember to set it back via setObjectMapper in order + * to trigger HTTP client rebuilding. + *

+ * + * @return Object mapper + */ + public ObjectMapper getObjectMapper() + { + return objectMapper; + } + + /** + * Sets the object mapper. + * + * @param objectMapper + * object mapper + * @return API client + */ + public ApiClient setObjectMapper( ObjectMapper objectMapper ) + { + this.objectMapper = objectMapper; + return this; + } + + public CloseableHttpClient getHttpClient() + { + return httpClient; + } + + /** + * Sets the HTTP client. + * + * @param httpClient + * HTTP client + * @return API client + */ + public ApiClient setHttpClient( CloseableHttpClient httpClient ) + { + this.httpClient = httpClient; + return this; + } + + public String getBasePath() + { + return basePath; + } + + /** + * Sets the base path. + * + * @param basePath + * base path + * @return API client + */ + public ApiClient setBasePath( String basePath ) + { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() + { + return servers; + } + + /** + * Sets the server. + * + * @param servers + * a list of server configuration + * @return API client + */ + public ApiClient setServers( List servers ) + { + this.servers = servers; + return this; + } + + public Integer getServerIndex() + { + return serverIndex; + } + + /** + * Sets the server index. + * + * @param serverIndex + * server index + * @return API client + */ + public ApiClient setServerIndex( Integer serverIndex ) + { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() + { + return serverVariables; + } + + /** + * Sets the server variables. + * + * @param serverVariables + * server variables + * @return API client + */ + public ApiClient setServerVariables( Map serverVariables ) + { + this.serverVariables = serverVariables; + return this; + } + + /** + * Gets the status code of the previous request + * + * @return Status code + */ + @Deprecated + public int getStatusCode() + { + return lastStatusCode.get(); + } + + /** + * Gets the response headers of the previous request + * + * @return Response headers + */ + @Deprecated + public Map> getResponseHeaders() + { + return lastResponseHeaders.get(); + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication + */ + public Map getAuthentications() + { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName + * The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication( String authName ) + { + return authentications.get(authName); + } + + /** + * The path of temporary folder used to store downloaded files from endpoints with file response. The default value + * is null, i.e. using the system's default temporary folder. + * + * @return Temp folder path + */ + public String getTempFolderPath() + { + return tempFolderPath; + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent + * User agent + * @return API client + */ + public final ApiClient setUserAgent( String userAgent ) + { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Set temp folder path + * + * @param tempFolderPath + * Temp folder path + * @return API client + */ + public ApiClient setTempFolderPath( String tempFolderPath ) + { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Add a default header. + * + * @param key + * The header's key + * @param value + * The header's value + * @return API client + */ + public final ApiClient addDefaultHeader( String key, String value ) + { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key + * The cookie's key + * @param value + * The cookie's value + * @return API client + */ + public ApiClient addDefaultCookie( String key, String value ) + { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is on + */ + public boolean isDebugging() + { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging + * To enable (true) or disable (false) debugging + * @return API client + */ + public ApiClient setDebugging( boolean debugging ) + { + // TODO: implement debugging mode + this.debugging = debugging; + return this; + } + + /** + * Connect timeout (in milliseconds). + * + * @return Connection timeout + */ + public int getConnectTimeout() + { + return connectionTimeout; + } + + /** + * Set the connect timeout (in milliseconds). A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param connectionTimeout + * Connection timeout in milliseconds + * @return API client + */ + public ApiClient setConnectTimeout( int connectionTimeout ) + { + this.connectionTimeout = connectionTimeout; + return this; + } + + /** + * Get the date format used to parse/format date parameters. + * + * @return Date format + */ + public DateFormat getDateFormat() + { + return dateFormat; + } + + /** + * Set the date format used to parse/format date parameters. + * + * @param dateFormat + * Date format + * @return API client + */ + public ApiClient setDateFormat( DateFormat dateFormat ) + { + this.dateFormat = dateFormat; + // Also set the date format for model (de)serialization with Date properties. + this.objectMapper.setDateFormat((DateFormat) dateFormat.clone()); + return this; + } + + /** + * Parse the given string into Date object. + * + * @param str + * String + * @return Date + */ + public Date parseDate( String str ) + { + try { + return dateFormat.parse(str); + } + catch( java.text.ParseException e ) { + throw new RuntimeException(e); + } + } -public class ApiClient { - protected Map defaultHeaderMap = new HashMap(); - protected Map defaultCookieMap = new HashMap(); - protected String basePath = "http://localhost"; - protected List servers = new ArrayList(Arrays.asList( - new ServerConfiguration( - "", - "No description provided", - new HashMap() - ) - )); - protected Integer serverIndex = 0; - protected Map serverVariables = null; - protected boolean debugging = false; - protected int connectionTimeout = 0; - - protected CloseableHttpClient httpClient; - protected ObjectMapper objectMapper; - protected String tempFolderPath = null; - - protected Map authentications; - - protected ThreadLocal lastStatusCode = new ThreadLocal<>(); - protected ThreadLocal>> lastResponseHeaders = new ThreadLocal<>(); - - protected DateFormat dateFormat; - - // Methods that can have a request body - protected static List bodyMethods = Arrays.asList("POST", "PUT", "DELETE", "PATCH"); - - public ApiClient(CloseableHttpClient httpClient) { - objectMapper = new ObjectMapper(); - objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - objectMapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); - objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); - objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); - objectMapper.registerModule(new JavaTimeModule()); - objectMapper.registerModule(new RFC3339JavaTimeModule()); - objectMapper.setDateFormat(ApiClient.buildDefaultDateFormat()); - - dateFormat = ApiClient.buildDefaultDateFormat(); - - // Set default User-Agent. - setUserAgent("OpenAPI-Generator/0.0.1/java"); - - // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap(); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - - this.httpClient = httpClient; - } - - public ApiClient() { - this(HttpClients.createDefault()); - } - - public static DateFormat buildDefaultDateFormat() { - return new RFC3339DateFormat(); - } - - /** - * Returns the current object mapper used for JSON serialization/deserialization. - *

- * Note: If you make changes to the object mapper, remember to set it back via - * setObjectMapper in order to trigger HTTP client rebuilding. - *

- * @return Object mapper - */ - public ObjectMapper getObjectMapper() { - return objectMapper; - } - - /** - * Sets the object mapper. - * - * @param objectMapper object mapper - * @return API client - */ - public ApiClient setObjectMapper(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - return this; - } - - public CloseableHttpClient getHttpClient() { - return httpClient; - } - - /** - * Sets the HTTP client. - * - * @param httpClient HTTP client - * @return API client - */ - public ApiClient setHttpClient(CloseableHttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - public String getBasePath() { - return basePath; - } - - /** - * Sets the base path. - * - * @param basePath base path - * @return API client - */ - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; - this.serverIndex = null; - return this; - } - - public List getServers() { - return servers; - } - - /** - * Sets the server. - * - * @param servers a list of server configuration - * @return API client - */ - public ApiClient setServers(List servers) { - this.servers = servers; - return this; - } - - public Integer getServerIndex() { - return serverIndex; - } - - /** - * Sets the server index. - * - * @param serverIndex server index - * @return API client - */ - public ApiClient setServerIndex(Integer serverIndex) { - this.serverIndex = serverIndex; - return this; - } - - public Map getServerVariables() { - return serverVariables; - } - - /** - * Sets the server variables. - * - * @param serverVariables server variables - * @return API client - */ - public ApiClient setServerVariables(Map serverVariables) { - this.serverVariables = serverVariables; - return this; - } - - /** - * Gets the status code of the previous request - * - * @return Status code - */ - @Deprecated - public int getStatusCode() { - return lastStatusCode.get(); - } - - /** - * Gets the response headers of the previous request - * @return Response headers - */ - @Deprecated - public Map> getResponseHeaders() { - return lastResponseHeaders.get(); - } - - /** - * Get authentications (key: authentication name, value: authentication). - * @return Map of authentication - */ - public Map getAuthentications() { - return authentications; - } - - /** - * Get authentication for the given name. - * - * @param authName The authentication name - * @return The authentication, null if not found - */ - public Authentication getAuthentication(String authName) { - return authentications.get(authName); - } - - /** - * The path of temporary folder used to store downloaded files from endpoints - * with file response. The default value is null, i.e. using - * the system's default temporary folder. - * - * @return Temp folder path - */ - public String getTempFolderPath() { - return tempFolderPath; - } - - - - - - /** - * Set the User-Agent header's value (by adding to the default header map). - * @param userAgent User agent - * @return API client - */ - public final ApiClient setUserAgent(String userAgent) { - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Set temp folder path - * @param tempFolderPath Temp folder path - * @return API client - */ - public ApiClient setTempFolderPath(String tempFolderPath) { - this.tempFolderPath = tempFolderPath; - return this; - } - - /** - * Add a default header. - * - * @param key The header's key - * @param value The header's value - * @return API client - */ - public final ApiClient addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * Add a default cookie. - * - * @param key The cookie's key - * @param value The cookie's value - * @return API client - */ - public ApiClient addDefaultCookie(String key, String value) { - defaultCookieMap.put(key, value); - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - * @return True if debugging is on - */ - public boolean isDebugging() { - return debugging; - } - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - * @return API client - */ - public ApiClient setDebugging(boolean debugging) { - // TODO: implement debugging mode - this.debugging = debugging; - return this; - } - - /** - * Connect timeout (in milliseconds). - * @return Connection timeout - */ - public int getConnectTimeout() { - return connectionTimeout; - } - - /** - * Set the connect timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * @param connectionTimeout Connection timeout in milliseconds - * @return API client - */ - public ApiClient setConnectTimeout(int connectionTimeout) { - this.connectionTimeout = connectionTimeout; - return this; - } - - /** - * Get the date format used to parse/format date parameters. - * @return Date format - */ - public DateFormat getDateFormat() { - return dateFormat; - } - - /** - * Set the date format used to parse/format date parameters. - * @param dateFormat Date format - * @return API client - */ - public ApiClient setDateFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - // Also set the date format for model (de)serialization with Date properties. - this.objectMapper.setDateFormat((DateFormat) dateFormat.clone()); - return this; - } - - /** - * Parse the given string into Date object. - * @param str String - * @return Date - */ - public Date parseDate(String str) { - try { - return dateFormat.parse(str); - } catch (java.text.ParseException e) { - throw new RuntimeException(e); - } - } - - /** - * Format the given Date object into string. - * @param date Date - * @return Date in string format - */ - public String formatDate(Date date) { - return dateFormat.format(date); - } - - /** - * Format the given parameter object into string. - * @param param Object - * @return Object in string format - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if (param instanceof Date) { - return formatDate((Date) param); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for(Object o : (Collection)param) { - if(b.length() > 0) { - b.append(','); - } - b.append(String.valueOf(o)); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /** - * Formats the specified query parameter to a list containing a single {@code Pair} object. - * - * Note that {@code value} must not be a collection. - * - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list containing a single {@code Pair} object. - */ - public List parameterToPair(String name, Object value) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null || value instanceof Collection) { - return params; - } - - params.add(new Pair(name, escapeString(parameterToString(value)))); - return params; - } - - /** - * Formats the specified collection query parameters to a list of {@code Pair} objects. - * - * Note that the values of each of the returned Pair objects are percent-encoded. - * - * @param collectionFormat The collection format of the parameter. - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list of {@code Pair} objects. - */ - public List parameterToPairs(String collectionFormat, String name, Collection value) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null || value.isEmpty()) { - return params; - } - - // create the params based on the collection format - if ("multi".equals(collectionFormat)) { - for (Object item : value) { - params.add(new Pair(name, escapeString(parameterToString(item)))); - } - return params; - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - // escape all delimiters except commas, which are URI reserved - // characters - if ("ssv".equals(collectionFormat)) { - delimiter = escapeString(" "); - } else if ("tsv".equals(collectionFormat)) { - delimiter = escapeString("\t"); - } else if ("pipes".equals(collectionFormat)) { - delimiter = escapeString("|"); - } - - StringBuilder sb = new StringBuilder() ; - for (Object item : value) { - sb.append(delimiter); - sb.append(escapeString(parameterToString(item))); - } - - params.add(new Pair(name, sb.substring(delimiter.length()))); - - return params; - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime MIME - * @return True if MIME type is boolean - */ - public boolean isJsonMime(String mime) { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); - } - - /** - * Select the Accept header's value from the given accepts array: - * if JSON exists in the given array, use it; - * otherwise use all of them (joining into a string) - * - * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). - */ - public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) { - return null; - } - for (String accept : accepts) { - if (isJsonMime(accept)) { - return accept; - } - } - return StringUtil.join(accepts, ","); - } - - /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. - * - * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * or matches "any", JSON will be used. - */ - public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { - return "application/json"; - } - for (String contentType : contentTypes) { - if (isJsonMime(contentType)) { - return contentType; - } - } - return contentTypes[0]; - } - - /** - * Escape the given string to be used as URL query value. - * @param str String - * @return Escaped string - */ - public String escapeString(String str) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - return str; - } - } - - /** - * Transforms response headers into map. - * - * @param headers HTTP headers - * @return a map of string array - */ - protected Map> transformResponseHeaders(Header[] headers) { - Map> headersMap = new HashMap<>(); - for (Header header : headers) { - List valuesList = headersMap.get(header.getName()); - if (valuesList != null) { - valuesList.add(header.getValue()); - } else { - valuesList = new ArrayList<>(); - valuesList.add(header.getValue()); - headersMap.put(header.getName(), valuesList); - } - } - return headersMap; - } - - /** - * Parse content type object from header value - */ - protected ContentType getContentType(String headerValue) throws ApiException { - try { - return ContentType.parse(headerValue); - } catch (UnsupportedCharsetException e) { - throw new ApiException("Could not parse content type " + headerValue); - } - } - - /** - * Get content type of a response or null if one was not provided - */ - protected String getResponseMimeType(HttpResponse response) throws ApiException { - Header contentTypeHeader = response.getFirstHeader("Content-Type"); - if (contentTypeHeader != null) { - return getContentType(contentTypeHeader.getValue()).getMimeType(); - } - return null; - } - - /** - * Serialize the given Java object into string according the given - * Content-Type (only JSON is supported for now). - * @param obj Object - * @param contentType Content type - * @param formParams Form parameters - * @return Object - * @throws ApiException API exception - */ - public HttpEntity serialize(Object obj, Map formParams, ContentType contentType) throws ApiException { - String mimeType = contentType.getMimeType(); - if (isJsonMime(mimeType)) { - try { - return new StringEntity(objectMapper.writeValueAsString(obj), contentType.withCharset(StandardCharsets.UTF_8)); - } catch (JsonProcessingException e) { - throw new ApiException(e); - } - } else if (mimeType.equals(ContentType.MULTIPART_FORM_DATA.getMimeType())) { - MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create(); - for (Entry paramEntry : formParams.entrySet()) { - Object value = paramEntry.getValue(); - if (value instanceof File) { - multiPartBuilder.addBinaryBody(paramEntry.getKey(), (File) value); - } else if (value instanceof byte[]) { - multiPartBuilder.addBinaryBody(paramEntry.getKey(), (byte[]) value); + /** + * Format the given Date object into string. + * + * @param date + * Date + * @return Date in string format + */ + public String formatDate( Date date ) + { + return dateFormat.format(date); + } + + /** + * Format the given parameter object into string. + * + * @param param + * Object + * @return Object in string format + */ + public String parameterToString( Object param ) + { + if( param == null ) { + return ""; + } else if( param instanceof Date ) { + return formatDate((Date) param); + } else if( param instanceof Collection ) { + StringBuilder b = new StringBuilder(); + for( Object o : (Collection) param ) { + if( b.length() > 0 ) { + b.append(','); + } + b.append(String.valueOf(o)); + } + return b.toString(); } else { - Charset charset = contentType.getCharset(); - if (charset != null) { - ContentType customContentType = ContentType.create(ContentType.TEXT_PLAIN.getMimeType(), charset); - multiPartBuilder.addTextBody(paramEntry.getKey(), parameterToString(paramEntry.getValue()), - customContentType); - } else { - multiPartBuilder.addTextBody(paramEntry.getKey(), parameterToString(paramEntry.getValue())); - } - } - } - return multiPartBuilder.build(); - } else if (mimeType.equals(ContentType.APPLICATION_FORM_URLENCODED.getMimeType())) { - List formValues = new ArrayList<>(); - for (Entry paramEntry : formParams.entrySet()) { - formValues.add(new BasicNameValuePair(paramEntry.getKey(), parameterToString(paramEntry.getValue()))); - } - return new UrlEncodedFormEntity(formValues, contentType.getCharset()); - } else { - // Handle files with unknown content type - if (obj instanceof File) { - return new FileEntity((File) obj, contentType); - } else if (obj instanceof byte[]) { - return new ByteArrayEntity((byte[]) obj, contentType); - } - throw new ApiException("Serialization for content type '" + contentType + "' not supported"); - } - } - - /** - * Deserialize response body to Java object according to the Content-Type. - * - * @param Type - * @param response Response - * @param valueType Return type - * @return Deserialized object - * @throws ApiException API exception - * @throws IOException IO exception - */ - @SuppressWarnings("unchecked") - public T deserialize(CloseableHttpResponse response, TypeReference valueType) throws ApiException, IOException, ParseException { - if (valueType == null) { - return null; - } - HttpEntity entity = response.getEntity(); - Type valueRawType = valueType.getType(); - if (valueRawType.equals(byte[].class)) { - return (T) EntityUtils.toByteArray(entity); - } else if (valueRawType.equals(File.class)) { - return (T) downloadFileFromResponse(response); - } - String mimeType = getResponseMimeType(response); - if (mimeType == null || isJsonMime(mimeType)) { - // Assume json if no mime type - // convert input stream to string - String content = EntityUtils.toString(entity); - - if ("".equals(content)) { // returns null for empty body + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name + * The name of the parameter. + * @param value + * The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair( String name, Object value ) + { + List params = new ArrayList(); + + // preconditions + if( name == null || name.isEmpty() || value == null || value instanceof Collection ) { + return params; + } + + params.add(new Pair(name, escapeString(parameterToString(value)))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat + * The collection format of the parameter. + * @param name + * The name of the parameter. + * @param value + * The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs( String collectionFormat, String name, Collection value ) + { + List params = new ArrayList(); + + // preconditions + if( name == null || name.isEmpty() || value == null || value.isEmpty() ) { + return params; + } + + // create the params based on the collection format + if( "multi".equals(collectionFormat) ) { + for( Object item : value ) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if( "ssv".equals(collectionFormat) ) { + delimiter = escapeString(" "); + } else if( "tsv".equals(collectionFormat) ) { + delimiter = escapeString("\t"); + } else if( "pipes".equals(collectionFormat) ) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for( Object item : value ) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; charset=UTF8 + * APPLICATION/JSON application/vnd.company+json + * + * @param mime + * MIME + * @return True if MIME type is boolean + */ + public boolean isJsonMime( String mime ) + { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts + * The accepts array to select from + * @return The Accept header to use. If the given array is empty, null will be returned (not to set the Accept + * header explicitly). + */ + public String selectHeaderAccept( String[] accepts ) + { + if( accepts.length == 0 ) { + return null; + } + for( String accept : accepts ) { + if( isJsonMime(accept) ) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: if JSON exists in the given array, use it; otherwise + * use the first one of the array. + * + * @param contentTypes + * The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, or matches "any", JSON will be used. + */ + public String selectHeaderContentType( String[] contentTypes ) + { + if( contentTypes.length == 0 || contentTypes[0].equals("*/*") ) { + return "application/json"; + } + for( String contentType : contentTypes ) { + if( isJsonMime(contentType) ) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str + * String + * @return Escaped string + */ + public String escapeString( String str ) + { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } + catch( UnsupportedEncodingException e ) { + return str; + } + } + + /** + * Transforms response headers into map. + * + * @param headers + * HTTP headers + * @return a map of string array + */ + protected Map> transformResponseHeaders( Header[] headers ) + { + Map> headersMap = new HashMap<>(); + for( Header header : headers ) { + List valuesList = headersMap.get(header.getName()); + if( valuesList != null ) { + valuesList.add(header.getValue()); + } else { + valuesList = new ArrayList<>(); + valuesList.add(header.getValue()); + headersMap.put(header.getName(), valuesList); + } + } + return headersMap; + } + + /** + * Parse content type object from header value + */ + protected ContentType getContentType( String headerValue ) + throws ApiException + { + try { + return ContentType.parse(headerValue); + } + catch( UnsupportedCharsetException e ) { + throw new ApiException("Could not parse content type " + headerValue); + } + } + + /** + * Get content type of a response or null if one was not provided + */ + protected String getResponseMimeType( HttpResponse response ) + throws ApiException + { + Header contentTypeHeader = response.getFirstHeader("Content-Type"); + if( contentTypeHeader != null ) { + return getContentType(contentTypeHeader.getValue()).getMimeType(); + } return null; - } - - return objectMapper.readValue(content, valueType); - } else if (mimeType.toLowerCase().startsWith("text/")) { - // convert input stream to string - return (T) EntityUtils.toString(entity); - } else { - Map> responseHeaders = transformResponseHeaders(response.getHeaders()); - throw new ApiException( - "Deserialization for content type '" + mimeType + "' not supported for type '" + valueType + "'", - response.getCode(), - responseHeaders, - EntityUtils.toString(entity) - ); - } - } - - protected File downloadFileFromResponse(CloseableHttpResponse response) throws IOException { - Header contentDispositionHeader = response.getFirstHeader("Content-Disposition"); - String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue(); - File file = prepareDownloadFile(contentDisposition); - Files.copy(response.getEntity().getContent(), file.toPath(), StandardCopyOption.REPLACE_EXISTING); - return file; - } - - protected File prepareDownloadFile(String contentDisposition) throws IOException { - String filename = null; - if (contentDisposition != null && !"".equals(contentDisposition)) { - // Get filename from the Content-Disposition header. - Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); - Matcher matcher = pattern.matcher(contentDisposition); - if (matcher.find()) - filename = matcher.group(1); - } - - String prefix; - String suffix = null; - if (filename == null) { - prefix = "download-"; - suffix = ""; - } else { - int pos = filename.lastIndexOf('.'); - if (pos == -1) { - prefix = filename + "-"; - } else { - prefix = filename.substring(0, pos) + "-"; - suffix = filename.substring(pos); - } - // Files.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) - prefix = "download-"; - } - - if (tempFolderPath == null) - return Files.createTempFile(prefix, suffix).toFile(); - else - return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); - } - - /** - * Returns the URL of the client as defined by the server (if exists) or the base path. - * - * @return The URL for the client. - */ - public String getBaseURL() { - String baseURL; - if (serverIndex != null) { - if (serverIndex < 0 || serverIndex >= servers.size()) { - throw new ArrayIndexOutOfBoundsException(String.format( - Locale.ROOT, - "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() - )); - } - baseURL = servers.get(serverIndex).URL(serverVariables); - } else { - baseURL = basePath; - } - return baseURL; - } - - /** - * Build full URL by concatenating base URL, the given sub path and query parameters. - * - * @param path The sub path - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @param urlQueryDeepObject URL query string of the deep object parameters - * @return The full URL - */ - protected String buildUrl(String path, List queryParams, List collectionQueryParams, String urlQueryDeepObject) { - String baseURL = getBaseURL(); - - final StringBuilder url = new StringBuilder(); - url.append(baseURL).append(path); - - if (queryParams != null && !queryParams.isEmpty()) { - // support (constant) query string in `path`, e.g. "/posts?draft=1" - String prefix = path.contains("?") ? "&" : "?"; - for (Pair param : queryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - // query parameter value already escaped as part of parameterToPair - url.append(escapeString(param.getName())).append("=").append(value); - } - } - } - - if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { - String prefix = url.toString().contains("?") ? "&" : "?"; - for (Pair param : collectionQueryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - // collection query parameter value already escaped as part of parameterToPairs - url.append(escapeString(param.getName())).append("=").append(value); - } - } - } - - if (urlQueryDeepObject != null && urlQueryDeepObject.length() > 0) { - url.append(url.toString().contains("?") ? "&" : "?"); - url.append(urlQueryDeepObject); - } - - return url.toString(); - } - - protected boolean isSuccessfulStatus(int statusCode) { - return statusCode >= 200 && statusCode < 300; - } - - protected boolean isBodyAllowed(String method) { - return bodyMethods.contains(method); - } - - protected Cookie buildCookie(String key, String value, URI uri) { - BasicClientCookie cookie = new BasicClientCookie(key, value); - cookie.setDomain(uri.getHost()); - cookie.setPath("/"); - return cookie; - } - - protected T processResponse(CloseableHttpResponse response, TypeReference returnType) throws ApiException, IOException, ParseException { - int statusCode = response.getCode(); - lastStatusCode.set(statusCode); - if (statusCode == HttpStatus.SC_NO_CONTENT) { - return null; - } - - Map> responseHeaders = transformResponseHeaders(response.getHeaders()); - lastResponseHeaders.set(responseHeaders); - - if (isSuccessfulStatus(statusCode)) { - return this.deserialize(response, returnType); - } else { - String message = EntityUtils.toString(response.getEntity()); - throw new ApiException(message, statusCode, responseHeaders, message); - } - } - - /** - * Invoke API by sending HTTP request with the given options. - * - * @param Type - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "POST", "PUT", and "DELETE" - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @param urlQueryDeepObject A URL query string for deep object parameters - * @param body The request body object - if it is not binary, otherwise null - * @param headerParams The header parameters - * @param cookieParams The cookie parameters - * @param formParams The form parameters - * @param accept The request's Accept header - * @param contentType The request's Content-Type header - * @param authNames The authentications to apply - * @param returnType Return type - * @return The response body in type of string - * @throws ApiException API exception - */ - public T invokeAPI( - String path, - String method, - List queryParams, - List collectionQueryParams, - String urlQueryDeepObject, - Object body, - Map headerParams, - Map cookieParams, - Map formParams, - String accept, - String contentType, - String[] authNames, - TypeReference returnType) throws ApiException { - if (body != null && !formParams.isEmpty()) { - throw new ApiException("Cannot have body and form params"); - } - - updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); - final String url = buildUrl(path, queryParams, collectionQueryParams, urlQueryDeepObject); - - ClassicRequestBuilder builder = ClassicRequestBuilder.create(method); - builder.setUri(url); - - if (accept != null) { - builder.addHeader("Accept", accept); - } - for (Entry keyValue : headerParams.entrySet()) { - builder.addHeader(keyValue.getKey(), keyValue.getValue()); - } - for (Map.Entry keyValue : defaultHeaderMap.entrySet()) { - if (!headerParams.containsKey(keyValue.getKey())) { - builder.addHeader(keyValue.getKey(), keyValue.getValue()); - } - } - - BasicCookieStore store = new BasicCookieStore(); - for (Entry keyValue : cookieParams.entrySet()) { - store.addCookie(buildCookie(keyValue.getKey(), keyValue.getValue(), builder.getUri())); - } - for (Entry keyValue : defaultCookieMap.entrySet()) { - if (!cookieParams.containsKey(keyValue.getKey())) { - store.addCookie(buildCookie(keyValue.getKey(), keyValue.getValue(), builder.getUri())); - } - } - - HttpClientContext context = HttpClientContext.create(); - context.setCookieStore(store); - - ContentType contentTypeObj = getContentType(contentType); - if (body != null || !formParams.isEmpty()) { - if (isBodyAllowed(method)) { - // Add entity if we have content and a valid method - builder.setEntity(serialize(body, formParams, contentTypeObj)); - } else { - throw new ApiException("method " + method + " does not support a request body"); - } - } else { - // for empty body - builder.setEntity(new StringEntity("", contentTypeObj)); - } - - try (CloseableHttpResponse response = httpClient.execute(builder.build(), context)) { - return processResponse(response, returnType); - } catch (IOException | ParseException e) { - throw new ApiException(e); - } - } - - /** - * Update query and header parameters based on authentication settings. - * - * @param authNames The authentications to apply - * @param queryParams Query parameters - * @param headerParams Header parameters - * @param cookieParams Cookie parameters - */ - protected void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, Map cookieParams) { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); - auth.applyToParams(queryParams, headerParams, cookieParams); - } - } + } + + /** + * Serialize the given Java object into string according the given Content-Type (only JSON is supported for now). + * + * @param obj + * Object + * @param contentType + * Content type + * @param formParams + * Form parameters + * @return Object + * @throws ApiException + * API exception + */ + public HttpEntity serialize( Object obj, Map formParams, ContentType contentType ) + throws ApiException + { + String mimeType = contentType.getMimeType(); + if( isJsonMime(mimeType) ) { + try { + return new StringEntity( + objectMapper.writeValueAsString(obj), + contentType.withCharset(StandardCharsets.UTF_8)); + } + catch( JsonProcessingException e ) { + throw new ApiException(e); + } + } else if( mimeType.equals(ContentType.MULTIPART_FORM_DATA.getMimeType()) ) { + MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create(); + for( Entry paramEntry : formParams.entrySet() ) { + Object value = paramEntry.getValue(); + if( value instanceof File ) { + multiPartBuilder.addBinaryBody(paramEntry.getKey(), (File) value); + } else if( value instanceof byte[] ) { + multiPartBuilder.addBinaryBody(paramEntry.getKey(), (byte[]) value); + } else { + Charset charset = contentType.getCharset(); + if( charset != null ) { + ContentType customContentType = + ContentType.create(ContentType.TEXT_PLAIN.getMimeType(), charset); + multiPartBuilder + .addTextBody( + paramEntry.getKey(), + parameterToString(paramEntry.getValue()), + customContentType); + } else { + multiPartBuilder.addTextBody(paramEntry.getKey(), parameterToString(paramEntry.getValue())); + } + } + } + return multiPartBuilder.build(); + } else if( mimeType.equals(ContentType.APPLICATION_FORM_URLENCODED.getMimeType()) ) { + List formValues = new ArrayList<>(); + for( Entry paramEntry : formParams.entrySet() ) { + formValues.add(new BasicNameValuePair(paramEntry.getKey(), parameterToString(paramEntry.getValue()))); + } + return new UrlEncodedFormEntity(formValues, contentType.getCharset()); + } else { + // Handle files with unknown content type + if( obj instanceof File ) { + return new FileEntity((File) obj, contentType); + } else if( obj instanceof byte[] ) { + return new ByteArrayEntity((byte[]) obj, contentType); + } + throw new ApiException("Serialization for content type '" + contentType + "' not supported"); + } + } + + /** + * Deserialize response body to Java object according to the Content-Type. + * + * @param + * Type + * @param response + * Response + * @param valueType + * Return type + * @return Deserialized object + * @throws ApiException + * API exception + * @throws IOException + * IO exception + */ + @SuppressWarnings( "unchecked" ) + public T deserialize( CloseableHttpResponse response, TypeReference valueType ) + throws ApiException, + IOException, + ParseException + { + if( valueType == null ) { + return null; + } + HttpEntity entity = response.getEntity(); + Type valueRawType = valueType.getType(); + if( valueRawType.equals(byte[].class) ) { + return (T) EntityUtils.toByteArray(entity); + } else if( valueRawType.equals(File.class) ) { + return (T) downloadFileFromResponse(response); + } + String mimeType = getResponseMimeType(response); + if( mimeType == null || isJsonMime(mimeType) ) { + // Assume json if no mime type + // convert input stream to string + String content = EntityUtils.toString(entity); + + if( "".equals(content) ) { // returns null for empty body + return null; + } + + return objectMapper.readValue(content, valueType); + } else if( mimeType.toLowerCase().startsWith("text/") ) { + // convert input stream to string + return (T) EntityUtils.toString(entity); + } else { + Map> responseHeaders = transformResponseHeaders(response.getHeaders()); + throw new ApiException( + "Deserialization for content type '" + mimeType + "' not supported for type '" + valueType + "'", + response.getCode(), + responseHeaders, + EntityUtils.toString(entity)); + } + } + + protected File downloadFileFromResponse( CloseableHttpResponse response ) + throws IOException + { + Header contentDispositionHeader = response.getFirstHeader("Content-Disposition"); + String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue(); + File file = prepareDownloadFile(contentDisposition); + Files.copy(response.getEntity().getContent(), file.toPath(), StandardCopyOption.REPLACE_EXISTING); + return file; + } + + protected File prepareDownloadFile( String contentDisposition ) + throws IOException + { + String filename = null; + if( contentDisposition != null && !"".equals(contentDisposition) ) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if( matcher.find() ) + filename = matcher.group(1); + } + + String prefix; + String suffix = null; + if( filename == null ) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf('.'); + if( pos == -1 ) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // Files.createTempFile requires the prefix to be at least three characters long + if( prefix.length() < 3 ) + prefix = "download-"; + } + + if( tempFolderPath == null ) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * Returns the URL of the client as defined by the server (if exists) or the base path. + * + * @return The URL for the client. + */ + public String getBaseURL() + { + String baseURL; + if( serverIndex != null ) { + if( serverIndex < 0 || serverIndex >= servers.size() ) { + throw new ArrayIndexOutOfBoundsException( + String + .format( + Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", + serverIndex, + servers.size())); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + return baseURL; + } + + /** + * Build full URL by concatenating base URL, the given sub path and query parameters. + * + * @param path + * The sub path + * @param queryParams + * The query parameters + * @param collectionQueryParams + * The collection query parameters + * @param urlQueryDeepObject + * URL query string of the deep object parameters + * @return The full URL + */ + protected + String + buildUrl( String path, List queryParams, List collectionQueryParams, String urlQueryDeepObject ) + { + String baseURL = getBaseURL(); + + final StringBuilder url = new StringBuilder(); + url.append(baseURL).append(path); + + if( queryParams != null && !queryParams.isEmpty() ) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for( Pair param : queryParams ) { + if( param.getValue() != null ) { + if( prefix != null ) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // query parameter value already escaped as part of parameterToPair + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + if( collectionQueryParams != null && !collectionQueryParams.isEmpty() ) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for( Pair param : collectionQueryParams ) { + if( param.getValue() != null ) { + if( prefix != null ) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + if( urlQueryDeepObject != null && urlQueryDeepObject.length() > 0 ) { + url.append(url.toString().contains("?") ? "&" : "?"); + url.append(urlQueryDeepObject); + } + + return url.toString(); + } + + protected boolean isSuccessfulStatus( int statusCode ) + { + return statusCode >= 200 && statusCode < 300; + } + + protected boolean isBodyAllowed( String method ) + { + return bodyMethods.contains(method); + } + + protected Cookie buildCookie( String key, String value, URI uri ) + { + BasicClientCookie cookie = new BasicClientCookie(key, value); + cookie.setDomain(uri.getHost()); + cookie.setPath("/"); + return cookie; + } + + protected T processResponse( CloseableHttpResponse response, TypeReference returnType ) + throws ApiException, + IOException, + ParseException + { + int statusCode = response.getCode(); + lastStatusCode.set(statusCode); + if( statusCode == HttpStatus.SC_NO_CONTENT ) { + return null; + } + + Map> responseHeaders = transformResponseHeaders(response.getHeaders()); + lastResponseHeaders.set(responseHeaders); + + if( isSuccessfulStatus(statusCode) ) { + return this.deserialize(response, returnType); + } else { + String message = EntityUtils.toString(response.getEntity()); + throw new ApiException(message, statusCode, responseHeaders, message); + } + } + + /** + * Invoke API by sending HTTP request with the given options. + * + * @param + * Type + * @param path + * The sub-path of the HTTP URL + * @param method + * The request method, one of "GET", "POST", "PUT", and "DELETE" + * @param queryParams + * The query parameters + * @param collectionQueryParams + * The collection query parameters + * @param urlQueryDeepObject + * A URL query string for deep object parameters + * @param body + * The request body object - if it is not binary, otherwise null + * @param headerParams + * The header parameters + * @param cookieParams + * The cookie parameters + * @param formParams + * The form parameters + * @param accept + * The request's Accept header + * @param contentType + * The request's Content-Type header + * @param authNames + * The authentications to apply + * @param returnType + * Return type + * @return The response body in type of string + * @throws ApiException + * API exception + */ + public T invokeAPI( + String path, + String method, + List queryParams, + List collectionQueryParams, + String urlQueryDeepObject, + Object body, + Map headerParams, + Map cookieParams, + Map formParams, + String accept, + String contentType, + String[] authNames, + TypeReference returnType ) + throws ApiException + { + if( body != null && !formParams.isEmpty() ) { + throw new ApiException("Cannot have body and form params"); + } + + updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); + final String url = buildUrl(path, queryParams, collectionQueryParams, urlQueryDeepObject); + + ClassicRequestBuilder builder = ClassicRequestBuilder.create(method); + builder.setUri(url); + + if( accept != null ) { + builder.addHeader("Accept", accept); + } + for( Entry keyValue : headerParams.entrySet() ) { + builder.addHeader(keyValue.getKey(), keyValue.getValue()); + } + for( Map.Entry keyValue : defaultHeaderMap.entrySet() ) { + if( !headerParams.containsKey(keyValue.getKey()) ) { + builder.addHeader(keyValue.getKey(), keyValue.getValue()); + } + } + + BasicCookieStore store = new BasicCookieStore(); + for( Entry keyValue : cookieParams.entrySet() ) { + store.addCookie(buildCookie(keyValue.getKey(), keyValue.getValue(), builder.getUri())); + } + for( Entry keyValue : defaultCookieMap.entrySet() ) { + if( !cookieParams.containsKey(keyValue.getKey()) ) { + store.addCookie(buildCookie(keyValue.getKey(), keyValue.getValue(), builder.getUri())); + } + } + + HttpClientContext context = HttpClientContext.create(); + context.setCookieStore(store); + + ContentType contentTypeObj = getContentType(contentType); + if( body != null || !formParams.isEmpty() ) { + if( isBodyAllowed(method) ) { + // Add entity if we have content and a valid method + builder.setEntity(serialize(body, formParams, contentTypeObj)); + } else { + throw new ApiException("method " + method + " does not support a request body"); + } + } else { + // for empty body + builder.setEntity(new StringEntity("", contentTypeObj)); + } + + try( CloseableHttpResponse response = httpClient.execute(builder.build(), context) ) { + return processResponse(response, returnType); + } + catch( IOException | ParseException e ) { + throw new ApiException(e); + } + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames + * The authentications to apply + * @param queryParams + * Query parameters + * @param headerParams + * Header parameters + * @param cookieParams + * Cookie parameters + */ + protected void updateParamsForAuth( + String[] authNames, + List queryParams, + Map headerParams, + Map cookieParams ) + { + for( String authName : authNames ) { + Authentication auth = authentications.get(authName); + if( auth == null ) + throw new RuntimeException("Authentication undefined: " + authName); + auth.applyToParams(queryParams, headerParams, cookieParams); + } + } } diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiException.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiException.java index 8680974b4..3257e1591 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiException.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiException.java @@ -3,61 +3,81 @@ * Prompt Storage service for Design time & Runtime prompt templates. * * The version of the OpenAPI document: 0.0.1 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package com.sap.cloud.sdk.services.openapi.apache; import java.util.List; import java.util.Map; -public class ApiException extends Exception { +public class ApiException extends Exception +{ private static final long serialVersionUID = 1L; private int code = 0; private Map> responseHeaders = null; private String responseBody = null; - public ApiException() {} + public ApiException() + { + } - public ApiException(Throwable throwable) { + public ApiException( Throwable throwable ) + { super(throwable); } - public ApiException(String message) { + public ApiException( String message ) + { super(message); } - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + public ApiException( + String message, + Throwable throwable, + int code, + Map> responseHeaders, + String responseBody ) + { super(message, throwable); this.code = code; this.responseHeaders = responseHeaders; this.responseBody = responseBody; } - public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + public ApiException( String message, int code, Map> responseHeaders, String responseBody ) + { this(message, (Throwable) null, code, responseHeaders, responseBody); } - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + public ApiException( String message, Throwable throwable, int code, Map> responseHeaders ) + { this(message, throwable, code, responseHeaders, null); } - public ApiException(int code, Map> responseHeaders, String responseBody) { - this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + public ApiException( int code, Map> responseHeaders, String responseBody ) + { + this( + "Response Code: " + code + " Response Body: " + responseBody, + (Throwable) null, + code, + responseHeaders, + responseBody); } - public ApiException(int code, String message) { + public ApiException( int code, String message ) + { super(message); this.code = code; } - public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + public ApiException( int code, String message, Map> responseHeaders, String responseBody ) + { this(code, message); this.responseHeaders = responseHeaders; this.responseBody = responseBody; @@ -68,7 +88,8 @@ public ApiException(int code, String message, Map> response * * @return HTTP status code */ - public int getCode() { + public int getCode() + { return code; } @@ -77,7 +98,8 @@ public int getCode() { * * @return A map of list of string */ - public Map> getResponseHeaders() { + public Map> getResponseHeaders() + { return responseHeaders; } @@ -86,16 +108,22 @@ public Map> getResponseHeaders() { * * @return Response body in the form of string */ - public String getResponseBody() { + public String getResponseBody() + { return responseBody; } @Override - public String toString() { - return "ApiException{" + - "code=" + code + - ", responseHeaders=" + responseHeaders + - ", responseBody='" + responseBody + '\'' + - '}'; + public String toString() + { + return "ApiException{" + + "code=" + + code + + ", responseHeaders=" + + responseHeaders + + ", responseBody='" + + responseBody + + '\'' + + '}'; } } diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/BaseApi.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/BaseApi.java index 6dd81521a..7203f9e7f 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/BaseApi.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/BaseApi.java @@ -3,7 +3,7 @@ * Prompt Storage service for Design time & Runtime prompt templates. * * The version of the OpenAPI document: 0.0.1 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -12,109 +12,170 @@ package com.sap.cloud.sdk.services.openapi.apache; -import com.fasterxml.jackson.core.type.TypeReference; - import java.util.Collections; import java.util.Map; -public abstract class BaseApi { - - protected ApiClient apiClient; - - public BaseApi() { - this(Configuration.getDefaultApiClient()); - } - - public BaseApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. - * @param url The URL for the request, either full URL or only the path. - * @param method The HTTP method for the request. - * @throws ApiException if fails to make API call. - */ - public void invokeAPI(String url, String method) throws ApiException { - invokeAPI(url, method, null, null, Collections.emptyMap()); - } - - /** - * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. - * @param url The URL for the request, either full URL or only the path. - * @param method The HTTP method for the request. - * @param additionalHeaders Additional headers for the request. - * @throws ApiException if fails to make API call. - */ - public void invokeAPI(String url, String method, Map additionalHeaders) throws ApiException { - invokeAPI(url, method, null, null, additionalHeaders); - } - - /** - * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. - * @param url The URL for the request, either full URL or only the path. - * @param method The HTTP method for the request. - * @param request The request object. - * @throws ApiException if fails to make API call. - */ - public void invokeAPI(String url, String method, Object request) throws ApiException { - invokeAPI(url, method, request, null, Collections.emptyMap()); - } - - /** - * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. - * @param url The URL for the request, either full URL or only the path. - * @param method The HTTP method for the request. - * @param request The request object. - * @param additionalHeaders Additional headers for the request. - * @throws ApiException if fails to make API call. - */ - public void invokeAPI(String url, String method, Object request, Map additionalHeaders) throws ApiException { - invokeAPI(url, method, request, null, additionalHeaders); - } - - /** - * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. - * @param url The URL for the request, either full URL or only the path. - * @param method The HTTP method for the request. - * @param returnType The return type. - * @return The API response in the specified type. - * @throws ApiException if fails to make API call. - */ - public T invokeAPI(String url, String method, TypeReference returnType) throws ApiException { - return invokeAPI(url, method, null, returnType, Collections.emptyMap()); - } - - /** - * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. - * @param url The URL for the request, either full URL or only the path. - * @param method The HTTP method for the request. - * @param request The request object. - * @param returnType The return type. - * @return The API response in the specified type. - * @throws ApiException if fails to make API call. - */ - public T invokeAPI(String url, String method, Object request, TypeReference returnType) throws ApiException { - return invokeAPI(url, method, request, returnType, Collections.emptyMap()); - } - - /** - * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. - * @param url The URL for the request, either full URL or only the path. - * @param method The HTTP method for the request. - * @param request The request object. - * @param returnType The return type. - * @param additionalHeaders Additional headers for the request. - * @return The API response in the specified type. - * @throws ApiException if fails to make API call. - */ - public abstract T invokeAPI(String url, String method, Object request, TypeReference returnType, Map additionalHeaders) throws ApiException; +import com.fasterxml.jackson.core.type.TypeReference; + +public abstract class BaseApi +{ + + protected ApiClient apiClient; + + public BaseApi() + { + this(Configuration.getDefaultApiClient()); + } + + public BaseApi( ApiClient apiClient ) + { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() + { + return apiClient; + } + + public void setApiClient( ApiClient apiClient ) + { + this.apiClient = apiClient; + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * + * @param url + * The URL for the request, either full URL or only the path. + * @param method + * The HTTP method for the request. + * @throws ApiException + * if fails to make API call. + */ + public void invokeAPI( String url, String method ) + throws ApiException + { + invokeAPI(url, method, null, null, Collections.emptyMap()); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * + * @param url + * The URL for the request, either full URL or only the path. + * @param method + * The HTTP method for the request. + * @param additionalHeaders + * Additional headers for the request. + * @throws ApiException + * if fails to make API call. + */ + public void invokeAPI( String url, String method, Map additionalHeaders ) + throws ApiException + { + invokeAPI(url, method, null, null, additionalHeaders); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * + * @param url + * The URL for the request, either full URL or only the path. + * @param method + * The HTTP method for the request. + * @param request + * The request object. + * @throws ApiException + * if fails to make API call. + */ + public void invokeAPI( String url, String method, Object request ) + throws ApiException + { + invokeAPI(url, method, request, null, Collections.emptyMap()); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * + * @param url + * The URL for the request, either full URL or only the path. + * @param method + * The HTTP method for the request. + * @param request + * The request object. + * @param additionalHeaders + * Additional headers for the request. + * @throws ApiException + * if fails to make API call. + */ + public void invokeAPI( String url, String method, Object request, Map additionalHeaders ) + throws ApiException + { + invokeAPI(url, method, request, null, additionalHeaders); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * + * @param url + * The URL for the request, either full URL or only the path. + * @param method + * The HTTP method for the request. + * @param returnType + * The return type. + * @return The API response in the specified type. + * @throws ApiException + * if fails to make API call. + */ + public T invokeAPI( String url, String method, TypeReference returnType ) + throws ApiException + { + return invokeAPI(url, method, null, returnType, Collections.emptyMap()); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * + * @param url + * The URL for the request, either full URL or only the path. + * @param method + * The HTTP method for the request. + * @param request + * The request object. + * @param returnType + * The return type. + * @return The API response in the specified type. + * @throws ApiException + * if fails to make API call. + */ + public T invokeAPI( String url, String method, Object request, TypeReference returnType ) + throws ApiException + { + return invokeAPI(url, method, request, returnType, Collections.emptyMap()); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * + * @param url + * The URL for the request, either full URL or only the path. + * @param method + * The HTTP method for the request. + * @param request + * The request object. + * @param returnType + * The return type. + * @param additionalHeaders + * Additional headers for the request. + * @return The API response in the specified type. + * @throws ApiException + * if fails to make API call. + */ + public abstract T invokeAPI( + String url, + String method, + Object request, + TypeReference returnType, + Map additionalHeaders ) + throws ApiException; } diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Configuration.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Configuration.java index 6b02a53e0..8978044d7 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Configuration.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Configuration.java @@ -3,60 +3,65 @@ * Prompt Storage service for Design time & Runtime prompt templates. * * The version of the OpenAPI document: 0.0.1 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package com.sap.cloud.sdk.services.openapi.apache; import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -public class Configuration { - public static final String VERSION = "0.0.1"; - - private static final AtomicReference defaultApiClient = new AtomicReference<>(); - private static volatile Supplier apiClientFactory = ApiClient::new; - - /** - * Get the default API client, which would be used when creating API instances without providing an API client. - * - * @return Default API client - */ - public static ApiClient getDefaultApiClient() { - ApiClient client = defaultApiClient.get(); - if (client == null) { - client = defaultApiClient.updateAndGet(val -> { - if (val != null) { // changed by another thread - return val; +public class Configuration +{ + public static final String VERSION = "0.0.1"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * Get the default API client, which would be used when creating API instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() + { + ApiClient client = defaultApiClient.get(); + if( client == null ) { + client = defaultApiClient.updateAndGet(val -> { + if( val != null ) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); } - return apiClientFactory.get(); - }); + return client; + } + + /** + * Set the default API client, which would be used when creating API instances without providing an API client. + * + * @param apiClient + * API client + */ + public static void setDefaultApiClient( ApiClient apiClient ) + { + defaultApiClient.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory( Supplier factory ) + { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() + { } - return client; - } - - /** - * Set the default API client, which would be used when creating API instances without providing an API client. - * - * @param apiClient API client - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient.set(apiClient); - } - - /** - * set the callback used to create new ApiClient objects - */ - public static void setApiClientFactory(Supplier factory) { - apiClientFactory = Objects.requireNonNull(factory); - } - - private Configuration() { - } -} \ No newline at end of file +} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Pair.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Pair.java index 3723451ee..c7e9a9711 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Pair.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Pair.java @@ -3,34 +3,38 @@ * Prompt Storage service for Design time & Runtime prompt templates. * * The version of the OpenAPI document: 0.0.1 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package com.sap.cloud.sdk.services.openapi.apache; -public class Pair { - private final String name; - private final String value; +public class Pair +{ + private final String name; + private final String value; - public Pair(String name, String value) { - this.name = isValidString(name) ? name : ""; - this.value = isValidString(value) ? value : ""; - } + public Pair( String name, String value ) + { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } - public String getName() { - return this.name; - } + public String getName() + { + return this.name; + } - public String getValue() { - return this.value; - } + public String getValue() + { + return this.value; + } - private static boolean isValidString(String arg) { - return arg != null; - } + private static boolean isValidString( String arg ) + { + return arg != null; + } } diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerConfiguration.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerConfiguration.java index e7ffd6eee..3c91ed3b8 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerConfiguration.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerConfiguration.java @@ -3,14 +3,13 @@ * Prompt Storage service for Design time & Runtime prompt templates. * * The version of the OpenAPI document: 0.0.1 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package com.sap.cloud.sdk.services.openapi.apache; import java.util.Map; @@ -18,17 +17,23 @@ /** * Representing a Server configuration. */ -public class ServerConfiguration { +public class ServerConfiguration +{ public String URL; public String description; public Map variables; /** - * @param URL A URL to the target host. - * @param description A description of the host designated by the URL. - * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + * @param URL + * A URL to the target host. + * @param description + * A description of the host designated by the URL. + * @param variables + * A map between a variable name and its value. The value is used for substitution in the server's URL + * template. */ - public ServerConfiguration(String URL, String description, Map variables) { + public ServerConfiguration( String URL, String description, Map variables ) + { this.URL = URL; this.description = description; this.variables = variables; @@ -37,22 +42,25 @@ public ServerConfiguration(String URL, String description, Map variables) { + public String URL( Map variables ) + { String url = this.URL; // go through variables and replace placeholders - for (Map.Entry variable: this.variables.entrySet()) { + for( Map.Entry variable : this.variables.entrySet() ) { String name = variable.getKey(); ServerVariable serverVariable = variable.getValue(); String value = serverVariable.defaultValue; - if (variables != null && variables.containsKey(name)) { + if( variables != null && variables.containsKey(name) ) { value = variables.get(name); - if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { - throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + if( serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value) ) { + throw new IllegalArgumentException( + "The variable " + name + " in the server URL has invalid value " + value + "."); } } url = url.replace("{" + name + "}", value); @@ -65,7 +73,8 @@ public String URL(Map variables) { * * @return Formatted URL. */ - public String URL() { + public String URL() + { return URL(null); } } diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerVariable.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerVariable.java index 5b5cf2e9f..e2e4a3d06 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerVariable.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerVariable.java @@ -3,14 +3,13 @@ * Prompt Storage service for Design time & Runtime prompt templates. * * The version of the OpenAPI document: 0.0.1 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package com.sap.cloud.sdk.services.openapi.apache; import java.util.HashSet; @@ -18,17 +17,22 @@ /** * Representing a Server Variable for server URL template substitution. */ -public class ServerVariable { +public class ServerVariable +{ public String description; public String defaultValue; public HashSet enumValues = null; /** - * @param description A description for the server variable. - * @param defaultValue The default value to use for substitution. - * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + * @param description + * A description for the server variable. + * @param defaultValue + * The default value to use for substitution. + * @param enumValues + * An enumeration of string values to be used if the substitution options are from a limited set. */ - public ServerVariable(String description, String defaultValue, HashSet enumValues) { + public ServerVariable( String description, String defaultValue, HashSet enumValues ) + { this.description = description; this.defaultValue = defaultValue; this.enumValues = enumValues; diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/ApiKeyAuth.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/ApiKeyAuth.java index 22adc7d24..87f4fe832 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/ApiKeyAuth.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/ApiKeyAuth.java @@ -3,74 +3,84 @@ * Prompt Storage service for Design time & Runtime prompt templates. * * The version of the OpenAPI document: 0.0.1 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package com.sap.cloud.sdk.services.openapi.apache.auth; -import com.sap.cloud.sdk.services.openapi.apache.Pair; - -import java.util.Map; import java.util.List; +import java.util.Map; -public class ApiKeyAuth implements Authentication { - private final String location; - private final String paramName; - - private String apiKey; - private String apiKeyPrefix; +import com.sap.cloud.sdk.services.openapi.apache.Pair; - public ApiKeyAuth(String location, String paramName) { - this.location = location; - this.paramName = paramName; - } +public class ApiKeyAuth implements Authentication +{ + private final String location; + private final String paramName; - public String getLocation() { - return location; - } + private String apiKey; + private String apiKeyPrefix; - public String getParamName() { - return paramName; - } + public ApiKeyAuth( String location, String paramName ) + { + this.location = location; + this.paramName = paramName; + } - public String getApiKey() { - return apiKey; - } + public String getLocation() + { + return location; + } - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } + public String getParamName() + { + return paramName; + } - public String getApiKeyPrefix() { - return apiKeyPrefix; - } + public String getApiKey() + { + return apiKey; + } - public void setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - } + public void setApiKey( String apiKey ) + { + this.apiKey = apiKey; + } - @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { - if (apiKey == null) { - return; + public String getApiKeyPrefix() + { + return apiKeyPrefix; } - String value; - if (apiKeyPrefix != null) { - value = apiKeyPrefix + " " + apiKey; - } else { - value = apiKey; + + public void setApiKeyPrefix( String apiKeyPrefix ) + { + this.apiKeyPrefix = apiKeyPrefix; } - if ("query".equals(location)) { - queryParams.add(new Pair(paramName, value)); - } else if ("header".equals(location)) { - headerParams.put(paramName, value); - } else if ("cookie".equals(location)) { - cookieParams.put(paramName, value); + + @Override + public + void + applyToParams( List queryParams, Map headerParams, Map cookieParams ) + { + if( apiKey == null ) { + return; + } + String value; + if( apiKeyPrefix != null ) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if( "query".equals(location) ) { + queryParams.add(new Pair(paramName, value)); + } else if( "header".equals(location) ) { + headerParams.put(paramName, value); + } else if( "cookie".equals(location) ) { + cookieParams.put(paramName, value); + } } - } } diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/Authentication.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/Authentication.java index 20fd12cf2..92d1e48b2 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/Authentication.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/Authentication.java @@ -3,28 +3,31 @@ * Prompt Storage service for Design time & Runtime prompt templates. * * The version of the OpenAPI document: 0.0.1 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package com.sap.cloud.sdk.services.openapi.apache.auth; -import com.sap.cloud.sdk.services.openapi.apache.Pair; - -import java.util.Map; import java.util.List; +import java.util.Map; + +import com.sap.cloud.sdk.services.openapi.apache.Pair; -public interface Authentication { - /** - * Apply authentication settings to header and query params. - * - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - * @param cookieParams Map of cookie parameters - */ - void applyToParams(List queryParams, Map headerParams, Map cookieParams); +public interface Authentication +{ + /** + * Apply authentication settings to header and query params. + * + * @param queryParams + * List of query parameters + * @param headerParams + * Map of header parameters + * @param cookieParams + * Map of cookie parameters + */ + void applyToParams( List queryParams, Map headerParams, Map cookieParams ); } diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBasicAuth.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBasicAuth.java index ac286f9e0..fc48507f6 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBasicAuth.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBasicAuth.java @@ -3,50 +3,57 @@ * Prompt Storage service for Design time & Runtime prompt templates. * * The version of the OpenAPI document: 0.0.1 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package com.sap.cloud.sdk.services.openapi.apache.auth; -import com.sap.cloud.sdk.services.openapi.apache.Pair; - -import java.util.Base64; import java.nio.charset.StandardCharsets; - -import java.util.Map; +import java.util.Base64; import java.util.List; +import java.util.Map; -public class HttpBasicAuth implements Authentication { - private String username; - private String password; +import com.sap.cloud.sdk.services.openapi.apache.Pair; - public String getUsername() { - return username; - } +public class HttpBasicAuth implements Authentication +{ + private String username; + private String password; - public void setUsername(String username) { - this.username = username; - } + public String getUsername() + { + return username; + } - public String getPassword() { - return password; - } + public void setUsername( String username ) + { + this.username = username; + } - public void setPassword(String password) { - this.password = password; - } + public String getPassword() + { + return password; + } + + public void setPassword( String password ) + { + this.password = password; + } - @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { - if (username == null && password == null) { - return; + @Override + public + void + applyToParams( List queryParams, Map headerParams, Map cookieParams ) + { + if( username == null && password == null ) { + return; + } + String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + headerParams + .put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); } - String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); - headerParams.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); - } } diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBearerAuth.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBearerAuth.java index 1b2c04676..886915d6e 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBearerAuth.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBearerAuth.java @@ -3,67 +3,78 @@ * Prompt Storage service for Design time & Runtime prompt templates. * * The version of the OpenAPI document: 0.0.1 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package com.sap.cloud.sdk.services.openapi.apache.auth; -import com.sap.cloud.sdk.services.openapi.apache.Pair; - import java.util.List; import java.util.Map; import java.util.function.Supplier; -public class HttpBearerAuth implements Authentication { - private final String scheme; - private Supplier tokenSupplier; +import com.sap.cloud.sdk.services.openapi.apache.Pair; - public HttpBearerAuth(String scheme) { - this.scheme = upperCaseBearer(scheme); - } +public class HttpBearerAuth implements Authentication +{ + private final String scheme; + private Supplier tokenSupplier; - /** - * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. - * - * @return The bearer token - */ - public String getBearerToken() { - return tokenSupplier.get(); - } + public HttpBearerAuth( String scheme ) + { + this.scheme = upperCaseBearer(scheme); + } - /** - * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. - * - * @param bearerToken The bearer token to send in the Authorization header - */ - public void setBearerToken(String bearerToken) { - this.tokenSupplier = () -> bearerToken; - } + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() + { + return tokenSupplier.get(); + } - /** - * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header. - * - * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header - */ - public void setBearerToken(Supplier tokenSupplier) { - this.tokenSupplier = tokenSupplier; - } + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken + * The bearer token to send in the Authorization header + */ + public void setBearerToken( String bearerToken ) + { + this.tokenSupplier = () -> bearerToken; + } - @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { - String bearerToken = tokenSupplier != null ? tokenSupplier.get() : null; - if (bearerToken == null) { - return; + /** + * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization + * header. + * + * @param tokenSupplier + * The supplier of bearer tokens to send in the Authorization header + */ + public void setBearerToken( Supplier tokenSupplier ) + { + this.tokenSupplier = tokenSupplier; } - headerParams.put("Authorization", (scheme != null ? scheme + " " : "") + bearerToken); - } - private static String upperCaseBearer(String scheme) { - return "bearer".equalsIgnoreCase(scheme) ? "Bearer" : scheme; - } + @Override + public + void + applyToParams( List queryParams, Map headerParams, Map cookieParams ) + { + String bearerToken = tokenSupplier != null ? tokenSupplier.get() : null; + if( bearerToken == null ) { + return; + } + headerParams.put("Authorization", (scheme != null ? scheme + " " : "") + bearerToken); + } + + private static String upperCaseBearer( String scheme ) + { + return "bearer".equalsIgnoreCase(scheme) ? "Bearer" : scheme; + } } From c3e438fd75afedbb417399b650d8a229114a823f Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Thu, 11 Dec 2025 13:48:06 +0100 Subject: [PATCH 08/26] Add all required file (pruned later) --- datamodel/openapi/openapi-core/pom.xml | 8 +- .../openapi/apache/RFC3339DateFormat.java | 57 +++++++++++ .../apache/RFC3339InstantDeserializer.java | 99 +++++++++++++++++++ .../openapi/apache/RFC3339JavaTimeModule.java | 37 +++++++ .../services/openapi/apache/StringUtil.java | 82 +++++++++++++++ 5 files changed, 279 insertions(+), 4 deletions(-) create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339DateFormat.java create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339InstantDeserializer.java create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339JavaTimeModule.java create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/StringUtil.java diff --git a/datamodel/openapi/openapi-core/pom.xml b/datamodel/openapi/openapi-core/pom.xml index f33fda715..1f5f8dcd0 100644 --- a/datamodel/openapi/openapi-core/pom.xml +++ b/datamodel/openapi/openapi-core/pom.xml @@ -68,10 +68,6 @@ com.fasterxml.jackson.core jackson-core
- - org.apache.httpcomponents.core5 - httpcore5 - org.projectlombok @@ -104,6 +100,10 @@ httpcore5 test + + org.apache.httpcomponents.core5 + httpcore5 + diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339DateFormat.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339DateFormat.java new file mode 100644 index 000000000..ef267cdc8 --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339DateFormat.java @@ -0,0 +1,57 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.openapi.apache; + +import com.fasterxml.jackson.databind.util.StdDateFormat; + +import java.text.DateFormat; +import java.text.DecimalFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + this.numberFormat = new DecimalFormat(); + } + + @Override + public Date parse(String source) { + return parse(source, new ParsePosition(0)); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return super.clone(); + } +} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339InstantDeserializer.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339InstantDeserializer.java new file mode 100644 index 000000000..383c28dd6 --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339InstantDeserializer.java @@ -0,0 +1,99 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.openapi.apache; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; +import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; + +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.Temporal; +import java.time.temporal.TemporalAccessor; +import java.util.function.BiFunction; +import java.util.function.Function; + +public class RFC3339InstantDeserializer extends InstantDeserializer { + private static final long serialVersionUID = 1L; + private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); + private final static boolean DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + = JavaTimeFeature.ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS.enabledByDefault(); + + public static final RFC3339InstantDeserializer INSTANT = new RFC3339InstantDeserializer<>( + Instant.class, DateTimeFormatter.ISO_INSTANT, + Instant::from, + a -> Instant.ofEpochMilli( a.value ), + a -> Instant.ofEpochSecond( a.integer, a.fraction ), + null, + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer OFFSET_DATE_TIME = new RFC3339InstantDeserializer<>( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + OffsetDateTime::from, + a -> OffsetDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> OffsetDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + (d, z) -> ( d.isEqual( OffsetDateTime.MIN ) || d.isEqual( OffsetDateTime.MAX ) ? + d : + d.withOffsetSameInstant( z.getRules().getOffset( d.toLocalDateTime() ) ) ), + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer ZONED_DATE_TIME = new RFC3339InstantDeserializer<>( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + ZonedDateTime::from, + a -> ZonedDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> ZonedDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + ZonedDateTime::withZoneSameInstant, + false, // keep zero offset and Z separate since zones explicitly supported + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + protected RFC3339InstantDeserializer( + Class supportedType, + DateTimeFormatter formatter, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust, + boolean replaceZeroOffsetAsZ, + boolean normalizeZoneId, + boolean readNumericStringsAsTimestamp) { + super( + supportedType, + formatter, + parsedToValue, + fromMilliseconds, + fromNanoseconds, + adjust, + replaceZeroOffsetAsZ, + normalizeZoneId, + readNumericStringsAsTimestamp + ); + } + + @Override + protected T _fromString(JsonParser p, DeserializationContext ctxt, String string0) throws IOException { + return super._fromString(p, ctxt, string0.replace( ' ', 'T' )); + } +} \ No newline at end of file diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339JavaTimeModule.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339JavaTimeModule.java new file mode 100644 index 000000000..36108fbc1 --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339JavaTimeModule.java @@ -0,0 +1,37 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.openapi.apache; + +import com.fasterxml.jackson.databind.module.SimpleModule; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZonedDateTime; + +public class RFC3339JavaTimeModule extends SimpleModule { + private static final long serialVersionUID = 1L; + + public RFC3339JavaTimeModule() { + super("RFC3339JavaTimeModule"); + } + + @Override + public void setupModule(SetupContext context) { + super.setupModule(context); + + addDeserializer(Instant.class, RFC3339InstantDeserializer.INSTANT); + addDeserializer(OffsetDateTime.class, RFC3339InstantDeserializer.OFFSET_DATE_TIME); + addDeserializer(ZonedDateTime.class, RFC3339InstantDeserializer.ZONED_DATE_TIME); + } + +} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/StringUtil.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/StringUtil.java new file mode 100644 index 000000000..3a0dbff69 --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/StringUtil.java @@ -0,0 +1,82 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.sap.cloud.sdk.services.openapi.apache; + +import java.util.Collection; +import java.util.Iterator; + +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } + + /** + * Join a list of strings with the given separator. + * + * @param list The list of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(Collection list, String separator) { + Iterator iterator = list.iterator(); + StringBuilder out = new StringBuilder(); + if (iterator.hasNext()) { + out.append(iterator.next()); + } + while (iterator.hasNext()) { + out.append(separator).append(iterator.next()); + } + return out.toString(); + } +} From c934b1fe68b3c5f6f85e42da51d5e80dbfc83b83 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Thu, 11 Dec 2025 15:26:30 +0100 Subject: [PATCH 09/26] Fix dependencies - formatting - add api classes --- .../openapi/openapi-api-apache-sample/pom.xml | 18 +- .../sample/api/OrchestrationConfigsApi.java | 871 ++++++++++++ .../apache/sample/api/PromptTemplatesApi.java | 1173 +++++++++++++++++ datamodel/openapi/openapi-core/pom.xml | 7 +- .../services/openapi/apache/ApiClient.java | 41 +- .../services/openapi/apache/ApiException.java | 2 +- .../openapi/apache/RFC3339DateFormat.java | 74 +- .../apache/RFC3339InstantDeserializer.java | 137 +- .../openapi/apache/RFC3339JavaTimeModule.java | 27 +- .../services/openapi/apache/StringUtil.java | 127 +- 10 files changed, 2288 insertions(+), 189 deletions(-) create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrchestrationConfigsApi.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/PromptTemplatesApi.java diff --git a/datamodel/openapi/openapi-api-apache-sample/pom.xml b/datamodel/openapi/openapi-api-apache-sample/pom.xml index 7cdf574cf..4e01eb1b1 100644 --- a/datamodel/openapi/openapi-api-apache-sample/pom.xml +++ b/datamodel/openapi/openapi-api-apache-sample/pom.xml @@ -22,10 +22,18 @@ com.sap.cloud.sdk.datamodel openapi-core - - com.sap.cloud.sdk.cloudplatform - cloudplatform-connectivity - + + com.google.guava + guava + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-annotations + @@ -50,7 +58,7 @@ com.sap.cloud.sdk.datamodel.openapi.apache.sample.model true - + com.sap.cloud.sdk.services.openapi.apache apache-httpclient false true diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrchestrationConfigsApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrchestrationConfigsApi.java new file mode 100644 index 000000000..a18aada96 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrchestrationConfigsApi.java @@ -0,0 +1,871 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.api; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.StringJoiner; +import java.util.UUID; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.OrchestrationConfigDeleteResponse; +import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.OrchestrationConfigGetResponse; +import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.OrchestrationConfigListResponse; +import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.OrchestrationConfigPostRequest; +import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.OrchestrationConfigPostResponse; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.ApiException; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Configuration; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + +public class OrchestrationConfigsApi extends BaseApi +{ + + public OrchestrationConfigsApi() + { + super(Configuration.getDefaultApiClient()); + } + + public OrchestrationConfigsApi( ApiClient apiClient ) + { + super(apiClient); + } + + /** + * + * Create or update an orchestration config + * + * @param orchestrationConfigPostRequest + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @return OrchestrationConfigPostResponse + * @throws ApiException + * if fails to make API call + */ + public OrchestrationConfigPostResponse createUpdateOrchestrationConfig( + @javax.annotation.Nonnull OrchestrationConfigPostRequest orchestrationConfigPostRequest, + @javax.annotation.Nullable String aiResourceGroup ) + throws ApiException + { + return this + .createUpdateOrchestrationConfig(orchestrationConfigPostRequest, aiResourceGroup, Collections.emptyMap()); + } + + /** + * + * Create or update an orchestration config + * + * @param orchestrationConfigPostRequest + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param additionalHeaders + * additionalHeaders for this call + * @return OrchestrationConfigPostResponse + * @throws ApiException + * if fails to make API call + */ + public OrchestrationConfigPostResponse createUpdateOrchestrationConfig( + @javax.annotation.Nonnull OrchestrationConfigPostRequest orchestrationConfigPostRequest, + @javax.annotation.Nullable String aiResourceGroup, + Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = orchestrationConfigPostRequest; + + // verify the required parameter 'orchestrationConfigPostRequest' is set + if( orchestrationConfigPostRequest == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'orchestrationConfigPostRequest' when calling createUpdateOrchestrationConfig"); + } + + // create path and map variables + String localVarPath = "/registry/v2/orchestrationConfigs"; + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if( aiResourceGroup != null ) + localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = + new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * + * Delete orchestration config + * + * @param orchestrationConfigId + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @return OrchestrationConfigDeleteResponse + * @throws ApiException + * if fails to make API call + */ + public OrchestrationConfigDeleteResponse deleteOrchestrationConfig( + @javax.annotation.Nonnull UUID orchestrationConfigId, + @javax.annotation.Nullable String aiResourceGroup ) + throws ApiException + { + return this.deleteOrchestrationConfig(orchestrationConfigId, aiResourceGroup, Collections.emptyMap()); + } + + /** + * + * Delete orchestration config + * + * @param orchestrationConfigId + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param additionalHeaders + * additionalHeaders for this call + * @return OrchestrationConfigDeleteResponse + * @throws ApiException + * if fails to make API call + */ + public OrchestrationConfigDeleteResponse deleteOrchestrationConfig( + @javax.annotation.Nonnull UUID orchestrationConfigId, + @javax.annotation.Nullable String aiResourceGroup, + Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = null; + + // verify the required parameter 'orchestrationConfigId' is set + if( orchestrationConfigId == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'orchestrationConfigId' when calling deleteOrchestrationConfig"); + } + + // create path and map variables + String localVarPath = + "/registry/v2/orchestrationConfigs/{orchestrationConfigId}" + .replaceAll( + "\\{" + "orchestrationConfigId" + "\\}", + apiClient.escapeString(apiClient.parameterToString(orchestrationConfigId))); + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if( aiResourceGroup != null ) + localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = + new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * + * Export orchestration config + * + * @param orchestrationConfigId + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @return File + * @throws ApiException + * if fails to make API call + */ + public File exportOrchestrationConfig( + @javax.annotation.Nonnull UUID orchestrationConfigId, + @javax.annotation.Nullable String aiResourceGroup ) + throws ApiException + { + return this.exportOrchestrationConfig(orchestrationConfigId, aiResourceGroup, Collections.emptyMap()); + } + + /** + * + * Export orchestration config + * + * @param orchestrationConfigId + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param additionalHeaders + * additionalHeaders for this call + * @return File + * @throws ApiException + * if fails to make API call + */ + public File exportOrchestrationConfig( + @javax.annotation.Nonnull UUID orchestrationConfigId, + @javax.annotation.Nullable String aiResourceGroup, + Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = null; + + // verify the required parameter 'orchestrationConfigId' is set + if( orchestrationConfigId == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'orchestrationConfigId' when calling exportOrchestrationConfig"); + } + + // create path and map variables + String localVarPath = + "/registry/v2/orchestrationConfigs/{orchestrationConfigId}/export" + .replaceAll( + "\\{" + "orchestrationConfigId" + "\\}", + apiClient.escapeString(apiClient.parameterToString(orchestrationConfigId))); + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if( aiResourceGroup != null ) + localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/octet-stream", "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * + * Get orchestration config by UUID + * + * @param orchestrationConfigId + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param resolveTemplateRef + * (optional, default to false) + * @return OrchestrationConfigGetResponse + * @throws ApiException + * if fails to make API call + */ + public OrchestrationConfigGetResponse getOrchestrationConfigByUuid( + @javax.annotation.Nonnull UUID orchestrationConfigId, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable Boolean resolveTemplateRef ) + throws ApiException + { + return this + .getOrchestrationConfigByUuid( + orchestrationConfigId, + aiResourceGroup, + resolveTemplateRef, + Collections.emptyMap()); + } + + /** + * + * Get orchestration config by UUID + * + * @param orchestrationConfigId + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param resolveTemplateRef + * (optional, default to false) + * @param additionalHeaders + * additionalHeaders for this call + * @return OrchestrationConfigGetResponse + * @throws ApiException + * if fails to make API call + */ + public OrchestrationConfigGetResponse getOrchestrationConfigByUuid( + @javax.annotation.Nonnull UUID orchestrationConfigId, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable Boolean resolveTemplateRef, + Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = null; + + // verify the required parameter 'orchestrationConfigId' is set + if( orchestrationConfigId == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'orchestrationConfigId' when calling getOrchestrationConfigByUuid"); + } + + // create path and map variables + String localVarPath = + "/registry/v2/orchestrationConfigs/{orchestrationConfigId}" + .replaceAll( + "\\{" + "orchestrationConfigId" + "\\}", + apiClient.escapeString(apiClient.parameterToString(orchestrationConfigId))); + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPair("resolve_template_ref", resolveTemplateRef)); + if( aiResourceGroup != null ) + localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = + new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * + * Import orchestration config + * + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param _file + * (optional) + * @return OrchestrationConfigPostResponse + * @throws ApiException + * if fails to make API call + */ + public OrchestrationConfigPostResponse importOrchestrationConfig( + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable File _file ) + throws ApiException + { + return this.importOrchestrationConfig(aiResourceGroup, _file, Collections.emptyMap()); + } + + /** + * + * Import orchestration config + * + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param _file + * (optional) + * @param additionalHeaders + * additionalHeaders for this call + * @return OrchestrationConfigPostResponse + * @throws ApiException + * if fails to make API call + */ + public OrchestrationConfigPostResponse importOrchestrationConfig( + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable File _file, + Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/registry/v2/orchestrationConfigs/import"; + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if( aiResourceGroup != null ) + localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + + localVarHeaderParams.putAll(additionalHeaders); + + if( _file != null ) + localVarFormParams.put("file", _file); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { "multipart/form-data" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = + new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * + * List orchestration config history + * + * @param scenario + * (required) + * @param version + * (required) + * @param name + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param includeSpec + * (optional, default to false) + * @param resolveTemplateRef + * (optional, default to false) + * @return OrchestrationConfigListResponse + * @throws ApiException + * if fails to make API call + */ + public OrchestrationConfigListResponse listOrchestrationConfigHistory( + @javax.annotation.Nonnull String scenario, + @javax.annotation.Nonnull String version, + @javax.annotation.Nonnull String name, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable Boolean includeSpec, + @javax.annotation.Nullable Boolean resolveTemplateRef ) + throws ApiException + { + return this + .listOrchestrationConfigHistory( + scenario, + version, + name, + aiResourceGroup, + includeSpec, + resolveTemplateRef, + Collections.emptyMap()); + } + + /** + * + * List orchestration config history + * + * @param scenario + * (required) + * @param version + * (required) + * @param name + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param includeSpec + * (optional, default to false) + * @param resolveTemplateRef + * (optional, default to false) + * @param additionalHeaders + * additionalHeaders for this call + * @return OrchestrationConfigListResponse + * @throws ApiException + * if fails to make API call + */ + public OrchestrationConfigListResponse listOrchestrationConfigHistory( + @javax.annotation.Nonnull String scenario, + @javax.annotation.Nonnull String version, + @javax.annotation.Nonnull String name, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable Boolean includeSpec, + @javax.annotation.Nullable Boolean resolveTemplateRef, + Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = null; + + // verify the required parameter 'scenario' is set + if( scenario == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'scenario' when calling listOrchestrationConfigHistory"); + } + + // verify the required parameter 'version' is set + if( version == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'version' when calling listOrchestrationConfigHistory"); + } + + // verify the required parameter 'name' is set + if( name == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'name' when calling listOrchestrationConfigHistory"); + } + + // create path and map variables + String localVarPath = + "/registry/v2/scenarios/{scenario}/orchestrationConfigs/{name}/versions/{version}/history" + .replaceAll("\\{" + "scenario" + "\\}", apiClient.escapeString(apiClient.parameterToString(scenario))) + .replaceAll("\\{" + "version" + "\\}", apiClient.escapeString(apiClient.parameterToString(version))) + .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(apiClient.parameterToString(name))); + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPair("include_spec", includeSpec)); + localVarQueryParams.addAll(apiClient.parameterToPair("resolve_template_ref", resolveTemplateRef)); + if( aiResourceGroup != null ) + localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = + new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * + * List orchestration configs + * + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param scenario + * (optional) + * @param name + * (optional) + * @param version + * (optional) + * @param retrieve + * (optional, default to both) + * @param includeSpec + * (optional, default to false) + * @param resolveTemplateRef + * (optional, default to false) + * @return OrchestrationConfigListResponse + * @throws ApiException + * if fails to make API call + */ + public OrchestrationConfigListResponse listOrchestrationConfigs( + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String scenario, + @javax.annotation.Nullable String name, + @javax.annotation.Nullable String version, + @javax.annotation.Nullable String retrieve, + @javax.annotation.Nullable Boolean includeSpec, + @javax.annotation.Nullable Boolean resolveTemplateRef ) + throws ApiException + { + return this + .listOrchestrationConfigs( + aiResourceGroup, + scenario, + name, + version, + retrieve, + includeSpec, + resolveTemplateRef, + Collections.emptyMap()); + } + + /** + * + * List orchestration configs + * + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param scenario + * (optional) + * @param name + * (optional) + * @param version + * (optional) + * @param retrieve + * (optional, default to both) + * @param includeSpec + * (optional, default to false) + * @param resolveTemplateRef + * (optional, default to false) + * @param additionalHeaders + * additionalHeaders for this call + * @return OrchestrationConfigListResponse + * @throws ApiException + * if fails to make API call + */ + public OrchestrationConfigListResponse listOrchestrationConfigs( + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String scenario, + @javax.annotation.Nullable String name, + @javax.annotation.Nullable String version, + @javax.annotation.Nullable String retrieve, + @javax.annotation.Nullable Boolean includeSpec, + @javax.annotation.Nullable Boolean resolveTemplateRef, + Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/registry/v2/orchestrationConfigs"; + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPair("scenario", scenario)); + localVarQueryParams.addAll(apiClient.parameterToPair("name", name)); + localVarQueryParams.addAll(apiClient.parameterToPair("version", version)); + localVarQueryParams.addAll(apiClient.parameterToPair("retrieve", retrieve)); + localVarQueryParams.addAll(apiClient.parameterToPair("include_spec", includeSpec)); + localVarQueryParams.addAll(apiClient.parameterToPair("resolve_template_ref", resolveTemplateRef)); + if( aiResourceGroup != null ) + localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = + new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + @Override + public T invokeAPI( + String url, + String method, + Object request, + TypeReference returnType, + Map additionalHeaders ) + throws ApiException + { + String localVarPath = url.replace(apiClient.getBaseURL(), ""); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + return apiClient + .invokeAPI( + localVarPath, + method, + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + request, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + returnType); + } +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/PromptTemplatesApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/PromptTemplatesApi.java new file mode 100644 index 000000000..4fb3e9f73 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/PromptTemplatesApi.java @@ -0,0 +1,1173 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.api; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.StringJoiner; +import java.util.UUID; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.PromptTemplateDeleteResponse; +import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.PromptTemplateGetResponse; +import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.PromptTemplateListResponse; +import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.PromptTemplatePostRequest; +import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.PromptTemplatePostResponse; +import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.PromptTemplateSubstitutionRequest; +import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.PromptTemplateSubstitutionResponse; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.ApiException; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Configuration; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + +public class PromptTemplatesApi extends BaseApi +{ + + public PromptTemplatesApi() + { + super(Configuration.getDefaultApiClient()); + } + + public PromptTemplatesApi( ApiClient apiClient ) + { + super(apiClient); + } + + /** + * + * Create or update a prompt template + * + * @param promptTemplatePostRequest + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @return PromptTemplatePostResponse + * @throws ApiException + * if fails to make API call + */ + public PromptTemplatePostResponse createUpdatePromptTemplate( + @javax.annotation.Nonnull PromptTemplatePostRequest promptTemplatePostRequest, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope ) + throws ApiException + { + return this + .createUpdatePromptTemplate( + promptTemplatePostRequest, + aiResourceGroup, + aiResourceGroupScope, + Collections.emptyMap()); + } + + /** + * + * Create or update a prompt template + * + * @param promptTemplatePostRequest + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @param additionalHeaders + * additionalHeaders for this call + * @return PromptTemplatePostResponse + * @throws ApiException + * if fails to make API call + */ + public PromptTemplatePostResponse createUpdatePromptTemplate( + @javax.annotation.Nonnull PromptTemplatePostRequest promptTemplatePostRequest, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope, + Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = promptTemplatePostRequest; + + // verify the required parameter 'promptTemplatePostRequest' is set + if( promptTemplatePostRequest == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'promptTemplatePostRequest' when calling createUpdatePromptTemplate"); + } + + // create path and map variables + String localVarPath = "/lm/promptTemplates"; + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if( aiResourceGroup != null ) + localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if( aiResourceGroupScope != null ) + localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * + * Delete prompt template + * + * @param promptTemplateId + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @return PromptTemplateDeleteResponse + * @throws ApiException + * if fails to make API call + */ + public PromptTemplateDeleteResponse deletePromptTemplate( + @javax.annotation.Nonnull UUID promptTemplateId, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope ) + throws ApiException + { + return this + .deletePromptTemplate(promptTemplateId, aiResourceGroup, aiResourceGroupScope, Collections.emptyMap()); + } + + /** + * + * Delete prompt template + * + * @param promptTemplateId + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @param additionalHeaders + * additionalHeaders for this call + * @return PromptTemplateDeleteResponse + * @throws ApiException + * if fails to make API call + */ + public PromptTemplateDeleteResponse deletePromptTemplate( + @javax.annotation.Nonnull UUID promptTemplateId, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope, + Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = null; + + // verify the required parameter 'promptTemplateId' is set + if( promptTemplateId == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'promptTemplateId' when calling deletePromptTemplate"); + } + + // create path and map variables + String localVarPath = + "/lm/promptTemplates/{promptTemplateId}" + .replaceAll( + "\\{" + "promptTemplateId" + "\\}", + apiClient.escapeString(apiClient.parameterToString(promptTemplateId))); + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if( aiResourceGroup != null ) + localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if( aiResourceGroupScope != null ) + localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = + new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * + * Export prompt template + * + * @param promptTemplateId + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @return File + * @throws ApiException + * if fails to make API call + */ + public File exportPromptTemplate( + @javax.annotation.Nonnull UUID promptTemplateId, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope ) + throws ApiException + { + return this + .exportPromptTemplate(promptTemplateId, aiResourceGroup, aiResourceGroupScope, Collections.emptyMap()); + } + + /** + * + * Export prompt template + * + * @param promptTemplateId + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @param additionalHeaders + * additionalHeaders for this call + * @return File + * @throws ApiException + * if fails to make API call + */ + public File exportPromptTemplate( + @javax.annotation.Nonnull UUID promptTemplateId, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope, + Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = null; + + // verify the required parameter 'promptTemplateId' is set + if( promptTemplateId == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'promptTemplateId' when calling exportPromptTemplate"); + } + + // create path and map variables + String localVarPath = + "/lm/promptTemplates/{promptTemplateId}/export" + .replaceAll( + "\\{" + "promptTemplateId" + "\\}", + apiClient.escapeString(apiClient.parameterToString(promptTemplateId))); + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if( aiResourceGroup != null ) + localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if( aiResourceGroupScope != null ) + localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/octet-stream", "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * + * Get prompt template by UUID + * + * @param promptTemplateId + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @return PromptTemplateGetResponse + * @throws ApiException + * if fails to make API call + */ + public PromptTemplateGetResponse getPromptTemplateByUuid( + @javax.annotation.Nonnull UUID promptTemplateId, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope ) + throws ApiException + { + return this + .getPromptTemplateByUuid(promptTemplateId, aiResourceGroup, aiResourceGroupScope, Collections.emptyMap()); + } + + /** + * + * Get prompt template by UUID + * + * @param promptTemplateId + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @param additionalHeaders + * additionalHeaders for this call + * @return PromptTemplateGetResponse + * @throws ApiException + * if fails to make API call + */ + public PromptTemplateGetResponse getPromptTemplateByUuid( + @javax.annotation.Nonnull UUID promptTemplateId, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope, + Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = null; + + // verify the required parameter 'promptTemplateId' is set + if( promptTemplateId == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'promptTemplateId' when calling getPromptTemplateByUuid"); + } + + // create path and map variables + String localVarPath = + "/lm/promptTemplates/{promptTemplateId}" + .replaceAll( + "\\{" + "promptTemplateId" + "\\}", + apiClient.escapeString(apiClient.parameterToString(promptTemplateId))); + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if( aiResourceGroup != null ) + localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if( aiResourceGroupScope != null ) + localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * + * Import prompt template + * + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @param _file + * (optional) + * @return PromptTemplatePostResponse + * @throws ApiException + * if fails to make API call + */ + public PromptTemplatePostResponse importPromptTemplate( + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope, + @javax.annotation.Nullable File _file ) + throws ApiException + { + return this.importPromptTemplate(aiResourceGroup, aiResourceGroupScope, _file, Collections.emptyMap()); + } + + /** + * + * Import prompt template + * + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @param _file + * (optional) + * @param additionalHeaders + * additionalHeaders for this call + * @return PromptTemplatePostResponse + * @throws ApiException + * if fails to make API call + */ + public PromptTemplatePostResponse importPromptTemplate( + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope, + @javax.annotation.Nullable File _file, + Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/lm/promptTemplates/import"; + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if( aiResourceGroup != null ) + localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if( aiResourceGroupScope != null ) + localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); + + localVarHeaderParams.putAll(additionalHeaders); + + if( _file != null ) + localVarFormParams.put("file", _file); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { "multipart/form-data" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * + * List prompt template history + * + * @param scenario + * (required) + * @param version + * (required) + * @param name + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @return PromptTemplateListResponse + * @throws ApiException + * if fails to make API call + */ + public PromptTemplateListResponse listPromptTemplateHistory( + @javax.annotation.Nonnull String scenario, + @javax.annotation.Nonnull String version, + @javax.annotation.Nonnull String name, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope ) + throws ApiException + { + return this + .listPromptTemplateHistory( + scenario, + version, + name, + aiResourceGroup, + aiResourceGroupScope, + Collections.emptyMap()); + } + + /** + * + * List prompt template history + * + * @param scenario + * (required) + * @param version + * (required) + * @param name + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @param additionalHeaders + * additionalHeaders for this call + * @return PromptTemplateListResponse + * @throws ApiException + * if fails to make API call + */ + public PromptTemplateListResponse listPromptTemplateHistory( + @javax.annotation.Nonnull String scenario, + @javax.annotation.Nonnull String version, + @javax.annotation.Nonnull String name, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope, + Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = null; + + // verify the required parameter 'scenario' is set + if( scenario == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'scenario' when calling listPromptTemplateHistory"); + } + + // verify the required parameter 'version' is set + if( version == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'version' when calling listPromptTemplateHistory"); + } + + // verify the required parameter 'name' is set + if( name == null ) { + throw new ApiException(400, "Missing the required parameter 'name' when calling listPromptTemplateHistory"); + } + + // create path and map variables + String localVarPath = + "/lm/scenarios/{scenario}/promptTemplates/{name}/versions/{version}/history" + .replaceAll("\\{" + "scenario" + "\\}", apiClient.escapeString(apiClient.parameterToString(scenario))) + .replaceAll("\\{" + "version" + "\\}", apiClient.escapeString(apiClient.parameterToString(version))) + .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(apiClient.parameterToString(name))); + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if( aiResourceGroup != null ) + localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if( aiResourceGroupScope != null ) + localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * + * List prompt templates + * + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @param scenario + * (optional) + * @param name + * (optional) + * @param version + * (optional) + * @param retrieve + * (optional, default to both) + * @param includeSpec + * (optional, default to false) + * @return PromptTemplateListResponse + * @throws ApiException + * if fails to make API call + */ + public PromptTemplateListResponse listPromptTemplates( + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope, + @javax.annotation.Nullable String scenario, + @javax.annotation.Nullable String name, + @javax.annotation.Nullable String version, + @javax.annotation.Nullable String retrieve, + @javax.annotation.Nullable Boolean includeSpec ) + throws ApiException + { + return this + .listPromptTemplates( + aiResourceGroup, + aiResourceGroupScope, + scenario, + name, + version, + retrieve, + includeSpec, + Collections.emptyMap()); + } + + /** + * + * List prompt templates + * + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @param scenario + * (optional) + * @param name + * (optional) + * @param version + * (optional) + * @param retrieve + * (optional, default to both) + * @param includeSpec + * (optional, default to false) + * @param additionalHeaders + * additionalHeaders for this call + * @return PromptTemplateListResponse + * @throws ApiException + * if fails to make API call + */ + public PromptTemplateListResponse listPromptTemplates( + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope, + @javax.annotation.Nullable String scenario, + @javax.annotation.Nullable String name, + @javax.annotation.Nullable String version, + @javax.annotation.Nullable String retrieve, + @javax.annotation.Nullable Boolean includeSpec, + Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/lm/promptTemplates"; + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPair("scenario", scenario)); + localVarQueryParams.addAll(apiClient.parameterToPair("name", name)); + localVarQueryParams.addAll(apiClient.parameterToPair("version", version)); + localVarQueryParams.addAll(apiClient.parameterToPair("retrieve", retrieve)); + localVarQueryParams.addAll(apiClient.parameterToPair("includeSpec", includeSpec)); + if( aiResourceGroup != null ) + localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if( aiResourceGroupScope != null ) + localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * + * Parse prompt template by ID + * + * @param promptTemplateId + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @param metadata + * (optional, default to false) + * @param promptTemplateSubstitutionRequest + * (optional) + * @return PromptTemplateSubstitutionResponse + * @throws ApiException + * if fails to make API call + */ + public PromptTemplateSubstitutionResponse parsePromptTemplateById( + @javax.annotation.Nonnull UUID promptTemplateId, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope, + @javax.annotation.Nullable Boolean metadata, + @javax.annotation.Nullable PromptTemplateSubstitutionRequest promptTemplateSubstitutionRequest ) + throws ApiException + { + return this + .parsePromptTemplateById( + promptTemplateId, + aiResourceGroup, + aiResourceGroupScope, + metadata, + promptTemplateSubstitutionRequest, + Collections.emptyMap()); + } + + /** + * + * Parse prompt template by ID + * + * @param promptTemplateId + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @param metadata + * (optional, default to false) + * @param promptTemplateSubstitutionRequest + * (optional) + * @param additionalHeaders + * additionalHeaders for this call + * @return PromptTemplateSubstitutionResponse + * @throws ApiException + * if fails to make API call + */ + public PromptTemplateSubstitutionResponse parsePromptTemplateById( + @javax.annotation.Nonnull UUID promptTemplateId, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope, + @javax.annotation.Nullable Boolean metadata, + @javax.annotation.Nullable PromptTemplateSubstitutionRequest promptTemplateSubstitutionRequest, + Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = promptTemplateSubstitutionRequest; + + // verify the required parameter 'promptTemplateId' is set + if( promptTemplateId == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'promptTemplateId' when calling parsePromptTemplateById"); + } + + // create path and map variables + String localVarPath = + "/lm/promptTemplates/{promptTemplateId}/substitution" + .replaceAll( + "\\{" + "promptTemplateId" + "\\}", + apiClient.escapeString(apiClient.parameterToString(promptTemplateId))); + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPair("metadata", metadata)); + if( aiResourceGroup != null ) + localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if( aiResourceGroupScope != null ) + localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = + new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * + * Parse prompt template by name and version + * + * @param scenario + * (required) + * @param version + * (required) + * @param name + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @param metadata + * (optional, default to false) + * @param promptTemplateSubstitutionRequest + * (optional) + * @return PromptTemplateSubstitutionResponse + * @throws ApiException + * if fails to make API call + */ + public PromptTemplateSubstitutionResponse parsePromptTemplateByNameVersion( + @javax.annotation.Nonnull String scenario, + @javax.annotation.Nonnull String version, + @javax.annotation.Nonnull String name, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope, + @javax.annotation.Nullable Boolean metadata, + @javax.annotation.Nullable PromptTemplateSubstitutionRequest promptTemplateSubstitutionRequest ) + throws ApiException + { + return this + .parsePromptTemplateByNameVersion( + scenario, + version, + name, + aiResourceGroup, + aiResourceGroupScope, + metadata, + promptTemplateSubstitutionRequest, + Collections.emptyMap()); + } + + /** + * + * Parse prompt template by name and version + * + * @param scenario + * (required) + * @param version + * (required) + * @param name + * (required) + * @param aiResourceGroup + * Specify a resource group id to use (optional) + * @param aiResourceGroupScope + * Specify whether the resource group scope is to be used (optional) + * @param metadata + * (optional, default to false) + * @param promptTemplateSubstitutionRequest + * (optional) + * @param additionalHeaders + * additionalHeaders for this call + * @return PromptTemplateSubstitutionResponse + * @throws ApiException + * if fails to make API call + */ + public PromptTemplateSubstitutionResponse parsePromptTemplateByNameVersion( + @javax.annotation.Nonnull String scenario, + @javax.annotation.Nonnull String version, + @javax.annotation.Nonnull String name, + @javax.annotation.Nullable String aiResourceGroup, + @javax.annotation.Nullable String aiResourceGroupScope, + @javax.annotation.Nullable Boolean metadata, + @javax.annotation.Nullable PromptTemplateSubstitutionRequest promptTemplateSubstitutionRequest, + Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = promptTemplateSubstitutionRequest; + + // verify the required parameter 'scenario' is set + if( scenario == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'scenario' when calling parsePromptTemplateByNameVersion"); + } + + // verify the required parameter 'version' is set + if( version == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'version' when calling parsePromptTemplateByNameVersion"); + } + + // verify the required parameter 'name' is set + if( name == null ) { + throw new ApiException( + 400, + "Missing the required parameter 'name' when calling parsePromptTemplateByNameVersion"); + } + + // create path and map variables + String localVarPath = + "/lm/scenarios/{scenario}/promptTemplates/{name}/versions/{version}/substitution" + .replaceAll("\\{" + "scenario" + "\\}", apiClient.escapeString(apiClient.parameterToString(scenario))) + .replaceAll("\\{" + "version" + "\\}", apiClient.escapeString(apiClient.parameterToString(version))) + .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(apiClient.parameterToString(name))); + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPair("metadata", metadata)); + if( aiResourceGroup != null ) + localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if( aiResourceGroupScope != null ) + localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + TypeReference localVarReturnType = + new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + @Override + public T invokeAPI( + String url, + String method, + Object request, + TypeReference returnType, + Map additionalHeaders ) + throws ApiException + { + String localVarPath = url.replace(apiClient.getBaseURL(), ""); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + return apiClient + .invokeAPI( + localVarPath, + method, + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + request, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + returnType); + } +} diff --git a/datamodel/openapi/openapi-core/pom.xml b/datamodel/openapi/openapi-core/pom.xml index 1f5f8dcd0..272303c75 100644 --- a/datamodel/openapi/openapi-core/pom.xml +++ b/datamodel/openapi/openapi-core/pom.xml @@ -59,10 +59,12 @@ org.springframework spring-core + true org.springframework spring-web + true com.fasterxml.jackson.core @@ -95,11 +97,6 @@ spring-test test - - org.apache.httpcomponents.core5 - httpcore5 - test - org.apache.httpcomponents.core5 httpcore5 diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java index a9e673078..e8669d7bb 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java @@ -43,10 +43,10 @@ import org.apache.hc.client5.http.entity.UrlEncodedFormEntity; import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder; import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; -import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse; import org.apache.hc.client5.http.impl.classic.HttpClients; import org.apache.hc.client5.http.impl.cookie.BasicClientCookie; import org.apache.hc.client5.http.protocol.HttpClientContext; +import org.apache.hc.core5.http.ClassicHttpResponse; import org.apache.hc.core5.http.ContentType; import org.apache.hc.core5.http.Header; import org.apache.hc.core5.http.HttpEntity; @@ -54,6 +54,7 @@ import org.apache.hc.core5.http.HttpStatus; import org.apache.hc.core5.http.NameValuePair; import org.apache.hc.core5.http.ParseException; +import org.apache.hc.core5.http.io.HttpClientResponseHandler; import org.apache.hc.core5.http.io.entity.ByteArrayEntity; import org.apache.hc.core5.http.io.entity.EntityUtils; import org.apache.hc.core5.http.io.entity.FileEntity; @@ -99,7 +100,7 @@ public class ApiClient public ApiClient( CloseableHttpClient httpClient ) { objectMapper = new ObjectMapper(); - objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + objectMapper.setDefaultPropertyInclusion(JsonInclude.Include.NON_NULL); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); objectMapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); @@ -775,7 +776,7 @@ public HttpEntity serialize( Object obj, Map formParams, Content * IO exception */ @SuppressWarnings( "unchecked" ) - public T deserialize( CloseableHttpResponse response, TypeReference valueType ) + public T deserialize( ClassicHttpResponse response, TypeReference valueType ) throws ApiException, IOException, ParseException @@ -814,7 +815,7 @@ public T deserialize( CloseableHttpResponse response, TypeReference value } } - protected File downloadFileFromResponse( CloseableHttpResponse response ) + protected File downloadFileFromResponse( ClassicHttpResponse response ) throws IOException { Header contentDispositionHeader = response.getFirstHeader("Content-Disposition"); @@ -968,7 +969,30 @@ protected Cookie buildCookie( String key, String value, URI uri ) return cookie; } - protected T processResponse( CloseableHttpResponse response, TypeReference returnType ) + /** + * Creates an HttpClientResponseHandler for processing HTTP responses. Wraps checked exceptions (ParseException, + * ApiException) as IOException since the handler interface only allows IOException to be thrown. + * + * @param + * Type + * @param returnType + * Return type + * @return HttpClientResponseHandler instance + */ + protected HttpClientResponseHandler createResponseHandler( TypeReference returnType ) + { + return response -> { + try { + return processResponse(response, returnType); + } + catch( ParseException | ApiException e ) { + // Wrap exceptions as IOException since handler can only throw IOException + throw new IOException("Failed to process response: " + e.getMessage(), e); + } + }; + } + + protected T processResponse( ClassicHttpResponse response, TypeReference returnType ) throws ApiException, IOException, ParseException @@ -1089,10 +1113,11 @@ public T invokeAPI( builder.setEntity(new StringEntity("", contentTypeObj)); } - try( CloseableHttpResponse response = httpClient.execute(builder.build(), context) ) { - return processResponse(response, returnType); + try { + HttpClientResponseHandler responseHandler = createResponseHandler(returnType); + return httpClient.execute(builder.build(), context, responseHandler); } - catch( IOException | ParseException e ) { + catch( IOException e ) { throw new ApiException(e); } } diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiException.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiException.java index 3257e1591..b8ab4534c 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiException.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiException.java @@ -20,7 +20,7 @@ public class ApiException extends Exception private static final long serialVersionUID = 1L; private int code = 0; - private Map> responseHeaders = null; + private transient Map> responseHeaders = null; private String responseBody = null; public ApiException() diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339DateFormat.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339DateFormat.java index ef267cdc8..8d841d0bd 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339DateFormat.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339DateFormat.java @@ -3,7 +3,7 @@ * Prompt Storage service for Design time & Runtime prompt templates. * * The version of the OpenAPI document: 0.0.1 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -12,8 +12,6 @@ package com.sap.cloud.sdk.services.openapi.apache; -import com.fasterxml.jackson.databind.util.StdDateFormat; - import java.text.DateFormat; import java.text.DecimalFormat; import java.text.FieldPosition; @@ -22,36 +20,42 @@ import java.util.GregorianCalendar; import java.util.TimeZone; -public class RFC3339DateFormat extends DateFormat { - private static final long serialVersionUID = 1L; - private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - - public RFC3339DateFormat() { - this.calendar = new GregorianCalendar(); - this.numberFormat = new DecimalFormat(); - } - - @Override - public Date parse(String source) { - return parse(source, new ParsePosition(0)); - } - - @Override - public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); - } - - @Override - public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); - } - - @Override - public Object clone() { - return super.clone(); - } +import com.fasterxml.jackson.databind.util.StdDateFormat; + +public class RFC3339DateFormat extends DateFormat +{ + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat().withTimeZone(TIMEZONE_Z).withColonInTimeZone(true); + + public RFC3339DateFormat() + { + this.calendar = new GregorianCalendar(); + this.numberFormat = new DecimalFormat(); + } + + @Override + public Date parse( String source ) + { + return parse(source, new ParsePosition(0)); + } + + @Override + public Date parse( String source, ParsePosition pos ) + { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format( Date date, StringBuffer toAppendTo, FieldPosition fieldPosition ) + { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() + { + return super.clone(); + } } diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339InstantDeserializer.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339InstantDeserializer.java index 383c28dd6..ae5560a88 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339InstantDeserializer.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339InstantDeserializer.java @@ -3,7 +3,7 @@ * Prompt Storage service for Design time & Runtime prompt templates. * * The version of the OpenAPI document: 0.0.1 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -12,11 +12,6 @@ package com.sap.cloud.sdk.services.openapi.apache; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; -import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; - import java.io.IOException; import java.time.Instant; import java.time.OffsetDateTime; @@ -28,72 +23,86 @@ import java.util.function.BiFunction; import java.util.function.Function; -public class RFC3339InstantDeserializer extends InstantDeserializer { +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; +import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; + +public class RFC3339InstantDeserializer extends InstantDeserializer +{ private static final long serialVersionUID = 1L; - private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); - private final static boolean DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS - = JavaTimeFeature.ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS.enabledByDefault(); + private final static boolean DEFAULT_NORMALIZE_ZONE_ID = + JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); + private final static boolean DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS = + JavaTimeFeature.ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS.enabledByDefault(); - public static final RFC3339InstantDeserializer INSTANT = new RFC3339InstantDeserializer<>( - Instant.class, DateTimeFormatter.ISO_INSTANT, - Instant::from, - a -> Instant.ofEpochMilli( a.value ), - a -> Instant.ofEpochSecond( a.integer, a.fraction ), - null, - true, // yes, replace zero offset with Z - DEFAULT_NORMALIZE_ZONE_ID, - DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS - ); + public static final RFC3339InstantDeserializer INSTANT = + new RFC3339InstantDeserializer<>( + Instant.class, + DateTimeFormatter.ISO_INSTANT, + Instant::from, + a -> Instant.ofEpochMilli(a.value), + a -> Instant.ofEpochSecond(a.integer, a.fraction), + null, + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS); - public static final RFC3339InstantDeserializer OFFSET_DATE_TIME = new RFC3339InstantDeserializer<>( - OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, - OffsetDateTime::from, - a -> OffsetDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), - a -> OffsetDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), - (d, z) -> ( d.isEqual( OffsetDateTime.MIN ) || d.isEqual( OffsetDateTime.MAX ) ? - d : - d.withOffsetSameInstant( z.getRules().getOffset( d.toLocalDateTime() ) ) ), - true, // yes, replace zero offset with Z - DEFAULT_NORMALIZE_ZONE_ID, - DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS - ); + public static final RFC3339InstantDeserializer OFFSET_DATE_TIME = + new RFC3339InstantDeserializer<>( + OffsetDateTime.class, + DateTimeFormatter.ISO_OFFSET_DATE_TIME, + OffsetDateTime::from, + a -> OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId), + a -> OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId), + ( + d, + z ) -> (d.isEqual(OffsetDateTime.MIN) || d.isEqual(OffsetDateTime.MAX) + ? d + : d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime()))), + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS); - public static final RFC3339InstantDeserializer ZONED_DATE_TIME = new RFC3339InstantDeserializer<>( - ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, - ZonedDateTime::from, - a -> ZonedDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), - a -> ZonedDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), - ZonedDateTime::withZoneSameInstant, - false, // keep zero offset and Z separate since zones explicitly supported - DEFAULT_NORMALIZE_ZONE_ID, - DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS - ); + public static final RFC3339InstantDeserializer ZONED_DATE_TIME = + new RFC3339InstantDeserializer<>( + ZonedDateTime.class, + DateTimeFormatter.ISO_ZONED_DATE_TIME, + ZonedDateTime::from, + a -> ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId), + a -> ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId), + ZonedDateTime::withZoneSameInstant, + false, // keep zero offset and Z separate since zones explicitly supported + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS); protected RFC3339InstantDeserializer( - Class supportedType, - DateTimeFormatter formatter, - Function parsedToValue, - Function fromMilliseconds, - Function fromNanoseconds, - BiFunction adjust, - boolean replaceZeroOffsetAsZ, - boolean normalizeZoneId, - boolean readNumericStringsAsTimestamp) { + Class supportedType, + DateTimeFormatter formatter, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust, + boolean replaceZeroOffsetAsZ, + boolean normalizeZoneId, + boolean readNumericStringsAsTimestamp ) + { super( - supportedType, - formatter, - parsedToValue, - fromMilliseconds, - fromNanoseconds, - adjust, - replaceZeroOffsetAsZ, - normalizeZoneId, - readNumericStringsAsTimestamp - ); + supportedType, + formatter, + parsedToValue, + fromMilliseconds, + fromNanoseconds, + adjust, + replaceZeroOffsetAsZ, + normalizeZoneId, + readNumericStringsAsTimestamp); } @Override - protected T _fromString(JsonParser p, DeserializationContext ctxt, String string0) throws IOException { - return super._fromString(p, ctxt, string0.replace( ' ', 'T' )); + protected T _fromString( JsonParser p, DeserializationContext ctxt, String string0 ) + throws IOException + { + return super._fromString(p, ctxt, string0.replace(' ', 'T')); } -} \ No newline at end of file +} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339JavaTimeModule.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339JavaTimeModule.java index 36108fbc1..ce882de8c 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339JavaTimeModule.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339JavaTimeModule.java @@ -3,7 +3,7 @@ * Prompt Storage service for Design time & Runtime prompt templates. * * The version of the OpenAPI document: 0.0.1 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -12,26 +12,29 @@ package com.sap.cloud.sdk.services.openapi.apache; -import com.fasterxml.jackson.databind.module.SimpleModule; - import java.time.Instant; import java.time.OffsetDateTime; import java.time.ZonedDateTime; -public class RFC3339JavaTimeModule extends SimpleModule { +import com.fasterxml.jackson.databind.module.SimpleModule; + +public class RFC3339JavaTimeModule extends SimpleModule +{ private static final long serialVersionUID = 1L; - public RFC3339JavaTimeModule() { + public RFC3339JavaTimeModule() + { super("RFC3339JavaTimeModule"); } - @Override - public void setupModule(SetupContext context) { - super.setupModule(context); + @Override + public void setupModule( SetupContext context ) + { + super.setupModule(context); - addDeserializer(Instant.class, RFC3339InstantDeserializer.INSTANT); - addDeserializer(OffsetDateTime.class, RFC3339InstantDeserializer.OFFSET_DATE_TIME); - addDeserializer(ZonedDateTime.class, RFC3339InstantDeserializer.ZONED_DATE_TIME); - } + addDeserializer(Instant.class, RFC3339InstantDeserializer.INSTANT); + addDeserializer(OffsetDateTime.class, RFC3339InstantDeserializer.OFFSET_DATE_TIME); + addDeserializer(ZonedDateTime.class, RFC3339InstantDeserializer.ZONED_DATE_TIME); + } } diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/StringUtil.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/StringUtil.java index 3a0dbff69..8fe49ac89 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/StringUtil.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/StringUtil.java @@ -3,80 +3,89 @@ * Prompt Storage service for Design time & Runtime prompt templates. * * The version of the OpenAPI document: 0.0.1 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package com.sap.cloud.sdk.services.openapi.apache; import java.util.Collection; import java.util.Iterator; -public class StringUtil { - /** - * Check if the given array contains the given value (with case-insensitive comparison). - * - * @param array The array - * @param value The value to search - * @return true if the array contains the value - */ - public static boolean containsIgnoreCase(String[] array, String value) { - for (String str : array) { - if (value == null && str == null) { - return true; - } - if (value != null && value.equalsIgnoreCase(str)) { - return true; - } +public class StringUtil +{ + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array + * The array + * @param value + * The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase( String[] array, String value ) + { + for( String str : array ) { + if( value == null && str == null ) { + return true; + } + if( value != null && value.equalsIgnoreCase(str) ) { + return true; + } + } + return false; } - return false; - } - /** - * Join an array of strings with the given separator. - *

- * Note: This might be replaced by utility method from commons-lang or guava someday - * if one of those libraries is added as dependency. - *

- * - * @param array The array of strings - * @param separator The separator - * @return the resulting string - */ - public static String join(String[] array, String separator) { - int len = array.length; - if (len == 0) { - return ""; - } + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday if one of those libraries is + * added as dependency. + *

+ * + * @param array + * The array of strings + * @param separator + * The separator + * @return the resulting string + */ + public static String join( String[] array, String separator ) + { + int len = array.length; + if( len == 0 ) { + return ""; + } - StringBuilder out = new StringBuilder(); - out.append(array[0]); - for (int i = 1; i < len; i++) { - out.append(separator).append(array[i]); + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for( int i = 1; i < len; i++ ) { + out.append(separator).append(array[i]); + } + return out.toString(); } - return out.toString(); - } - /** - * Join a list of strings with the given separator. - * - * @param list The list of strings - * @param separator The separator - * @return the resulting string - */ - public static String join(Collection list, String separator) { - Iterator iterator = list.iterator(); - StringBuilder out = new StringBuilder(); - if (iterator.hasNext()) { - out.append(iterator.next()); - } - while (iterator.hasNext()) { - out.append(separator).append(iterator.next()); + /** + * Join a list of strings with the given separator. + * + * @param list + * The list of strings + * @param separator + * The separator + * @return the resulting string + */ + public static String join( Collection list, String separator ) + { + Iterator iterator = list.iterator(); + StringBuilder out = new StringBuilder(); + if( iterator.hasNext() ) { + out.append(iterator.next()); + } + while( iterator.hasNext() ) { + out.append(separator).append(iterator.next()); + } + return out.toString(); } - return out.toString(); - } } From ea0eeb666ecf04e79b00ddcb8417e2ba92d85aa1 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Thu, 11 Dec 2025 15:34:58 +0100 Subject: [PATCH 10/26] Simply api-apache-sample --- .../openapi/openapi-api-apache-sample/pom.xml | 4 +- .../sample/api/OrchestrationConfigsApi.java | 871 ------- .../openapi/apache/sample/api/OrdersApi.java | 162 ++ .../apache/sample/api/PromptTemplatesApi.java | 1173 ---------- .../openapi/apache/sample/api/SodasApi.java | 395 ++++ .../openapi/apache/sample/model/AllOf.java | 413 ++++ .../openapi/apache/sample/model/AnyOf.java | 413 ++++ .../sample/model/AssistantChatMessage.java | 414 ---- .../sample/model/AzureContentSafetyInput.java | 371 --- .../AzureContentSafetyInputFilterConfig.java | 312 --- .../model/AzureContentSafetyOutput.java | 374 --- .../AzureContentSafetyOutputFilterConfig.java | 312 --- .../apache/sample/model/AzureThreshold.java | 86 - .../{ResponseFormatText.java => Bar.java} | 135 +- .../sample/model/ChatCompletionTool.java | 309 --- .../apache/sample/model/ChatMessage.java | 36 - .../openapi/apache/sample/model/Cola.java | 327 +++ ...atMessageContent.java => ColaBarCode.java} | 25 +- ...rChatMessageContent.java => ColaLogo.java} | 25 +- .../apache/sample/model/DPIConfig.java | 545 ----- .../model/DPIConfigMaskGroundingInput.java | 202 -- .../apache/sample/model/DPICustomEntity.java | 241 -- .../apache/sample/model/DPIEntities.java | 130 -- .../sample/model/DPIMethodConstant.java | 309 --- .../sample/model/DPIMethodFabricatedData.java | 267 --- .../sample/model/DPIStandardEntity.java | 242 -- .../DPIStandardEntityReplacementStrategy.java | 33 - .../sample/model/DataRepositoryType.java | 82 - .../sample/model/DeveloperChatMessage.java | 309 --- .../sample/model/DocumentGroundingFilter.java | 546 ----- .../apache/sample/model/ErrorResponse.java | 241 -- .../{KeyValueListPair.java => Fanta.java} | 162 +- .../apache/sample/model/FantaFlavor.java | 108 + .../sample/model/FilteringModuleConfig.java | 241 -- .../sample/model/FilteringStreamOptions.java | 202 -- .../{ImageContentUrl.java => FlavorType.java} | 116 +- ...ResponseFormatJsonObject.java => Foo.java} | 136 +- .../apache/sample/model/FunctionObject.java | 370 --- .../sample/model/GlobalStreamOptions.java | 308 --- .../GroundingFilterSearchConfiguration.java | 251 -- .../sample/model/GroundingModuleConfig.java | 309 --- .../model/GroundingModuleConfigConfig.java | 323 --- ...oundingModuleConfigConfigFiltersInner.java | 31 - ...oundingModuleConfigConfigPlaceholders.java | 263 --- .../apache/sample/model/ImageContent.java | 309 --- .../sample/model/ImageContentImageUrl.java | 241 -- .../sample/model/InputFilteringConfig.java | 219 -- .../apache/sample/model/LLMModelDetails.java | 397 ---- .../apache/sample/model/LlamaGuard38b.java | 773 ------- .../model/LlamaGuard38bFilterConfig.java | 310 --- .../MaskingModuleConfigMaskingProviders.java | 226 -- .../model/MaskingModuleConfigProviders.java | 218 -- .../apache/sample/model/MessageToolCall.java | 352 --- .../sample/model/MessageToolCallFunction.java | 248 -- .../apache/sample/model/ModuleConfigs.java | 370 --- .../sample/model/MultiChatTemplate.java | 260 --- .../{MultiChatContent.java => OneOf.java} | 10 +- ...onfig.java => OneOfWithDiscriminator.java} | 15 +- ... => OneOfWithDiscriminatorAndMapping.java} | 15 +- ...g.java => OneOfWithEnumDiscriminator.java} | 15 +- .../sample/model/OrchestrationConfig.java | 241 -- .../OrchestrationConfigDeleteResponse.java | 201 -- .../model/OrchestrationConfigGetResponse.java | 555 ----- .../OrchestrationConfigListResponse.java | 262 --- .../model/OrchestrationConfigPostRequest.java | 328 --- .../OrchestrationConfigPostResponse.java | 372 --- .../model/OrchestrationConfigResource.java | 555 ----- .../openapi/apache/sample/model/Order.java | 370 +++ .../sample/model/OrderWithTimestamp.java | 415 ++++ .../sample/model/OutputFilterConfig.java | 33 - .../sample/model/OutputFilteringConfig.java | 262 --- .../apache/sample/model/PromptTemplate.java | 33 - .../model/PromptTemplateDeleteResponse.java | 199 -- .../model/PromptTemplateGetResponse.java | 555 ----- .../model/PromptTemplateListResponse.java | 261 --- .../model/PromptTemplatePostRequest.java | 328 --- .../model/PromptTemplatePostResponse.java | 372 --- .../sample/model/PromptTemplateSpec.java | 411 ---- .../PromptTemplateSpecResponseFormat.java | 35 - .../PromptTemplateSubstitutionRequest.java | 201 -- .../PromptTemplateSubstitutionResponse.java | 263 --- .../model/PromptTemplatingModuleConfig.java | 242 -- .../PromptTemplatingModuleConfigPrompt.java | 32 - .../model/ResponseFormatJsonSchema.java | 310 --- .../ResponseFormatJsonSchemaJsonSchema.java | 366 --- .../model/RuntimeOrchestrationConfigFile.java | 328 --- .../model/RuntimePromptTemplateFile.java | 328 --- .../RuntimePromptTemplateFileMetadata.java | 287 --- ...SAPDocumentTranslationApplyToSelector.java | 384 ---- .../model/SAPDocumentTranslationInput.java | 355 --- .../SAPDocumentTranslationInputConfig.java | 308 --- .../model/SAPDocumentTranslationOutput.java | 310 --- .../SAPDocumentTranslationOutputConfig.java | 245 -- ...cumentTranslationOutputTargetLanguage.java | 69 - .../model/SearchDocumentKeyValueListPair.java | 321 --- .../sample/model/SearchSelectOptionEnum.java | 80 - .../sample/model/SingleChatTemplate.java | 241 -- .../openapi/apache/sample/model/Soda.java | 448 ++++ .../apache/sample/model/SodaWithId.java | 491 ++++ .../sample/model/SystemChatMessage.java | 309 --- .../openapi/apache/sample/model/Template.java | 389 ---- .../apache/sample/model/TemplateRef.java | 198 -- .../apache/sample/model/TemplateRefByID.java | 322 --- .../TemplateRefByScenarioNameVersion.java | 409 ---- .../sample/model/TemplateRefTemplateRef.java | 33 - .../sample/model/TemplateResponseFormat.java | 34 - .../apache/sample/model/TextContent.java | 309 --- .../apache/sample/model/ToolChatMessage.java | 352 --- .../sample/model/TranslationModuleConfig.java | 242 -- .../apache/sample/model/UserChatMessage.java | 309 --- .../model/UserChatMessageContentItem.java | 358 --- .../src/main/resources/prompt-registry.yaml | 2026 ----------------- .../src/main/resources/sodastore.yaml | 307 +++ 113 files changed, 4234 insertions(+), 28862 deletions(-) delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrchestrationConfigsApi.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/PromptTemplatesApi.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AllOf.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AnyOf.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AssistantChatMessage.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyInput.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyInputFilterConfig.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyOutput.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyOutputFilterConfig.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureThreshold.java rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/{ResponseFormatText.java => Bar.java} (62%) delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatCompletionTool.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatMessage.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Cola.java rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/{ChatMessageContent.java => ColaBarCode.java} (60%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/{UserChatMessageContent.java => ColaLogo.java} (55%) delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIConfig.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIConfigMaskGroundingInput.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPICustomEntity.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIEntities.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIMethodConstant.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIMethodFabricatedData.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIStandardEntity.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIStandardEntityReplacementStrategy.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DataRepositoryType.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DeveloperChatMessage.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DocumentGroundingFilter.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ErrorResponse.java rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/{KeyValueListPair.java => Fanta.java} (50%) create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FantaFlavor.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FilteringModuleConfig.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FilteringStreamOptions.java rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/{ImageContentUrl.java => FlavorType.java} (56%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/{ResponseFormatJsonObject.java => Foo.java} (61%) delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FunctionObject.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GlobalStreamOptions.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingFilterSearchConfiguration.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfig.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfig.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfigFiltersInner.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfigPlaceholders.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContent.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContentImageUrl.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/InputFilteringConfig.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LLMModelDetails.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LlamaGuard38b.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LlamaGuard38bFilterConfig.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfigMaskingProviders.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfigProviders.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MessageToolCall.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MessageToolCallFunction.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ModuleConfigs.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MultiChatTemplate.java rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/{MultiChatContent.java => OneOf.java} (67%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/{MaskingModuleConfig.java => OneOfWithDiscriminator.java} (57%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/{DPIEntityConfig.java => OneOfWithDiscriminatorAndMapping.java} (55%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/{InputFilterConfig.java => OneOfWithEnumDiscriminator.java} (57%) delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfig.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigDeleteResponse.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigGetResponse.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigListResponse.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigPostRequest.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigPostResponse.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigResource.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Order.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrderWithTimestamp.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OutputFilterConfig.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OutputFilteringConfig.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplate.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateDeleteResponse.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateGetResponse.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateListResponse.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatePostRequest.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatePostResponse.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSpec.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSpecResponseFormat.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSubstitutionRequest.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSubstitutionResponse.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatingModuleConfig.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatingModuleConfigPrompt.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonSchema.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonSchemaJsonSchema.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimeOrchestrationConfigFile.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimePromptTemplateFile.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimePromptTemplateFileMetadata.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationApplyToSelector.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationInput.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationInputConfig.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutput.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutputConfig.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutputTargetLanguage.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SearchDocumentKeyValueListPair.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SearchSelectOptionEnum.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SingleChatTemplate.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Soda.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SodaWithId.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SystemChatMessage.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Template.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRef.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefByID.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefByScenarioNameVersion.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefTemplateRef.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateResponseFormat.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TextContent.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ToolChatMessage.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TranslationModuleConfig.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessage.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessageContentItem.java delete mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/resources/prompt-registry.yaml create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/resources/sodastore.yaml diff --git a/datamodel/openapi/openapi-api-apache-sample/pom.xml b/datamodel/openapi/openapi-api-apache-sample/pom.xml index 4e01eb1b1..533a7be33 100644 --- a/datamodel/openapi/openapi-api-apache-sample/pom.xml +++ b/datamodel/openapi/openapi-api-apache-sample/pom.xml @@ -47,13 +47,13 @@ - prompt-registry + sample-generation generate generate-sources - ${project.basedir}/src/main/resources/prompt-registry.yaml + ${project.basedir}/src/main/resources/sodastore.yaml com.sap.cloud.sdk.datamodel.openapi.apache.sample.api com.sap.cloud.sdk.datamodel.openapi.apache.sample.model diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrchestrationConfigsApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrchestrationConfigsApi.java deleted file mode 100644 index a18aada96..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrchestrationConfigsApi.java +++ /dev/null @@ -1,871 +0,0 @@ -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.api; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.StringJoiner; -import java.util.UUID; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.OrchestrationConfigDeleteResponse; -import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.OrchestrationConfigGetResponse; -import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.OrchestrationConfigListResponse; -import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.OrchestrationConfigPostRequest; -import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.OrchestrationConfigPostResponse; -import com.sap.cloud.sdk.services.openapi.apache.ApiClient; -import com.sap.cloud.sdk.services.openapi.apache.ApiException; -import com.sap.cloud.sdk.services.openapi.apache.BaseApi; -import com.sap.cloud.sdk.services.openapi.apache.Configuration; -import com.sap.cloud.sdk.services.openapi.apache.Pair; - -public class OrchestrationConfigsApi extends BaseApi -{ - - public OrchestrationConfigsApi() - { - super(Configuration.getDefaultApiClient()); - } - - public OrchestrationConfigsApi( ApiClient apiClient ) - { - super(apiClient); - } - - /** - * - * Create or update an orchestration config - * - * @param orchestrationConfigPostRequest - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @return OrchestrationConfigPostResponse - * @throws ApiException - * if fails to make API call - */ - public OrchestrationConfigPostResponse createUpdateOrchestrationConfig( - @javax.annotation.Nonnull OrchestrationConfigPostRequest orchestrationConfigPostRequest, - @javax.annotation.Nullable String aiResourceGroup ) - throws ApiException - { - return this - .createUpdateOrchestrationConfig(orchestrationConfigPostRequest, aiResourceGroup, Collections.emptyMap()); - } - - /** - * - * Create or update an orchestration config - * - * @param orchestrationConfigPostRequest - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param additionalHeaders - * additionalHeaders for this call - * @return OrchestrationConfigPostResponse - * @throws ApiException - * if fails to make API call - */ - public OrchestrationConfigPostResponse createUpdateOrchestrationConfig( - @javax.annotation.Nonnull OrchestrationConfigPostRequest orchestrationConfigPostRequest, - @javax.annotation.Nullable String aiResourceGroup, - Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = orchestrationConfigPostRequest; - - // verify the required parameter 'orchestrationConfigPostRequest' is set - if( orchestrationConfigPostRequest == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'orchestrationConfigPostRequest' when calling createUpdateOrchestrationConfig"); - } - - // create path and map variables - String localVarPath = "/registry/v2/orchestrationConfigs"; - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if( aiResourceGroup != null ) - localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - TypeReference localVarReturnType = - new TypeReference() - { - }; - return apiClient - .invokeAPI( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - /** - * - * Delete orchestration config - * - * @param orchestrationConfigId - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @return OrchestrationConfigDeleteResponse - * @throws ApiException - * if fails to make API call - */ - public OrchestrationConfigDeleteResponse deleteOrchestrationConfig( - @javax.annotation.Nonnull UUID orchestrationConfigId, - @javax.annotation.Nullable String aiResourceGroup ) - throws ApiException - { - return this.deleteOrchestrationConfig(orchestrationConfigId, aiResourceGroup, Collections.emptyMap()); - } - - /** - * - * Delete orchestration config - * - * @param orchestrationConfigId - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param additionalHeaders - * additionalHeaders for this call - * @return OrchestrationConfigDeleteResponse - * @throws ApiException - * if fails to make API call - */ - public OrchestrationConfigDeleteResponse deleteOrchestrationConfig( - @javax.annotation.Nonnull UUID orchestrationConfigId, - @javax.annotation.Nullable String aiResourceGroup, - Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = null; - - // verify the required parameter 'orchestrationConfigId' is set - if( orchestrationConfigId == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'orchestrationConfigId' when calling deleteOrchestrationConfig"); - } - - // create path and map variables - String localVarPath = - "/registry/v2/orchestrationConfigs/{orchestrationConfigId}" - .replaceAll( - "\\{" + "orchestrationConfigId" + "\\}", - apiClient.escapeString(apiClient.parameterToString(orchestrationConfigId))); - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if( aiResourceGroup != null ) - localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - TypeReference localVarReturnType = - new TypeReference() - { - }; - return apiClient - .invokeAPI( - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - /** - * - * Export orchestration config - * - * @param orchestrationConfigId - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @return File - * @throws ApiException - * if fails to make API call - */ - public File exportOrchestrationConfig( - @javax.annotation.Nonnull UUID orchestrationConfigId, - @javax.annotation.Nullable String aiResourceGroup ) - throws ApiException - { - return this.exportOrchestrationConfig(orchestrationConfigId, aiResourceGroup, Collections.emptyMap()); - } - - /** - * - * Export orchestration config - * - * @param orchestrationConfigId - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param additionalHeaders - * additionalHeaders for this call - * @return File - * @throws ApiException - * if fails to make API call - */ - public File exportOrchestrationConfig( - @javax.annotation.Nonnull UUID orchestrationConfigId, - @javax.annotation.Nullable String aiResourceGroup, - Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = null; - - // verify the required parameter 'orchestrationConfigId' is set - if( orchestrationConfigId == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'orchestrationConfigId' when calling exportOrchestrationConfig"); - } - - // create path and map variables - String localVarPath = - "/registry/v2/orchestrationConfigs/{orchestrationConfigId}/export" - .replaceAll( - "\\{" + "orchestrationConfigId" + "\\}", - apiClient.escapeString(apiClient.parameterToString(orchestrationConfigId))); - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if( aiResourceGroup != null ) - localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/octet-stream", "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - TypeReference localVarReturnType = new TypeReference() - { - }; - return apiClient - .invokeAPI( - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - /** - * - * Get orchestration config by UUID - * - * @param orchestrationConfigId - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param resolveTemplateRef - * (optional, default to false) - * @return OrchestrationConfigGetResponse - * @throws ApiException - * if fails to make API call - */ - public OrchestrationConfigGetResponse getOrchestrationConfigByUuid( - @javax.annotation.Nonnull UUID orchestrationConfigId, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable Boolean resolveTemplateRef ) - throws ApiException - { - return this - .getOrchestrationConfigByUuid( - orchestrationConfigId, - aiResourceGroup, - resolveTemplateRef, - Collections.emptyMap()); - } - - /** - * - * Get orchestration config by UUID - * - * @param orchestrationConfigId - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param resolveTemplateRef - * (optional, default to false) - * @param additionalHeaders - * additionalHeaders for this call - * @return OrchestrationConfigGetResponse - * @throws ApiException - * if fails to make API call - */ - public OrchestrationConfigGetResponse getOrchestrationConfigByUuid( - @javax.annotation.Nonnull UUID orchestrationConfigId, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable Boolean resolveTemplateRef, - Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = null; - - // verify the required parameter 'orchestrationConfigId' is set - if( orchestrationConfigId == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'orchestrationConfigId' when calling getOrchestrationConfigByUuid"); - } - - // create path and map variables - String localVarPath = - "/registry/v2/orchestrationConfigs/{orchestrationConfigId}" - .replaceAll( - "\\{" + "orchestrationConfigId" + "\\}", - apiClient.escapeString(apiClient.parameterToString(orchestrationConfigId))); - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPair("resolve_template_ref", resolveTemplateRef)); - if( aiResourceGroup != null ) - localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - TypeReference localVarReturnType = - new TypeReference() - { - }; - return apiClient - .invokeAPI( - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - /** - * - * Import orchestration config - * - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param _file - * (optional) - * @return OrchestrationConfigPostResponse - * @throws ApiException - * if fails to make API call - */ - public OrchestrationConfigPostResponse importOrchestrationConfig( - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable File _file ) - throws ApiException - { - return this.importOrchestrationConfig(aiResourceGroup, _file, Collections.emptyMap()); - } - - /** - * - * Import orchestration config - * - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param _file - * (optional) - * @param additionalHeaders - * additionalHeaders for this call - * @return OrchestrationConfigPostResponse - * @throws ApiException - * if fails to make API call - */ - public OrchestrationConfigPostResponse importOrchestrationConfig( - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable File _file, - Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/registry/v2/orchestrationConfigs/import"; - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if( aiResourceGroup != null ) - localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); - - localVarHeaderParams.putAll(additionalHeaders); - - if( _file != null ) - localVarFormParams.put("file", _file); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { "multipart/form-data" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - TypeReference localVarReturnType = - new TypeReference() - { - }; - return apiClient - .invokeAPI( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - /** - * - * List orchestration config history - * - * @param scenario - * (required) - * @param version - * (required) - * @param name - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param includeSpec - * (optional, default to false) - * @param resolveTemplateRef - * (optional, default to false) - * @return OrchestrationConfigListResponse - * @throws ApiException - * if fails to make API call - */ - public OrchestrationConfigListResponse listOrchestrationConfigHistory( - @javax.annotation.Nonnull String scenario, - @javax.annotation.Nonnull String version, - @javax.annotation.Nonnull String name, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable Boolean includeSpec, - @javax.annotation.Nullable Boolean resolveTemplateRef ) - throws ApiException - { - return this - .listOrchestrationConfigHistory( - scenario, - version, - name, - aiResourceGroup, - includeSpec, - resolveTemplateRef, - Collections.emptyMap()); - } - - /** - * - * List orchestration config history - * - * @param scenario - * (required) - * @param version - * (required) - * @param name - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param includeSpec - * (optional, default to false) - * @param resolveTemplateRef - * (optional, default to false) - * @param additionalHeaders - * additionalHeaders for this call - * @return OrchestrationConfigListResponse - * @throws ApiException - * if fails to make API call - */ - public OrchestrationConfigListResponse listOrchestrationConfigHistory( - @javax.annotation.Nonnull String scenario, - @javax.annotation.Nonnull String version, - @javax.annotation.Nonnull String name, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable Boolean includeSpec, - @javax.annotation.Nullable Boolean resolveTemplateRef, - Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = null; - - // verify the required parameter 'scenario' is set - if( scenario == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'scenario' when calling listOrchestrationConfigHistory"); - } - - // verify the required parameter 'version' is set - if( version == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'version' when calling listOrchestrationConfigHistory"); - } - - // verify the required parameter 'name' is set - if( name == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'name' when calling listOrchestrationConfigHistory"); - } - - // create path and map variables - String localVarPath = - "/registry/v2/scenarios/{scenario}/orchestrationConfigs/{name}/versions/{version}/history" - .replaceAll("\\{" + "scenario" + "\\}", apiClient.escapeString(apiClient.parameterToString(scenario))) - .replaceAll("\\{" + "version" + "\\}", apiClient.escapeString(apiClient.parameterToString(version))) - .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(apiClient.parameterToString(name))); - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPair("include_spec", includeSpec)); - localVarQueryParams.addAll(apiClient.parameterToPair("resolve_template_ref", resolveTemplateRef)); - if( aiResourceGroup != null ) - localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - TypeReference localVarReturnType = - new TypeReference() - { - }; - return apiClient - .invokeAPI( - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - /** - * - * List orchestration configs - * - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param scenario - * (optional) - * @param name - * (optional) - * @param version - * (optional) - * @param retrieve - * (optional, default to both) - * @param includeSpec - * (optional, default to false) - * @param resolveTemplateRef - * (optional, default to false) - * @return OrchestrationConfigListResponse - * @throws ApiException - * if fails to make API call - */ - public OrchestrationConfigListResponse listOrchestrationConfigs( - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String scenario, - @javax.annotation.Nullable String name, - @javax.annotation.Nullable String version, - @javax.annotation.Nullable String retrieve, - @javax.annotation.Nullable Boolean includeSpec, - @javax.annotation.Nullable Boolean resolveTemplateRef ) - throws ApiException - { - return this - .listOrchestrationConfigs( - aiResourceGroup, - scenario, - name, - version, - retrieve, - includeSpec, - resolveTemplateRef, - Collections.emptyMap()); - } - - /** - * - * List orchestration configs - * - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param scenario - * (optional) - * @param name - * (optional) - * @param version - * (optional) - * @param retrieve - * (optional, default to both) - * @param includeSpec - * (optional, default to false) - * @param resolveTemplateRef - * (optional, default to false) - * @param additionalHeaders - * additionalHeaders for this call - * @return OrchestrationConfigListResponse - * @throws ApiException - * if fails to make API call - */ - public OrchestrationConfigListResponse listOrchestrationConfigs( - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String scenario, - @javax.annotation.Nullable String name, - @javax.annotation.Nullable String version, - @javax.annotation.Nullable String retrieve, - @javax.annotation.Nullable Boolean includeSpec, - @javax.annotation.Nullable Boolean resolveTemplateRef, - Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/registry/v2/orchestrationConfigs"; - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPair("scenario", scenario)); - localVarQueryParams.addAll(apiClient.parameterToPair("name", name)); - localVarQueryParams.addAll(apiClient.parameterToPair("version", version)); - localVarQueryParams.addAll(apiClient.parameterToPair("retrieve", retrieve)); - localVarQueryParams.addAll(apiClient.parameterToPair("include_spec", includeSpec)); - localVarQueryParams.addAll(apiClient.parameterToPair("resolve_template_ref", resolveTemplateRef)); - if( aiResourceGroup != null ) - localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - TypeReference localVarReturnType = - new TypeReference() - { - }; - return apiClient - .invokeAPI( - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - @Override - public T invokeAPI( - String url, - String method, - Object request, - TypeReference returnType, - Map additionalHeaders ) - throws ApiException - { - String localVarPath = url.replace(apiClient.getBaseURL(), ""); - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - return apiClient - .invokeAPI( - localVarPath, - method, - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - request, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - returnType); - } -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java new file mode 100644 index 000000000..a68fbf053 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java @@ -0,0 +1,162 @@ +/* + * SodaStore API + * API for managing soda products and orders in SodaStore. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.api; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.StringJoiner; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.Order; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.ApiException; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Configuration; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + +public class OrdersApi extends BaseApi +{ + + public OrdersApi() + { + super(Configuration.getDefaultApiClient()); + } + + public OrdersApi( ApiClient apiClient ) + { + super(apiClient); + } + + /** + * Create a new order + * + * @param order + * The order details (required) + * @return Order + * @throws ApiException + * if fails to make API call + */ + public Order ordersPost( @javax.annotation.Nonnull Order order ) + throws ApiException + { + return this.ordersPost(order, Collections.emptyMap()); + } + + /** + * Create a new order + * + * @param order + * The order details (required) + * @param additionalHeaders + * additionalHeaders for this call + * @return Order + * @throws ApiException + * if fails to make API call + */ + public Order ordersPost( @javax.annotation.Nonnull Order order, Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = order; + + // verify the required parameter 'order' is set + if( order == null ) { + throw new ApiException(400, "Missing the required parameter 'order' when calling ordersPost"); + } + + // create path and map variables + String localVarPath = "/orders"; + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "apiKeyAuth" }; + + TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + @Override + public T invokeAPI( + String url, + String method, + Object request, + TypeReference returnType, + Map additionalHeaders ) + throws ApiException + { + String localVarPath = url.replace(apiClient.getBaseURL(), ""); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "apiKeyAuth" }; + + return apiClient + .invokeAPI( + localVarPath, + method, + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + request, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + returnType); + } +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/PromptTemplatesApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/PromptTemplatesApi.java deleted file mode 100644 index 4fb3e9f73..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/PromptTemplatesApi.java +++ /dev/null @@ -1,1173 +0,0 @@ -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.api; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.StringJoiner; -import java.util.UUID; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.PromptTemplateDeleteResponse; -import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.PromptTemplateGetResponse; -import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.PromptTemplateListResponse; -import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.PromptTemplatePostRequest; -import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.PromptTemplatePostResponse; -import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.PromptTemplateSubstitutionRequest; -import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.PromptTemplateSubstitutionResponse; -import com.sap.cloud.sdk.services.openapi.apache.ApiClient; -import com.sap.cloud.sdk.services.openapi.apache.ApiException; -import com.sap.cloud.sdk.services.openapi.apache.BaseApi; -import com.sap.cloud.sdk.services.openapi.apache.Configuration; -import com.sap.cloud.sdk.services.openapi.apache.Pair; - -public class PromptTemplatesApi extends BaseApi -{ - - public PromptTemplatesApi() - { - super(Configuration.getDefaultApiClient()); - } - - public PromptTemplatesApi( ApiClient apiClient ) - { - super(apiClient); - } - - /** - * - * Create or update a prompt template - * - * @param promptTemplatePostRequest - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @return PromptTemplatePostResponse - * @throws ApiException - * if fails to make API call - */ - public PromptTemplatePostResponse createUpdatePromptTemplate( - @javax.annotation.Nonnull PromptTemplatePostRequest promptTemplatePostRequest, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope ) - throws ApiException - { - return this - .createUpdatePromptTemplate( - promptTemplatePostRequest, - aiResourceGroup, - aiResourceGroupScope, - Collections.emptyMap()); - } - - /** - * - * Create or update a prompt template - * - * @param promptTemplatePostRequest - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @param additionalHeaders - * additionalHeaders for this call - * @return PromptTemplatePostResponse - * @throws ApiException - * if fails to make API call - */ - public PromptTemplatePostResponse createUpdatePromptTemplate( - @javax.annotation.Nonnull PromptTemplatePostRequest promptTemplatePostRequest, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope, - Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = promptTemplatePostRequest; - - // verify the required parameter 'promptTemplatePostRequest' is set - if( promptTemplatePostRequest == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'promptTemplatePostRequest' when calling createUpdatePromptTemplate"); - } - - // create path and map variables - String localVarPath = "/lm/promptTemplates"; - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if( aiResourceGroup != null ) - localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); - if( aiResourceGroupScope != null ) - localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - TypeReference localVarReturnType = new TypeReference() - { - }; - return apiClient - .invokeAPI( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - /** - * - * Delete prompt template - * - * @param promptTemplateId - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @return PromptTemplateDeleteResponse - * @throws ApiException - * if fails to make API call - */ - public PromptTemplateDeleteResponse deletePromptTemplate( - @javax.annotation.Nonnull UUID promptTemplateId, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope ) - throws ApiException - { - return this - .deletePromptTemplate(promptTemplateId, aiResourceGroup, aiResourceGroupScope, Collections.emptyMap()); - } - - /** - * - * Delete prompt template - * - * @param promptTemplateId - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @param additionalHeaders - * additionalHeaders for this call - * @return PromptTemplateDeleteResponse - * @throws ApiException - * if fails to make API call - */ - public PromptTemplateDeleteResponse deletePromptTemplate( - @javax.annotation.Nonnull UUID promptTemplateId, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope, - Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = null; - - // verify the required parameter 'promptTemplateId' is set - if( promptTemplateId == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'promptTemplateId' when calling deletePromptTemplate"); - } - - // create path and map variables - String localVarPath = - "/lm/promptTemplates/{promptTemplateId}" - .replaceAll( - "\\{" + "promptTemplateId" + "\\}", - apiClient.escapeString(apiClient.parameterToString(promptTemplateId))); - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if( aiResourceGroup != null ) - localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); - if( aiResourceGroupScope != null ) - localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - TypeReference localVarReturnType = - new TypeReference() - { - }; - return apiClient - .invokeAPI( - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - /** - * - * Export prompt template - * - * @param promptTemplateId - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @return File - * @throws ApiException - * if fails to make API call - */ - public File exportPromptTemplate( - @javax.annotation.Nonnull UUID promptTemplateId, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope ) - throws ApiException - { - return this - .exportPromptTemplate(promptTemplateId, aiResourceGroup, aiResourceGroupScope, Collections.emptyMap()); - } - - /** - * - * Export prompt template - * - * @param promptTemplateId - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @param additionalHeaders - * additionalHeaders for this call - * @return File - * @throws ApiException - * if fails to make API call - */ - public File exportPromptTemplate( - @javax.annotation.Nonnull UUID promptTemplateId, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope, - Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = null; - - // verify the required parameter 'promptTemplateId' is set - if( promptTemplateId == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'promptTemplateId' when calling exportPromptTemplate"); - } - - // create path and map variables - String localVarPath = - "/lm/promptTemplates/{promptTemplateId}/export" - .replaceAll( - "\\{" + "promptTemplateId" + "\\}", - apiClient.escapeString(apiClient.parameterToString(promptTemplateId))); - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if( aiResourceGroup != null ) - localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); - if( aiResourceGroupScope != null ) - localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/octet-stream", "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - TypeReference localVarReturnType = new TypeReference() - { - }; - return apiClient - .invokeAPI( - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - /** - * - * Get prompt template by UUID - * - * @param promptTemplateId - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @return PromptTemplateGetResponse - * @throws ApiException - * if fails to make API call - */ - public PromptTemplateGetResponse getPromptTemplateByUuid( - @javax.annotation.Nonnull UUID promptTemplateId, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope ) - throws ApiException - { - return this - .getPromptTemplateByUuid(promptTemplateId, aiResourceGroup, aiResourceGroupScope, Collections.emptyMap()); - } - - /** - * - * Get prompt template by UUID - * - * @param promptTemplateId - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @param additionalHeaders - * additionalHeaders for this call - * @return PromptTemplateGetResponse - * @throws ApiException - * if fails to make API call - */ - public PromptTemplateGetResponse getPromptTemplateByUuid( - @javax.annotation.Nonnull UUID promptTemplateId, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope, - Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = null; - - // verify the required parameter 'promptTemplateId' is set - if( promptTemplateId == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'promptTemplateId' when calling getPromptTemplateByUuid"); - } - - // create path and map variables - String localVarPath = - "/lm/promptTemplates/{promptTemplateId}" - .replaceAll( - "\\{" + "promptTemplateId" + "\\}", - apiClient.escapeString(apiClient.parameterToString(promptTemplateId))); - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if( aiResourceGroup != null ) - localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); - if( aiResourceGroupScope != null ) - localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - TypeReference localVarReturnType = new TypeReference() - { - }; - return apiClient - .invokeAPI( - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - /** - * - * Import prompt template - * - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @param _file - * (optional) - * @return PromptTemplatePostResponse - * @throws ApiException - * if fails to make API call - */ - public PromptTemplatePostResponse importPromptTemplate( - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope, - @javax.annotation.Nullable File _file ) - throws ApiException - { - return this.importPromptTemplate(aiResourceGroup, aiResourceGroupScope, _file, Collections.emptyMap()); - } - - /** - * - * Import prompt template - * - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @param _file - * (optional) - * @param additionalHeaders - * additionalHeaders for this call - * @return PromptTemplatePostResponse - * @throws ApiException - * if fails to make API call - */ - public PromptTemplatePostResponse importPromptTemplate( - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope, - @javax.annotation.Nullable File _file, - Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/lm/promptTemplates/import"; - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if( aiResourceGroup != null ) - localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); - if( aiResourceGroupScope != null ) - localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); - - localVarHeaderParams.putAll(additionalHeaders); - - if( _file != null ) - localVarFormParams.put("file", _file); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { "multipart/form-data" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - TypeReference localVarReturnType = new TypeReference() - { - }; - return apiClient - .invokeAPI( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - /** - * - * List prompt template history - * - * @param scenario - * (required) - * @param version - * (required) - * @param name - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @return PromptTemplateListResponse - * @throws ApiException - * if fails to make API call - */ - public PromptTemplateListResponse listPromptTemplateHistory( - @javax.annotation.Nonnull String scenario, - @javax.annotation.Nonnull String version, - @javax.annotation.Nonnull String name, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope ) - throws ApiException - { - return this - .listPromptTemplateHistory( - scenario, - version, - name, - aiResourceGroup, - aiResourceGroupScope, - Collections.emptyMap()); - } - - /** - * - * List prompt template history - * - * @param scenario - * (required) - * @param version - * (required) - * @param name - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @param additionalHeaders - * additionalHeaders for this call - * @return PromptTemplateListResponse - * @throws ApiException - * if fails to make API call - */ - public PromptTemplateListResponse listPromptTemplateHistory( - @javax.annotation.Nonnull String scenario, - @javax.annotation.Nonnull String version, - @javax.annotation.Nonnull String name, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope, - Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = null; - - // verify the required parameter 'scenario' is set - if( scenario == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'scenario' when calling listPromptTemplateHistory"); - } - - // verify the required parameter 'version' is set - if( version == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'version' when calling listPromptTemplateHistory"); - } - - // verify the required parameter 'name' is set - if( name == null ) { - throw new ApiException(400, "Missing the required parameter 'name' when calling listPromptTemplateHistory"); - } - - // create path and map variables - String localVarPath = - "/lm/scenarios/{scenario}/promptTemplates/{name}/versions/{version}/history" - .replaceAll("\\{" + "scenario" + "\\}", apiClient.escapeString(apiClient.parameterToString(scenario))) - .replaceAll("\\{" + "version" + "\\}", apiClient.escapeString(apiClient.parameterToString(version))) - .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(apiClient.parameterToString(name))); - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if( aiResourceGroup != null ) - localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); - if( aiResourceGroupScope != null ) - localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - TypeReference localVarReturnType = new TypeReference() - { - }; - return apiClient - .invokeAPI( - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - /** - * - * List prompt templates - * - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @param scenario - * (optional) - * @param name - * (optional) - * @param version - * (optional) - * @param retrieve - * (optional, default to both) - * @param includeSpec - * (optional, default to false) - * @return PromptTemplateListResponse - * @throws ApiException - * if fails to make API call - */ - public PromptTemplateListResponse listPromptTemplates( - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope, - @javax.annotation.Nullable String scenario, - @javax.annotation.Nullable String name, - @javax.annotation.Nullable String version, - @javax.annotation.Nullable String retrieve, - @javax.annotation.Nullable Boolean includeSpec ) - throws ApiException - { - return this - .listPromptTemplates( - aiResourceGroup, - aiResourceGroupScope, - scenario, - name, - version, - retrieve, - includeSpec, - Collections.emptyMap()); - } - - /** - * - * List prompt templates - * - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @param scenario - * (optional) - * @param name - * (optional) - * @param version - * (optional) - * @param retrieve - * (optional, default to both) - * @param includeSpec - * (optional, default to false) - * @param additionalHeaders - * additionalHeaders for this call - * @return PromptTemplateListResponse - * @throws ApiException - * if fails to make API call - */ - public PromptTemplateListResponse listPromptTemplates( - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope, - @javax.annotation.Nullable String scenario, - @javax.annotation.Nullable String name, - @javax.annotation.Nullable String version, - @javax.annotation.Nullable String retrieve, - @javax.annotation.Nullable Boolean includeSpec, - Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/lm/promptTemplates"; - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPair("scenario", scenario)); - localVarQueryParams.addAll(apiClient.parameterToPair("name", name)); - localVarQueryParams.addAll(apiClient.parameterToPair("version", version)); - localVarQueryParams.addAll(apiClient.parameterToPair("retrieve", retrieve)); - localVarQueryParams.addAll(apiClient.parameterToPair("includeSpec", includeSpec)); - if( aiResourceGroup != null ) - localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); - if( aiResourceGroupScope != null ) - localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - TypeReference localVarReturnType = new TypeReference() - { - }; - return apiClient - .invokeAPI( - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - /** - * - * Parse prompt template by ID - * - * @param promptTemplateId - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @param metadata - * (optional, default to false) - * @param promptTemplateSubstitutionRequest - * (optional) - * @return PromptTemplateSubstitutionResponse - * @throws ApiException - * if fails to make API call - */ - public PromptTemplateSubstitutionResponse parsePromptTemplateById( - @javax.annotation.Nonnull UUID promptTemplateId, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope, - @javax.annotation.Nullable Boolean metadata, - @javax.annotation.Nullable PromptTemplateSubstitutionRequest promptTemplateSubstitutionRequest ) - throws ApiException - { - return this - .parsePromptTemplateById( - promptTemplateId, - aiResourceGroup, - aiResourceGroupScope, - metadata, - promptTemplateSubstitutionRequest, - Collections.emptyMap()); - } - - /** - * - * Parse prompt template by ID - * - * @param promptTemplateId - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @param metadata - * (optional, default to false) - * @param promptTemplateSubstitutionRequest - * (optional) - * @param additionalHeaders - * additionalHeaders for this call - * @return PromptTemplateSubstitutionResponse - * @throws ApiException - * if fails to make API call - */ - public PromptTemplateSubstitutionResponse parsePromptTemplateById( - @javax.annotation.Nonnull UUID promptTemplateId, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope, - @javax.annotation.Nullable Boolean metadata, - @javax.annotation.Nullable PromptTemplateSubstitutionRequest promptTemplateSubstitutionRequest, - Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = promptTemplateSubstitutionRequest; - - // verify the required parameter 'promptTemplateId' is set - if( promptTemplateId == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'promptTemplateId' when calling parsePromptTemplateById"); - } - - // create path and map variables - String localVarPath = - "/lm/promptTemplates/{promptTemplateId}/substitution" - .replaceAll( - "\\{" + "promptTemplateId" + "\\}", - apiClient.escapeString(apiClient.parameterToString(promptTemplateId))); - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPair("metadata", metadata)); - if( aiResourceGroup != null ) - localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); - if( aiResourceGroupScope != null ) - localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - TypeReference localVarReturnType = - new TypeReference() - { - }; - return apiClient - .invokeAPI( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - /** - * - * Parse prompt template by name and version - * - * @param scenario - * (required) - * @param version - * (required) - * @param name - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @param metadata - * (optional, default to false) - * @param promptTemplateSubstitutionRequest - * (optional) - * @return PromptTemplateSubstitutionResponse - * @throws ApiException - * if fails to make API call - */ - public PromptTemplateSubstitutionResponse parsePromptTemplateByNameVersion( - @javax.annotation.Nonnull String scenario, - @javax.annotation.Nonnull String version, - @javax.annotation.Nonnull String name, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope, - @javax.annotation.Nullable Boolean metadata, - @javax.annotation.Nullable PromptTemplateSubstitutionRequest promptTemplateSubstitutionRequest ) - throws ApiException - { - return this - .parsePromptTemplateByNameVersion( - scenario, - version, - name, - aiResourceGroup, - aiResourceGroupScope, - metadata, - promptTemplateSubstitutionRequest, - Collections.emptyMap()); - } - - /** - * - * Parse prompt template by name and version - * - * @param scenario - * (required) - * @param version - * (required) - * @param name - * (required) - * @param aiResourceGroup - * Specify a resource group id to use (optional) - * @param aiResourceGroupScope - * Specify whether the resource group scope is to be used (optional) - * @param metadata - * (optional, default to false) - * @param promptTemplateSubstitutionRequest - * (optional) - * @param additionalHeaders - * additionalHeaders for this call - * @return PromptTemplateSubstitutionResponse - * @throws ApiException - * if fails to make API call - */ - public PromptTemplateSubstitutionResponse parsePromptTemplateByNameVersion( - @javax.annotation.Nonnull String scenario, - @javax.annotation.Nonnull String version, - @javax.annotation.Nonnull String name, - @javax.annotation.Nullable String aiResourceGroup, - @javax.annotation.Nullable String aiResourceGroupScope, - @javax.annotation.Nullable Boolean metadata, - @javax.annotation.Nullable PromptTemplateSubstitutionRequest promptTemplateSubstitutionRequest, - Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = promptTemplateSubstitutionRequest; - - // verify the required parameter 'scenario' is set - if( scenario == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'scenario' when calling parsePromptTemplateByNameVersion"); - } - - // verify the required parameter 'version' is set - if( version == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'version' when calling parsePromptTemplateByNameVersion"); - } - - // verify the required parameter 'name' is set - if( name == null ) { - throw new ApiException( - 400, - "Missing the required parameter 'name' when calling parsePromptTemplateByNameVersion"); - } - - // create path and map variables - String localVarPath = - "/lm/scenarios/{scenario}/promptTemplates/{name}/versions/{version}/substitution" - .replaceAll("\\{" + "scenario" + "\\}", apiClient.escapeString(apiClient.parameterToString(scenario))) - .replaceAll("\\{" + "version" + "\\}", apiClient.escapeString(apiClient.parameterToString(version))) - .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(apiClient.parameterToString(name))); - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPair("metadata", metadata)); - if( aiResourceGroup != null ) - localVarHeaderParams.put("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); - if( aiResourceGroupScope != null ) - localVarHeaderParams.put("AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - TypeReference localVarReturnType = - new TypeReference() - { - }; - return apiClient - .invokeAPI( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType); - } - - @Override - public T invokeAPI( - String url, - String method, - Object request, - TypeReference returnType, - Map additionalHeaders ) - throws ApiException - { - String localVarPath = url.replace(apiClient.getBaseURL(), ""); - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] {}; - - return apiClient - .invokeAPI( - localVarPath, - method, - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - request, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - returnType); - } -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java new file mode 100644 index 000000000..9a5265ac2 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java @@ -0,0 +1,395 @@ +/* + * SodaStore API + * API for managing soda products and orders in SodaStore. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.api; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.StringJoiner; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.Soda; +import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.SodaWithId; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.ApiException; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Configuration; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + +public class SodasApi extends BaseApi +{ + + public SodasApi() + { + super(Configuration.getDefaultApiClient()); + } + + public SodasApi( ApiClient apiClient ) + { + super(apiClient); + } + + /** + * Download soda product data as binary + * + * @param id + * ID of the soda product to download (required) + * @return File + * @throws ApiException + * if fails to make API call + */ + public File sodasDownloadIdGet( @javax.annotation.Nonnull Long id ) + throws ApiException + { + return this.sodasDownloadIdGet(id, Collections.emptyMap()); + } + + /** + * Download soda product data as binary + * + * @param id + * ID of the soda product to download (required) + * @param additionalHeaders + * additionalHeaders for this call + * @return File + * @throws ApiException + * if fails to make API call + */ + public File sodasDownloadIdGet( @javax.annotation.Nonnull Long id, Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = null; + + // verify the required parameter 'id' is set + if( id == null ) { + throw new ApiException(400, "Missing the required parameter 'id' when calling sodasDownloadIdGet"); + } + + // create path and map variables + String localVarPath = + "/sodas/download/{id}" + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(apiClient.parameterToString(id))); + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/octet-stream" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "apiKeyAuth", "bearerAuth" }; + + TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Get all soda products + * + * @return List<SodaWithId> + * @throws ApiException + * if fails to make API call + */ + public List sodasGet() + throws ApiException + { + return this.sodasGet(Collections.emptyMap()); + } + + /** + * Get all soda products + * + * @param additionalHeaders + * additionalHeaders for this call + * @return List<SodaWithId> + * @throws ApiException + * if fails to make API call + */ + public List sodasGet( Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sodas"; + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "apiKeyAuth" }; + + TypeReference> localVarReturnType = new TypeReference>() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Get a specific soda product by ID + * + * @param id + * ID of the soda product to retrieve (required) + * @return SodaWithId + * @throws ApiException + * if fails to make API call + */ + public SodaWithId sodasIdGet( @javax.annotation.Nonnull Long id ) + throws ApiException + { + return this.sodasIdGet(id, Collections.emptyMap()); + } + + /** + * Get a specific soda product by ID + * + * @param id + * ID of the soda product to retrieve (required) + * @param additionalHeaders + * additionalHeaders for this call + * @return SodaWithId + * @throws ApiException + * if fails to make API call + */ + public SodaWithId sodasIdGet( @javax.annotation.Nonnull Long id, Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = null; + + // verify the required parameter 'id' is set + if( id == null ) { + throw new ApiException(400, "Missing the required parameter 'id' when calling sodasIdGet"); + } + + // create path and map variables + String localVarPath = + "/sodas/{id}".replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(apiClient.parameterToString(id))); + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "apiKeyAuth" }; + + TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Update a specific soda product by ID + * + * @param sodaWithId + * The updated soda product (required) + * @return Soda + * @throws ApiException + * if fails to make API call + */ + public Soda sodasPut( @javax.annotation.Nonnull SodaWithId sodaWithId ) + throws ApiException + { + return this.sodasPut(sodaWithId, Collections.emptyMap()); + } + + /** + * Update a specific soda product by ID + * + * @param sodaWithId + * The updated soda product (required) + * @param additionalHeaders + * additionalHeaders for this call + * @return Soda + * @throws ApiException + * if fails to make API call + */ + public Soda sodasPut( @javax.annotation.Nonnull SodaWithId sodaWithId, Map additionalHeaders ) + throws ApiException + { + Object localVarPostBody = sodaWithId; + + // verify the required parameter 'sodaWithId' is set + if( sodaWithId == null ) { + throw new ApiException(400, "Missing the required parameter 'sodaWithId' when calling sodasPut"); + } + + // create path and map variables + String localVarPath = "/sodas"; + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "apiKeyAuth" }; + + TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + @Override + public T invokeAPI( + String url, + String method, + Object request, + TypeReference returnType, + Map additionalHeaders ) + throws ApiException + { + String localVarPath = url.replace(apiClient.getBaseURL(), ""); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "apiKeyAuth" }; + + return apiClient + .invokeAPI( + localVarPath, + method, + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + request, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + returnType); + } +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AllOf.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AllOf.java new file mode 100644 index 000000000..d6462cc87 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AllOf.java @@ -0,0 +1,413 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * SodaStore API + * API for managing soda products and orders in SodaStore. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * AllOf + */ + +@Beta // CHECKSTYLE:OFF +public class AllOf +// CHECKSTYLE:ON +{ + @JsonProperty( "sodaType" ) + private String sodaType; + + @JsonProperty( "caffeine" ) + private Boolean caffeine; + + @JsonProperty( "logo" ) + private ColaLogo logo; + + @JsonProperty( "barCode" ) + private ColaBarCode barCode; + + @JsonProperty( "color" ) + private String color; + + @JsonProperty( "flavor" ) + private FantaFlavor flavor; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for AllOf. + */ + protected AllOf() + { + } + + /** + * Set the sodaType of this {@link AllOf} instance and return the same instance. + * + * @param sodaType + * The sodaType of this {@link AllOf} + * @return The same instance of this {@link AllOf} class + */ + @Nonnull + public AllOf sodaType( @Nullable final String sodaType ) + { + this.sodaType = sodaType; + return this; + } + + /** + * Get sodaType + * + * @return sodaType The sodaType of this {@link AllOf} instance. + */ + @Nonnull + public String getSodaType() + { + return sodaType; + } + + /** + * Set the sodaType of this {@link AllOf} instance. + * + * @param sodaType + * The sodaType of this {@link AllOf} + */ + public void setSodaType( @Nullable final String sodaType ) + { + this.sodaType = sodaType; + } + + /** + * Set the caffeine of this {@link AllOf} instance and return the same instance. + * + * @param caffeine + * The caffeine of this {@link AllOf} + * @return The same instance of this {@link AllOf} class + */ + @Nonnull + public AllOf caffeine( @Nullable final Boolean caffeine ) + { + this.caffeine = caffeine; + return this; + } + + /** + * Get caffeine + * + * @return caffeine The caffeine of this {@link AllOf} instance. + */ + @Nonnull + public Boolean isCaffeine() + { + return caffeine; + } + + /** + * Set the caffeine of this {@link AllOf} instance. + * + * @param caffeine + * The caffeine of this {@link AllOf} + */ + public void setCaffeine( @Nullable final Boolean caffeine ) + { + this.caffeine = caffeine; + } + + /** + * Set the logo of this {@link AllOf} instance and return the same instance. + * + * @param logo + * The logo of this {@link AllOf} + * @return The same instance of this {@link AllOf} class + */ + @Nonnull + public AllOf logo( @Nullable final ColaLogo logo ) + { + this.logo = logo; + return this; + } + + /** + * Get logo + * + * @return logo The logo of this {@link AllOf} instance. + */ + @Nonnull + public ColaLogo getLogo() + { + return logo; + } + + /** + * Set the logo of this {@link AllOf} instance. + * + * @param logo + * The logo of this {@link AllOf} + */ + public void setLogo( @Nullable final ColaLogo logo ) + { + this.logo = logo; + } + + /** + * Set the barCode of this {@link AllOf} instance and return the same instance. + * + * @param barCode + * The barCode of this {@link AllOf} + * @return The same instance of this {@link AllOf} class + */ + @Nonnull + public AllOf barCode( @Nullable final ColaBarCode barCode ) + { + this.barCode = barCode; + return this; + } + + /** + * Get barCode + * + * @return barCode The barCode of this {@link AllOf} instance. + */ + @Nonnull + public ColaBarCode getBarCode() + { + return barCode; + } + + /** + * Set the barCode of this {@link AllOf} instance. + * + * @param barCode + * The barCode of this {@link AllOf} + */ + public void setBarCode( @Nullable final ColaBarCode barCode ) + { + this.barCode = barCode; + } + + /** + * Set the color of this {@link AllOf} instance and return the same instance. + * + * @param color + * The color of this {@link AllOf} + * @return The same instance of this {@link AllOf} class + */ + @Nonnull + public AllOf color( @Nullable final String color ) + { + this.color = color; + return this; + } + + /** + * Get color + * + * @return color The color of this {@link AllOf} instance. + */ + @Nonnull + public String getColor() + { + return color; + } + + /** + * Set the color of this {@link AllOf} instance. + * + * @param color + * The color of this {@link AllOf} + */ + public void setColor( @Nullable final String color ) + { + this.color = color; + } + + /** + * Set the flavor of this {@link AllOf} instance and return the same instance. + * + * @param flavor + * The flavor of this {@link AllOf} + * @return The same instance of this {@link AllOf} class + */ + @Nonnull + public AllOf flavor( @Nullable final FantaFlavor flavor ) + { + this.flavor = flavor; + return this; + } + + /** + * Get flavor + * + * @return flavor The flavor of this {@link AllOf} instance. + */ + @Nonnull + public FantaFlavor getFlavor() + { + return flavor; + } + + /** + * Set the flavor of this {@link AllOf} instance. + * + * @param flavor + * The flavor of this {@link AllOf} + */ + public void setFlavor( @Nullable final FantaFlavor flavor ) + { + this.flavor = flavor; + } + + /** + * Get the names of the unrecognizable properties of the {@link AllOf}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link AllOf} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("AllOf has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link AllOf} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( sodaType != null ) + declaredFields.put("sodaType", sodaType); + if( caffeine != null ) + declaredFields.put("caffeine", caffeine); + if( logo != null ) + declaredFields.put("logo", logo); + if( barCode != null ) + declaredFields.put("barCode", barCode); + if( color != null ) + declaredFields.put("color", color); + if( flavor != null ) + declaredFields.put("flavor", flavor); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link AllOf} instance. If the map previously contained a mapping for the + * key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final AllOf allOf = (AllOf) o; + return Objects.equals(this.cloudSdkCustomFields, allOf.cloudSdkCustomFields) + && Objects.equals(this.sodaType, allOf.sodaType) + && Objects.equals(this.caffeine, allOf.caffeine) + && Objects.equals(this.logo, allOf.logo) + && Objects.equals(this.barCode, allOf.barCode) + && Objects.equals(this.color, allOf.color) + && Objects.equals(this.flavor, allOf.flavor); + } + + @Override + public int hashCode() + { + return Objects.hash(sodaType, caffeine, logo, barCode, color, flavor, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class AllOf {\n"); + sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n"); + sb.append(" caffeine: ").append(toIndentedString(caffeine)).append("\n"); + sb.append(" logo: ").append(toIndentedString(logo)).append("\n"); + sb.append(" barCode: ").append(toIndentedString(barCode)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" flavor: ").append(toIndentedString(flavor)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AnyOf.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AnyOf.java new file mode 100644 index 000000000..97f8d677f --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AnyOf.java @@ -0,0 +1,413 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * SodaStore API + * API for managing soda products and orders in SodaStore. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * AnyOf + */ + +@Beta // CHECKSTYLE:OFF +public class AnyOf +// CHECKSTYLE:ON +{ + @JsonProperty( "sodaType" ) + private String sodaType; + + @JsonProperty( "caffeine" ) + private Boolean caffeine; + + @JsonProperty( "logo" ) + private ColaLogo logo; + + @JsonProperty( "barCode" ) + private ColaBarCode barCode; + + @JsonProperty( "color" ) + private String color; + + @JsonProperty( "flavor" ) + private FantaFlavor flavor; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for AnyOf. + */ + protected AnyOf() + { + } + + /** + * Set the sodaType of this {@link AnyOf} instance and return the same instance. + * + * @param sodaType + * The sodaType of this {@link AnyOf} + * @return The same instance of this {@link AnyOf} class + */ + @Nonnull + public AnyOf sodaType( @Nullable final String sodaType ) + { + this.sodaType = sodaType; + return this; + } + + /** + * Get sodaType + * + * @return sodaType The sodaType of this {@link AnyOf} instance. + */ + @Nonnull + public String getSodaType() + { + return sodaType; + } + + /** + * Set the sodaType of this {@link AnyOf} instance. + * + * @param sodaType + * The sodaType of this {@link AnyOf} + */ + public void setSodaType( @Nullable final String sodaType ) + { + this.sodaType = sodaType; + } + + /** + * Set the caffeine of this {@link AnyOf} instance and return the same instance. + * + * @param caffeine + * The caffeine of this {@link AnyOf} + * @return The same instance of this {@link AnyOf} class + */ + @Nonnull + public AnyOf caffeine( @Nullable final Boolean caffeine ) + { + this.caffeine = caffeine; + return this; + } + + /** + * Get caffeine + * + * @return caffeine The caffeine of this {@link AnyOf} instance. + */ + @Nonnull + public Boolean isCaffeine() + { + return caffeine; + } + + /** + * Set the caffeine of this {@link AnyOf} instance. + * + * @param caffeine + * The caffeine of this {@link AnyOf} + */ + public void setCaffeine( @Nullable final Boolean caffeine ) + { + this.caffeine = caffeine; + } + + /** + * Set the logo of this {@link AnyOf} instance and return the same instance. + * + * @param logo + * The logo of this {@link AnyOf} + * @return The same instance of this {@link AnyOf} class + */ + @Nonnull + public AnyOf logo( @Nullable final ColaLogo logo ) + { + this.logo = logo; + return this; + } + + /** + * Get logo + * + * @return logo The logo of this {@link AnyOf} instance. + */ + @Nonnull + public ColaLogo getLogo() + { + return logo; + } + + /** + * Set the logo of this {@link AnyOf} instance. + * + * @param logo + * The logo of this {@link AnyOf} + */ + public void setLogo( @Nullable final ColaLogo logo ) + { + this.logo = logo; + } + + /** + * Set the barCode of this {@link AnyOf} instance and return the same instance. + * + * @param barCode + * The barCode of this {@link AnyOf} + * @return The same instance of this {@link AnyOf} class + */ + @Nonnull + public AnyOf barCode( @Nullable final ColaBarCode barCode ) + { + this.barCode = barCode; + return this; + } + + /** + * Get barCode + * + * @return barCode The barCode of this {@link AnyOf} instance. + */ + @Nonnull + public ColaBarCode getBarCode() + { + return barCode; + } + + /** + * Set the barCode of this {@link AnyOf} instance. + * + * @param barCode + * The barCode of this {@link AnyOf} + */ + public void setBarCode( @Nullable final ColaBarCode barCode ) + { + this.barCode = barCode; + } + + /** + * Set the color of this {@link AnyOf} instance and return the same instance. + * + * @param color + * The color of this {@link AnyOf} + * @return The same instance of this {@link AnyOf} class + */ + @Nonnull + public AnyOf color( @Nullable final String color ) + { + this.color = color; + return this; + } + + /** + * Get color + * + * @return color The color of this {@link AnyOf} instance. + */ + @Nonnull + public String getColor() + { + return color; + } + + /** + * Set the color of this {@link AnyOf} instance. + * + * @param color + * The color of this {@link AnyOf} + */ + public void setColor( @Nullable final String color ) + { + this.color = color; + } + + /** + * Set the flavor of this {@link AnyOf} instance and return the same instance. + * + * @param flavor + * The flavor of this {@link AnyOf} + * @return The same instance of this {@link AnyOf} class + */ + @Nonnull + public AnyOf flavor( @Nullable final FantaFlavor flavor ) + { + this.flavor = flavor; + return this; + } + + /** + * Get flavor + * + * @return flavor The flavor of this {@link AnyOf} instance. + */ + @Nonnull + public FantaFlavor getFlavor() + { + return flavor; + } + + /** + * Set the flavor of this {@link AnyOf} instance. + * + * @param flavor + * The flavor of this {@link AnyOf} + */ + public void setFlavor( @Nullable final FantaFlavor flavor ) + { + this.flavor = flavor; + } + + /** + * Get the names of the unrecognizable properties of the {@link AnyOf}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link AnyOf} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("AnyOf has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link AnyOf} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( sodaType != null ) + declaredFields.put("sodaType", sodaType); + if( caffeine != null ) + declaredFields.put("caffeine", caffeine); + if( logo != null ) + declaredFields.put("logo", logo); + if( barCode != null ) + declaredFields.put("barCode", barCode); + if( color != null ) + declaredFields.put("color", color); + if( flavor != null ) + declaredFields.put("flavor", flavor); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link AnyOf} instance. If the map previously contained a mapping for the + * key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final AnyOf anyOf = (AnyOf) o; + return Objects.equals(this.cloudSdkCustomFields, anyOf.cloudSdkCustomFields) + && Objects.equals(this.sodaType, anyOf.sodaType) + && Objects.equals(this.caffeine, anyOf.caffeine) + && Objects.equals(this.logo, anyOf.logo) + && Objects.equals(this.barCode, anyOf.barCode) + && Objects.equals(this.color, anyOf.color) + && Objects.equals(this.flavor, anyOf.flavor); + } + + @Override + public int hashCode() + { + return Objects.hash(sodaType, caffeine, logo, barCode, color, flavor, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class AnyOf {\n"); + sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n"); + sb.append(" caffeine: ").append(toIndentedString(caffeine)).append("\n"); + sb.append(" logo: ").append(toIndentedString(logo)).append("\n"); + sb.append(" barCode: ").append(toIndentedString(barCode)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" flavor: ").append(toIndentedString(flavor)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AssistantChatMessage.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AssistantChatMessage.java deleted file mode 100644 index bad1e31cf..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AssistantChatMessage.java +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * AssistantChatMessage - */ - -@Beta // CHECKSTYLE:OFF -public class AssistantChatMessage implements ChatMessage -// CHECKSTYLE:ON -{ - /** - * Gets or Sets role - */ - public enum RoleEnum - { - /** - * The ASSISTANT option of this AssistantChatMessage - */ - ASSISTANT("assistant"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this AssistantChatMessage - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - RoleEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type AssistantChatMessage - */ - @JsonCreator - @Nonnull - public static RoleEnum fromValue( @Nonnull final String value ) - { - for( RoleEnum b : RoleEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "role" ) - private RoleEnum role; - - @JsonProperty( "content" ) - private ChatMessageContent content; - - @JsonProperty( "refusal" ) - private String refusal; - - @JsonProperty( "tool_calls" ) - private List toolCalls = new ArrayList<>(); - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for AssistantChatMessage. - */ - protected AssistantChatMessage() - { - } - - /** - * Set the role of this {@link AssistantChatMessage} instance and return the same instance. - * - * @param role - * The role of this {@link AssistantChatMessage} - * @return The same instance of this {@link AssistantChatMessage} class - */ - @Nonnull - public AssistantChatMessage role( @Nonnull final RoleEnum role ) - { - this.role = role; - return this; - } - - /** - * Get role - * - * @return role The role of this {@link AssistantChatMessage} instance. - */ - @Nonnull - public RoleEnum getRole() - { - return role; - } - - /** - * Set the role of this {@link AssistantChatMessage} instance. - * - * @param role - * The role of this {@link AssistantChatMessage} - */ - public void setRole( @Nonnull final RoleEnum role ) - { - this.role = role; - } - - /** - * Set the content of this {@link AssistantChatMessage} instance and return the same instance. - * - * @param content - * The content of this {@link AssistantChatMessage} - * @return The same instance of this {@link AssistantChatMessage} class - */ - @Nonnull - public AssistantChatMessage content( @Nullable final ChatMessageContent content ) - { - this.content = content; - return this; - } - - /** - * Get content - * - * @return content The content of this {@link AssistantChatMessage} instance. - */ - @Nonnull - public ChatMessageContent getContent() - { - return content; - } - - /** - * Set the content of this {@link AssistantChatMessage} instance. - * - * @param content - * The content of this {@link AssistantChatMessage} - */ - public void setContent( @Nullable final ChatMessageContent content ) - { - this.content = content; - } - - /** - * Set the refusal of this {@link AssistantChatMessage} instance and return the same instance. - * - * @param refusal - * The refusal of this {@link AssistantChatMessage} - * @return The same instance of this {@link AssistantChatMessage} class - */ - @Nonnull - public AssistantChatMessage refusal( @Nullable final String refusal ) - { - this.refusal = refusal; - return this; - } - - /** - * Get refusal - * - * @return refusal The refusal of this {@link AssistantChatMessage} instance. - */ - @Nonnull - public String getRefusal() - { - return refusal; - } - - /** - * Set the refusal of this {@link AssistantChatMessage} instance. - * - * @param refusal - * The refusal of this {@link AssistantChatMessage} - */ - public void setRefusal( @Nullable final String refusal ) - { - this.refusal = refusal; - } - - /** - * Set the toolCalls of this {@link AssistantChatMessage} instance and return the same instance. - * - * @param toolCalls - * The tool calls generated by the model, such as function calls. - * @return The same instance of this {@link AssistantChatMessage} class - */ - @Nonnull - public AssistantChatMessage toolCalls( @Nullable final List toolCalls ) - { - this.toolCalls = toolCalls; - return this; - } - - /** - * Add one toolCalls instance to this {@link AssistantChatMessage}. - * - * @param toolCallsItem - * The toolCalls that should be added - * @return The same instance of type {@link AssistantChatMessage} - */ - @Nonnull - public AssistantChatMessage addToolCallsItem( @Nonnull final MessageToolCall toolCallsItem ) - { - if( this.toolCalls == null ) { - this.toolCalls = new ArrayList<>(); - } - this.toolCalls.add(toolCallsItem); - return this; - } - - /** - * The tool calls generated by the model, such as function calls. - * - * @return toolCalls The toolCalls of this {@link AssistantChatMessage} instance. - */ - @Nonnull - public List getToolCalls() - { - return toolCalls; - } - - /** - * Set the toolCalls of this {@link AssistantChatMessage} instance. - * - * @param toolCalls - * The tool calls generated by the model, such as function calls. - */ - public void setToolCalls( @Nullable final List toolCalls ) - { - this.toolCalls = toolCalls; - } - - /** - * Get the names of the unrecognizable properties of the {@link AssistantChatMessage}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link AssistantChatMessage} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("AssistantChatMessage has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link AssistantChatMessage} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( role != null ) - declaredFields.put("role", role); - if( content != null ) - declaredFields.put("content", content); - if( refusal != null ) - declaredFields.put("refusal", refusal); - if( toolCalls != null ) - declaredFields.put("toolCalls", toolCalls); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link AssistantChatMessage} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final AssistantChatMessage assistantChatMessage = (AssistantChatMessage) o; - return Objects.equals(this.cloudSdkCustomFields, assistantChatMessage.cloudSdkCustomFields) - && Objects.equals(this.role, assistantChatMessage.role) - && Objects.equals(this.content, assistantChatMessage.content) - && Objects.equals(this.refusal, assistantChatMessage.refusal) - && Objects.equals(this.toolCalls, assistantChatMessage.toolCalls); - } - - @Override - public int hashCode() - { - return Objects.hash(role, content, refusal, toolCalls, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class AssistantChatMessage {\n"); - sb.append(" role: ").append(toIndentedString(role)).append("\n"); - sb.append(" content: ").append(toIndentedString(content)).append("\n"); - sb.append(" refusal: ").append(toIndentedString(refusal)).append("\n"); - sb.append(" toolCalls: ").append(toIndentedString(toolCalls)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyInput.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyInput.java deleted file mode 100644 index 499774e0a..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyInput.java +++ /dev/null @@ -1,371 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * Filter configuration for Azure Content Safety - */ - -@Beta // CHECKSTYLE:OFF -public class AzureContentSafetyInput -// CHECKSTYLE:ON -{ - @JsonProperty( "hate" ) - private AzureThreshold hate; - - @JsonProperty( "self_harm" ) - private AzureThreshold selfHarm; - - @JsonProperty( "sexual" ) - private AzureThreshold sexual; - - @JsonProperty( "violence" ) - private AzureThreshold violence; - - @JsonProperty( "prompt_shield" ) - private Boolean promptShield = false; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for AzureContentSafetyInput. - */ - protected AzureContentSafetyInput() - { - } - - /** - * Set the hate of this {@link AzureContentSafetyInput} instance and return the same instance. - * - * @param hate - * The hate of this {@link AzureContentSafetyInput} - * @return The same instance of this {@link AzureContentSafetyInput} class - */ - @Nonnull - public AzureContentSafetyInput hate( @Nullable final AzureThreshold hate ) - { - this.hate = hate; - return this; - } - - /** - * Get hate - * - * @return hate The hate of this {@link AzureContentSafetyInput} instance. - */ - @Nonnull - public AzureThreshold getHate() - { - return hate; - } - - /** - * Set the hate of this {@link AzureContentSafetyInput} instance. - * - * @param hate - * The hate of this {@link AzureContentSafetyInput} - */ - public void setHate( @Nullable final AzureThreshold hate ) - { - this.hate = hate; - } - - /** - * Set the selfHarm of this {@link AzureContentSafetyInput} instance and return the same instance. - * - * @param selfHarm - * The selfHarm of this {@link AzureContentSafetyInput} - * @return The same instance of this {@link AzureContentSafetyInput} class - */ - @Nonnull - public AzureContentSafetyInput selfHarm( @Nullable final AzureThreshold selfHarm ) - { - this.selfHarm = selfHarm; - return this; - } - - /** - * Get selfHarm - * - * @return selfHarm The selfHarm of this {@link AzureContentSafetyInput} instance. - */ - @Nonnull - public AzureThreshold getSelfHarm() - { - return selfHarm; - } - - /** - * Set the selfHarm of this {@link AzureContentSafetyInput} instance. - * - * @param selfHarm - * The selfHarm of this {@link AzureContentSafetyInput} - */ - public void setSelfHarm( @Nullable final AzureThreshold selfHarm ) - { - this.selfHarm = selfHarm; - } - - /** - * Set the sexual of this {@link AzureContentSafetyInput} instance and return the same instance. - * - * @param sexual - * The sexual of this {@link AzureContentSafetyInput} - * @return The same instance of this {@link AzureContentSafetyInput} class - */ - @Nonnull - public AzureContentSafetyInput sexual( @Nullable final AzureThreshold sexual ) - { - this.sexual = sexual; - return this; - } - - /** - * Get sexual - * - * @return sexual The sexual of this {@link AzureContentSafetyInput} instance. - */ - @Nonnull - public AzureThreshold getSexual() - { - return sexual; - } - - /** - * Set the sexual of this {@link AzureContentSafetyInput} instance. - * - * @param sexual - * The sexual of this {@link AzureContentSafetyInput} - */ - public void setSexual( @Nullable final AzureThreshold sexual ) - { - this.sexual = sexual; - } - - /** - * Set the violence of this {@link AzureContentSafetyInput} instance and return the same instance. - * - * @param violence - * The violence of this {@link AzureContentSafetyInput} - * @return The same instance of this {@link AzureContentSafetyInput} class - */ - @Nonnull - public AzureContentSafetyInput violence( @Nullable final AzureThreshold violence ) - { - this.violence = violence; - return this; - } - - /** - * Get violence - * - * @return violence The violence of this {@link AzureContentSafetyInput} instance. - */ - @Nonnull - public AzureThreshold getViolence() - { - return violence; - } - - /** - * Set the violence of this {@link AzureContentSafetyInput} instance. - * - * @param violence - * The violence of this {@link AzureContentSafetyInput} - */ - public void setViolence( @Nullable final AzureThreshold violence ) - { - this.violence = violence; - } - - /** - * Set the promptShield of this {@link AzureContentSafetyInput} instance and return the same instance. - * - * @param promptShield - * Filter prompts for harmful content such as jailbreaks and prompt injections. - * @return The same instance of this {@link AzureContentSafetyInput} class - */ - @Nonnull - public AzureContentSafetyInput promptShield( @Nullable final Boolean promptShield ) - { - this.promptShield = promptShield; - return this; - } - - /** - * Filter prompts for harmful content such as jailbreaks and prompt injections. - * - * @return promptShield The promptShield of this {@link AzureContentSafetyInput} instance. - */ - @Nonnull - public Boolean isPromptShield() - { - return promptShield; - } - - /** - * Set the promptShield of this {@link AzureContentSafetyInput} instance. - * - * @param promptShield - * Filter prompts for harmful content such as jailbreaks and prompt injections. - */ - public void setPromptShield( @Nullable final Boolean promptShield ) - { - this.promptShield = promptShield; - } - - /** - * Get the names of the unrecognizable properties of the {@link AzureContentSafetyInput}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link AzureContentSafetyInput} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("AzureContentSafetyInput has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link AzureContentSafetyInput} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( hate != null ) - declaredFields.put("hate", hate); - if( selfHarm != null ) - declaredFields.put("selfHarm", selfHarm); - if( sexual != null ) - declaredFields.put("sexual", sexual); - if( violence != null ) - declaredFields.put("violence", violence); - if( promptShield != null ) - declaredFields.put("promptShield", promptShield); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link AzureContentSafetyInput} instance. If the map previously contained - * a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final AzureContentSafetyInput azureContentSafetyInput = (AzureContentSafetyInput) o; - return Objects.equals(this.cloudSdkCustomFields, azureContentSafetyInput.cloudSdkCustomFields) - && Objects.equals(this.hate, azureContentSafetyInput.hate) - && Objects.equals(this.selfHarm, azureContentSafetyInput.selfHarm) - && Objects.equals(this.sexual, azureContentSafetyInput.sexual) - && Objects.equals(this.violence, azureContentSafetyInput.violence) - && Objects.equals(this.promptShield, azureContentSafetyInput.promptShield); - } - - @Override - public int hashCode() - { - return Objects.hash(hate, selfHarm, sexual, violence, promptShield, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class AzureContentSafetyInput {\n"); - sb.append(" hate: ").append(toIndentedString(hate)).append("\n"); - sb.append(" selfHarm: ").append(toIndentedString(selfHarm)).append("\n"); - sb.append(" sexual: ").append(toIndentedString(sexual)).append("\n"); - sb.append(" violence: ").append(toIndentedString(violence)).append("\n"); - sb.append(" promptShield: ").append(toIndentedString(promptShield)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyInputFilterConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyInputFilterConfig.java deleted file mode 100644 index d244a4f45..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyInputFilterConfig.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * AzureContentSafetyInputFilterConfig - */ - -@Beta // CHECKSTYLE:OFF -public class AzureContentSafetyInputFilterConfig implements InputFilterConfig -// CHECKSTYLE:ON -{ - /** - * Name of the filter provider type - */ - public enum TypeEnum - { - /** - * The AZURE_CONTENT_SAFETY option of this AzureContentSafetyInputFilterConfig - */ - AZURE_CONTENT_SAFETY("azure_content_safety"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this AzureContentSafetyInputFilterConfig - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type AzureContentSafetyInputFilterConfig - */ - @JsonCreator - @Nonnull - public static TypeEnum fromValue( @Nonnull final String value ) - { - for( TypeEnum b : TypeEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "type" ) - private TypeEnum type; - - @JsonProperty( "config" ) - private AzureContentSafetyInput config; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for AzureContentSafetyInputFilterConfig. - */ - protected AzureContentSafetyInputFilterConfig() - { - } - - /** - * Set the type of this {@link AzureContentSafetyInputFilterConfig} instance and return the same instance. - * - * @param type - * Name of the filter provider type - * @return The same instance of this {@link AzureContentSafetyInputFilterConfig} class - */ - @Nonnull - public AzureContentSafetyInputFilterConfig type( @Nonnull final TypeEnum type ) - { - this.type = type; - return this; - } - - /** - * Name of the filter provider type - * - * @return type The type of this {@link AzureContentSafetyInputFilterConfig} instance. - */ - @Nonnull - public TypeEnum getType() - { - return type; - } - - /** - * Set the type of this {@link AzureContentSafetyInputFilterConfig} instance. - * - * @param type - * Name of the filter provider type - */ - public void setType( @Nonnull final TypeEnum type ) - { - this.type = type; - } - - /** - * Set the config of this {@link AzureContentSafetyInputFilterConfig} instance and return the same instance. - * - * @param config - * The config of this {@link AzureContentSafetyInputFilterConfig} - * @return The same instance of this {@link AzureContentSafetyInputFilterConfig} class - */ - @Nonnull - public AzureContentSafetyInputFilterConfig config( @Nullable final AzureContentSafetyInput config ) - { - this.config = config; - return this; - } - - /** - * Get config - * - * @return config The config of this {@link AzureContentSafetyInputFilterConfig} instance. - */ - @Nonnull - public AzureContentSafetyInput getConfig() - { - return config; - } - - /** - * Set the config of this {@link AzureContentSafetyInputFilterConfig} instance. - * - * @param config - * The config of this {@link AzureContentSafetyInputFilterConfig} - */ - public void setConfig( @Nullable final AzureContentSafetyInput config ) - { - this.config = config; - } - - /** - * Get the names of the unrecognizable properties of the {@link AzureContentSafetyInputFilterConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link AzureContentSafetyInputFilterConfig} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException( - "AzureContentSafetyInputFilterConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link AzureContentSafetyInputFilterConfig} instance including - * unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( type != null ) - declaredFields.put("type", type); - if( config != null ) - declaredFields.put("config", config); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link AzureContentSafetyInputFilterConfig} instance. If the map - * previously contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final AzureContentSafetyInputFilterConfig azureContentSafetyInputFilterConfig = - (AzureContentSafetyInputFilterConfig) o; - return Objects.equals(this.cloudSdkCustomFields, azureContentSafetyInputFilterConfig.cloudSdkCustomFields) - && Objects.equals(this.type, azureContentSafetyInputFilterConfig.type) - && Objects.equals(this.config, azureContentSafetyInputFilterConfig.config); - } - - @Override - public int hashCode() - { - return Objects.hash(type, config, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class AzureContentSafetyInputFilterConfig {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" config: ").append(toIndentedString(config)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyOutput.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyOutput.java deleted file mode 100644 index 16620fcb6..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyOutput.java +++ /dev/null @@ -1,374 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * Filter configuration for Azure Content Safety - */ - -@Beta // CHECKSTYLE:OFF -public class AzureContentSafetyOutput -// CHECKSTYLE:ON -{ - @JsonProperty( "hate" ) - private AzureThreshold hate; - - @JsonProperty( "self_harm" ) - private AzureThreshold selfHarm; - - @JsonProperty( "sexual" ) - private AzureThreshold sexual; - - @JsonProperty( "violence" ) - private AzureThreshold violence; - - @JsonProperty( "protected_material_code" ) - private Boolean protectedMaterialCode = false; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for AzureContentSafetyOutput. - */ - protected AzureContentSafetyOutput() - { - } - - /** - * Set the hate of this {@link AzureContentSafetyOutput} instance and return the same instance. - * - * @param hate - * The hate of this {@link AzureContentSafetyOutput} - * @return The same instance of this {@link AzureContentSafetyOutput} class - */ - @Nonnull - public AzureContentSafetyOutput hate( @Nullable final AzureThreshold hate ) - { - this.hate = hate; - return this; - } - - /** - * Get hate - * - * @return hate The hate of this {@link AzureContentSafetyOutput} instance. - */ - @Nonnull - public AzureThreshold getHate() - { - return hate; - } - - /** - * Set the hate of this {@link AzureContentSafetyOutput} instance. - * - * @param hate - * The hate of this {@link AzureContentSafetyOutput} - */ - public void setHate( @Nullable final AzureThreshold hate ) - { - this.hate = hate; - } - - /** - * Set the selfHarm of this {@link AzureContentSafetyOutput} instance and return the same instance. - * - * @param selfHarm - * The selfHarm of this {@link AzureContentSafetyOutput} - * @return The same instance of this {@link AzureContentSafetyOutput} class - */ - @Nonnull - public AzureContentSafetyOutput selfHarm( @Nullable final AzureThreshold selfHarm ) - { - this.selfHarm = selfHarm; - return this; - } - - /** - * Get selfHarm - * - * @return selfHarm The selfHarm of this {@link AzureContentSafetyOutput} instance. - */ - @Nonnull - public AzureThreshold getSelfHarm() - { - return selfHarm; - } - - /** - * Set the selfHarm of this {@link AzureContentSafetyOutput} instance. - * - * @param selfHarm - * The selfHarm of this {@link AzureContentSafetyOutput} - */ - public void setSelfHarm( @Nullable final AzureThreshold selfHarm ) - { - this.selfHarm = selfHarm; - } - - /** - * Set the sexual of this {@link AzureContentSafetyOutput} instance and return the same instance. - * - * @param sexual - * The sexual of this {@link AzureContentSafetyOutput} - * @return The same instance of this {@link AzureContentSafetyOutput} class - */ - @Nonnull - public AzureContentSafetyOutput sexual( @Nullable final AzureThreshold sexual ) - { - this.sexual = sexual; - return this; - } - - /** - * Get sexual - * - * @return sexual The sexual of this {@link AzureContentSafetyOutput} instance. - */ - @Nonnull - public AzureThreshold getSexual() - { - return sexual; - } - - /** - * Set the sexual of this {@link AzureContentSafetyOutput} instance. - * - * @param sexual - * The sexual of this {@link AzureContentSafetyOutput} - */ - public void setSexual( @Nullable final AzureThreshold sexual ) - { - this.sexual = sexual; - } - - /** - * Set the violence of this {@link AzureContentSafetyOutput} instance and return the same instance. - * - * @param violence - * The violence of this {@link AzureContentSafetyOutput} - * @return The same instance of this {@link AzureContentSafetyOutput} class - */ - @Nonnull - public AzureContentSafetyOutput violence( @Nullable final AzureThreshold violence ) - { - this.violence = violence; - return this; - } - - /** - * Get violence - * - * @return violence The violence of this {@link AzureContentSafetyOutput} instance. - */ - @Nonnull - public AzureThreshold getViolence() - { - return violence; - } - - /** - * Set the violence of this {@link AzureContentSafetyOutput} instance. - * - * @param violence - * The violence of this {@link AzureContentSafetyOutput} - */ - public void setViolence( @Nullable final AzureThreshold violence ) - { - this.violence = violence; - } - - /** - * Set the protectedMaterialCode of this {@link AzureContentSafetyOutput} instance and return the same instance. - * - * @param protectedMaterialCode - * Detect protected code content from known GitHub repositories. The scan includes software libraries, - * source code, algorithms, and other proprietary programming content. - * @return The same instance of this {@link AzureContentSafetyOutput} class - */ - @Nonnull - public AzureContentSafetyOutput protectedMaterialCode( @Nullable final Boolean protectedMaterialCode ) - { - this.protectedMaterialCode = protectedMaterialCode; - return this; - } - - /** - * Detect protected code content from known GitHub repositories. The scan includes software libraries, source code, - * algorithms, and other proprietary programming content. - * - * @return protectedMaterialCode The protectedMaterialCode of this {@link AzureContentSafetyOutput} instance. - */ - @Nonnull - public Boolean isProtectedMaterialCode() - { - return protectedMaterialCode; - } - - /** - * Set the protectedMaterialCode of this {@link AzureContentSafetyOutput} instance. - * - * @param protectedMaterialCode - * Detect protected code content from known GitHub repositories. The scan includes software libraries, - * source code, algorithms, and other proprietary programming content. - */ - public void setProtectedMaterialCode( @Nullable final Boolean protectedMaterialCode ) - { - this.protectedMaterialCode = protectedMaterialCode; - } - - /** - * Get the names of the unrecognizable properties of the {@link AzureContentSafetyOutput}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link AzureContentSafetyOutput} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("AzureContentSafetyOutput has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link AzureContentSafetyOutput} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( hate != null ) - declaredFields.put("hate", hate); - if( selfHarm != null ) - declaredFields.put("selfHarm", selfHarm); - if( sexual != null ) - declaredFields.put("sexual", sexual); - if( violence != null ) - declaredFields.put("violence", violence); - if( protectedMaterialCode != null ) - declaredFields.put("protectedMaterialCode", protectedMaterialCode); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link AzureContentSafetyOutput} instance. If the map previously contained - * a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final AzureContentSafetyOutput azureContentSafetyOutput = (AzureContentSafetyOutput) o; - return Objects.equals(this.cloudSdkCustomFields, azureContentSafetyOutput.cloudSdkCustomFields) - && Objects.equals(this.hate, azureContentSafetyOutput.hate) - && Objects.equals(this.selfHarm, azureContentSafetyOutput.selfHarm) - && Objects.equals(this.sexual, azureContentSafetyOutput.sexual) - && Objects.equals(this.violence, azureContentSafetyOutput.violence) - && Objects.equals(this.protectedMaterialCode, azureContentSafetyOutput.protectedMaterialCode); - } - - @Override - public int hashCode() - { - return Objects.hash(hate, selfHarm, sexual, violence, protectedMaterialCode, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class AzureContentSafetyOutput {\n"); - sb.append(" hate: ").append(toIndentedString(hate)).append("\n"); - sb.append(" selfHarm: ").append(toIndentedString(selfHarm)).append("\n"); - sb.append(" sexual: ").append(toIndentedString(sexual)).append("\n"); - sb.append(" violence: ").append(toIndentedString(violence)).append("\n"); - sb.append(" protectedMaterialCode: ").append(toIndentedString(protectedMaterialCode)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyOutputFilterConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyOutputFilterConfig.java deleted file mode 100644 index 1353dd435..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureContentSafetyOutputFilterConfig.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * AzureContentSafetyOutputFilterConfig - */ - -@Beta // CHECKSTYLE:OFF -public class AzureContentSafetyOutputFilterConfig implements OutputFilterConfig -// CHECKSTYLE:ON -{ - /** - * Name of the filter provider type - */ - public enum TypeEnum - { - /** - * The AZURE_CONTENT_SAFETY option of this AzureContentSafetyOutputFilterConfig - */ - AZURE_CONTENT_SAFETY("azure_content_safety"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this AzureContentSafetyOutputFilterConfig - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type AzureContentSafetyOutputFilterConfig - */ - @JsonCreator - @Nonnull - public static TypeEnum fromValue( @Nonnull final String value ) - { - for( TypeEnum b : TypeEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "type" ) - private TypeEnum type; - - @JsonProperty( "config" ) - private AzureContentSafetyOutput config; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for AzureContentSafetyOutputFilterConfig. - */ - protected AzureContentSafetyOutputFilterConfig() - { - } - - /** - * Set the type of this {@link AzureContentSafetyOutputFilterConfig} instance and return the same instance. - * - * @param type - * Name of the filter provider type - * @return The same instance of this {@link AzureContentSafetyOutputFilterConfig} class - */ - @Nonnull - public AzureContentSafetyOutputFilterConfig type( @Nonnull final TypeEnum type ) - { - this.type = type; - return this; - } - - /** - * Name of the filter provider type - * - * @return type The type of this {@link AzureContentSafetyOutputFilterConfig} instance. - */ - @Nonnull - public TypeEnum getType() - { - return type; - } - - /** - * Set the type of this {@link AzureContentSafetyOutputFilterConfig} instance. - * - * @param type - * Name of the filter provider type - */ - public void setType( @Nonnull final TypeEnum type ) - { - this.type = type; - } - - /** - * Set the config of this {@link AzureContentSafetyOutputFilterConfig} instance and return the same instance. - * - * @param config - * The config of this {@link AzureContentSafetyOutputFilterConfig} - * @return The same instance of this {@link AzureContentSafetyOutputFilterConfig} class - */ - @Nonnull - public AzureContentSafetyOutputFilterConfig config( @Nullable final AzureContentSafetyOutput config ) - { - this.config = config; - return this; - } - - /** - * Get config - * - * @return config The config of this {@link AzureContentSafetyOutputFilterConfig} instance. - */ - @Nonnull - public AzureContentSafetyOutput getConfig() - { - return config; - } - - /** - * Set the config of this {@link AzureContentSafetyOutputFilterConfig} instance. - * - * @param config - * The config of this {@link AzureContentSafetyOutputFilterConfig} - */ - public void setConfig( @Nullable final AzureContentSafetyOutput config ) - { - this.config = config; - } - - /** - * Get the names of the unrecognizable properties of the {@link AzureContentSafetyOutputFilterConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link AzureContentSafetyOutputFilterConfig} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException( - "AzureContentSafetyOutputFilterConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link AzureContentSafetyOutputFilterConfig} instance including - * unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( type != null ) - declaredFields.put("type", type); - if( config != null ) - declaredFields.put("config", config); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link AzureContentSafetyOutputFilterConfig} instance. If the map - * previously contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final AzureContentSafetyOutputFilterConfig azureContentSafetyOutputFilterConfig = - (AzureContentSafetyOutputFilterConfig) o; - return Objects.equals(this.cloudSdkCustomFields, azureContentSafetyOutputFilterConfig.cloudSdkCustomFields) - && Objects.equals(this.type, azureContentSafetyOutputFilterConfig.type) - && Objects.equals(this.config, azureContentSafetyOutputFilterConfig.config); - } - - @Override - public int hashCode() - { - return Objects.hash(type, config, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class AzureContentSafetyOutputFilterConfig {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" config: ").append(toIndentedString(config)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureThreshold.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureThreshold.java deleted file mode 100644 index fb7df9c8d..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AzureThreshold.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import javax.annotation.Nonnull; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * Gets or Sets AzureThreshold - */ - -@Beta -public enum AzureThreshold -{ - - NUMBER_0(0), - - NUMBER_2(2), - - NUMBER_4(4), - - NUMBER_6(6), - - NUMBER_unknown_default_open_api(11184809); - - private final Integer value; - - AzureThreshold( Integer value ) - { - this.value = value; - } - - /** - * @return The enum value. - */ - @JsonValue - public Integer getValue() - { - return value; - } - - /** - * @return The String representation of the enum value. - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Converts the given value to its enum representation. - * - * @param value - * The input value. - * - * @return The enum representation of the given value. - */ - @JsonCreator - public static AzureThreshold fromValue( @Nonnull final Integer value ) - { - for( final AzureThreshold b : AzureThreshold.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return NUMBER_unknown_default_open_api; - } -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatText.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Bar.java similarity index 62% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatText.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Bar.java index f7e94b815..55111820b 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatText.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Bar.java @@ -3,8 +3,8 @@ */ /* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. + * SodaStore API + * API for managing soda products and orders in SodaStore. * * * @@ -33,31 +33,34 @@ import com.google.common.annotations.Beta; /** - * ResponseFormatText + * Bar */ @Beta // CHECKSTYLE:OFF -public class ResponseFormatText implements PromptTemplateSpecResponseFormat, TemplateResponseFormat +public class Bar implements OneOfWithEnumDiscriminator // CHECKSTYLE:ON { + @JsonProperty( "bar" ) + private String bar; + /** - * The type of response format being defined: `text` + * Gets or Sets disc */ - public enum TypeEnum + public enum DiscEnum { /** - * The TEXT option of this ResponseFormatText + * The DISC_BAR option of this Bar */ - TEXT("text"), + DISC_BAR("disc_bar"), /** - * The UNKNOWN_DEFAULT_OPEN_API option of this ResponseFormatText + * The UNKNOWN_DEFAULT_OPEN_API option of this Bar */ UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); private String value; - TypeEnum( String value ) + DiscEnum( String value ) { this.value = value; } @@ -91,13 +94,13 @@ public String toString() * * @param value * The String value - * @return The enum value of type ResponseFormatText + * @return The enum value of type Bar */ @JsonCreator @Nonnull - public static TypeEnum fromValue( @Nonnull final String value ) + public static DiscEnum fromValue( @Nonnull final String value ) { - for( TypeEnum b : TypeEnum.values() ) { + for( DiscEnum b : DiscEnum.values() ) { if( b.value.equals(value) ) { return b; } @@ -106,58 +109,94 @@ public static TypeEnum fromValue( @Nonnull final String value ) } } - @JsonProperty( "type" ) - private TypeEnum type; + @JsonProperty( "disc" ) + private DiscEnum disc; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); /** - * Default constructor for ResponseFormatText. + * Default constructor for Bar. + */ + protected Bar() + { + } + + /** + * Set the bar of this {@link Bar} instance and return the same instance. + * + * @param bar + * The bar of this {@link Bar} + * @return The same instance of this {@link Bar} class + */ + @Nonnull + public Bar bar( @Nullable final String bar ) + { + this.bar = bar; + return this; + } + + /** + * Get bar + * + * @return bar The bar of this {@link Bar} instance. + */ + @Nonnull + public String getBar() + { + return bar; + } + + /** + * Set the bar of this {@link Bar} instance. + * + * @param bar + * The bar of this {@link Bar} */ - protected ResponseFormatText() + public void setBar( @Nullable final String bar ) { + this.bar = bar; } /** - * Set the type of this {@link ResponseFormatText} instance and return the same instance. + * Set the disc of this {@link Bar} instance and return the same instance. * - * @param type - * The type of response format being defined: `text` - * @return The same instance of this {@link ResponseFormatText} class + * @param disc + * The disc of this {@link Bar} + * @return The same instance of this {@link Bar} class */ @Nonnull - public ResponseFormatText type( @Nonnull final TypeEnum type ) + public Bar disc( @Nullable final DiscEnum disc ) { - this.type = type; + this.disc = disc; return this; } /** - * The type of response format being defined: `text` + * Get disc * - * @return type The type of this {@link ResponseFormatText} instance. + * @return disc The disc of this {@link Bar} instance. */ @Nonnull - public TypeEnum getType() + public DiscEnum getDisc() { - return type; + return disc; } /** - * Set the type of this {@link ResponseFormatText} instance. + * Set the disc of this {@link Bar} instance. * - * @param type - * The type of response format being defined: `text` + * @param disc + * The disc of this {@link Bar} */ - public void setType( @Nonnull final TypeEnum type ) + public void setDisc( @Nullable final DiscEnum disc ) { - this.type = type; + this.disc = disc; } /** - * Get the names of the unrecognizable properties of the {@link ResponseFormatText}. + * Get the names of the unrecognizable properties of the {@link Bar}. * * @return The set of properties names */ @@ -169,7 +208,7 @@ public Set getCustomFieldNames() } /** - * Get the value of an unrecognizable property of this {@link ResponseFormatText} instance. + * Get the value of an unrecognizable property of this {@link Bar} instance. * * @deprecated Use {@link #toMap()} instead. * @param name @@ -184,13 +223,13 @@ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("ResponseFormatText has no field with name '" + name + "'."); + throw new NoSuchElementException("Bar has no field with name '" + name + "'."); } return cloudSdkCustomFields.get(name); } /** - * Get the value of all properties of this {@link ResponseFormatText} instance including unrecognized properties. + * Get the value of all properties of this {@link Bar} instance including unrecognized properties. * * @return The map of all properties */ @@ -199,14 +238,16 @@ public Object getCustomField( @Nonnull final String name ) public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( type != null ) - declaredFields.put("type", type); + if( bar != null ) + declaredFields.put("bar", bar); + if( disc != null ) + declaredFields.put("disc", disc); return declaredFields; } /** - * Set an unrecognizable property of this {@link ResponseFormatText} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. + * Set an unrecognizable property of this {@link Bar} instance. If the map previously contained a mapping for the + * key, the old value is replaced by the specified value. * * @param customFieldName * The name of the property @@ -228,15 +269,16 @@ public boolean equals( @Nullable final java.lang.Object o ) if( o == null || getClass() != o.getClass() ) { return false; } - final ResponseFormatText responseFormatText = (ResponseFormatText) o; - return Objects.equals(this.cloudSdkCustomFields, responseFormatText.cloudSdkCustomFields) - && Objects.equals(this.type, responseFormatText.type); + final Bar bar = (Bar) o; + return Objects.equals(this.cloudSdkCustomFields, bar.cloudSdkCustomFields) + && Objects.equals(this.bar, bar.bar) + && Objects.equals(this.disc, bar.disc); } @Override public int hashCode() { - return Objects.hash(type, cloudSdkCustomFields); + return Objects.hash(bar, disc, cloudSdkCustomFields); } @Override @@ -244,8 +286,9 @@ public int hashCode() public String toString() { final StringBuilder sb = new StringBuilder(); - sb.append("class ResponseFormatText {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("class Bar {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" disc: ").append(toIndentedString(disc)).append("\n"); cloudSdkCustomFields .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); sb.append("}"); diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatCompletionTool.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatCompletionTool.java deleted file mode 100644 index 803eb5a21..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatCompletionTool.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * ChatCompletionTool - */ - -@Beta // CHECKSTYLE:OFF -public class ChatCompletionTool -// CHECKSTYLE:ON -{ - /** - * The type of the tool. Currently, only `function` is supported. - */ - public enum TypeEnum - { - /** - * The FUNCTION option of this ChatCompletionTool - */ - FUNCTION("function"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this ChatCompletionTool - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type ChatCompletionTool - */ - @JsonCreator - @Nonnull - public static TypeEnum fromValue( @Nonnull final String value ) - { - for( TypeEnum b : TypeEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "type" ) - private TypeEnum type; - - @JsonProperty( "function" ) - private FunctionObject function; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for ChatCompletionTool. - */ - protected ChatCompletionTool() - { - } - - /** - * Set the type of this {@link ChatCompletionTool} instance and return the same instance. - * - * @param type - * The type of the tool. Currently, only `function` is supported. - * @return The same instance of this {@link ChatCompletionTool} class - */ - @Nonnull - public ChatCompletionTool type( @Nonnull final TypeEnum type ) - { - this.type = type; - return this; - } - - /** - * The type of the tool. Currently, only `function` is supported. - * - * @return type The type of this {@link ChatCompletionTool} instance. - */ - @Nonnull - public TypeEnum getType() - { - return type; - } - - /** - * Set the type of this {@link ChatCompletionTool} instance. - * - * @param type - * The type of the tool. Currently, only `function` is supported. - */ - public void setType( @Nonnull final TypeEnum type ) - { - this.type = type; - } - - /** - * Set the function of this {@link ChatCompletionTool} instance and return the same instance. - * - * @param function - * The function of this {@link ChatCompletionTool} - * @return The same instance of this {@link ChatCompletionTool} class - */ - @Nonnull - public ChatCompletionTool function( @Nonnull final FunctionObject function ) - { - this.function = function; - return this; - } - - /** - * Get function - * - * @return function The function of this {@link ChatCompletionTool} instance. - */ - @Nonnull - public FunctionObject getFunction() - { - return function; - } - - /** - * Set the function of this {@link ChatCompletionTool} instance. - * - * @param function - * The function of this {@link ChatCompletionTool} - */ - public void setFunction( @Nonnull final FunctionObject function ) - { - this.function = function; - } - - /** - * Get the names of the unrecognizable properties of the {@link ChatCompletionTool}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link ChatCompletionTool} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("ChatCompletionTool has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link ChatCompletionTool} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( type != null ) - declaredFields.put("type", type); - if( function != null ) - declaredFields.put("function", function); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link ChatCompletionTool} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final ChatCompletionTool chatCompletionTool = (ChatCompletionTool) o; - return Objects.equals(this.cloudSdkCustomFields, chatCompletionTool.cloudSdkCustomFields) - && Objects.equals(this.type, chatCompletionTool.type) - && Objects.equals(this.function, chatCompletionTool.function); - } - - @Override - public int hashCode() - { - return Objects.hash(type, function, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class ChatCompletionTool {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" function: ").append(toIndentedString(function)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatMessage.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatMessage.java deleted file mode 100644 index ac6e70339..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatMessage.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.google.common.annotations.Beta; - -/** - * ChatMessage - */ -@Beta -@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) -@JsonSubTypes( { - @JsonSubTypes.Type( value = AssistantChatMessage.class ), - @JsonSubTypes.Type( value = DeveloperChatMessage.class ), - @JsonSubTypes.Type( value = SystemChatMessage.class ), - @JsonSubTypes.Type( value = ToolChatMessage.class ), - @JsonSubTypes.Type( value = UserChatMessage.class ), } ) - -public interface ChatMessage -{ -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Cola.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Cola.java new file mode 100644 index 000000000..7d5bb90be --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Cola.java @@ -0,0 +1,327 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * SodaStore API + * API for managing soda products and orders in SodaStore. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * Cola + */ + +@Beta // CHECKSTYLE:OFF +public class Cola implements OneOf, OneOfWithDiscriminator, OneOfWithDiscriminatorAndMapping +// CHECKSTYLE:ON +{ + @JsonProperty( "sodaType" ) + private String sodaType; + + @JsonProperty( "caffeine" ) + private Boolean caffeine; + + @JsonProperty( "logo" ) + private ColaLogo logo; + + @JsonProperty( "barCode" ) + private ColaBarCode barCode; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for Cola. + */ + protected Cola() + { + } + + /** + * Set the sodaType of this {@link Cola} instance and return the same instance. + * + * @param sodaType + * The sodaType of this {@link Cola} + * @return The same instance of this {@link Cola} class + */ + @Nonnull + public Cola sodaType( @Nullable final String sodaType ) + { + this.sodaType = sodaType; + return this; + } + + /** + * Get sodaType + * + * @return sodaType The sodaType of this {@link Cola} instance. + */ + @Nonnull + public String getSodaType() + { + return sodaType; + } + + /** + * Set the sodaType of this {@link Cola} instance. + * + * @param sodaType + * The sodaType of this {@link Cola} + */ + public void setSodaType( @Nullable final String sodaType ) + { + this.sodaType = sodaType; + } + + /** + * Set the caffeine of this {@link Cola} instance and return the same instance. + * + * @param caffeine + * The caffeine of this {@link Cola} + * @return The same instance of this {@link Cola} class + */ + @Nonnull + public Cola caffeine( @Nullable final Boolean caffeine ) + { + this.caffeine = caffeine; + return this; + } + + /** + * Get caffeine + * + * @return caffeine The caffeine of this {@link Cola} instance. + */ + @Nonnull + public Boolean isCaffeine() + { + return caffeine; + } + + /** + * Set the caffeine of this {@link Cola} instance. + * + * @param caffeine + * The caffeine of this {@link Cola} + */ + public void setCaffeine( @Nullable final Boolean caffeine ) + { + this.caffeine = caffeine; + } + + /** + * Set the logo of this {@link Cola} instance and return the same instance. + * + * @param logo + * The logo of this {@link Cola} + * @return The same instance of this {@link Cola} class + */ + @Nonnull + public Cola logo( @Nullable final ColaLogo logo ) + { + this.logo = logo; + return this; + } + + /** + * Get logo + * + * @return logo The logo of this {@link Cola} instance. + */ + @Nonnull + public ColaLogo getLogo() + { + return logo; + } + + /** + * Set the logo of this {@link Cola} instance. + * + * @param logo + * The logo of this {@link Cola} + */ + public void setLogo( @Nullable final ColaLogo logo ) + { + this.logo = logo; + } + + /** + * Set the barCode of this {@link Cola} instance and return the same instance. + * + * @param barCode + * The barCode of this {@link Cola} + * @return The same instance of this {@link Cola} class + */ + @Nonnull + public Cola barCode( @Nullable final ColaBarCode barCode ) + { + this.barCode = barCode; + return this; + } + + /** + * Get barCode + * + * @return barCode The barCode of this {@link Cola} instance. + */ + @Nonnull + public ColaBarCode getBarCode() + { + return barCode; + } + + /** + * Set the barCode of this {@link Cola} instance. + * + * @param barCode + * The barCode of this {@link Cola} + */ + public void setBarCode( @Nullable final ColaBarCode barCode ) + { + this.barCode = barCode; + } + + /** + * Get the names of the unrecognizable properties of the {@link Cola}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Cola} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("Cola has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Cola} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( sodaType != null ) + declaredFields.put("sodaType", sodaType); + if( caffeine != null ) + declaredFields.put("caffeine", caffeine); + if( logo != null ) + declaredFields.put("logo", logo); + if( barCode != null ) + declaredFields.put("barCode", barCode); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Cola} instance. If the map previously contained a mapping for the + * key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final Cola cola = (Cola) o; + return Objects.equals(this.cloudSdkCustomFields, cola.cloudSdkCustomFields) + && Objects.equals(this.sodaType, cola.sodaType) + && Objects.equals(this.caffeine, cola.caffeine) + && Objects.equals(this.logo, cola.logo) + && Objects.equals(this.barCode, cola.barCode); + } + + @Override + public int hashCode() + { + return Objects.hash(sodaType, caffeine, logo, barCode, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class Cola {\n"); + sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n"); + sb.append(" caffeine: ").append(toIndentedString(caffeine)).append("\n"); + sb.append(" logo: ").append(toIndentedString(logo)).append("\n"); + sb.append(" barCode: ").append(toIndentedString(barCode)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatMessageContent.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaBarCode.java similarity index 60% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatMessageContent.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaBarCode.java index b89cdc2a3..6ca5fa9dc 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ChatMessageContent.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaBarCode.java @@ -3,8 +3,8 @@ */ /* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. + * SodaStore API + * API for managing soda products and orders in SodaStore. * * * @@ -15,6 +15,7 @@ package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +import java.math.BigDecimal; import java.util.List; import javax.annotation.Nonnull; @@ -22,34 +23,34 @@ import com.google.common.annotations.Beta; /** - * ChatMessageContent + * ColaBarCode */ @Beta -public interface ChatMessageContent +public interface ColaBarCode { /** - * Helper class to create {@code List } that implements {@link ChatMessageContent}. + * Helper class to create {@code List } that implements {@link ColaBarCode}. */ - record ListOfTextContents(@com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) implements ChatMessageContent {} + record ListOfBigDecimals(@com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) implements ColaBarCode {} /** - * Creator to enable deserialization of {@code List }. + * Creator to enable deserialization of {@code List }. * * @param val * the value to use - * @return a new instance of {@link ListOfTextContents}. + * @return a new instance of {@link ListOfBigDecimals}. */ @com.fasterxml.jackson.annotation.JsonCreator @Nonnull - static ListOfTextContents createListOfTextContents( @Nonnull final List val ) + static ListOfBigDecimals createListOfBigDecimals( @Nonnull final List val ) { - return new ListOfTextContents(val); + return new ListOfBigDecimals(val); } /** - * Helper class to create {@code String } that implements {@link ChatMessageContent}. + * Helper class to create {@code String } that implements {@link ColaBarCode}. */ - record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) implements ChatMessageContent {} + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) implements ColaBarCode {} /** * Creator to enable deserialization of {@code String }. diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessageContent.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaLogo.java similarity index 55% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessageContent.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaLogo.java index 8ebd2fb23..84624d0e3 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessageContent.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaLogo.java @@ -3,8 +3,8 @@ */ /* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. + * SodaStore API + * API for managing soda products and orders in SodaStore. * * * @@ -22,35 +22,34 @@ import com.google.common.annotations.Beta; /** - * UserChatMessageContent + * ColaLogo */ @Beta -public interface UserChatMessageContent +public interface ColaLogo { /** - * Helper class to create {@code List } that implements {@link UserChatMessageContent}. + * Helper class to create {@code List> } that implements {@link ColaLogo}. */ - record ListOfUserChatMessageContentItems(@com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) implements UserChatMessageContent {} + record ListOfListOfIntegers(@com.fasterxml.jackson.annotation.JsonValue @Nonnull List> values) implements ColaLogo {} /** - * Creator to enable deserialization of {@code List }. + * Creator to enable deserialization of {@code List> }. * * @param val * the value to use - * @return a new instance of {@link ListOfUserChatMessageContentItems}. + * @return a new instance of {@link ListOfListOfIntegers}. */ @com.fasterxml.jackson.annotation.JsonCreator @Nonnull - static ListOfUserChatMessageContentItems createListOfUserChatMessageContentItems( - @Nonnull final List val ) + static ListOfListOfIntegers createListOfListOfIntegers( @Nonnull final List> val ) { - return new ListOfUserChatMessageContentItems(val); + return new ListOfListOfIntegers(val); } /** - * Helper class to create {@code String } that implements {@link UserChatMessageContent}. + * Helper class to create {@code String } that implements {@link ColaLogo}. */ - record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) implements UserChatMessageContent {} + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) implements ColaLogo {} /** * Creator to enable deserialization of {@code String }. diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIConfig.java deleted file mode 100644 index b6a28ae28..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIConfig.java +++ /dev/null @@ -1,545 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * DPIConfig - */ - -@Beta // CHECKSTYLE:OFF -public class DPIConfig -// CHECKSTYLE:ON -{ - /** - * Type of masking service provider - */ - public enum TypeEnum - { - /** - * The SAP_DATA_PRIVACY_INTEGRATION option of this DPIConfig - */ - SAP_DATA_PRIVACY_INTEGRATION("sap_data_privacy_integration"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this DPIConfig - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type DPIConfig - */ - @JsonCreator - @Nonnull - public static TypeEnum fromValue( @Nonnull final String value ) - { - for( TypeEnum b : TypeEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "type" ) - private TypeEnum type; - - /** - * Type of masking method to be used - */ - public enum MethodEnum - { - /** - * The ANONYMIZATION option of this DPIConfig - */ - ANONYMIZATION("anonymization"), - - /** - * The PSEUDONYMIZATION option of this DPIConfig - */ - PSEUDONYMIZATION("pseudonymization"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this DPIConfig - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - MethodEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type DPIConfig - */ - @JsonCreator - @Nonnull - public static MethodEnum fromValue( @Nonnull final String value ) - { - for( MethodEnum b : MethodEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "method" ) - private MethodEnum method; - - @JsonProperty( "entities" ) - private List entities = new ArrayList<>(); - - @JsonProperty( "allowlist" ) - private List allowlist = new ArrayList<>(); - - @JsonProperty( "mask_grounding_input" ) - private DPIConfigMaskGroundingInput maskGroundingInput; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for DPIConfig. - */ - protected DPIConfig() - { - } - - /** - * Set the type of this {@link DPIConfig} instance and return the same instance. - * - * @param type - * Type of masking service provider - * @return The same instance of this {@link DPIConfig} class - */ - @Nonnull - public DPIConfig type( @Nonnull final TypeEnum type ) - { - this.type = type; - return this; - } - - /** - * Type of masking service provider - * - * @return type The type of this {@link DPIConfig} instance. - */ - @Nonnull - public TypeEnum getType() - { - return type; - } - - /** - * Set the type of this {@link DPIConfig} instance. - * - * @param type - * Type of masking service provider - */ - public void setType( @Nonnull final TypeEnum type ) - { - this.type = type; - } - - /** - * Set the method of this {@link DPIConfig} instance and return the same instance. - * - * @param method - * Type of masking method to be used - * @return The same instance of this {@link DPIConfig} class - */ - @Nonnull - public DPIConfig method( @Nonnull final MethodEnum method ) - { - this.method = method; - return this; - } - - /** - * Type of masking method to be used - * - * @return method The method of this {@link DPIConfig} instance. - */ - @Nonnull - public MethodEnum getMethod() - { - return method; - } - - /** - * Set the method of this {@link DPIConfig} instance. - * - * @param method - * Type of masking method to be used - */ - public void setMethod( @Nonnull final MethodEnum method ) - { - this.method = method; - } - - /** - * Set the entities of this {@link DPIConfig} instance and return the same instance. - * - * @param entities - * List of entities to be masked - * @return The same instance of this {@link DPIConfig} class - */ - @Nonnull - public DPIConfig entities( @Nonnull final List entities ) - { - this.entities = entities; - return this; - } - - /** - * Add one entities instance to this {@link DPIConfig}. - * - * @param entitiesItem - * The entities that should be added - * @return The same instance of type {@link DPIConfig} - */ - @Nonnull - public DPIConfig addEntitiesItem( @Nonnull final DPIEntityConfig entitiesItem ) - { - if( this.entities == null ) { - this.entities = new ArrayList<>(); - } - this.entities.add(entitiesItem); - return this; - } - - /** - * List of entities to be masked - * - * @return entities The entities of this {@link DPIConfig} instance. - */ - @Nonnull - public List getEntities() - { - return entities; - } - - /** - * Set the entities of this {@link DPIConfig} instance. - * - * @param entities - * List of entities to be masked - */ - public void setEntities( @Nonnull final List entities ) - { - this.entities = entities; - } - - /** - * Set the allowlist of this {@link DPIConfig} instance and return the same instance. - * - * @param allowlist - * List of strings that should not be masked - * @return The same instance of this {@link DPIConfig} class - */ - @Nonnull - public DPIConfig allowlist( @Nullable final List allowlist ) - { - this.allowlist = allowlist; - return this; - } - - /** - * Add one allowlist instance to this {@link DPIConfig}. - * - * @param allowlistItem - * The allowlist that should be added - * @return The same instance of type {@link DPIConfig} - */ - @Nonnull - public DPIConfig addAllowlistItem( @Nonnull final String allowlistItem ) - { - if( this.allowlist == null ) { - this.allowlist = new ArrayList<>(); - } - this.allowlist.add(allowlistItem); - return this; - } - - /** - * List of strings that should not be masked - * - * @return allowlist The allowlist of this {@link DPIConfig} instance. - */ - @Nonnull - public List getAllowlist() - { - return allowlist; - } - - /** - * Set the allowlist of this {@link DPIConfig} instance. - * - * @param allowlist - * List of strings that should not be masked - */ - public void setAllowlist( @Nullable final List allowlist ) - { - this.allowlist = allowlist; - } - - /** - * Set the maskGroundingInput of this {@link DPIConfig} instance and return the same instance. - * - * @param maskGroundingInput - * The maskGroundingInput of this {@link DPIConfig} - * @return The same instance of this {@link DPIConfig} class - */ - @Nonnull - public DPIConfig maskGroundingInput( @Nullable final DPIConfigMaskGroundingInput maskGroundingInput ) - { - this.maskGroundingInput = maskGroundingInput; - return this; - } - - /** - * Get maskGroundingInput - * - * @return maskGroundingInput The maskGroundingInput of this {@link DPIConfig} instance. - */ - @Nonnull - public DPIConfigMaskGroundingInput getMaskGroundingInput() - { - return maskGroundingInput; - } - - /** - * Set the maskGroundingInput of this {@link DPIConfig} instance. - * - * @param maskGroundingInput - * The maskGroundingInput of this {@link DPIConfig} - */ - public void setMaskGroundingInput( @Nullable final DPIConfigMaskGroundingInput maskGroundingInput ) - { - this.maskGroundingInput = maskGroundingInput; - } - - /** - * Get the names of the unrecognizable properties of the {@link DPIConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link DPIConfig} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("DPIConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link DPIConfig} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( type != null ) - declaredFields.put("type", type); - if( method != null ) - declaredFields.put("method", method); - if( entities != null ) - declaredFields.put("entities", entities); - if( allowlist != null ) - declaredFields.put("allowlist", allowlist); - if( maskGroundingInput != null ) - declaredFields.put("maskGroundingInput", maskGroundingInput); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link DPIConfig} instance. If the map previously contained a mapping for - * the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final DPIConfig dpIConfig = (DPIConfig) o; - return Objects.equals(this.cloudSdkCustomFields, dpIConfig.cloudSdkCustomFields) - && Objects.equals(this.type, dpIConfig.type) - && Objects.equals(this.method, dpIConfig.method) - && Objects.equals(this.entities, dpIConfig.entities) - && Objects.equals(this.allowlist, dpIConfig.allowlist) - && Objects.equals(this.maskGroundingInput, dpIConfig.maskGroundingInput); - } - - @Override - public int hashCode() - { - return Objects.hash(type, method, entities, allowlist, maskGroundingInput, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class DPIConfig {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" method: ").append(toIndentedString(method)).append("\n"); - sb.append(" entities: ").append(toIndentedString(entities)).append("\n"); - sb.append(" allowlist: ").append(toIndentedString(allowlist)).append("\n"); - sb.append(" maskGroundingInput: ").append(toIndentedString(maskGroundingInput)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIConfigMaskGroundingInput.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIConfigMaskGroundingInput.java deleted file mode 100644 index 6b386e048..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIConfigMaskGroundingInput.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * DPIConfigMaskGroundingInput - */ - -@Beta // CHECKSTYLE:OFF -public class DPIConfigMaskGroundingInput -// CHECKSTYLE:ON -{ - @JsonProperty( "enabled" ) - private Boolean enabled = false; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for DPIConfigMaskGroundingInput. - */ - protected DPIConfigMaskGroundingInput() - { - } - - /** - * Set the enabled of this {@link DPIConfigMaskGroundingInput} instance and return the same instance. - * - * @param enabled - * controls whether the input to the grounding module will be masked with the configuration supplied in - * the masking module - * @return The same instance of this {@link DPIConfigMaskGroundingInput} class - */ - @Nonnull - public DPIConfigMaskGroundingInput enabled( @Nullable final Boolean enabled ) - { - this.enabled = enabled; - return this; - } - - /** - * controls whether the input to the grounding module will be masked with the configuration supplied in the masking - * module - * - * @return enabled The enabled of this {@link DPIConfigMaskGroundingInput} instance. - */ - @Nonnull - public Boolean isEnabled() - { - return enabled; - } - - /** - * Set the enabled of this {@link DPIConfigMaskGroundingInput} instance. - * - * @param enabled - * controls whether the input to the grounding module will be masked with the configuration supplied in - * the masking module - */ - public void setEnabled( @Nullable final Boolean enabled ) - { - this.enabled = enabled; - } - - /** - * Get the names of the unrecognizable properties of the {@link DPIConfigMaskGroundingInput}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link DPIConfigMaskGroundingInput} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("DPIConfigMaskGroundingInput has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link DPIConfigMaskGroundingInput} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( enabled != null ) - declaredFields.put("enabled", enabled); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link DPIConfigMaskGroundingInput} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final DPIConfigMaskGroundingInput dpIConfigMaskGroundingInput = (DPIConfigMaskGroundingInput) o; - return Objects.equals(this.cloudSdkCustomFields, dpIConfigMaskGroundingInput.cloudSdkCustomFields) - && Objects.equals(this.enabled, dpIConfigMaskGroundingInput.enabled); - } - - @Override - public int hashCode() - { - return Objects.hash(enabled, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class DPIConfigMaskGroundingInput {\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPICustomEntity.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPICustomEntity.java deleted file mode 100644 index 3dad3a337..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPICustomEntity.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * DPICustomEntity - */ - -@Beta // CHECKSTYLE:OFF -public class DPICustomEntity implements DPIEntityConfig -// CHECKSTYLE:ON -{ - @JsonProperty( "regex" ) - private String regex; - - @JsonProperty( "replacement_strategy" ) - private DPIMethodConstant replacementStrategy; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for DPICustomEntity. - */ - protected DPICustomEntity() - { - } - - /** - * Set the regex of this {@link DPICustomEntity} instance and return the same instance. - * - * @param regex - * Regular expression to match the entity - * @return The same instance of this {@link DPICustomEntity} class - */ - @Nonnull - public DPICustomEntity regex( @Nonnull final String regex ) - { - this.regex = regex; - return this; - } - - /** - * Regular expression to match the entity - * - * @return regex The regex of this {@link DPICustomEntity} instance. - */ - @Nonnull - public String getRegex() - { - return regex; - } - - /** - * Set the regex of this {@link DPICustomEntity} instance. - * - * @param regex - * Regular expression to match the entity - */ - public void setRegex( @Nonnull final String regex ) - { - this.regex = regex; - } - - /** - * Set the replacementStrategy of this {@link DPICustomEntity} instance and return the same instance. - * - * @param replacementStrategy - * The replacementStrategy of this {@link DPICustomEntity} - * @return The same instance of this {@link DPICustomEntity} class - */ - @Nonnull - public DPICustomEntity replacementStrategy( @Nonnull final DPIMethodConstant replacementStrategy ) - { - this.replacementStrategy = replacementStrategy; - return this; - } - - /** - * Get replacementStrategy - * - * @return replacementStrategy The replacementStrategy of this {@link DPICustomEntity} instance. - */ - @Nonnull - public DPIMethodConstant getReplacementStrategy() - { - return replacementStrategy; - } - - /** - * Set the replacementStrategy of this {@link DPICustomEntity} instance. - * - * @param replacementStrategy - * The replacementStrategy of this {@link DPICustomEntity} - */ - public void setReplacementStrategy( @Nonnull final DPIMethodConstant replacementStrategy ) - { - this.replacementStrategy = replacementStrategy; - } - - /** - * Get the names of the unrecognizable properties of the {@link DPICustomEntity}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link DPICustomEntity} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("DPICustomEntity has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link DPICustomEntity} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( regex != null ) - declaredFields.put("regex", regex); - if( replacementStrategy != null ) - declaredFields.put("replacementStrategy", replacementStrategy); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link DPICustomEntity} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final DPICustomEntity dpICustomEntity = (DPICustomEntity) o; - return Objects.equals(this.cloudSdkCustomFields, dpICustomEntity.cloudSdkCustomFields) - && Objects.equals(this.regex, dpICustomEntity.regex) - && Objects.equals(this.replacementStrategy, dpICustomEntity.replacementStrategy); - } - - @Override - public int hashCode() - { - return Objects.hash(regex, replacementStrategy, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class DPICustomEntity {\n"); - sb.append(" regex: ").append(toIndentedString(regex)).append("\n"); - sb.append(" replacementStrategy: ").append(toIndentedString(replacementStrategy)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIEntities.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIEntities.java deleted file mode 100644 index 8c8acdcec..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIEntities.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import javax.annotation.Nonnull; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * Default entities supported by data privacy and integration service - */ - -@Beta -public enum DPIEntities -{ - - PROFILE_PERSON("profile-person"), - - PROFILE_ORG("profile-org"), - - PROFILE_UNIVERSITY("profile-university"), - - PROFILE_LOCATION("profile-location"), - - PROFILE_EMAIL("profile-email"), - - PROFILE_PHONE("profile-phone"), - - PROFILE_ADDRESS("profile-address"), - - PROFILE_SAPIDS_INTERNAL("profile-sapids-internal"), - - PROFILE_SAPIDS_PUBLIC("profile-sapids-public"), - - PROFILE_URL("profile-url"), - - PROFILE_USERNAME_PASSWORD("profile-username-password"), - - PROFILE_NATIONALID("profile-nationalid"), - - PROFILE_IBAN("profile-iban"), - - PROFILE_SSN("profile-ssn"), - - PROFILE_CREDIT_CARD_NUMBER("profile-credit-card-number"), - - PROFILE_PASSPORT("profile-passport"), - - PROFILE_DRIVERLICENSE("profile-driverlicense"), - - PROFILE_NATIONALITY("profile-nationality"), - - PROFILE_RELIGIOUS_GROUP("profile-religious-group"), - - PROFILE_POLITICAL_GROUP("profile-political-group"), - - PROFILE_PRONOUNS_GENDER("profile-pronouns-gender"), - - PROFILE_ETHNICITY("profile-ethnicity"), - - PROFILE_GENDER("profile-gender"), - - PROFILE_SEXUAL_ORIENTATION("profile-sexual-orientation"), - - PROFILE_TRADE_UNION("profile-trade-union"), - - PROFILE_SENSITIVE_DATA("profile-sensitive-data"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private final String value; - - DPIEntities( String value ) - { - this.value = value; - } - - /** - * @return The enum value. - */ - @JsonValue - public String getValue() - { - return value; - } - - /** - * @return The String representation of the enum value. - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Converts the given value to its enum representation. - * - * @param value - * The input value. - * - * @return The enum representation of the given value. - */ - @JsonCreator - public static DPIEntities fromValue( @Nonnull final String value ) - { - for( final DPIEntities b : DPIEntities.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIMethodConstant.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIMethodConstant.java deleted file mode 100644 index 13d5bc1dc..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIMethodConstant.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * Replaces the entity with the specified value followed by an incrementing number - */ - -@Beta // CHECKSTYLE:OFF -public class DPIMethodConstant implements DPIStandardEntityReplacementStrategy -// CHECKSTYLE:ON -{ - /** - * Gets or Sets method - */ - public enum MethodEnum - { - /** - * The CONSTANT option of this DPIMethodConstant - */ - CONSTANT("constant"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this DPIMethodConstant - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - MethodEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type DPIMethodConstant - */ - @JsonCreator - @Nonnull - public static MethodEnum fromValue( @Nonnull final String value ) - { - for( MethodEnum b : MethodEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "method" ) - private MethodEnum method; - - @JsonProperty( "value" ) - private String value; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for DPIMethodConstant. - */ - protected DPIMethodConstant() - { - } - - /** - * Set the method of this {@link DPIMethodConstant} instance and return the same instance. - * - * @param method - * The method of this {@link DPIMethodConstant} - * @return The same instance of this {@link DPIMethodConstant} class - */ - @Nonnull - public DPIMethodConstant method( @Nonnull final MethodEnum method ) - { - this.method = method; - return this; - } - - /** - * Get method - * - * @return method The method of this {@link DPIMethodConstant} instance. - */ - @Nonnull - public MethodEnum getMethod() - { - return method; - } - - /** - * Set the method of this {@link DPIMethodConstant} instance. - * - * @param method - * The method of this {@link DPIMethodConstant} - */ - public void setMethod( @Nonnull final MethodEnum method ) - { - this.method = method; - } - - /** - * Set the value of this {@link DPIMethodConstant} instance and return the same instance. - * - * @param value - * Value to be used for replacement - * @return The same instance of this {@link DPIMethodConstant} class - */ - @Nonnull - public DPIMethodConstant value( @Nonnull final String value ) - { - this.value = value; - return this; - } - - /** - * Value to be used for replacement - * - * @return value The value of this {@link DPIMethodConstant} instance. - */ - @Nonnull - public String getValue() - { - return value; - } - - /** - * Set the value of this {@link DPIMethodConstant} instance. - * - * @param value - * Value to be used for replacement - */ - public void setValue( @Nonnull final String value ) - { - this.value = value; - } - - /** - * Get the names of the unrecognizable properties of the {@link DPIMethodConstant}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link DPIMethodConstant} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("DPIMethodConstant has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link DPIMethodConstant} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( method != null ) - declaredFields.put("method", method); - if( value != null ) - declaredFields.put("value", value); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link DPIMethodConstant} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final DPIMethodConstant dpIMethodConstant = (DPIMethodConstant) o; - return Objects.equals(this.cloudSdkCustomFields, dpIMethodConstant.cloudSdkCustomFields) - && Objects.equals(this.method, dpIMethodConstant.method) - && Objects.equals(this.value, dpIMethodConstant.value); - } - - @Override - public int hashCode() - { - return Objects.hash(method, value, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class DPIMethodConstant {\n"); - sb.append(" method: ").append(toIndentedString(method)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIMethodFabricatedData.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIMethodFabricatedData.java deleted file mode 100644 index 564581c2b..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIMethodFabricatedData.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * Replaces the entity with a randomly generated value appropriate to its type. - */ - -@Beta // CHECKSTYLE:OFF -public class DPIMethodFabricatedData implements DPIStandardEntityReplacementStrategy -// CHECKSTYLE:ON -{ - /** - * Gets or Sets method - */ - public enum MethodEnum - { - /** - * The FABRICATED_DATA option of this DPIMethodFabricatedData - */ - FABRICATED_DATA("fabricated_data"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this DPIMethodFabricatedData - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - MethodEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type DPIMethodFabricatedData - */ - @JsonCreator - @Nonnull - public static MethodEnum fromValue( @Nonnull final String value ) - { - for( MethodEnum b : MethodEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "method" ) - private MethodEnum method; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for DPIMethodFabricatedData. - */ - protected DPIMethodFabricatedData() - { - } - - /** - * Set the method of this {@link DPIMethodFabricatedData} instance and return the same instance. - * - * @param method - * The method of this {@link DPIMethodFabricatedData} - * @return The same instance of this {@link DPIMethodFabricatedData} class - */ - @Nonnull - public DPIMethodFabricatedData method( @Nonnull final MethodEnum method ) - { - this.method = method; - return this; - } - - /** - * Get method - * - * @return method The method of this {@link DPIMethodFabricatedData} instance. - */ - @Nonnull - public MethodEnum getMethod() - { - return method; - } - - /** - * Set the method of this {@link DPIMethodFabricatedData} instance. - * - * @param method - * The method of this {@link DPIMethodFabricatedData} - */ - public void setMethod( @Nonnull final MethodEnum method ) - { - this.method = method; - } - - /** - * Get the names of the unrecognizable properties of the {@link DPIMethodFabricatedData}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link DPIMethodFabricatedData} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("DPIMethodFabricatedData has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link DPIMethodFabricatedData} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( method != null ) - declaredFields.put("method", method); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link DPIMethodFabricatedData} instance. If the map previously contained - * a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final DPIMethodFabricatedData dpIMethodFabricatedData = (DPIMethodFabricatedData) o; - return Objects.equals(this.cloudSdkCustomFields, dpIMethodFabricatedData.cloudSdkCustomFields) - && Objects.equals(this.method, dpIMethodFabricatedData.method); - } - - @Override - public int hashCode() - { - return Objects.hash(method, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class DPIMethodFabricatedData {\n"); - sb.append(" method: ").append(toIndentedString(method)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIStandardEntity.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIStandardEntity.java deleted file mode 100644 index 64cce67e4..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIStandardEntity.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * DPIStandardEntity - */ - -@Beta // CHECKSTYLE:OFF -public class DPIStandardEntity implements DPIEntityConfig -// CHECKSTYLE:ON -{ - @JsonProperty( "type" ) - private DPIEntities type; - - @JsonProperty( "replacement_strategy" ) - private DPIStandardEntityReplacementStrategy replacementStrategy; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for DPIStandardEntity. - */ - protected DPIStandardEntity() - { - } - - /** - * Set the type of this {@link DPIStandardEntity} instance and return the same instance. - * - * @param type - * The type of this {@link DPIStandardEntity} - * @return The same instance of this {@link DPIStandardEntity} class - */ - @Nonnull - public DPIStandardEntity type( @Nonnull final DPIEntities type ) - { - this.type = type; - return this; - } - - /** - * Get type - * - * @return type The type of this {@link DPIStandardEntity} instance. - */ - @Nonnull - public DPIEntities getType() - { - return type; - } - - /** - * Set the type of this {@link DPIStandardEntity} instance. - * - * @param type - * The type of this {@link DPIStandardEntity} - */ - public void setType( @Nonnull final DPIEntities type ) - { - this.type = type; - } - - /** - * Set the replacementStrategy of this {@link DPIStandardEntity} instance and return the same instance. - * - * @param replacementStrategy - * The replacementStrategy of this {@link DPIStandardEntity} - * @return The same instance of this {@link DPIStandardEntity} class - */ - @Nonnull - public DPIStandardEntity replacementStrategy( - @Nullable final DPIStandardEntityReplacementStrategy replacementStrategy ) - { - this.replacementStrategy = replacementStrategy; - return this; - } - - /** - * Get replacementStrategy - * - * @return replacementStrategy The replacementStrategy of this {@link DPIStandardEntity} instance. - */ - @Nonnull - public DPIStandardEntityReplacementStrategy getReplacementStrategy() - { - return replacementStrategy; - } - - /** - * Set the replacementStrategy of this {@link DPIStandardEntity} instance. - * - * @param replacementStrategy - * The replacementStrategy of this {@link DPIStandardEntity} - */ - public void setReplacementStrategy( @Nullable final DPIStandardEntityReplacementStrategy replacementStrategy ) - { - this.replacementStrategy = replacementStrategy; - } - - /** - * Get the names of the unrecognizable properties of the {@link DPIStandardEntity}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link DPIStandardEntity} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("DPIStandardEntity has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link DPIStandardEntity} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( type != null ) - declaredFields.put("type", type); - if( replacementStrategy != null ) - declaredFields.put("replacementStrategy", replacementStrategy); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link DPIStandardEntity} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final DPIStandardEntity dpIStandardEntity = (DPIStandardEntity) o; - return Objects.equals(this.cloudSdkCustomFields, dpIStandardEntity.cloudSdkCustomFields) - && Objects.equals(this.type, dpIStandardEntity.type) - && Objects.equals(this.replacementStrategy, dpIStandardEntity.replacementStrategy); - } - - @Override - public int hashCode() - { - return Objects.hash(type, replacementStrategy, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class DPIStandardEntity {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" replacementStrategy: ").append(toIndentedString(replacementStrategy)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIStandardEntityReplacementStrategy.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIStandardEntityReplacementStrategy.java deleted file mode 100644 index 64f03bdcf..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIStandardEntityReplacementStrategy.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.google.common.annotations.Beta; - -/** - * Replacement strategy to be used for the entity - */ -@Beta -@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) -@JsonSubTypes( { - @JsonSubTypes.Type( value = DPIMethodConstant.class ), - @JsonSubTypes.Type( value = DPIMethodFabricatedData.class ), } ) - -public interface DPIStandardEntityReplacementStrategy -{ -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DataRepositoryType.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DataRepositoryType.java deleted file mode 100644 index ea712242f..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DataRepositoryType.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import javax.annotation.Nonnull; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * Only include DataRepositories with the given type. - */ - -@Beta -public enum DataRepositoryType -{ - - VECTOR("vector"), - - HELP_SAP_COM("help.sap.com"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private final String value; - - DataRepositoryType( String value ) - { - this.value = value; - } - - /** - * @return The enum value. - */ - @JsonValue - public String getValue() - { - return value; - } - - /** - * @return The String representation of the enum value. - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Converts the given value to its enum representation. - * - * @param value - * The input value. - * - * @return The enum representation of the given value. - */ - @JsonCreator - public static DataRepositoryType fromValue( @Nonnull final String value ) - { - for( final DataRepositoryType b : DataRepositoryType.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DeveloperChatMessage.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DeveloperChatMessage.java deleted file mode 100644 index c3c17e4c8..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DeveloperChatMessage.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * DeveloperChatMessage - */ - -@Beta // CHECKSTYLE:OFF -public class DeveloperChatMessage implements ChatMessage -// CHECKSTYLE:ON -{ - /** - * Gets or Sets role - */ - public enum RoleEnum - { - /** - * The DEVELOPER option of this DeveloperChatMessage - */ - DEVELOPER("developer"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this DeveloperChatMessage - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - RoleEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type DeveloperChatMessage - */ - @JsonCreator - @Nonnull - public static RoleEnum fromValue( @Nonnull final String value ) - { - for( RoleEnum b : RoleEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "role" ) - private RoleEnum role; - - @JsonProperty( "content" ) - private ChatMessageContent content; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for DeveloperChatMessage. - */ - protected DeveloperChatMessage() - { - } - - /** - * Set the role of this {@link DeveloperChatMessage} instance and return the same instance. - * - * @param role - * The role of this {@link DeveloperChatMessage} - * @return The same instance of this {@link DeveloperChatMessage} class - */ - @Nonnull - public DeveloperChatMessage role( @Nonnull final RoleEnum role ) - { - this.role = role; - return this; - } - - /** - * Get role - * - * @return role The role of this {@link DeveloperChatMessage} instance. - */ - @Nonnull - public RoleEnum getRole() - { - return role; - } - - /** - * Set the role of this {@link DeveloperChatMessage} instance. - * - * @param role - * The role of this {@link DeveloperChatMessage} - */ - public void setRole( @Nonnull final RoleEnum role ) - { - this.role = role; - } - - /** - * Set the content of this {@link DeveloperChatMessage} instance and return the same instance. - * - * @param content - * The content of this {@link DeveloperChatMessage} - * @return The same instance of this {@link DeveloperChatMessage} class - */ - @Nonnull - public DeveloperChatMessage content( @Nonnull final ChatMessageContent content ) - { - this.content = content; - return this; - } - - /** - * Get content - * - * @return content The content of this {@link DeveloperChatMessage} instance. - */ - @Nonnull - public ChatMessageContent getContent() - { - return content; - } - - /** - * Set the content of this {@link DeveloperChatMessage} instance. - * - * @param content - * The content of this {@link DeveloperChatMessage} - */ - public void setContent( @Nonnull final ChatMessageContent content ) - { - this.content = content; - } - - /** - * Get the names of the unrecognizable properties of the {@link DeveloperChatMessage}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link DeveloperChatMessage} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("DeveloperChatMessage has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link DeveloperChatMessage} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( role != null ) - declaredFields.put("role", role); - if( content != null ) - declaredFields.put("content", content); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link DeveloperChatMessage} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final DeveloperChatMessage developerChatMessage = (DeveloperChatMessage) o; - return Objects.equals(this.cloudSdkCustomFields, developerChatMessage.cloudSdkCustomFields) - && Objects.equals(this.role, developerChatMessage.role) - && Objects.equals(this.content, developerChatMessage.content); - } - - @Override - public int hashCode() - { - return Objects.hash(role, content, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class DeveloperChatMessage {\n"); - sb.append(" role: ").append(toIndentedString(role)).append("\n"); - sb.append(" content: ").append(toIndentedString(content)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DocumentGroundingFilter.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DocumentGroundingFilter.java deleted file mode 100644 index 46854776a..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DocumentGroundingFilter.java +++ /dev/null @@ -1,546 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * DocumentGroundingFilter - */ - -@Beta // CHECKSTYLE:OFF -public class DocumentGroundingFilter implements GroundingModuleConfigConfigFiltersInner -// CHECKSTYLE:ON -{ - @JsonProperty( "id" ) - private String id; - - @JsonProperty( "search_config" ) - private GroundingFilterSearchConfiguration searchConfig; - - @JsonProperty( "data_repositories" ) - private List dataRepositories = new ArrayList<>(Arrays.asList("*")); - - @JsonProperty( "data_repository_type" ) - private DataRepositoryType dataRepositoryType; - - @JsonProperty( "data_repository_metadata" ) - private List dataRepositoryMetadata = new ArrayList<>(); - - @JsonProperty( "document_metadata" ) - private List documentMetadata = new ArrayList<>(); - - @JsonProperty( "chunk_metadata" ) - private List chunkMetadata = new ArrayList<>(); - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for DocumentGroundingFilter. - */ - protected DocumentGroundingFilter() - { - } - - /** - * Set the id of this {@link DocumentGroundingFilter} instance and return the same instance. - * - * @param id - * Identifier of this SearchFilter - unique per request. - * @return The same instance of this {@link DocumentGroundingFilter} class - */ - @Nonnull - public DocumentGroundingFilter id( @Nullable final String id ) - { - this.id = id; - return this; - } - - /** - * Identifier of this SearchFilter - unique per request. - * - * @return id The id of this {@link DocumentGroundingFilter} instance. - */ - @Nonnull - public String getId() - { - return id; - } - - /** - * Set the id of this {@link DocumentGroundingFilter} instance. - * - * @param id - * Identifier of this SearchFilter - unique per request. - */ - public void setId( @Nullable final String id ) - { - this.id = id; - } - - /** - * Set the searchConfig of this {@link DocumentGroundingFilter} instance and return the same instance. - * - * @param searchConfig - * The searchConfig of this {@link DocumentGroundingFilter} - * @return The same instance of this {@link DocumentGroundingFilter} class - */ - @Nonnull - public DocumentGroundingFilter searchConfig( @Nullable final GroundingFilterSearchConfiguration searchConfig ) - { - this.searchConfig = searchConfig; - return this; - } - - /** - * Get searchConfig - * - * @return searchConfig The searchConfig of this {@link DocumentGroundingFilter} instance. - */ - @Nonnull - public GroundingFilterSearchConfiguration getSearchConfig() - { - return searchConfig; - } - - /** - * Set the searchConfig of this {@link DocumentGroundingFilter} instance. - * - * @param searchConfig - * The searchConfig of this {@link DocumentGroundingFilter} - */ - public void setSearchConfig( @Nullable final GroundingFilterSearchConfiguration searchConfig ) - { - this.searchConfig = searchConfig; - } - - /** - * Set the dataRepositories of this {@link DocumentGroundingFilter} instance and return the same instance. - * - * @param dataRepositories - * Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository - * ids. - * @return The same instance of this {@link DocumentGroundingFilter} class - */ - @Nonnull - public DocumentGroundingFilter dataRepositories( @Nullable final List dataRepositories ) - { - this.dataRepositories = dataRepositories; - return this; - } - - /** - * Add one dataRepositories instance to this {@link DocumentGroundingFilter}. - * - * @param dataRepositoriesItem - * The dataRepositories that should be added - * @return The same instance of type {@link DocumentGroundingFilter} - */ - @Nonnull - public DocumentGroundingFilter addDataRepositoriesItem( @Nonnull final String dataRepositoriesItem ) - { - if( this.dataRepositories == null ) { - this.dataRepositories = new ArrayList<>(Arrays.asList("*")); - } - this.dataRepositories.add(dataRepositoriesItem); - return this; - } - - /** - * Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids. - * - * @return dataRepositories The dataRepositories of this {@link DocumentGroundingFilter} instance. - */ - @Nonnull - public List getDataRepositories() - { - return dataRepositories; - } - - /** - * Set the dataRepositories of this {@link DocumentGroundingFilter} instance. - * - * @param dataRepositories - * Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository - * ids. - */ - public void setDataRepositories( @Nullable final List dataRepositories ) - { - this.dataRepositories = dataRepositories; - } - - /** - * Set the dataRepositoryType of this {@link DocumentGroundingFilter} instance and return the same instance. - * - * @param dataRepositoryType - * The dataRepositoryType of this {@link DocumentGroundingFilter} - * @return The same instance of this {@link DocumentGroundingFilter} class - */ - @Nonnull - public DocumentGroundingFilter dataRepositoryType( @Nonnull final DataRepositoryType dataRepositoryType ) - { - this.dataRepositoryType = dataRepositoryType; - return this; - } - - /** - * Get dataRepositoryType - * - * @return dataRepositoryType The dataRepositoryType of this {@link DocumentGroundingFilter} instance. - */ - @Nonnull - public DataRepositoryType getDataRepositoryType() - { - return dataRepositoryType; - } - - /** - * Set the dataRepositoryType of this {@link DocumentGroundingFilter} instance. - * - * @param dataRepositoryType - * The dataRepositoryType of this {@link DocumentGroundingFilter} - */ - public void setDataRepositoryType( @Nonnull final DataRepositoryType dataRepositoryType ) - { - this.dataRepositoryType = dataRepositoryType; - } - - /** - * Set the dataRepositoryMetadata of this {@link DocumentGroundingFilter} instance and return the same instance. - * - * @param dataRepositoryMetadata - * Restrict DataRepositories considered during search to those annotated with the given metadata. Useful - * when combined with dataRepositories=['*'] - * @return The same instance of this {@link DocumentGroundingFilter} class - */ - @Nonnull - public DocumentGroundingFilter dataRepositoryMetadata( - @Nullable final List dataRepositoryMetadata ) - { - this.dataRepositoryMetadata = dataRepositoryMetadata; - return this; - } - - /** - * Add one dataRepositoryMetadata instance to this {@link DocumentGroundingFilter}. - * - * @param dataRepositoryMetadataItem - * The dataRepositoryMetadata that should be added - * @return The same instance of type {@link DocumentGroundingFilter} - */ - @Nonnull - public DocumentGroundingFilter addDataRepositoryMetadataItem( - @Nonnull final KeyValueListPair dataRepositoryMetadataItem ) - { - if( this.dataRepositoryMetadata == null ) { - this.dataRepositoryMetadata = new ArrayList<>(); - } - this.dataRepositoryMetadata.add(dataRepositoryMetadataItem); - return this; - } - - /** - * Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when - * combined with dataRepositories=['*'] - * - * @return dataRepositoryMetadata The dataRepositoryMetadata of this {@link DocumentGroundingFilter} instance. - */ - @Nonnull - public List getDataRepositoryMetadata() - { - return dataRepositoryMetadata; - } - - /** - * Set the dataRepositoryMetadata of this {@link DocumentGroundingFilter} instance. - * - * @param dataRepositoryMetadata - * Restrict DataRepositories considered during search to those annotated with the given metadata. Useful - * when combined with dataRepositories=['*'] - */ - public void setDataRepositoryMetadata( @Nullable final List dataRepositoryMetadata ) - { - this.dataRepositoryMetadata = dataRepositoryMetadata; - } - - /** - * Set the documentMetadata of this {@link DocumentGroundingFilter} instance and return the same instance. - * - * @param documentMetadata - * Restrict documents considered during search to those annotated with the given metadata. - * @return The same instance of this {@link DocumentGroundingFilter} class - */ - @Nonnull - public DocumentGroundingFilter documentMetadata( - @Nullable final List documentMetadata ) - { - this.documentMetadata = documentMetadata; - return this; - } - - /** - * Add one documentMetadata instance to this {@link DocumentGroundingFilter}. - * - * @param documentMetadataItem - * The documentMetadata that should be added - * @return The same instance of type {@link DocumentGroundingFilter} - */ - @Nonnull - public DocumentGroundingFilter addDocumentMetadataItem( - @Nonnull final SearchDocumentKeyValueListPair documentMetadataItem ) - { - if( this.documentMetadata == null ) { - this.documentMetadata = new ArrayList<>(); - } - this.documentMetadata.add(documentMetadataItem); - return this; - } - - /** - * Restrict documents considered during search to those annotated with the given metadata. - * - * @return documentMetadata The documentMetadata of this {@link DocumentGroundingFilter} instance. - */ - @Nonnull - public List getDocumentMetadata() - { - return documentMetadata; - } - - /** - * Set the documentMetadata of this {@link DocumentGroundingFilter} instance. - * - * @param documentMetadata - * Restrict documents considered during search to those annotated with the given metadata. - */ - public void setDocumentMetadata( @Nullable final List documentMetadata ) - { - this.documentMetadata = documentMetadata; - } - - /** - * Set the chunkMetadata of this {@link DocumentGroundingFilter} instance and return the same instance. - * - * @param chunkMetadata - * Restrict chunks considered during search to those with the given metadata. - * @return The same instance of this {@link DocumentGroundingFilter} class - */ - @Nonnull - public DocumentGroundingFilter chunkMetadata( @Nullable final List chunkMetadata ) - { - this.chunkMetadata = chunkMetadata; - return this; - } - - /** - * Add one chunkMetadata instance to this {@link DocumentGroundingFilter}. - * - * @param chunkMetadataItem - * The chunkMetadata that should be added - * @return The same instance of type {@link DocumentGroundingFilter} - */ - @Nonnull - public DocumentGroundingFilter addChunkMetadataItem( @Nonnull final KeyValueListPair chunkMetadataItem ) - { - if( this.chunkMetadata == null ) { - this.chunkMetadata = new ArrayList<>(); - } - this.chunkMetadata.add(chunkMetadataItem); - return this; - } - - /** - * Restrict chunks considered during search to those with the given metadata. - * - * @return chunkMetadata The chunkMetadata of this {@link DocumentGroundingFilter} instance. - */ - @Nonnull - public List getChunkMetadata() - { - return chunkMetadata; - } - - /** - * Set the chunkMetadata of this {@link DocumentGroundingFilter} instance. - * - * @param chunkMetadata - * Restrict chunks considered during search to those with the given metadata. - */ - public void setChunkMetadata( @Nullable final List chunkMetadata ) - { - this.chunkMetadata = chunkMetadata; - } - - /** - * Get the names of the unrecognizable properties of the {@link DocumentGroundingFilter}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link DocumentGroundingFilter} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("DocumentGroundingFilter has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link DocumentGroundingFilter} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( id != null ) - declaredFields.put("id", id); - if( searchConfig != null ) - declaredFields.put("searchConfig", searchConfig); - if( dataRepositories != null ) - declaredFields.put("dataRepositories", dataRepositories); - if( dataRepositoryType != null ) - declaredFields.put("dataRepositoryType", dataRepositoryType); - if( dataRepositoryMetadata != null ) - declaredFields.put("dataRepositoryMetadata", dataRepositoryMetadata); - if( documentMetadata != null ) - declaredFields.put("documentMetadata", documentMetadata); - if( chunkMetadata != null ) - declaredFields.put("chunkMetadata", chunkMetadata); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link DocumentGroundingFilter} instance. If the map previously contained - * a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final DocumentGroundingFilter documentGroundingFilter = (DocumentGroundingFilter) o; - return Objects.equals(this.cloudSdkCustomFields, documentGroundingFilter.cloudSdkCustomFields) - && Objects.equals(this.id, documentGroundingFilter.id) - && Objects.equals(this.searchConfig, documentGroundingFilter.searchConfig) - && Objects.equals(this.dataRepositories, documentGroundingFilter.dataRepositories) - && Objects.equals(this.dataRepositoryType, documentGroundingFilter.dataRepositoryType) - && Objects.equals(this.dataRepositoryMetadata, documentGroundingFilter.dataRepositoryMetadata) - && Objects.equals(this.documentMetadata, documentGroundingFilter.documentMetadata) - && Objects.equals(this.chunkMetadata, documentGroundingFilter.chunkMetadata); - } - - @Override - public int hashCode() - { - return Objects - .hash( - id, - searchConfig, - dataRepositories, - dataRepositoryType, - dataRepositoryMetadata, - documentMetadata, - chunkMetadata, - cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class DocumentGroundingFilter {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" searchConfig: ").append(toIndentedString(searchConfig)).append("\n"); - sb.append(" dataRepositories: ").append(toIndentedString(dataRepositories)).append("\n"); - sb.append(" dataRepositoryType: ").append(toIndentedString(dataRepositoryType)).append("\n"); - sb.append(" dataRepositoryMetadata: ").append(toIndentedString(dataRepositoryMetadata)).append("\n"); - sb.append(" documentMetadata: ").append(toIndentedString(documentMetadata)).append("\n"); - sb.append(" chunkMetadata: ").append(toIndentedString(chunkMetadata)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ErrorResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ErrorResponse.java deleted file mode 100644 index 449e750ee..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ErrorResponse.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * ErrorResponse - */ - -@Beta // CHECKSTYLE:OFF -public class ErrorResponse -// CHECKSTYLE:ON -{ - @JsonProperty( "request_id" ) - private String requestId; - - @JsonProperty( "message" ) - private String message; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for ErrorResponse. - */ - protected ErrorResponse() - { - } - - /** - * Set the requestId of this {@link ErrorResponse} instance and return the same instance. - * - * @param requestId - * The requestId of this {@link ErrorResponse} - * @return The same instance of this {@link ErrorResponse} class - */ - @Nonnull - public ErrorResponse requestId( @Nonnull final String requestId ) - { - this.requestId = requestId; - return this; - } - - /** - * Get requestId - * - * @return requestId The requestId of this {@link ErrorResponse} instance. - */ - @Nonnull - public String getRequestId() - { - return requestId; - } - - /** - * Set the requestId of this {@link ErrorResponse} instance. - * - * @param requestId - * The requestId of this {@link ErrorResponse} - */ - public void setRequestId( @Nonnull final String requestId ) - { - this.requestId = requestId; - } - - /** - * Set the message of this {@link ErrorResponse} instance and return the same instance. - * - * @param message - * The message of this {@link ErrorResponse} - * @return The same instance of this {@link ErrorResponse} class - */ - @Nonnull - public ErrorResponse message( @Nonnull final String message ) - { - this.message = message; - return this; - } - - /** - * Get message - * - * @return message The message of this {@link ErrorResponse} instance. - */ - @Nonnull - public String getMessage() - { - return message; - } - - /** - * Set the message of this {@link ErrorResponse} instance. - * - * @param message - * The message of this {@link ErrorResponse} - */ - public void setMessage( @Nonnull final String message ) - { - this.message = message; - } - - /** - * Get the names of the unrecognizable properties of the {@link ErrorResponse}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link ErrorResponse} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("ErrorResponse has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link ErrorResponse} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( requestId != null ) - declaredFields.put("requestId", requestId); - if( message != null ) - declaredFields.put("message", message); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link ErrorResponse} instance. If the map previously contained a mapping - * for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final ErrorResponse errorResponse = (ErrorResponse) o; - return Objects.equals(this.cloudSdkCustomFields, errorResponse.cloudSdkCustomFields) - && Objects.equals(this.requestId, errorResponse.requestId) - && Objects.equals(this.message, errorResponse.message); - } - - @Override - public int hashCode() - { - return Objects.hash(requestId, message, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class ErrorResponse {\n"); - sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/KeyValueListPair.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Fanta.java similarity index 50% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/KeyValueListPair.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Fanta.java index 245f3d533..0215af3cb 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/KeyValueListPair.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Fanta.java @@ -3,8 +3,8 @@ */ /* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. + * SodaStore API + * API for managing soda products and orders in SodaStore. * * * @@ -15,9 +15,7 @@ package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; -import java.util.ArrayList; import java.util.LinkedHashMap; -import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import java.util.Objects; @@ -33,121 +31,143 @@ import com.google.common.annotations.Beta; /** - * KeyValueListPair + * Fanta */ @Beta // CHECKSTYLE:OFF -public class KeyValueListPair +public class Fanta implements OneOf, OneOfWithDiscriminator, OneOfWithDiscriminatorAndMapping // CHECKSTYLE:ON { - @JsonProperty( "key" ) - private String key; + @JsonProperty( "sodaType" ) + private String sodaType; - @JsonProperty( "value" ) - private List value = new ArrayList<>(); + @JsonProperty( "color" ) + private String color; + + @JsonProperty( "flavor" ) + private FantaFlavor flavor; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); /** - * Default constructor for KeyValueListPair. + * Default constructor for Fanta. */ - protected KeyValueListPair() + protected Fanta() { } /** - * Set the key of this {@link KeyValueListPair} instance and return the same instance. + * Set the sodaType of this {@link Fanta} instance and return the same instance. * - * @param key - * The key of this {@link KeyValueListPair} - * @return The same instance of this {@link KeyValueListPair} class + * @param sodaType + * The sodaType of this {@link Fanta} + * @return The same instance of this {@link Fanta} class */ @Nonnull - public KeyValueListPair key( @Nonnull final String key ) + public Fanta sodaType( @Nullable final String sodaType ) { - this.key = key; + this.sodaType = sodaType; return this; } /** - * Get key + * Get sodaType * - * @return key The key of this {@link KeyValueListPair} instance. + * @return sodaType The sodaType of this {@link Fanta} instance. */ @Nonnull - public String getKey() + public String getSodaType() { - return key; + return sodaType; } /** - * Set the key of this {@link KeyValueListPair} instance. + * Set the sodaType of this {@link Fanta} instance. * - * @param key - * The key of this {@link KeyValueListPair} + * @param sodaType + * The sodaType of this {@link Fanta} */ - public void setKey( @Nonnull final String key ) + public void setSodaType( @Nullable final String sodaType ) { - this.key = key; + this.sodaType = sodaType; } /** - * Set the value of this {@link KeyValueListPair} instance and return the same instance. + * Set the color of this {@link Fanta} instance and return the same instance. * - * @param value - * The value of this {@link KeyValueListPair} - * @return The same instance of this {@link KeyValueListPair} class + * @param color + * The color of this {@link Fanta} + * @return The same instance of this {@link Fanta} class */ @Nonnull - public KeyValueListPair value( @Nonnull final List value ) + public Fanta color( @Nullable final String color ) { - this.value = value; + this.color = color; return this; } /** - * Add one value instance to this {@link KeyValueListPair}. + * Get color * - * @param valueItem - * The value that should be added - * @return The same instance of type {@link KeyValueListPair} + * @return color The color of this {@link Fanta} instance. */ @Nonnull - public KeyValueListPair addValueItem( @Nonnull final String valueItem ) + public String getColor() { - if( this.value == null ) { - this.value = new ArrayList<>(); - } - this.value.add(valueItem); + return color; + } + + /** + * Set the color of this {@link Fanta} instance. + * + * @param color + * The color of this {@link Fanta} + */ + public void setColor( @Nullable final String color ) + { + this.color = color; + } + + /** + * Set the flavor of this {@link Fanta} instance and return the same instance. + * + * @param flavor + * The flavor of this {@link Fanta} + * @return The same instance of this {@link Fanta} class + */ + @Nonnull + public Fanta flavor( @Nullable final FantaFlavor flavor ) + { + this.flavor = flavor; return this; } /** - * Get value + * Get flavor * - * @return value The value of this {@link KeyValueListPair} instance. + * @return flavor The flavor of this {@link Fanta} instance. */ @Nonnull - public List getValue() + public FantaFlavor getFlavor() { - return value; + return flavor; } /** - * Set the value of this {@link KeyValueListPair} instance. + * Set the flavor of this {@link Fanta} instance. * - * @param value - * The value of this {@link KeyValueListPair} + * @param flavor + * The flavor of this {@link Fanta} */ - public void setValue( @Nonnull final List value ) + public void setFlavor( @Nullable final FantaFlavor flavor ) { - this.value = value; + this.flavor = flavor; } /** - * Get the names of the unrecognizable properties of the {@link KeyValueListPair}. + * Get the names of the unrecognizable properties of the {@link Fanta}. * * @return The set of properties names */ @@ -159,7 +179,7 @@ public Set getCustomFieldNames() } /** - * Get the value of an unrecognizable property of this {@link KeyValueListPair} instance. + * Get the value of an unrecognizable property of this {@link Fanta} instance. * * @deprecated Use {@link #toMap()} instead. * @param name @@ -174,13 +194,13 @@ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("KeyValueListPair has no field with name '" + name + "'."); + throw new NoSuchElementException("Fanta has no field with name '" + name + "'."); } return cloudSdkCustomFields.get(name); } /** - * Get the value of all properties of this {@link KeyValueListPair} instance including unrecognized properties. + * Get the value of all properties of this {@link Fanta} instance including unrecognized properties. * * @return The map of all properties */ @@ -189,16 +209,18 @@ public Object getCustomField( @Nonnull final String name ) public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( key != null ) - declaredFields.put("key", key); - if( value != null ) - declaredFields.put("value", value); + if( sodaType != null ) + declaredFields.put("sodaType", sodaType); + if( color != null ) + declaredFields.put("color", color); + if( flavor != null ) + declaredFields.put("flavor", flavor); return declaredFields; } /** - * Set an unrecognizable property of this {@link KeyValueListPair} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. + * Set an unrecognizable property of this {@link Fanta} instance. If the map previously contained a mapping for the + * key, the old value is replaced by the specified value. * * @param customFieldName * The name of the property @@ -220,16 +242,17 @@ public boolean equals( @Nullable final java.lang.Object o ) if( o == null || getClass() != o.getClass() ) { return false; } - final KeyValueListPair keyValueListPair = (KeyValueListPair) o; - return Objects.equals(this.cloudSdkCustomFields, keyValueListPair.cloudSdkCustomFields) - && Objects.equals(this.key, keyValueListPair.key) - && Objects.equals(this.value, keyValueListPair.value); + final Fanta fanta = (Fanta) o; + return Objects.equals(this.cloudSdkCustomFields, fanta.cloudSdkCustomFields) + && Objects.equals(this.sodaType, fanta.sodaType) + && Objects.equals(this.color, fanta.color) + && Objects.equals(this.flavor, fanta.flavor); } @Override public int hashCode() { - return Objects.hash(key, value, cloudSdkCustomFields); + return Objects.hash(sodaType, color, flavor, cloudSdkCustomFields); } @Override @@ -237,9 +260,10 @@ public int hashCode() public String toString() { final StringBuilder sb = new StringBuilder(); - sb.append("class KeyValueListPair {\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("class Fanta {\n"); + sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" flavor: ").append(toIndentedString(flavor)).append("\n"); cloudSdkCustomFields .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); sb.append("}"); diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FantaFlavor.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FantaFlavor.java new file mode 100644 index 000000000..143119694 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FantaFlavor.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * SodaStore API + * API for managing soda products and orders in SodaStore. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.List; + +import javax.annotation.Nonnull; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * FantaFlavor + */ +@Beta +public interface FantaFlavor +{ + /** + * Helper class to create {@code String } that implements {@link FantaFlavor}. + */ + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) implements FantaFlavor {} + + /** + * Creator to enable deserialization of {@code String }. + * + * @param val + * the value to use + * @return a new instance of {@link InnerString}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerString create( @Nonnull final String val ) + { + return new InnerString(val); + } + + /** + * Helper class to create {@code Integer } that implements {@link FantaFlavor}. + */ + record InnerInteger(@com.fasterxml.jackson.annotation.JsonValue @Nonnull Integer value) implements FantaFlavor {} + + /** + * Creator to enable deserialization of {@code Integer }. + * + * @param val + * the value to use + * @return a new instance of {@link InnerInteger}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerInteger create( @Nonnull final Integer val ) + { + return new InnerInteger(val); + } + + /** + * Helper class to create {@code FlavorType } that implements {@link FantaFlavor}. + */ + record InnerFlavorType(@com.fasterxml.jackson.annotation.JsonValue @Nonnull FlavorType value) implements FantaFlavor {} + + /** + * Creator to enable deserialization of {@code FlavorType }. + * + * @param val + * the value to use + * @return a new instance of {@link InnerFlavorType}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerFlavorType createInnerFlavorType( @Nonnull final FlavorType val ) + { + return new InnerFlavorType(val); + } + + /** + * Helper class to create {@code List } that implements {@link FantaFlavor}. + */ + record ListOfFlavorTypes(@com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) implements FantaFlavor {} + + /** + * Creator to enable deserialization of {@code List }. + * + * @param val + * the value to use + * @return a new instance of {@link ListOfFlavorTypes}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static ListOfFlavorTypes createListOfFlavorTypes( @Nonnull final List val ) + { + return new ListOfFlavorTypes(val); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FilteringModuleConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FilteringModuleConfig.java deleted file mode 100644 index 648ad36f8..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FilteringModuleConfig.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * FilteringModuleConfig - */ - -@Beta // CHECKSTYLE:OFF -public class FilteringModuleConfig -// CHECKSTYLE:ON -{ - @JsonProperty( "input" ) - private InputFilteringConfig input; - - @JsonProperty( "output" ) - private OutputFilteringConfig output; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for FilteringModuleConfig. - */ - protected FilteringModuleConfig() - { - } - - /** - * Set the input of this {@link FilteringModuleConfig} instance and return the same instance. - * - * @param input - * List of provider type and filters - * @return The same instance of this {@link FilteringModuleConfig} class - */ - @Nonnull - public FilteringModuleConfig input( @Nullable final InputFilteringConfig input ) - { - this.input = input; - return this; - } - - /** - * List of provider type and filters - * - * @return input The input of this {@link FilteringModuleConfig} instance. - */ - @Nonnull - public InputFilteringConfig getInput() - { - return input; - } - - /** - * Set the input of this {@link FilteringModuleConfig} instance. - * - * @param input - * List of provider type and filters - */ - public void setInput( @Nullable final InputFilteringConfig input ) - { - this.input = input; - } - - /** - * Set the output of this {@link FilteringModuleConfig} instance and return the same instance. - * - * @param output - * List of provider type and filters - * @return The same instance of this {@link FilteringModuleConfig} class - */ - @Nonnull - public FilteringModuleConfig output( @Nullable final OutputFilteringConfig output ) - { - this.output = output; - return this; - } - - /** - * List of provider type and filters - * - * @return output The output of this {@link FilteringModuleConfig} instance. - */ - @Nonnull - public OutputFilteringConfig getOutput() - { - return output; - } - - /** - * Set the output of this {@link FilteringModuleConfig} instance. - * - * @param output - * List of provider type and filters - */ - public void setOutput( @Nullable final OutputFilteringConfig output ) - { - this.output = output; - } - - /** - * Get the names of the unrecognizable properties of the {@link FilteringModuleConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link FilteringModuleConfig} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("FilteringModuleConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link FilteringModuleConfig} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( input != null ) - declaredFields.put("input", input); - if( output != null ) - declaredFields.put("output", output); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link FilteringModuleConfig} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final FilteringModuleConfig filteringModuleConfig = (FilteringModuleConfig) o; - return Objects.equals(this.cloudSdkCustomFields, filteringModuleConfig.cloudSdkCustomFields) - && Objects.equals(this.input, filteringModuleConfig.input) - && Objects.equals(this.output, filteringModuleConfig.output); - } - - @Override - public int hashCode() - { - return Objects.hash(input, output, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class FilteringModuleConfig {\n"); - sb.append(" input: ").append(toIndentedString(input)).append("\n"); - sb.append(" output: ").append(toIndentedString(output)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FilteringStreamOptions.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FilteringStreamOptions.java deleted file mode 100644 index 77629a087..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FilteringStreamOptions.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * Stream options for output filtering. Will be ignored if stream is false. - */ - -@Beta // CHECKSTYLE:OFF -public class FilteringStreamOptions -// CHECKSTYLE:ON -{ - @JsonProperty( "overlap" ) - private Integer overlap = 0; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for FilteringStreamOptions. - */ - protected FilteringStreamOptions() - { - } - - /** - * Set the overlap of this {@link FilteringStreamOptions} instance and return the same instance. - * - * @param overlap - * Number of characters that should be additionally sent to content filtering services from previous - * chunks as additional context. Minimum: 0 Maximum: 10000 - * @return The same instance of this {@link FilteringStreamOptions} class - */ - @Nonnull - public FilteringStreamOptions overlap( @Nullable final Integer overlap ) - { - this.overlap = overlap; - return this; - } - - /** - * Number of characters that should be additionally sent to content filtering services from previous chunks as - * additional context. minimum: 0 maximum: 10000 - * - * @return overlap The overlap of this {@link FilteringStreamOptions} instance. - */ - @Nonnull - public Integer getOverlap() - { - return overlap; - } - - /** - * Set the overlap of this {@link FilteringStreamOptions} instance. - * - * @param overlap - * Number of characters that should be additionally sent to content filtering services from previous - * chunks as additional context. Minimum: 0 Maximum: 10000 - */ - public void setOverlap( @Nullable final Integer overlap ) - { - this.overlap = overlap; - } - - /** - * Get the names of the unrecognizable properties of the {@link FilteringStreamOptions}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link FilteringStreamOptions} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("FilteringStreamOptions has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link FilteringStreamOptions} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( overlap != null ) - declaredFields.put("overlap", overlap); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link FilteringStreamOptions} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final FilteringStreamOptions filteringStreamOptions = (FilteringStreamOptions) o; - return Objects.equals(this.cloudSdkCustomFields, filteringStreamOptions.cloudSdkCustomFields) - && Objects.equals(this.overlap, filteringStreamOptions.overlap); - } - - @Override - public int hashCode() - { - return Objects.hash(overlap, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class FilteringStreamOptions {\n"); - sb.append(" overlap: ").append(toIndentedString(overlap)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContentUrl.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FlavorType.java similarity index 56% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContentUrl.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FlavorType.java index b06e269e9..e95740c27 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContentUrl.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FlavorType.java @@ -3,8 +3,8 @@ */ /* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. + * SodaStore API + * API for managing soda products and orders in SodaStore. * * * @@ -31,104 +31,104 @@ import com.google.common.annotations.Beta; /** - * ImageContentUrl + * FlavorType */ @Beta // CHECKSTYLE:OFF -public class ImageContentUrl +public class FlavorType // CHECKSTYLE:ON { - @JsonProperty( "url" ) - private String url; + @JsonProperty( "intensity" ) + private Integer intensity; - @JsonProperty( "detail" ) - private String detail = "auto"; + @JsonProperty( "nuance" ) + private String nuance; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); /** - * Default constructor for ImageContentUrl. + * Default constructor for FlavorType. */ - protected ImageContentUrl() + protected FlavorType() { } /** - * Set the url of this {@link ImageContentUrl} instance and return the same instance. + * Set the intensity of this {@link FlavorType} instance and return the same instance. * - * @param url - * The url of this {@link ImageContentUrl} - * @return The same instance of this {@link ImageContentUrl} class + * @param intensity + * The intensity of the flavor + * @return The same instance of this {@link FlavorType} class */ @Nonnull - public ImageContentUrl url( @Nonnull final String url ) + public FlavorType intensity( @Nullable final Integer intensity ) { - this.url = url; + this.intensity = intensity; return this; } /** - * Get url + * The intensity of the flavor * - * @return url The url of this {@link ImageContentUrl} instance. + * @return intensity The intensity of this {@link FlavorType} instance. */ @Nonnull - public String getUrl() + public Integer getIntensity() { - return url; + return intensity; } /** - * Set the url of this {@link ImageContentUrl} instance. + * Set the intensity of this {@link FlavorType} instance. * - * @param url - * The url of this {@link ImageContentUrl} + * @param intensity + * The intensity of the flavor */ - public void setUrl( @Nonnull final String url ) + public void setIntensity( @Nullable final Integer intensity ) { - this.url = url; + this.intensity = intensity; } /** - * Set the detail of this {@link ImageContentUrl} instance and return the same instance. + * Set the nuance of this {@link FlavorType} instance and return the same instance. * - * @param detail - * The detail of this {@link ImageContentUrl} - * @return The same instance of this {@link ImageContentUrl} class + * @param nuance + * The nuance of the flavor + * @return The same instance of this {@link FlavorType} class */ @Nonnull - public ImageContentUrl detail( @Nullable final String detail ) + public FlavorType nuance( @Nullable final String nuance ) { - this.detail = detail; + this.nuance = nuance; return this; } /** - * Get detail + * The nuance of the flavor * - * @return detail The detail of this {@link ImageContentUrl} instance. + * @return nuance The nuance of this {@link FlavorType} instance. */ @Nonnull - public String getDetail() + public String getNuance() { - return detail; + return nuance; } /** - * Set the detail of this {@link ImageContentUrl} instance. + * Set the nuance of this {@link FlavorType} instance. * - * @param detail - * The detail of this {@link ImageContentUrl} + * @param nuance + * The nuance of the flavor */ - public void setDetail( @Nullable final String detail ) + public void setNuance( @Nullable final String nuance ) { - this.detail = detail; + this.nuance = nuance; } /** - * Get the names of the unrecognizable properties of the {@link ImageContentUrl}. + * Get the names of the unrecognizable properties of the {@link FlavorType}. * * @return The set of properties names */ @@ -140,7 +140,7 @@ public Set getCustomFieldNames() } /** - * Get the value of an unrecognizable property of this {@link ImageContentUrl} instance. + * Get the value of an unrecognizable property of this {@link FlavorType} instance. * * @deprecated Use {@link #toMap()} instead. * @param name @@ -155,13 +155,13 @@ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("ImageContentUrl has no field with name '" + name + "'."); + throw new NoSuchElementException("FlavorType has no field with name '" + name + "'."); } return cloudSdkCustomFields.get(name); } /** - * Get the value of all properties of this {@link ImageContentUrl} instance including unrecognized properties. + * Get the value of all properties of this {@link FlavorType} instance including unrecognized properties. * * @return The map of all properties */ @@ -170,16 +170,16 @@ public Object getCustomField( @Nonnull final String name ) public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( url != null ) - declaredFields.put("url", url); - if( detail != null ) - declaredFields.put("detail", detail); + if( intensity != null ) + declaredFields.put("intensity", intensity); + if( nuance != null ) + declaredFields.put("nuance", nuance); return declaredFields; } /** - * Set an unrecognizable property of this {@link ImageContentUrl} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. + * Set an unrecognizable property of this {@link FlavorType} instance. If the map previously contained a mapping for + * the key, the old value is replaced by the specified value. * * @param customFieldName * The name of the property @@ -201,16 +201,16 @@ public boolean equals( @Nullable final java.lang.Object o ) if( o == null || getClass() != o.getClass() ) { return false; } - final ImageContentUrl imageContentUrl = (ImageContentUrl) o; - return Objects.equals(this.cloudSdkCustomFields, imageContentUrl.cloudSdkCustomFields) - && Objects.equals(this.url, imageContentUrl.url) - && Objects.equals(this.detail, imageContentUrl.detail); + final FlavorType flavorType = (FlavorType) o; + return Objects.equals(this.cloudSdkCustomFields, flavorType.cloudSdkCustomFields) + && Objects.equals(this.intensity, flavorType.intensity) + && Objects.equals(this.nuance, flavorType.nuance); } @Override public int hashCode() { - return Objects.hash(url, detail, cloudSdkCustomFields); + return Objects.hash(intensity, nuance, cloudSdkCustomFields); } @Override @@ -218,9 +218,9 @@ public int hashCode() public String toString() { final StringBuilder sb = new StringBuilder(); - sb.append("class ImageContentUrl {\n"); - sb.append(" url: ").append(toIndentedString(url)).append("\n"); - sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + sb.append("class FlavorType {\n"); + sb.append(" intensity: ").append(toIndentedString(intensity)).append("\n"); + sb.append(" nuance: ").append(toIndentedString(nuance)).append("\n"); cloudSdkCustomFields .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); sb.append("}"); diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonObject.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Foo.java similarity index 61% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonObject.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Foo.java index 9cd995069..963d22d89 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonObject.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Foo.java @@ -3,8 +3,8 @@ */ /* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. + * SodaStore API + * API for managing soda products and orders in SodaStore. * * * @@ -33,31 +33,34 @@ import com.google.common.annotations.Beta; /** - * ResponseFormatJsonObject + * Foo */ @Beta // CHECKSTYLE:OFF -public class ResponseFormatJsonObject implements PromptTemplateSpecResponseFormat, TemplateResponseFormat +public class Foo implements OneOfWithEnumDiscriminator // CHECKSTYLE:ON { + @JsonProperty( "foo" ) + private String foo; + /** - * The type of response format being defined: `json_object` + * Gets or Sets disc */ - public enum TypeEnum + public enum DiscEnum { /** - * The JSON_OBJECT option of this ResponseFormatJsonObject + * The DISC_FOO option of this Foo */ - JSON_OBJECT("json_object"), + DISC_FOO("disc_foo"), /** - * The UNKNOWN_DEFAULT_OPEN_API option of this ResponseFormatJsonObject + * The UNKNOWN_DEFAULT_OPEN_API option of this Foo */ UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); private String value; - TypeEnum( String value ) + DiscEnum( String value ) { this.value = value; } @@ -91,13 +94,13 @@ public String toString() * * @param value * The String value - * @return The enum value of type ResponseFormatJsonObject + * @return The enum value of type Foo */ @JsonCreator @Nonnull - public static TypeEnum fromValue( @Nonnull final String value ) + public static DiscEnum fromValue( @Nonnull final String value ) { - for( TypeEnum b : TypeEnum.values() ) { + for( DiscEnum b : DiscEnum.values() ) { if( b.value.equals(value) ) { return b; } @@ -106,58 +109,94 @@ public static TypeEnum fromValue( @Nonnull final String value ) } } - @JsonProperty( "type" ) - private TypeEnum type; + @JsonProperty( "disc" ) + private DiscEnum disc; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); /** - * Default constructor for ResponseFormatJsonObject. + * Default constructor for Foo. + */ + protected Foo() + { + } + + /** + * Set the foo of this {@link Foo} instance and return the same instance. + * + * @param foo + * The foo of this {@link Foo} + * @return The same instance of this {@link Foo} class + */ + @Nonnull + public Foo foo( @Nullable final String foo ) + { + this.foo = foo; + return this; + } + + /** + * Get foo + * + * @return foo The foo of this {@link Foo} instance. + */ + @Nonnull + public String getFoo() + { + return foo; + } + + /** + * Set the foo of this {@link Foo} instance. + * + * @param foo + * The foo of this {@link Foo} */ - protected ResponseFormatJsonObject() + public void setFoo( @Nullable final String foo ) { + this.foo = foo; } /** - * Set the type of this {@link ResponseFormatJsonObject} instance and return the same instance. + * Set the disc of this {@link Foo} instance and return the same instance. * - * @param type - * The type of response format being defined: `json_object` - * @return The same instance of this {@link ResponseFormatJsonObject} class + * @param disc + * The disc of this {@link Foo} + * @return The same instance of this {@link Foo} class */ @Nonnull - public ResponseFormatJsonObject type( @Nonnull final TypeEnum type ) + public Foo disc( @Nullable final DiscEnum disc ) { - this.type = type; + this.disc = disc; return this; } /** - * The type of response format being defined: `json_object` + * Get disc * - * @return type The type of this {@link ResponseFormatJsonObject} instance. + * @return disc The disc of this {@link Foo} instance. */ @Nonnull - public TypeEnum getType() + public DiscEnum getDisc() { - return type; + return disc; } /** - * Set the type of this {@link ResponseFormatJsonObject} instance. + * Set the disc of this {@link Foo} instance. * - * @param type - * The type of response format being defined: `json_object` + * @param disc + * The disc of this {@link Foo} */ - public void setType( @Nonnull final TypeEnum type ) + public void setDisc( @Nullable final DiscEnum disc ) { - this.type = type; + this.disc = disc; } /** - * Get the names of the unrecognizable properties of the {@link ResponseFormatJsonObject}. + * Get the names of the unrecognizable properties of the {@link Foo}. * * @return The set of properties names */ @@ -169,7 +208,7 @@ public Set getCustomFieldNames() } /** - * Get the value of an unrecognizable property of this {@link ResponseFormatJsonObject} instance. + * Get the value of an unrecognizable property of this {@link Foo} instance. * * @deprecated Use {@link #toMap()} instead. * @param name @@ -184,14 +223,13 @@ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("ResponseFormatJsonObject has no field with name '" + name + "'."); + throw new NoSuchElementException("Foo has no field with name '" + name + "'."); } return cloudSdkCustomFields.get(name); } /** - * Get the value of all properties of this {@link ResponseFormatJsonObject} instance including unrecognized - * properties. + * Get the value of all properties of this {@link Foo} instance including unrecognized properties. * * @return The map of all properties */ @@ -200,14 +238,16 @@ public Object getCustomField( @Nonnull final String name ) public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( type != null ) - declaredFields.put("type", type); + if( foo != null ) + declaredFields.put("foo", foo); + if( disc != null ) + declaredFields.put("disc", disc); return declaredFields; } /** - * Set an unrecognizable property of this {@link ResponseFormatJsonObject} instance. If the map previously contained - * a mapping for the key, the old value is replaced by the specified value. + * Set an unrecognizable property of this {@link Foo} instance. If the map previously contained a mapping for the + * key, the old value is replaced by the specified value. * * @param customFieldName * The name of the property @@ -229,15 +269,16 @@ public boolean equals( @Nullable final java.lang.Object o ) if( o == null || getClass() != o.getClass() ) { return false; } - final ResponseFormatJsonObject responseFormatJsonObject = (ResponseFormatJsonObject) o; - return Objects.equals(this.cloudSdkCustomFields, responseFormatJsonObject.cloudSdkCustomFields) - && Objects.equals(this.type, responseFormatJsonObject.type); + final Foo foo = (Foo) o; + return Objects.equals(this.cloudSdkCustomFields, foo.cloudSdkCustomFields) + && Objects.equals(this.foo, foo.foo) + && Objects.equals(this.disc, foo.disc); } @Override public int hashCode() { - return Objects.hash(type, cloudSdkCustomFields); + return Objects.hash(foo, disc, cloudSdkCustomFields); } @Override @@ -245,8 +286,9 @@ public int hashCode() public String toString() { final StringBuilder sb = new StringBuilder(); - sb.append("class ResponseFormatJsonObject {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("class Foo {\n"); + sb.append(" foo: ").append(toIndentedString(foo)).append("\n"); + sb.append(" disc: ").append(toIndentedString(disc)).append("\n"); cloudSdkCustomFields .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); sb.append("}"); diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FunctionObject.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FunctionObject.java deleted file mode 100644 index 93e7c7882..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FunctionObject.java +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * FunctionObject - */ - -@Beta // CHECKSTYLE:OFF -public class FunctionObject -// CHECKSTYLE:ON -{ - @JsonProperty( "description" ) - private String description; - - @JsonProperty( "name" ) - private String name; - - @JsonProperty( "parameters" ) - private Map parameters = new HashMap<>(); - - @JsonProperty( "strict" ) - private Boolean strict = false; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for FunctionObject. - */ - protected FunctionObject() - { - } - - /** - * Set the description of this {@link FunctionObject} instance and return the same instance. - * - * @param description - * A description of what the function does, used by the model to choose when and how to call the - * function. - * @return The same instance of this {@link FunctionObject} class - */ - @Nonnull - public FunctionObject description( @Nullable final String description ) - { - this.description = description; - return this; - } - - /** - * A description of what the function does, used by the model to choose when and how to call the function. - * - * @return description The description of this {@link FunctionObject} instance. - */ - @Nonnull - public String getDescription() - { - return description; - } - - /** - * Set the description of this {@link FunctionObject} instance. - * - * @param description - * A description of what the function does, used by the model to choose when and how to call the - * function. - */ - public void setDescription( @Nullable final String description ) - { - this.description = description; - } - - /** - * Set the name of this {@link FunctionObject} instance and return the same instance. - * - * @param name - * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with - * a maximum length of 64. - * @return The same instance of this {@link FunctionObject} class - */ - @Nonnull - public FunctionObject name( @Nonnull final String name ) - { - this.name = name; - return this; - } - - /** - * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum - * length of 64. - * - * @return name The name of this {@link FunctionObject} instance. - */ - @Nonnull - public String getName() - { - return name; - } - - /** - * Set the name of this {@link FunctionObject} instance. - * - * @param name - * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with - * a maximum length of 64. - */ - public void setName( @Nonnull final String name ) - { - this.name = name; - } - - /** - * Set the parameters of this {@link FunctionObject} instance and return the same instance. - * - * @param parameters - * The parameters the functions accepts, described as a JSON Schema object. See the - * [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema - * reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - * Omitting `parameters` defines a function with an empty parameter list. - * @return The same instance of this {@link FunctionObject} class - */ - @Nonnull - public FunctionObject parameters( @Nullable final Map parameters ) - { - this.parameters = parameters; - return this; - } - - /** - * Put one parameters instance to this {@link FunctionObject} instance. - * - * @param key - * The String key of this parameters instance - * @param parametersItem - * The parameters that should be added under the given key - * @return The same instance of type {@link FunctionObject} - */ - @Nonnull - public FunctionObject putparametersItem( @Nonnull final String key, @Nullable final Object parametersItem ) - { - if( this.parameters == null ) { - this.parameters = new HashMap<>(); - } - this.parameters.put(key, parametersItem); - return this; - } - - /** - * The parameters the functions accepts, described as a JSON Schema object. See the - * [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema - * reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. Omitting - * `parameters` defines a function with an empty parameter list. - * - * @return parameters The parameters of this {@link FunctionObject} instance. - */ - @Nonnull - public Map getParameters() - { - return parameters; - } - - /** - * Set the parameters of this {@link FunctionObject} instance. - * - * @param parameters - * The parameters the functions accepts, described as a JSON Schema object. See the - * [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema - * reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - * Omitting `parameters` defines a function with an empty parameter list. - */ - public void setParameters( @Nullable final Map parameters ) - { - this.parameters = parameters; - } - - /** - * Set the strict of this {@link FunctionObject} instance and return the same instance. - * - * @param strict - * Whether to enable strict schema adherence when generating the function call. If set to true, the model - * will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema - * is supported when `strict` is `true`. Learn more about Structured Outputs in the - * [function calling guide](docs/guides/function-calling). - * @return The same instance of this {@link FunctionObject} class - */ - @Nonnull - public FunctionObject strict( @Nullable final Boolean strict ) - { - this.strict = strict; - return this; - } - - /** - * Whether to enable strict schema adherence when generating the function call. If set to true, the model will - * follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported - * when `strict` is `true`. Learn more about Structured Outputs in the [function calling - * guide](docs/guides/function-calling). - * - * @return strict The strict of this {@link FunctionObject} instance. - */ - @Nullable - public Boolean isStrict() - { - return strict; - } - - /** - * Set the strict of this {@link FunctionObject} instance. - * - * @param strict - * Whether to enable strict schema adherence when generating the function call. If set to true, the model - * will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema - * is supported when `strict` is `true`. Learn more about Structured Outputs in the - * [function calling guide](docs/guides/function-calling). - */ - public void setStrict( @Nullable final Boolean strict ) - { - this.strict = strict; - } - - /** - * Get the names of the unrecognizable properties of the {@link FunctionObject}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link FunctionObject} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("FunctionObject has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link FunctionObject} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( description != null ) - declaredFields.put("description", description); - if( name != null ) - declaredFields.put("name", name); - if( parameters != null ) - declaredFields.put("parameters", parameters); - if( strict != null ) - declaredFields.put("strict", strict); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link FunctionObject} instance. If the map previously contained a mapping - * for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final FunctionObject functionObject = (FunctionObject) o; - return Objects.equals(this.cloudSdkCustomFields, functionObject.cloudSdkCustomFields) - && Objects.equals(this.description, functionObject.description) - && Objects.equals(this.name, functionObject.name) - && Objects.equals(this.parameters, functionObject.parameters) - && Objects.equals(this.strict, functionObject.strict); - } - - @Override - public int hashCode() - { - return Objects.hash(description, name, parameters, strict, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class FunctionObject {\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); - sb.append(" strict: ").append(toIndentedString(strict)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GlobalStreamOptions.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GlobalStreamOptions.java deleted file mode 100644 index a79b819ef..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GlobalStreamOptions.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * Options for streaming. Will be ignored if enabled is false. - */ - -@Beta // CHECKSTYLE:OFF -public class GlobalStreamOptions -// CHECKSTYLE:ON -{ - @JsonProperty( "enabled" ) - private Boolean enabled = false; - - @JsonProperty( "chunk_size" ) - private Integer chunkSize = 100; - - @JsonProperty( "delimiters" ) - private List delimiters = new ArrayList<>(); - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for GlobalStreamOptions. - */ - protected GlobalStreamOptions() - { - } - - /** - * Set the enabled of this {@link GlobalStreamOptions} instance and return the same instance. - * - * @param enabled - * If true, the response will be streamed back to the client - * @return The same instance of this {@link GlobalStreamOptions} class - */ - @Nonnull - public GlobalStreamOptions enabled( @Nullable final Boolean enabled ) - { - this.enabled = enabled; - return this; - } - - /** - * If true, the response will be streamed back to the client - * - * @return enabled The enabled of this {@link GlobalStreamOptions} instance. - */ - @Nonnull - public Boolean isEnabled() - { - return enabled; - } - - /** - * Set the enabled of this {@link GlobalStreamOptions} instance. - * - * @param enabled - * If true, the response will be streamed back to the client - */ - public void setEnabled( @Nullable final Boolean enabled ) - { - this.enabled = enabled; - } - - /** - * Set the chunkSize of this {@link GlobalStreamOptions} instance and return the same instance. - * - * @param chunkSize - * Minimum number of characters per chunk that post-LLM modules operate on. Minimum: 1 Maximum: 10000 - * @return The same instance of this {@link GlobalStreamOptions} class - */ - @Nonnull - public GlobalStreamOptions chunkSize( @Nullable final Integer chunkSize ) - { - this.chunkSize = chunkSize; - return this; - } - - /** - * Minimum number of characters per chunk that post-LLM modules operate on. minimum: 1 maximum: 10000 - * - * @return chunkSize The chunkSize of this {@link GlobalStreamOptions} instance. - */ - @Nonnull - public Integer getChunkSize() - { - return chunkSize; - } - - /** - * Set the chunkSize of this {@link GlobalStreamOptions} instance. - * - * @param chunkSize - * Minimum number of characters per chunk that post-LLM modules operate on. Minimum: 1 Maximum: 10000 - */ - public void setChunkSize( @Nullable final Integer chunkSize ) - { - this.chunkSize = chunkSize; - } - - /** - * Set the delimiters of this {@link GlobalStreamOptions} instance and return the same instance. - * - * @param delimiters - * List of delimiters to split the input text into chunks.Please note, this is a required parameter when - * `input_translation_module_config` or `output_translation_module_config` are - * configured. - * @return The same instance of this {@link GlobalStreamOptions} class - */ - @Nonnull - public GlobalStreamOptions delimiters( @Nullable final List delimiters ) - { - this.delimiters = delimiters; - return this; - } - - /** - * Add one delimiters instance to this {@link GlobalStreamOptions}. - * - * @param delimitersItem - * The delimiters that should be added - * @return The same instance of type {@link GlobalStreamOptions} - */ - @Nonnull - public GlobalStreamOptions addDelimitersItem( @Nonnull final String delimitersItem ) - { - if( this.delimiters == null ) { - this.delimiters = new ArrayList<>(); - } - this.delimiters.add(delimitersItem); - return this; - } - - /** - * List of delimiters to split the input text into chunks.Please note, this is a required parameter when - * `input_translation_module_config` or `output_translation_module_config` are configured. - * - * @return delimiters The delimiters of this {@link GlobalStreamOptions} instance. - */ - @Nonnull - public List getDelimiters() - { - return delimiters; - } - - /** - * Set the delimiters of this {@link GlobalStreamOptions} instance. - * - * @param delimiters - * List of delimiters to split the input text into chunks.Please note, this is a required parameter when - * `input_translation_module_config` or `output_translation_module_config` are - * configured. - */ - public void setDelimiters( @Nullable final List delimiters ) - { - this.delimiters = delimiters; - } - - /** - * Get the names of the unrecognizable properties of the {@link GlobalStreamOptions}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link GlobalStreamOptions} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("GlobalStreamOptions has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link GlobalStreamOptions} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( enabled != null ) - declaredFields.put("enabled", enabled); - if( chunkSize != null ) - declaredFields.put("chunkSize", chunkSize); - if( delimiters != null ) - declaredFields.put("delimiters", delimiters); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link GlobalStreamOptions} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final GlobalStreamOptions globalStreamOptions = (GlobalStreamOptions) o; - return Objects.equals(this.cloudSdkCustomFields, globalStreamOptions.cloudSdkCustomFields) - && Objects.equals(this.enabled, globalStreamOptions.enabled) - && Objects.equals(this.chunkSize, globalStreamOptions.chunkSize) - && Objects.equals(this.delimiters, globalStreamOptions.delimiters); - } - - @Override - public int hashCode() - { - return Objects.hash(enabled, chunkSize, delimiters, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class GlobalStreamOptions {\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" chunkSize: ").append(toIndentedString(chunkSize)).append("\n"); - sb.append(" delimiters: ").append(toIndentedString(delimiters)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingFilterSearchConfiguration.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingFilterSearchConfiguration.java deleted file mode 100644 index 0027dac92..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingFilterSearchConfiguration.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * GroundingFilterSearchConfiguration - */ - -@Beta // CHECKSTYLE:OFF -public class GroundingFilterSearchConfiguration -// CHECKSTYLE:ON -{ - @JsonProperty( "max_chunk_count" ) - private Integer maxChunkCount; - - @JsonProperty( "max_document_count" ) - private Integer maxDocumentCount; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for GroundingFilterSearchConfiguration. - */ - protected GroundingFilterSearchConfiguration() - { - } - - /** - * Set the maxChunkCount of this {@link GroundingFilterSearchConfiguration} instance and return the same instance. - * - * @param maxChunkCount - * Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. Minimum: 0 - * @return The same instance of this {@link GroundingFilterSearchConfiguration} class - */ - @Nonnull - public GroundingFilterSearchConfiguration maxChunkCount( @Nullable final Integer maxChunkCount ) - { - this.maxChunkCount = maxChunkCount; - return this; - } - - /** - * Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. minimum: 0 - * - * @return maxChunkCount The maxChunkCount of this {@link GroundingFilterSearchConfiguration} instance. - */ - @Nonnull - public Integer getMaxChunkCount() - { - return maxChunkCount; - } - - /** - * Set the maxChunkCount of this {@link GroundingFilterSearchConfiguration} instance. - * - * @param maxChunkCount - * Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. Minimum: 0 - */ - public void setMaxChunkCount( @Nullable final Integer maxChunkCount ) - { - this.maxChunkCount = maxChunkCount; - } - - /** - * Set the maxDocumentCount of this {@link GroundingFilterSearchConfiguration} instance and return the same - * instance. - * - * @param maxDocumentCount - * [Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. - * Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per - * document is returned. Minimum: 0 - * @return The same instance of this {@link GroundingFilterSearchConfiguration} class - */ - @Nonnull - public GroundingFilterSearchConfiguration maxDocumentCount( @Nullable final Integer maxDocumentCount ) - { - this.maxDocumentCount = maxDocumentCount; - return this; - } - - /** - * [Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used - * with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned. - * minimum: 0 - * - * @return maxDocumentCount The maxDocumentCount of this {@link GroundingFilterSearchConfiguration} instance. - */ - @Nonnull - public Integer getMaxDocumentCount() - { - return maxDocumentCount; - } - - /** - * Set the maxDocumentCount of this {@link GroundingFilterSearchConfiguration} instance. - * - * @param maxDocumentCount - * [Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. - * Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per - * document is returned. Minimum: 0 - */ - public void setMaxDocumentCount( @Nullable final Integer maxDocumentCount ) - { - this.maxDocumentCount = maxDocumentCount; - } - - /** - * Get the names of the unrecognizable properties of the {@link GroundingFilterSearchConfiguration}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link GroundingFilterSearchConfiguration} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException( - "GroundingFilterSearchConfiguration has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link GroundingFilterSearchConfiguration} instance including - * unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( maxChunkCount != null ) - declaredFields.put("maxChunkCount", maxChunkCount); - if( maxDocumentCount != null ) - declaredFields.put("maxDocumentCount", maxDocumentCount); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link GroundingFilterSearchConfiguration} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final GroundingFilterSearchConfiguration groundingFilterSearchConfiguration = - (GroundingFilterSearchConfiguration) o; - return Objects.equals(this.cloudSdkCustomFields, groundingFilterSearchConfiguration.cloudSdkCustomFields) - && Objects.equals(this.maxChunkCount, groundingFilterSearchConfiguration.maxChunkCount) - && Objects.equals(this.maxDocumentCount, groundingFilterSearchConfiguration.maxDocumentCount); - } - - @Override - public int hashCode() - { - return Objects.hash(maxChunkCount, maxDocumentCount, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class GroundingFilterSearchConfiguration {\n"); - sb.append(" maxChunkCount: ").append(toIndentedString(maxChunkCount)).append("\n"); - sb.append(" maxDocumentCount: ").append(toIndentedString(maxDocumentCount)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfig.java deleted file mode 100644 index fe17aff6a..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfig.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * GroundingModuleConfig - */ - -@Beta // CHECKSTYLE:OFF -public class GroundingModuleConfig -// CHECKSTYLE:ON -{ - /** - * Gets or Sets type - */ - public enum TypeEnum - { - /** - * The DOCUMENT_GROUNDING_SERVICE option of this GroundingModuleConfig - */ - DOCUMENT_GROUNDING_SERVICE("document_grounding_service"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this GroundingModuleConfig - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type GroundingModuleConfig - */ - @JsonCreator - @Nullable - public static TypeEnum fromValue( @Nonnull final String value ) - { - for( TypeEnum b : TypeEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return null; - } - } - - @JsonProperty( "type" ) - private TypeEnum type; - - @JsonProperty( "config" ) - private GroundingModuleConfigConfig config; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for GroundingModuleConfig. - */ - protected GroundingModuleConfig() - { - } - - /** - * Set the type of this {@link GroundingModuleConfig} instance and return the same instance. - * - * @param type - * The type of this {@link GroundingModuleConfig} - * @return The same instance of this {@link GroundingModuleConfig} class - */ - @Nonnull - public GroundingModuleConfig type( @Nullable final TypeEnum type ) - { - this.type = type; - return this; - } - - /** - * Get type - * - * @return type The type of this {@link GroundingModuleConfig} instance. - */ - @Nullable - public TypeEnum getType() - { - return type; - } - - /** - * Set the type of this {@link GroundingModuleConfig} instance. - * - * @param type - * The type of this {@link GroundingModuleConfig} - */ - public void setType( @Nullable final TypeEnum type ) - { - this.type = type; - } - - /** - * Set the config of this {@link GroundingModuleConfig} instance and return the same instance. - * - * @param config - * The config of this {@link GroundingModuleConfig} - * @return The same instance of this {@link GroundingModuleConfig} class - */ - @Nonnull - public GroundingModuleConfig config( @Nonnull final GroundingModuleConfigConfig config ) - { - this.config = config; - return this; - } - - /** - * Get config - * - * @return config The config of this {@link GroundingModuleConfig} instance. - */ - @Nonnull - public GroundingModuleConfigConfig getConfig() - { - return config; - } - - /** - * Set the config of this {@link GroundingModuleConfig} instance. - * - * @param config - * The config of this {@link GroundingModuleConfig} - */ - public void setConfig( @Nonnull final GroundingModuleConfigConfig config ) - { - this.config = config; - } - - /** - * Get the names of the unrecognizable properties of the {@link GroundingModuleConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link GroundingModuleConfig} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("GroundingModuleConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link GroundingModuleConfig} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( type != null ) - declaredFields.put("type", type); - if( config != null ) - declaredFields.put("config", config); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link GroundingModuleConfig} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final GroundingModuleConfig groundingModuleConfig = (GroundingModuleConfig) o; - return Objects.equals(this.cloudSdkCustomFields, groundingModuleConfig.cloudSdkCustomFields) - && Objects.equals(this.type, groundingModuleConfig.type) - && Objects.equals(this.config, groundingModuleConfig.config); - } - - @Override - public int hashCode() - { - return Objects.hash(type, config, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class GroundingModuleConfig {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" config: ").append(toIndentedString(config)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfig.java deleted file mode 100644 index d51035d24..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfig.java +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * GroundingModuleConfigConfig - */ - -@Beta // CHECKSTYLE:OFF -public class GroundingModuleConfigConfig -// CHECKSTYLE:ON -{ - @JsonProperty( "filters" ) - private List filters = new ArrayList<>(); - - @JsonProperty( "placeholders" ) - private GroundingModuleConfigConfigPlaceholders placeholders; - - @JsonProperty( "metadata_params" ) - private List metadataParams = new ArrayList<>(); - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for GroundingModuleConfigConfig. - */ - protected GroundingModuleConfigConfig() - { - } - - /** - * Set the filters of this {@link GroundingModuleConfigConfig} instance and return the same instance. - * - * @param filters - * Document grounding service filters to be used - * @return The same instance of this {@link GroundingModuleConfigConfig} class - */ - @Nonnull - public GroundingModuleConfigConfig filters( @Nullable final List filters ) - { - this.filters = filters; - return this; - } - - /** - * Add one filters instance to this {@link GroundingModuleConfigConfig}. - * - * @param filtersItem - * The filters that should be added - * @return The same instance of type {@link GroundingModuleConfigConfig} - */ - @Nonnull - public GroundingModuleConfigConfig addFiltersItem( - @Nonnull final GroundingModuleConfigConfigFiltersInner filtersItem ) - { - if( this.filters == null ) { - this.filters = new ArrayList<>(); - } - this.filters.add(filtersItem); - return this; - } - - /** - * Document grounding service filters to be used - * - * @return filters The filters of this {@link GroundingModuleConfigConfig} instance. - */ - @Nonnull - public List getFilters() - { - return filters; - } - - /** - * Set the filters of this {@link GroundingModuleConfigConfig} instance. - * - * @param filters - * Document grounding service filters to be used - */ - public void setFilters( @Nullable final List filters ) - { - this.filters = filters; - } - - /** - * Set the placeholders of this {@link GroundingModuleConfigConfig} instance and return the same instance. - * - * @param placeholders - * The placeholders of this {@link GroundingModuleConfigConfig} - * @return The same instance of this {@link GroundingModuleConfigConfig} class - */ - @Nonnull - public GroundingModuleConfigConfig placeholders( - @Nonnull final GroundingModuleConfigConfigPlaceholders placeholders ) - { - this.placeholders = placeholders; - return this; - } - - /** - * Get placeholders - * - * @return placeholders The placeholders of this {@link GroundingModuleConfigConfig} instance. - */ - @Nonnull - public GroundingModuleConfigConfigPlaceholders getPlaceholders() - { - return placeholders; - } - - /** - * Set the placeholders of this {@link GroundingModuleConfigConfig} instance. - * - * @param placeholders - * The placeholders of this {@link GroundingModuleConfigConfig} - */ - public void setPlaceholders( @Nonnull final GroundingModuleConfigConfigPlaceholders placeholders ) - { - this.placeholders = placeholders; - } - - /** - * Set the metadataParams of this {@link GroundingModuleConfigConfig} instance and return the same instance. - * - * @param metadataParams - * Parameter name used for specifying metadata parameters - * @return The same instance of this {@link GroundingModuleConfigConfig} class - */ - @Nonnull - public GroundingModuleConfigConfig metadataParams( @Nullable final List metadataParams ) - { - this.metadataParams = metadataParams; - return this; - } - - /** - * Add one metadataParams instance to this {@link GroundingModuleConfigConfig}. - * - * @param metadataParamsItem - * The metadataParams that should be added - * @return The same instance of type {@link GroundingModuleConfigConfig} - */ - @Nonnull - public GroundingModuleConfigConfig addMetadataParamsItem( @Nonnull final String metadataParamsItem ) - { - if( this.metadataParams == null ) { - this.metadataParams = new ArrayList<>(); - } - this.metadataParams.add(metadataParamsItem); - return this; - } - - /** - * Parameter name used for specifying metadata parameters - * - * @return metadataParams The metadataParams of this {@link GroundingModuleConfigConfig} instance. - */ - @Nonnull - public List getMetadataParams() - { - return metadataParams; - } - - /** - * Set the metadataParams of this {@link GroundingModuleConfigConfig} instance. - * - * @param metadataParams - * Parameter name used for specifying metadata parameters - */ - public void setMetadataParams( @Nullable final List metadataParams ) - { - this.metadataParams = metadataParams; - } - - /** - * Get the names of the unrecognizable properties of the {@link GroundingModuleConfigConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link GroundingModuleConfigConfig} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("GroundingModuleConfigConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link GroundingModuleConfigConfig} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( filters != null ) - declaredFields.put("filters", filters); - if( placeholders != null ) - declaredFields.put("placeholders", placeholders); - if( metadataParams != null ) - declaredFields.put("metadataParams", metadataParams); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link GroundingModuleConfigConfig} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final GroundingModuleConfigConfig groundingModuleConfigConfig = (GroundingModuleConfigConfig) o; - return Objects.equals(this.cloudSdkCustomFields, groundingModuleConfigConfig.cloudSdkCustomFields) - && Objects.equals(this.filters, groundingModuleConfigConfig.filters) - && Objects.equals(this.placeholders, groundingModuleConfigConfig.placeholders) - && Objects.equals(this.metadataParams, groundingModuleConfigConfig.metadataParams); - } - - @Override - public int hashCode() - { - return Objects.hash(filters, placeholders, metadataParams, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class GroundingModuleConfigConfig {\n"); - sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); - sb.append(" placeholders: ").append(toIndentedString(placeholders)).append("\n"); - sb.append(" metadataParams: ").append(toIndentedString(metadataParams)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfigFiltersInner.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfigFiltersInner.java deleted file mode 100644 index 7108206c9..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfigFiltersInner.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.google.common.annotations.Beta; - -/** - * GroundingModuleConfigConfigFiltersInner - */ -@Beta -@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) -@JsonSubTypes( { @JsonSubTypes.Type( value = DocumentGroundingFilter.class ), } ) - -public interface GroundingModuleConfigConfigFiltersInner -{ -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfigPlaceholders.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfigPlaceholders.java deleted file mode 100644 index 19d4b31fc..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/GroundingModuleConfigConfigPlaceholders.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * Placeholders to be used for grounding input questions and output - */ - -@Beta // CHECKSTYLE:OFF -public class GroundingModuleConfigConfigPlaceholders -// CHECKSTYLE:ON -{ - @JsonProperty( "input" ) - private List input = new ArrayList<>(); - - @JsonProperty( "output" ) - private String output; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for GroundingModuleConfigConfigPlaceholders. - */ - protected GroundingModuleConfigConfigPlaceholders() - { - } - - /** - * Set the input of this {@link GroundingModuleConfigConfigPlaceholders} instance and return the same instance. - * - * @param input - * Contains the input parameters used for grounding input questions - * @return The same instance of this {@link GroundingModuleConfigConfigPlaceholders} class - */ - @Nonnull - public GroundingModuleConfigConfigPlaceholders input( @Nonnull final List input ) - { - this.input = input; - return this; - } - - /** - * Add one input instance to this {@link GroundingModuleConfigConfigPlaceholders}. - * - * @param inputItem - * The input that should be added - * @return The same instance of type {@link GroundingModuleConfigConfigPlaceholders} - */ - @Nonnull - public GroundingModuleConfigConfigPlaceholders addInputItem( @Nonnull final String inputItem ) - { - if( this.input == null ) { - this.input = new ArrayList<>(); - } - this.input.add(inputItem); - return this; - } - - /** - * Contains the input parameters used for grounding input questions - * - * @return input The input of this {@link GroundingModuleConfigConfigPlaceholders} instance. - */ - @Nonnull - public List getInput() - { - return input; - } - - /** - * Set the input of this {@link GroundingModuleConfigConfigPlaceholders} instance. - * - * @param input - * Contains the input parameters used for grounding input questions - */ - public void setInput( @Nonnull final List input ) - { - this.input = input; - } - - /** - * Set the output of this {@link GroundingModuleConfigConfigPlaceholders} instance and return the same instance. - * - * @param output - * Placeholder name for grounding output - * @return The same instance of this {@link GroundingModuleConfigConfigPlaceholders} class - */ - @Nonnull - public GroundingModuleConfigConfigPlaceholders output( @Nonnull final String output ) - { - this.output = output; - return this; - } - - /** - * Placeholder name for grounding output - * - * @return output The output of this {@link GroundingModuleConfigConfigPlaceholders} instance. - */ - @Nonnull - public String getOutput() - { - return output; - } - - /** - * Set the output of this {@link GroundingModuleConfigConfigPlaceholders} instance. - * - * @param output - * Placeholder name for grounding output - */ - public void setOutput( @Nonnull final String output ) - { - this.output = output; - } - - /** - * Get the names of the unrecognizable properties of the {@link GroundingModuleConfigConfigPlaceholders}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link GroundingModuleConfigConfigPlaceholders} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException( - "GroundingModuleConfigConfigPlaceholders has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link GroundingModuleConfigConfigPlaceholders} instance including - * unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( input != null ) - declaredFields.put("input", input); - if( output != null ) - declaredFields.put("output", output); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link GroundingModuleConfigConfigPlaceholders} instance. If the map - * previously contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final GroundingModuleConfigConfigPlaceholders groundingModuleConfigConfigPlaceholders = - (GroundingModuleConfigConfigPlaceholders) o; - return Objects.equals(this.cloudSdkCustomFields, groundingModuleConfigConfigPlaceholders.cloudSdkCustomFields) - && Objects.equals(this.input, groundingModuleConfigConfigPlaceholders.input) - && Objects.equals(this.output, groundingModuleConfigConfigPlaceholders.output); - } - - @Override - public int hashCode() - { - return Objects.hash(input, output, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class GroundingModuleConfigConfigPlaceholders {\n"); - sb.append(" input: ").append(toIndentedString(input)).append("\n"); - sb.append(" output: ").append(toIndentedString(output)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContent.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContent.java deleted file mode 100644 index a36f2d705..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContent.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * ImageContent - */ - -@Beta // CHECKSTYLE:OFF -public class ImageContent implements MultiChatContent -// CHECKSTYLE:ON -{ - /** - * Gets or Sets type - */ - public enum TypeEnum - { - /** - * The IMAGE_URL option of this ImageContent - */ - IMAGE_URL("image_url"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this ImageContent - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type ImageContent - */ - @JsonCreator - @Nonnull - public static TypeEnum fromValue( @Nonnull final String value ) - { - for( TypeEnum b : TypeEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "type" ) - private TypeEnum type; - - @JsonProperty( "image_url" ) - private ImageContentImageUrl imageUrl; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for ImageContent. - */ - protected ImageContent() - { - } - - /** - * Set the type of this {@link ImageContent} instance and return the same instance. - * - * @param type - * The type of this {@link ImageContent} - * @return The same instance of this {@link ImageContent} class - */ - @Nonnull - public ImageContent type( @Nonnull final TypeEnum type ) - { - this.type = type; - return this; - } - - /** - * Get type - * - * @return type The type of this {@link ImageContent} instance. - */ - @Nonnull - public TypeEnum getType() - { - return type; - } - - /** - * Set the type of this {@link ImageContent} instance. - * - * @param type - * The type of this {@link ImageContent} - */ - public void setType( @Nonnull final TypeEnum type ) - { - this.type = type; - } - - /** - * Set the imageUrl of this {@link ImageContent} instance and return the same instance. - * - * @param imageUrl - * The imageUrl of this {@link ImageContent} - * @return The same instance of this {@link ImageContent} class - */ - @Nonnull - public ImageContent imageUrl( @Nonnull final ImageContentImageUrl imageUrl ) - { - this.imageUrl = imageUrl; - return this; - } - - /** - * Get imageUrl - * - * @return imageUrl The imageUrl of this {@link ImageContent} instance. - */ - @Nonnull - public ImageContentImageUrl getImageUrl() - { - return imageUrl; - } - - /** - * Set the imageUrl of this {@link ImageContent} instance. - * - * @param imageUrl - * The imageUrl of this {@link ImageContent} - */ - public void setImageUrl( @Nonnull final ImageContentImageUrl imageUrl ) - { - this.imageUrl = imageUrl; - } - - /** - * Get the names of the unrecognizable properties of the {@link ImageContent}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link ImageContent} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("ImageContent has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link ImageContent} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( type != null ) - declaredFields.put("type", type); - if( imageUrl != null ) - declaredFields.put("imageUrl", imageUrl); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link ImageContent} instance. If the map previously contained a mapping - * for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final ImageContent imageContent = (ImageContent) o; - return Objects.equals(this.cloudSdkCustomFields, imageContent.cloudSdkCustomFields) - && Objects.equals(this.type, imageContent.type) - && Objects.equals(this.imageUrl, imageContent.imageUrl); - } - - @Override - public int hashCode() - { - return Objects.hash(type, imageUrl, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class ImageContent {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" imageUrl: ").append(toIndentedString(imageUrl)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContentImageUrl.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContentImageUrl.java deleted file mode 100644 index dcfd9bc5f..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ImageContentImageUrl.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * ImageContentImageUrl - */ - -@Beta // CHECKSTYLE:OFF -public class ImageContentImageUrl -// CHECKSTYLE:ON -{ - @JsonProperty( "url" ) - private String url; - - @JsonProperty( "detail" ) - private String detail = "auto"; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for ImageContentImageUrl. - */ - protected ImageContentImageUrl() - { - } - - /** - * Set the url of this {@link ImageContentImageUrl} instance and return the same instance. - * - * @param url - * The url of this {@link ImageContentImageUrl} - * @return The same instance of this {@link ImageContentImageUrl} class - */ - @Nonnull - public ImageContentImageUrl url( @Nonnull final String url ) - { - this.url = url; - return this; - } - - /** - * Get url - * - * @return url The url of this {@link ImageContentImageUrl} instance. - */ - @Nonnull - public String getUrl() - { - return url; - } - - /** - * Set the url of this {@link ImageContentImageUrl} instance. - * - * @param url - * The url of this {@link ImageContentImageUrl} - */ - public void setUrl( @Nonnull final String url ) - { - this.url = url; - } - - /** - * Set the detail of this {@link ImageContentImageUrl} instance and return the same instance. - * - * @param detail - * The detail of this {@link ImageContentImageUrl} - * @return The same instance of this {@link ImageContentImageUrl} class - */ - @Nonnull - public ImageContentImageUrl detail( @Nullable final String detail ) - { - this.detail = detail; - return this; - } - - /** - * Get detail - * - * @return detail The detail of this {@link ImageContentImageUrl} instance. - */ - @Nonnull - public String getDetail() - { - return detail; - } - - /** - * Set the detail of this {@link ImageContentImageUrl} instance. - * - * @param detail - * The detail of this {@link ImageContentImageUrl} - */ - public void setDetail( @Nullable final String detail ) - { - this.detail = detail; - } - - /** - * Get the names of the unrecognizable properties of the {@link ImageContentImageUrl}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link ImageContentImageUrl} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("ImageContentImageUrl has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link ImageContentImageUrl} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( url != null ) - declaredFields.put("url", url); - if( detail != null ) - declaredFields.put("detail", detail); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link ImageContentImageUrl} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final ImageContentImageUrl imageContentImageUrl = (ImageContentImageUrl) o; - return Objects.equals(this.cloudSdkCustomFields, imageContentImageUrl.cloudSdkCustomFields) - && Objects.equals(this.url, imageContentImageUrl.url) - && Objects.equals(this.detail, imageContentImageUrl.detail); - } - - @Override - public int hashCode() - { - return Objects.hash(url, detail, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class ImageContentImageUrl {\n"); - sb.append(" url: ").append(toIndentedString(url)).append("\n"); - sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/InputFilteringConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/InputFilteringConfig.java deleted file mode 100644 index 66a973504..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/InputFilteringConfig.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * InputFilteringConfig - */ - -@Beta // CHECKSTYLE:OFF -public class InputFilteringConfig -// CHECKSTYLE:ON -{ - @JsonProperty( "filters" ) - private List filters = new ArrayList<>(); - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for InputFilteringConfig. - */ - protected InputFilteringConfig() - { - } - - /** - * Set the filters of this {@link InputFilteringConfig} instance and return the same instance. - * - * @param filters - * Configuration for content filtering services that should be used for the given filtering step (input - * filtering). - * @return The same instance of this {@link InputFilteringConfig} class - */ - @Nonnull - public InputFilteringConfig filters( @Nonnull final List filters ) - { - this.filters = filters; - return this; - } - - /** - * Add one filters instance to this {@link InputFilteringConfig}. - * - * @param filtersItem - * The filters that should be added - * @return The same instance of type {@link InputFilteringConfig} - */ - @Nonnull - public InputFilteringConfig addFiltersItem( @Nonnull final InputFilterConfig filtersItem ) - { - if( this.filters == null ) { - this.filters = new ArrayList<>(); - } - this.filters.add(filtersItem); - return this; - } - - /** - * Configuration for content filtering services that should be used for the given filtering step (input filtering). - * - * @return filters The filters of this {@link InputFilteringConfig} instance. - */ - @Nonnull - public List getFilters() - { - return filters; - } - - /** - * Set the filters of this {@link InputFilteringConfig} instance. - * - * @param filters - * Configuration for content filtering services that should be used for the given filtering step (input - * filtering). - */ - public void setFilters( @Nonnull final List filters ) - { - this.filters = filters; - } - - /** - * Get the names of the unrecognizable properties of the {@link InputFilteringConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link InputFilteringConfig} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("InputFilteringConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link InputFilteringConfig} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( filters != null ) - declaredFields.put("filters", filters); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link InputFilteringConfig} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final InputFilteringConfig inputFilteringConfig = (InputFilteringConfig) o; - return Objects.equals(this.cloudSdkCustomFields, inputFilteringConfig.cloudSdkCustomFields) - && Objects.equals(this.filters, inputFilteringConfig.filters); - } - - @Override - public int hashCode() - { - return Objects.hash(filters, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class InputFilteringConfig {\n"); - sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LLMModelDetails.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LLMModelDetails.java deleted file mode 100644 index c5ce5e330..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LLMModelDetails.java +++ /dev/null @@ -1,397 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * The model and parameters to be used for the prompt templating. This is the model that will be used to generate the - * response. - */ - -@Beta // CHECKSTYLE:OFF -public class LLMModelDetails -// CHECKSTYLE:ON -{ - @JsonProperty( "name" ) - private String name; - - @JsonProperty( "version" ) - private String version = "latest"; - - @JsonProperty( "params" ) - private Map params = new HashMap<>(); - - @JsonProperty( "timeout" ) - private Integer timeout = 600; - - @JsonProperty( "max_retries" ) - private Integer maxRetries = 2; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for LLMModelDetails. - */ - protected LLMModelDetails() - { - } - - /** - * Set the name of this {@link LLMModelDetails} instance and return the same instance. - * - * @param name - * Name of the model as in LLM Access configuration - * @return The same instance of this {@link LLMModelDetails} class - */ - @Nonnull - public LLMModelDetails name( @Nonnull final String name ) - { - this.name = name; - return this; - } - - /** - * Name of the model as in LLM Access configuration - * - * @return name The name of this {@link LLMModelDetails} instance. - */ - @Nonnull - public String getName() - { - return name; - } - - /** - * Set the name of this {@link LLMModelDetails} instance. - * - * @param name - * Name of the model as in LLM Access configuration - */ - public void setName( @Nonnull final String name ) - { - this.name = name; - } - - /** - * Set the version of this {@link LLMModelDetails} instance and return the same instance. - * - * @param version - * Version of the model to be used - * @return The same instance of this {@link LLMModelDetails} class - */ - @Nonnull - public LLMModelDetails version( @Nullable final String version ) - { - this.version = version; - return this; - } - - /** - * Version of the model to be used - * - * @return version The version of this {@link LLMModelDetails} instance. - */ - @Nonnull - public String getVersion() - { - return version; - } - - /** - * Set the version of this {@link LLMModelDetails} instance. - * - * @param version - * Version of the model to be used - */ - public void setVersion( @Nullable final String version ) - { - this.version = version; - } - - /** - * Set the params of this {@link LLMModelDetails} instance and return the same instance. - * - * @param params - * Additional parameters for the model. Default values are used for mandatory parameters. - * @return The same instance of this {@link LLMModelDetails} class - */ - @Nonnull - public LLMModelDetails params( @Nullable final Map params ) - { - this.params = params; - return this; - } - - /** - * Put one params instance to this {@link LLMModelDetails} instance. - * - * @param key - * The String key of this params instance - * @param paramsItem - * The params that should be added under the given key - * @return The same instance of type {@link LLMModelDetails} - */ - @Nonnull - public LLMModelDetails putparamsItem( @Nonnull final String key, @Nullable final Object paramsItem ) - { - if( this.params == null ) { - this.params = new HashMap<>(); - } - this.params.put(key, paramsItem); - return this; - } - - /** - * Additional parameters for the model. Default values are used for mandatory parameters. - * - * @return params The params of this {@link LLMModelDetails} instance. - */ - @Nonnull - public Map getParams() - { - return params; - } - - /** - * Set the params of this {@link LLMModelDetails} instance. - * - * @param params - * Additional parameters for the model. Default values are used for mandatory parameters. - */ - public void setParams( @Nullable final Map params ) - { - this.params = params; - } - - /** - * Set the timeout of this {@link LLMModelDetails} instance and return the same instance. - * - * @param timeout - * Timeout for the LLM request in seconds. This parameter is currently ignored for Vertex AI models. - * Minimum: 1 Maximum: 600 - * @return The same instance of this {@link LLMModelDetails} class - */ - @Nonnull - public LLMModelDetails timeout( @Nullable final Integer timeout ) - { - this.timeout = timeout; - return this; - } - - /** - * Timeout for the LLM request in seconds. This parameter is currently ignored for Vertex AI models. minimum: 1 - * maximum: 600 - * - * @return timeout The timeout of this {@link LLMModelDetails} instance. - */ - @Nonnull - public Integer getTimeout() - { - return timeout; - } - - /** - * Set the timeout of this {@link LLMModelDetails} instance. - * - * @param timeout - * Timeout for the LLM request in seconds. This parameter is currently ignored for Vertex AI models. - * Minimum: 1 Maximum: 600 - */ - public void setTimeout( @Nullable final Integer timeout ) - { - this.timeout = timeout; - } - - /** - * Set the maxRetries of this {@link LLMModelDetails} instance and return the same instance. - * - * @param maxRetries - * Maximum number of retries for the LLM request. This parameter is currently ignored for Vertex AI - * models. Minimum: 0 Maximum: 5 - * @return The same instance of this {@link LLMModelDetails} class - */ - @Nonnull - public LLMModelDetails maxRetries( @Nullable final Integer maxRetries ) - { - this.maxRetries = maxRetries; - return this; - } - - /** - * Maximum number of retries for the LLM request. This parameter is currently ignored for Vertex AI models. minimum: - * 0 maximum: 5 - * - * @return maxRetries The maxRetries of this {@link LLMModelDetails} instance. - */ - @Nonnull - public Integer getMaxRetries() - { - return maxRetries; - } - - /** - * Set the maxRetries of this {@link LLMModelDetails} instance. - * - * @param maxRetries - * Maximum number of retries for the LLM request. This parameter is currently ignored for Vertex AI - * models. Minimum: 0 Maximum: 5 - */ - public void setMaxRetries( @Nullable final Integer maxRetries ) - { - this.maxRetries = maxRetries; - } - - /** - * Get the names of the unrecognizable properties of the {@link LLMModelDetails}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link LLMModelDetails} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("LLMModelDetails has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link LLMModelDetails} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( name != null ) - declaredFields.put("name", name); - if( version != null ) - declaredFields.put("version", version); - if( params != null ) - declaredFields.put("params", params); - if( timeout != null ) - declaredFields.put("timeout", timeout); - if( maxRetries != null ) - declaredFields.put("maxRetries", maxRetries); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link LLMModelDetails} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final LLMModelDetails llMModelDetails = (LLMModelDetails) o; - return Objects.equals(this.cloudSdkCustomFields, llMModelDetails.cloudSdkCustomFields) - && Objects.equals(this.name, llMModelDetails.name) - && Objects.equals(this.version, llMModelDetails.version) - && Objects.equals(this.params, llMModelDetails.params) - && Objects.equals(this.timeout, llMModelDetails.timeout) - && Objects.equals(this.maxRetries, llMModelDetails.maxRetries); - } - - @Override - public int hashCode() - { - return Objects.hash(name, version, params, timeout, maxRetries, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class LLMModelDetails {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - sb.append(" params: ").append(toIndentedString(params)).append("\n"); - sb.append(" timeout: ").append(toIndentedString(timeout)).append("\n"); - sb.append(" maxRetries: ").append(toIndentedString(maxRetries)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LlamaGuard38b.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LlamaGuard38b.java deleted file mode 100644 index 8d2a41130..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LlamaGuard38b.java +++ /dev/null @@ -1,773 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * Filter configuration for Llama Guard 3 8B - */ - -@Beta // CHECKSTYLE:OFF -public class LlamaGuard38b -// CHECKSTYLE:ON -{ - @JsonProperty( "violent_crimes" ) - private Boolean violentCrimes; - - @JsonProperty( "non_violent_crimes" ) - private Boolean nonViolentCrimes; - - @JsonProperty( "sex_crimes" ) - private Boolean sexCrimes; - - @JsonProperty( "child_exploitation" ) - private Boolean childExploitation; - - @JsonProperty( "defamation" ) - private Boolean defamation; - - @JsonProperty( "specialized_advice" ) - private Boolean specializedAdvice; - - @JsonProperty( "privacy" ) - private Boolean privacy; - - @JsonProperty( "intellectual_property" ) - private Boolean intellectualProperty; - - @JsonProperty( "indiscriminate_weapons" ) - private Boolean indiscriminateWeapons; - - @JsonProperty( "hate" ) - private Boolean hate; - - @JsonProperty( "self_harm" ) - private Boolean selfHarm; - - @JsonProperty( "sexual_content" ) - private Boolean sexualContent; - - @JsonProperty( "elections" ) - private Boolean elections; - - @JsonProperty( "code_interpreter_abuse" ) - private Boolean codeInterpreterAbuse; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for LlamaGuard38b. - */ - protected LlamaGuard38b() - { - } - - /** - * Set the violentCrimes of this {@link LlamaGuard38b} instance and return the same instance. - * - * @param violentCrimes - * The violentCrimes of this {@link LlamaGuard38b} - * @return The same instance of this {@link LlamaGuard38b} class - */ - @Nonnull - public LlamaGuard38b violentCrimes( @Nullable final Boolean violentCrimes ) - { - this.violentCrimes = violentCrimes; - return this; - } - - /** - * Get violentCrimes - * - * @return violentCrimes The violentCrimes of this {@link LlamaGuard38b} instance. - */ - @Nonnull - public Boolean isViolentCrimes() - { - return violentCrimes; - } - - /** - * Set the violentCrimes of this {@link LlamaGuard38b} instance. - * - * @param violentCrimes - * The violentCrimes of this {@link LlamaGuard38b} - */ - public void setViolentCrimes( @Nullable final Boolean violentCrimes ) - { - this.violentCrimes = violentCrimes; - } - - /** - * Set the nonViolentCrimes of this {@link LlamaGuard38b} instance and return the same instance. - * - * @param nonViolentCrimes - * The nonViolentCrimes of this {@link LlamaGuard38b} - * @return The same instance of this {@link LlamaGuard38b} class - */ - @Nonnull - public LlamaGuard38b nonViolentCrimes( @Nullable final Boolean nonViolentCrimes ) - { - this.nonViolentCrimes = nonViolentCrimes; - return this; - } - - /** - * Get nonViolentCrimes - * - * @return nonViolentCrimes The nonViolentCrimes of this {@link LlamaGuard38b} instance. - */ - @Nonnull - public Boolean isNonViolentCrimes() - { - return nonViolentCrimes; - } - - /** - * Set the nonViolentCrimes of this {@link LlamaGuard38b} instance. - * - * @param nonViolentCrimes - * The nonViolentCrimes of this {@link LlamaGuard38b} - */ - public void setNonViolentCrimes( @Nullable final Boolean nonViolentCrimes ) - { - this.nonViolentCrimes = nonViolentCrimes; - } - - /** - * Set the sexCrimes of this {@link LlamaGuard38b} instance and return the same instance. - * - * @param sexCrimes - * The sexCrimes of this {@link LlamaGuard38b} - * @return The same instance of this {@link LlamaGuard38b} class - */ - @Nonnull - public LlamaGuard38b sexCrimes( @Nullable final Boolean sexCrimes ) - { - this.sexCrimes = sexCrimes; - return this; - } - - /** - * Get sexCrimes - * - * @return sexCrimes The sexCrimes of this {@link LlamaGuard38b} instance. - */ - @Nonnull - public Boolean isSexCrimes() - { - return sexCrimes; - } - - /** - * Set the sexCrimes of this {@link LlamaGuard38b} instance. - * - * @param sexCrimes - * The sexCrimes of this {@link LlamaGuard38b} - */ - public void setSexCrimes( @Nullable final Boolean sexCrimes ) - { - this.sexCrimes = sexCrimes; - } - - /** - * Set the childExploitation of this {@link LlamaGuard38b} instance and return the same instance. - * - * @param childExploitation - * The childExploitation of this {@link LlamaGuard38b} - * @return The same instance of this {@link LlamaGuard38b} class - */ - @Nonnull - public LlamaGuard38b childExploitation( @Nullable final Boolean childExploitation ) - { - this.childExploitation = childExploitation; - return this; - } - - /** - * Get childExploitation - * - * @return childExploitation The childExploitation of this {@link LlamaGuard38b} instance. - */ - @Nonnull - public Boolean isChildExploitation() - { - return childExploitation; - } - - /** - * Set the childExploitation of this {@link LlamaGuard38b} instance. - * - * @param childExploitation - * The childExploitation of this {@link LlamaGuard38b} - */ - public void setChildExploitation( @Nullable final Boolean childExploitation ) - { - this.childExploitation = childExploitation; - } - - /** - * Set the defamation of this {@link LlamaGuard38b} instance and return the same instance. - * - * @param defamation - * The defamation of this {@link LlamaGuard38b} - * @return The same instance of this {@link LlamaGuard38b} class - */ - @Nonnull - public LlamaGuard38b defamation( @Nullable final Boolean defamation ) - { - this.defamation = defamation; - return this; - } - - /** - * Get defamation - * - * @return defamation The defamation of this {@link LlamaGuard38b} instance. - */ - @Nonnull - public Boolean isDefamation() - { - return defamation; - } - - /** - * Set the defamation of this {@link LlamaGuard38b} instance. - * - * @param defamation - * The defamation of this {@link LlamaGuard38b} - */ - public void setDefamation( @Nullable final Boolean defamation ) - { - this.defamation = defamation; - } - - /** - * Set the specializedAdvice of this {@link LlamaGuard38b} instance and return the same instance. - * - * @param specializedAdvice - * The specializedAdvice of this {@link LlamaGuard38b} - * @return The same instance of this {@link LlamaGuard38b} class - */ - @Nonnull - public LlamaGuard38b specializedAdvice( @Nullable final Boolean specializedAdvice ) - { - this.specializedAdvice = specializedAdvice; - return this; - } - - /** - * Get specializedAdvice - * - * @return specializedAdvice The specializedAdvice of this {@link LlamaGuard38b} instance. - */ - @Nonnull - public Boolean isSpecializedAdvice() - { - return specializedAdvice; - } - - /** - * Set the specializedAdvice of this {@link LlamaGuard38b} instance. - * - * @param specializedAdvice - * The specializedAdvice of this {@link LlamaGuard38b} - */ - public void setSpecializedAdvice( @Nullable final Boolean specializedAdvice ) - { - this.specializedAdvice = specializedAdvice; - } - - /** - * Set the privacy of this {@link LlamaGuard38b} instance and return the same instance. - * - * @param privacy - * The privacy of this {@link LlamaGuard38b} - * @return The same instance of this {@link LlamaGuard38b} class - */ - @Nonnull - public LlamaGuard38b privacy( @Nullable final Boolean privacy ) - { - this.privacy = privacy; - return this; - } - - /** - * Get privacy - * - * @return privacy The privacy of this {@link LlamaGuard38b} instance. - */ - @Nonnull - public Boolean isPrivacy() - { - return privacy; - } - - /** - * Set the privacy of this {@link LlamaGuard38b} instance. - * - * @param privacy - * The privacy of this {@link LlamaGuard38b} - */ - public void setPrivacy( @Nullable final Boolean privacy ) - { - this.privacy = privacy; - } - - /** - * Set the intellectualProperty of this {@link LlamaGuard38b} instance and return the same instance. - * - * @param intellectualProperty - * The intellectualProperty of this {@link LlamaGuard38b} - * @return The same instance of this {@link LlamaGuard38b} class - */ - @Nonnull - public LlamaGuard38b intellectualProperty( @Nullable final Boolean intellectualProperty ) - { - this.intellectualProperty = intellectualProperty; - return this; - } - - /** - * Get intellectualProperty - * - * @return intellectualProperty The intellectualProperty of this {@link LlamaGuard38b} instance. - */ - @Nonnull - public Boolean isIntellectualProperty() - { - return intellectualProperty; - } - - /** - * Set the intellectualProperty of this {@link LlamaGuard38b} instance. - * - * @param intellectualProperty - * The intellectualProperty of this {@link LlamaGuard38b} - */ - public void setIntellectualProperty( @Nullable final Boolean intellectualProperty ) - { - this.intellectualProperty = intellectualProperty; - } - - /** - * Set the indiscriminateWeapons of this {@link LlamaGuard38b} instance and return the same instance. - * - * @param indiscriminateWeapons - * The indiscriminateWeapons of this {@link LlamaGuard38b} - * @return The same instance of this {@link LlamaGuard38b} class - */ - @Nonnull - public LlamaGuard38b indiscriminateWeapons( @Nullable final Boolean indiscriminateWeapons ) - { - this.indiscriminateWeapons = indiscriminateWeapons; - return this; - } - - /** - * Get indiscriminateWeapons - * - * @return indiscriminateWeapons The indiscriminateWeapons of this {@link LlamaGuard38b} instance. - */ - @Nonnull - public Boolean isIndiscriminateWeapons() - { - return indiscriminateWeapons; - } - - /** - * Set the indiscriminateWeapons of this {@link LlamaGuard38b} instance. - * - * @param indiscriminateWeapons - * The indiscriminateWeapons of this {@link LlamaGuard38b} - */ - public void setIndiscriminateWeapons( @Nullable final Boolean indiscriminateWeapons ) - { - this.indiscriminateWeapons = indiscriminateWeapons; - } - - /** - * Set the hate of this {@link LlamaGuard38b} instance and return the same instance. - * - * @param hate - * The hate of this {@link LlamaGuard38b} - * @return The same instance of this {@link LlamaGuard38b} class - */ - @Nonnull - public LlamaGuard38b hate( @Nullable final Boolean hate ) - { - this.hate = hate; - return this; - } - - /** - * Get hate - * - * @return hate The hate of this {@link LlamaGuard38b} instance. - */ - @Nonnull - public Boolean isHate() - { - return hate; - } - - /** - * Set the hate of this {@link LlamaGuard38b} instance. - * - * @param hate - * The hate of this {@link LlamaGuard38b} - */ - public void setHate( @Nullable final Boolean hate ) - { - this.hate = hate; - } - - /** - * Set the selfHarm of this {@link LlamaGuard38b} instance and return the same instance. - * - * @param selfHarm - * The selfHarm of this {@link LlamaGuard38b} - * @return The same instance of this {@link LlamaGuard38b} class - */ - @Nonnull - public LlamaGuard38b selfHarm( @Nullable final Boolean selfHarm ) - { - this.selfHarm = selfHarm; - return this; - } - - /** - * Get selfHarm - * - * @return selfHarm The selfHarm of this {@link LlamaGuard38b} instance. - */ - @Nonnull - public Boolean isSelfHarm() - { - return selfHarm; - } - - /** - * Set the selfHarm of this {@link LlamaGuard38b} instance. - * - * @param selfHarm - * The selfHarm of this {@link LlamaGuard38b} - */ - public void setSelfHarm( @Nullable final Boolean selfHarm ) - { - this.selfHarm = selfHarm; - } - - /** - * Set the sexualContent of this {@link LlamaGuard38b} instance and return the same instance. - * - * @param sexualContent - * The sexualContent of this {@link LlamaGuard38b} - * @return The same instance of this {@link LlamaGuard38b} class - */ - @Nonnull - public LlamaGuard38b sexualContent( @Nullable final Boolean sexualContent ) - { - this.sexualContent = sexualContent; - return this; - } - - /** - * Get sexualContent - * - * @return sexualContent The sexualContent of this {@link LlamaGuard38b} instance. - */ - @Nonnull - public Boolean isSexualContent() - { - return sexualContent; - } - - /** - * Set the sexualContent of this {@link LlamaGuard38b} instance. - * - * @param sexualContent - * The sexualContent of this {@link LlamaGuard38b} - */ - public void setSexualContent( @Nullable final Boolean sexualContent ) - { - this.sexualContent = sexualContent; - } - - /** - * Set the elections of this {@link LlamaGuard38b} instance and return the same instance. - * - * @param elections - * The elections of this {@link LlamaGuard38b} - * @return The same instance of this {@link LlamaGuard38b} class - */ - @Nonnull - public LlamaGuard38b elections( @Nullable final Boolean elections ) - { - this.elections = elections; - return this; - } - - /** - * Get elections - * - * @return elections The elections of this {@link LlamaGuard38b} instance. - */ - @Nonnull - public Boolean isElections() - { - return elections; - } - - /** - * Set the elections of this {@link LlamaGuard38b} instance. - * - * @param elections - * The elections of this {@link LlamaGuard38b} - */ - public void setElections( @Nullable final Boolean elections ) - { - this.elections = elections; - } - - /** - * Set the codeInterpreterAbuse of this {@link LlamaGuard38b} instance and return the same instance. - * - * @param codeInterpreterAbuse - * The codeInterpreterAbuse of this {@link LlamaGuard38b} - * @return The same instance of this {@link LlamaGuard38b} class - */ - @Nonnull - public LlamaGuard38b codeInterpreterAbuse( @Nullable final Boolean codeInterpreterAbuse ) - { - this.codeInterpreterAbuse = codeInterpreterAbuse; - return this; - } - - /** - * Get codeInterpreterAbuse - * - * @return codeInterpreterAbuse The codeInterpreterAbuse of this {@link LlamaGuard38b} instance. - */ - @Nonnull - public Boolean isCodeInterpreterAbuse() - { - return codeInterpreterAbuse; - } - - /** - * Set the codeInterpreterAbuse of this {@link LlamaGuard38b} instance. - * - * @param codeInterpreterAbuse - * The codeInterpreterAbuse of this {@link LlamaGuard38b} - */ - public void setCodeInterpreterAbuse( @Nullable final Boolean codeInterpreterAbuse ) - { - this.codeInterpreterAbuse = codeInterpreterAbuse; - } - - /** - * Get the names of the unrecognizable properties of the {@link LlamaGuard38b}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link LlamaGuard38b} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("LlamaGuard38b has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link LlamaGuard38b} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( violentCrimes != null ) - declaredFields.put("violentCrimes", violentCrimes); - if( nonViolentCrimes != null ) - declaredFields.put("nonViolentCrimes", nonViolentCrimes); - if( sexCrimes != null ) - declaredFields.put("sexCrimes", sexCrimes); - if( childExploitation != null ) - declaredFields.put("childExploitation", childExploitation); - if( defamation != null ) - declaredFields.put("defamation", defamation); - if( specializedAdvice != null ) - declaredFields.put("specializedAdvice", specializedAdvice); - if( privacy != null ) - declaredFields.put("privacy", privacy); - if( intellectualProperty != null ) - declaredFields.put("intellectualProperty", intellectualProperty); - if( indiscriminateWeapons != null ) - declaredFields.put("indiscriminateWeapons", indiscriminateWeapons); - if( hate != null ) - declaredFields.put("hate", hate); - if( selfHarm != null ) - declaredFields.put("selfHarm", selfHarm); - if( sexualContent != null ) - declaredFields.put("sexualContent", sexualContent); - if( elections != null ) - declaredFields.put("elections", elections); - if( codeInterpreterAbuse != null ) - declaredFields.put("codeInterpreterAbuse", codeInterpreterAbuse); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link LlamaGuard38b} instance. If the map previously contained a mapping - * for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final LlamaGuard38b llamaGuard38b = (LlamaGuard38b) o; - return Objects.equals(this.cloudSdkCustomFields, llamaGuard38b.cloudSdkCustomFields) - && Objects.equals(this.violentCrimes, llamaGuard38b.violentCrimes) - && Objects.equals(this.nonViolentCrimes, llamaGuard38b.nonViolentCrimes) - && Objects.equals(this.sexCrimes, llamaGuard38b.sexCrimes) - && Objects.equals(this.childExploitation, llamaGuard38b.childExploitation) - && Objects.equals(this.defamation, llamaGuard38b.defamation) - && Objects.equals(this.specializedAdvice, llamaGuard38b.specializedAdvice) - && Objects.equals(this.privacy, llamaGuard38b.privacy) - && Objects.equals(this.intellectualProperty, llamaGuard38b.intellectualProperty) - && Objects.equals(this.indiscriminateWeapons, llamaGuard38b.indiscriminateWeapons) - && Objects.equals(this.hate, llamaGuard38b.hate) - && Objects.equals(this.selfHarm, llamaGuard38b.selfHarm) - && Objects.equals(this.sexualContent, llamaGuard38b.sexualContent) - && Objects.equals(this.elections, llamaGuard38b.elections) - && Objects.equals(this.codeInterpreterAbuse, llamaGuard38b.codeInterpreterAbuse); - } - - @Override - public int hashCode() - { - return Objects - .hash( - violentCrimes, - nonViolentCrimes, - sexCrimes, - childExploitation, - defamation, - specializedAdvice, - privacy, - intellectualProperty, - indiscriminateWeapons, - hate, - selfHarm, - sexualContent, - elections, - codeInterpreterAbuse, - cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class LlamaGuard38b {\n"); - sb.append(" violentCrimes: ").append(toIndentedString(violentCrimes)).append("\n"); - sb.append(" nonViolentCrimes: ").append(toIndentedString(nonViolentCrimes)).append("\n"); - sb.append(" sexCrimes: ").append(toIndentedString(sexCrimes)).append("\n"); - sb.append(" childExploitation: ").append(toIndentedString(childExploitation)).append("\n"); - sb.append(" defamation: ").append(toIndentedString(defamation)).append("\n"); - sb.append(" specializedAdvice: ").append(toIndentedString(specializedAdvice)).append("\n"); - sb.append(" privacy: ").append(toIndentedString(privacy)).append("\n"); - sb.append(" intellectualProperty: ").append(toIndentedString(intellectualProperty)).append("\n"); - sb.append(" indiscriminateWeapons: ").append(toIndentedString(indiscriminateWeapons)).append("\n"); - sb.append(" hate: ").append(toIndentedString(hate)).append("\n"); - sb.append(" selfHarm: ").append(toIndentedString(selfHarm)).append("\n"); - sb.append(" sexualContent: ").append(toIndentedString(sexualContent)).append("\n"); - sb.append(" elections: ").append(toIndentedString(elections)).append("\n"); - sb.append(" codeInterpreterAbuse: ").append(toIndentedString(codeInterpreterAbuse)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LlamaGuard38bFilterConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LlamaGuard38bFilterConfig.java deleted file mode 100644 index dcd3b3c94..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/LlamaGuard38bFilterConfig.java +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * LlamaGuard38bFilterConfig - */ - -@Beta // CHECKSTYLE:OFF -public class LlamaGuard38bFilterConfig implements InputFilterConfig, OutputFilterConfig -// CHECKSTYLE:ON -{ - /** - * Name of the filter provider type - */ - public enum TypeEnum - { - /** - * The LLAMA_GUARD_3_8B option of this LlamaGuard38bFilterConfig - */ - LLAMA_GUARD_3_8B("llama_guard_3_8b"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this LlamaGuard38bFilterConfig - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type LlamaGuard38bFilterConfig - */ - @JsonCreator - @Nonnull - public static TypeEnum fromValue( @Nonnull final String value ) - { - for( TypeEnum b : TypeEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "type" ) - private TypeEnum type; - - @JsonProperty( "config" ) - private LlamaGuard38b config; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for LlamaGuard38bFilterConfig. - */ - protected LlamaGuard38bFilterConfig() - { - } - - /** - * Set the type of this {@link LlamaGuard38bFilterConfig} instance and return the same instance. - * - * @param type - * Name of the filter provider type - * @return The same instance of this {@link LlamaGuard38bFilterConfig} class - */ - @Nonnull - public LlamaGuard38bFilterConfig type( @Nonnull final TypeEnum type ) - { - this.type = type; - return this; - } - - /** - * Name of the filter provider type - * - * @return type The type of this {@link LlamaGuard38bFilterConfig} instance. - */ - @Nonnull - public TypeEnum getType() - { - return type; - } - - /** - * Set the type of this {@link LlamaGuard38bFilterConfig} instance. - * - * @param type - * Name of the filter provider type - */ - public void setType( @Nonnull final TypeEnum type ) - { - this.type = type; - } - - /** - * Set the config of this {@link LlamaGuard38bFilterConfig} instance and return the same instance. - * - * @param config - * The config of this {@link LlamaGuard38bFilterConfig} - * @return The same instance of this {@link LlamaGuard38bFilterConfig} class - */ - @Nonnull - public LlamaGuard38bFilterConfig config( @Nonnull final LlamaGuard38b config ) - { - this.config = config; - return this; - } - - /** - * Get config - * - * @return config The config of this {@link LlamaGuard38bFilterConfig} instance. - */ - @Nonnull - public LlamaGuard38b getConfig() - { - return config; - } - - /** - * Set the config of this {@link LlamaGuard38bFilterConfig} instance. - * - * @param config - * The config of this {@link LlamaGuard38bFilterConfig} - */ - public void setConfig( @Nonnull final LlamaGuard38b config ) - { - this.config = config; - } - - /** - * Get the names of the unrecognizable properties of the {@link LlamaGuard38bFilterConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link LlamaGuard38bFilterConfig} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("LlamaGuard38bFilterConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link LlamaGuard38bFilterConfig} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( type != null ) - declaredFields.put("type", type); - if( config != null ) - declaredFields.put("config", config); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link LlamaGuard38bFilterConfig} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final LlamaGuard38bFilterConfig llamaGuard38bFilterConfig = (LlamaGuard38bFilterConfig) o; - return Objects.equals(this.cloudSdkCustomFields, llamaGuard38bFilterConfig.cloudSdkCustomFields) - && Objects.equals(this.type, llamaGuard38bFilterConfig.type) - && Objects.equals(this.config, llamaGuard38bFilterConfig.config); - } - - @Override - public int hashCode() - { - return Objects.hash(type, config, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class LlamaGuard38bFilterConfig {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" config: ").append(toIndentedString(config)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfigMaskingProviders.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfigMaskingProviders.java deleted file mode 100644 index 6ec620150..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfigMaskingProviders.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * MaskingModuleConfigMaskingProviders - */ - -@Beta // CHECKSTYLE:OFF -public class MaskingModuleConfigMaskingProviders implements MaskingModuleConfig -// CHECKSTYLE:ON -{ - @JsonProperty( "masking_providers" ) - private List maskingProviders = new ArrayList<>(); - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for MaskingModuleConfigMaskingProviders. - */ - protected MaskingModuleConfigMaskingProviders() - { - } - - /** - * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance and return the same - * instance. - * - * @param maskingProviders - * List of masking service providers. **DEPRECATED**: will be removed Sept 15, 2026. Use - * `providers` property instead. - * @return The same instance of this {@link MaskingModuleConfigMaskingProviders} class - */ - @Nonnull - public MaskingModuleConfigMaskingProviders maskingProviders( @Nonnull final List maskingProviders ) - { - this.maskingProviders = maskingProviders; - return this; - } - - /** - * Add one maskingProviders instance to this {@link MaskingModuleConfigMaskingProviders}. - * - * @param maskingProvidersItem - * The maskingProviders that should be added - * @return The same instance of type {@link MaskingModuleConfigMaskingProviders} - */ - @Nonnull - public MaskingModuleConfigMaskingProviders addMaskingProvidersItem( @Nonnull final DPIConfig maskingProvidersItem ) - { - if( this.maskingProviders == null ) { - this.maskingProviders = new ArrayList<>(); - } - this.maskingProviders.add(maskingProvidersItem); - return this; - } - - /** - * List of masking service providers. **DEPRECATED**: will be removed Sept 15, 2026. Use `providers` - * property instead. - * - * @return maskingProviders The maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance. - * @deprecated - */ - @Deprecated - @Nonnull - public List getMaskingProviders() - { - return maskingProviders; - } - - /** - * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance. - * - * @param maskingProviders - * List of masking service providers. **DEPRECATED**: will be removed Sept 15, 2026. Use - * `providers` property instead. - */ - public void setMaskingProviders( @Nonnull final List maskingProviders ) - { - this.maskingProviders = maskingProviders; - } - - /** - * Get the names of the unrecognizable properties of the {@link MaskingModuleConfigMaskingProviders}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link MaskingModuleConfigMaskingProviders} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException( - "MaskingModuleConfigMaskingProviders has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link MaskingModuleConfigMaskingProviders} instance including - * unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( maskingProviders != null ) - declaredFields.put("maskingProviders", maskingProviders); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link MaskingModuleConfigMaskingProviders} instance. If the map - * previously contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final MaskingModuleConfigMaskingProviders maskingModuleConfigMaskingProviders = - (MaskingModuleConfigMaskingProviders) o; - return Objects.equals(this.cloudSdkCustomFields, maskingModuleConfigMaskingProviders.cloudSdkCustomFields) - && Objects.equals(this.maskingProviders, maskingModuleConfigMaskingProviders.maskingProviders); - } - - @Override - public int hashCode() - { - return Objects.hash(maskingProviders, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class MaskingModuleConfigMaskingProviders {\n"); - sb.append(" maskingProviders: ").append(toIndentedString(maskingProviders)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfigProviders.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfigProviders.java deleted file mode 100644 index 8465d3086..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfigProviders.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * MaskingModuleConfigProviders - */ - -@Beta // CHECKSTYLE:OFF -public class MaskingModuleConfigProviders implements MaskingModuleConfig -// CHECKSTYLE:ON -{ - @JsonProperty( "providers" ) - private List providers = new ArrayList<>(); - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for MaskingModuleConfigProviders. - */ - protected MaskingModuleConfigProviders() - { - } - - /** - * Set the providers of this {@link MaskingModuleConfigProviders} instance and return the same instance. - * - * @param providers - * List of masking service providers - * @return The same instance of this {@link MaskingModuleConfigProviders} class - */ - @Nonnull - public MaskingModuleConfigProviders providers( @Nonnull final List providers ) - { - this.providers = providers; - return this; - } - - /** - * Add one providers instance to this {@link MaskingModuleConfigProviders}. - * - * @param providersItem - * The providers that should be added - * @return The same instance of type {@link MaskingModuleConfigProviders} - */ - @Nonnull - public MaskingModuleConfigProviders addProvidersItem( @Nonnull final DPIConfig providersItem ) - { - if( this.providers == null ) { - this.providers = new ArrayList<>(); - } - this.providers.add(providersItem); - return this; - } - - /** - * List of masking service providers - * - * @return providers The providers of this {@link MaskingModuleConfigProviders} instance. - */ - @Nonnull - public List getProviders() - { - return providers; - } - - /** - * Set the providers of this {@link MaskingModuleConfigProviders} instance. - * - * @param providers - * List of masking service providers - */ - public void setProviders( @Nonnull final List providers ) - { - this.providers = providers; - } - - /** - * Get the names of the unrecognizable properties of the {@link MaskingModuleConfigProviders}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link MaskingModuleConfigProviders} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("MaskingModuleConfigProviders has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link MaskingModuleConfigProviders} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( providers != null ) - declaredFields.put("providers", providers); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link MaskingModuleConfigProviders} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final MaskingModuleConfigProviders maskingModuleConfigProviders = (MaskingModuleConfigProviders) o; - return Objects.equals(this.cloudSdkCustomFields, maskingModuleConfigProviders.cloudSdkCustomFields) - && Objects.equals(this.providers, maskingModuleConfigProviders.providers); - } - - @Override - public int hashCode() - { - return Objects.hash(providers, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class MaskingModuleConfigProviders {\n"); - sb.append(" providers: ").append(toIndentedString(providers)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MessageToolCall.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MessageToolCall.java deleted file mode 100644 index 54c929f92..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MessageToolCall.java +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * MessageToolCall - */ - -@Beta // CHECKSTYLE:OFF -public class MessageToolCall -// CHECKSTYLE:ON -{ - @JsonProperty( "id" ) - private String id; - - /** - * The type of the tool. Currently, only `function` is supported. - */ - public enum TypeEnum - { - /** - * The FUNCTION option of this MessageToolCall - */ - FUNCTION("function"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this MessageToolCall - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type MessageToolCall - */ - @JsonCreator - @Nonnull - public static TypeEnum fromValue( @Nonnull final String value ) - { - for( TypeEnum b : TypeEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "type" ) - private TypeEnum type; - - @JsonProperty( "function" ) - private MessageToolCallFunction function; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for MessageToolCall. - */ - protected MessageToolCall() - { - } - - /** - * Set the id of this {@link MessageToolCall} instance and return the same instance. - * - * @param id - * The ID of the tool call. - * @return The same instance of this {@link MessageToolCall} class - */ - @Nonnull - public MessageToolCall id( @Nonnull final String id ) - { - this.id = id; - return this; - } - - /** - * The ID of the tool call. - * - * @return id The id of this {@link MessageToolCall} instance. - */ - @Nonnull - public String getId() - { - return id; - } - - /** - * Set the id of this {@link MessageToolCall} instance. - * - * @param id - * The ID of the tool call. - */ - public void setId( @Nonnull final String id ) - { - this.id = id; - } - - /** - * Set the type of this {@link MessageToolCall} instance and return the same instance. - * - * @param type - * The type of the tool. Currently, only `function` is supported. - * @return The same instance of this {@link MessageToolCall} class - */ - @Nonnull - public MessageToolCall type( @Nonnull final TypeEnum type ) - { - this.type = type; - return this; - } - - /** - * The type of the tool. Currently, only `function` is supported. - * - * @return type The type of this {@link MessageToolCall} instance. - */ - @Nonnull - public TypeEnum getType() - { - return type; - } - - /** - * Set the type of this {@link MessageToolCall} instance. - * - * @param type - * The type of the tool. Currently, only `function` is supported. - */ - public void setType( @Nonnull final TypeEnum type ) - { - this.type = type; - } - - /** - * Set the function of this {@link MessageToolCall} instance and return the same instance. - * - * @param function - * The function of this {@link MessageToolCall} - * @return The same instance of this {@link MessageToolCall} class - */ - @Nonnull - public MessageToolCall function( @Nonnull final MessageToolCallFunction function ) - { - this.function = function; - return this; - } - - /** - * Get function - * - * @return function The function of this {@link MessageToolCall} instance. - */ - @Nonnull - public MessageToolCallFunction getFunction() - { - return function; - } - - /** - * Set the function of this {@link MessageToolCall} instance. - * - * @param function - * The function of this {@link MessageToolCall} - */ - public void setFunction( @Nonnull final MessageToolCallFunction function ) - { - this.function = function; - } - - /** - * Get the names of the unrecognizable properties of the {@link MessageToolCall}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link MessageToolCall} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("MessageToolCall has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link MessageToolCall} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( id != null ) - declaredFields.put("id", id); - if( type != null ) - declaredFields.put("type", type); - if( function != null ) - declaredFields.put("function", function); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link MessageToolCall} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final MessageToolCall messageToolCall = (MessageToolCall) o; - return Objects.equals(this.cloudSdkCustomFields, messageToolCall.cloudSdkCustomFields) - && Objects.equals(this.id, messageToolCall.id) - && Objects.equals(this.type, messageToolCall.type) - && Objects.equals(this.function, messageToolCall.function); - } - - @Override - public int hashCode() - { - return Objects.hash(id, type, function, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class MessageToolCall {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" function: ").append(toIndentedString(function)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MessageToolCallFunction.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MessageToolCallFunction.java deleted file mode 100644 index e6bd2178a..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MessageToolCallFunction.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * The function that the model called. - */ - -@Beta // CHECKSTYLE:OFF -public class MessageToolCallFunction -// CHECKSTYLE:ON -{ - @JsonProperty( "name" ) - private String name; - - @JsonProperty( "arguments" ) - private String arguments; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for MessageToolCallFunction. - */ - protected MessageToolCallFunction() - { - } - - /** - * Set the name of this {@link MessageToolCallFunction} instance and return the same instance. - * - * @param name - * The name of the function to call. - * @return The same instance of this {@link MessageToolCallFunction} class - */ - @Nonnull - public MessageToolCallFunction name( @Nonnull final String name ) - { - this.name = name; - return this; - } - - /** - * The name of the function to call. - * - * @return name The name of this {@link MessageToolCallFunction} instance. - */ - @Nonnull - public String getName() - { - return name; - } - - /** - * Set the name of this {@link MessageToolCallFunction} instance. - * - * @param name - * The name of the function to call. - */ - public void setName( @Nonnull final String name ) - { - this.name = name; - } - - /** - * Set the arguments of this {@link MessageToolCallFunction} instance and return the same instance. - * - * @param arguments - * The arguments to call the function with, as generated by the model in JSON format. Note that the model - * does not always generate valid JSON, and may hallucinate parameters not defined by your function - * schema. Validate the arguments in your code before calling your function. - * @return The same instance of this {@link MessageToolCallFunction} class - */ - @Nonnull - public MessageToolCallFunction arguments( @Nonnull final String arguments ) - { - this.arguments = arguments; - return this; - } - - /** - * The arguments to call the function with, as generated by the model in JSON format. Note that the model does not - * always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the - * arguments in your code before calling your function. - * - * @return arguments The arguments of this {@link MessageToolCallFunction} instance. - */ - @Nonnull - public String getArguments() - { - return arguments; - } - - /** - * Set the arguments of this {@link MessageToolCallFunction} instance. - * - * @param arguments - * The arguments to call the function with, as generated by the model in JSON format. Note that the model - * does not always generate valid JSON, and may hallucinate parameters not defined by your function - * schema. Validate the arguments in your code before calling your function. - */ - public void setArguments( @Nonnull final String arguments ) - { - this.arguments = arguments; - } - - /** - * Get the names of the unrecognizable properties of the {@link MessageToolCallFunction}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link MessageToolCallFunction} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("MessageToolCallFunction has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link MessageToolCallFunction} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( name != null ) - declaredFields.put("name", name); - if( arguments != null ) - declaredFields.put("arguments", arguments); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link MessageToolCallFunction} instance. If the map previously contained - * a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final MessageToolCallFunction messageToolCallFunction = (MessageToolCallFunction) o; - return Objects.equals(this.cloudSdkCustomFields, messageToolCallFunction.cloudSdkCustomFields) - && Objects.equals(this.name, messageToolCallFunction.name) - && Objects.equals(this.arguments, messageToolCallFunction.arguments); - } - - @Override - public int hashCode() - { - return Objects.hash(name, arguments, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class MessageToolCallFunction {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" arguments: ").append(toIndentedString(arguments)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ModuleConfigs.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ModuleConfigs.java deleted file mode 100644 index 51809571b..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ModuleConfigs.java +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * ModuleConfigs - */ - -@Beta // CHECKSTYLE:OFF -public class ModuleConfigs -// CHECKSTYLE:ON -{ - @JsonProperty( "prompt_templating" ) - private PromptTemplatingModuleConfig promptTemplating; - - @JsonProperty( "filtering" ) - private FilteringModuleConfig filtering; - - @JsonProperty( "masking" ) - private MaskingModuleConfig masking; - - @JsonProperty( "grounding" ) - private GroundingModuleConfig grounding; - - @JsonProperty( "translation" ) - private TranslationModuleConfig translation; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for ModuleConfigs. - */ - protected ModuleConfigs() - { - } - - /** - * Set the promptTemplating of this {@link ModuleConfigs} instance and return the same instance. - * - * @param promptTemplating - * The promptTemplating of this {@link ModuleConfigs} - * @return The same instance of this {@link ModuleConfigs} class - */ - @Nonnull - public ModuleConfigs promptTemplating( @Nonnull final PromptTemplatingModuleConfig promptTemplating ) - { - this.promptTemplating = promptTemplating; - return this; - } - - /** - * Get promptTemplating - * - * @return promptTemplating The promptTemplating of this {@link ModuleConfigs} instance. - */ - @Nonnull - public PromptTemplatingModuleConfig getPromptTemplating() - { - return promptTemplating; - } - - /** - * Set the promptTemplating of this {@link ModuleConfigs} instance. - * - * @param promptTemplating - * The promptTemplating of this {@link ModuleConfigs} - */ - public void setPromptTemplating( @Nonnull final PromptTemplatingModuleConfig promptTemplating ) - { - this.promptTemplating = promptTemplating; - } - - /** - * Set the filtering of this {@link ModuleConfigs} instance and return the same instance. - * - * @param filtering - * The filtering of this {@link ModuleConfigs} - * @return The same instance of this {@link ModuleConfigs} class - */ - @Nonnull - public ModuleConfigs filtering( @Nullable final FilteringModuleConfig filtering ) - { - this.filtering = filtering; - return this; - } - - /** - * Get filtering - * - * @return filtering The filtering of this {@link ModuleConfigs} instance. - */ - @Nonnull - public FilteringModuleConfig getFiltering() - { - return filtering; - } - - /** - * Set the filtering of this {@link ModuleConfigs} instance. - * - * @param filtering - * The filtering of this {@link ModuleConfigs} - */ - public void setFiltering( @Nullable final FilteringModuleConfig filtering ) - { - this.filtering = filtering; - } - - /** - * Set the masking of this {@link ModuleConfigs} instance and return the same instance. - * - * @param masking - * The masking of this {@link ModuleConfigs} - * @return The same instance of this {@link ModuleConfigs} class - */ - @Nonnull - public ModuleConfigs masking( @Nullable final MaskingModuleConfig masking ) - { - this.masking = masking; - return this; - } - - /** - * Get masking - * - * @return masking The masking of this {@link ModuleConfigs} instance. - */ - @Nonnull - public MaskingModuleConfig getMasking() - { - return masking; - } - - /** - * Set the masking of this {@link ModuleConfigs} instance. - * - * @param masking - * The masking of this {@link ModuleConfigs} - */ - public void setMasking( @Nullable final MaskingModuleConfig masking ) - { - this.masking = masking; - } - - /** - * Set the grounding of this {@link ModuleConfigs} instance and return the same instance. - * - * @param grounding - * The grounding of this {@link ModuleConfigs} - * @return The same instance of this {@link ModuleConfigs} class - */ - @Nonnull - public ModuleConfigs grounding( @Nullable final GroundingModuleConfig grounding ) - { - this.grounding = grounding; - return this; - } - - /** - * Get grounding - * - * @return grounding The grounding of this {@link ModuleConfigs} instance. - */ - @Nonnull - public GroundingModuleConfig getGrounding() - { - return grounding; - } - - /** - * Set the grounding of this {@link ModuleConfigs} instance. - * - * @param grounding - * The grounding of this {@link ModuleConfigs} - */ - public void setGrounding( @Nullable final GroundingModuleConfig grounding ) - { - this.grounding = grounding; - } - - /** - * Set the translation of this {@link ModuleConfigs} instance and return the same instance. - * - * @param translation - * The translation of this {@link ModuleConfigs} - * @return The same instance of this {@link ModuleConfigs} class - */ - @Nonnull - public ModuleConfigs translation( @Nullable final TranslationModuleConfig translation ) - { - this.translation = translation; - return this; - } - - /** - * Get translation - * - * @return translation The translation of this {@link ModuleConfigs} instance. - */ - @Nonnull - public TranslationModuleConfig getTranslation() - { - return translation; - } - - /** - * Set the translation of this {@link ModuleConfigs} instance. - * - * @param translation - * The translation of this {@link ModuleConfigs} - */ - public void setTranslation( @Nullable final TranslationModuleConfig translation ) - { - this.translation = translation; - } - - /** - * Get the names of the unrecognizable properties of the {@link ModuleConfigs}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link ModuleConfigs} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("ModuleConfigs has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link ModuleConfigs} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( promptTemplating != null ) - declaredFields.put("promptTemplating", promptTemplating); - if( filtering != null ) - declaredFields.put("filtering", filtering); - if( masking != null ) - declaredFields.put("masking", masking); - if( grounding != null ) - declaredFields.put("grounding", grounding); - if( translation != null ) - declaredFields.put("translation", translation); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link ModuleConfigs} instance. If the map previously contained a mapping - * for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final ModuleConfigs moduleConfigs = (ModuleConfigs) o; - return Objects.equals(this.cloudSdkCustomFields, moduleConfigs.cloudSdkCustomFields) - && Objects.equals(this.promptTemplating, moduleConfigs.promptTemplating) - && Objects.equals(this.filtering, moduleConfigs.filtering) - && Objects.equals(this.masking, moduleConfigs.masking) - && Objects.equals(this.grounding, moduleConfigs.grounding) - && Objects.equals(this.translation, moduleConfigs.translation); - } - - @Override - public int hashCode() - { - return Objects.hash(promptTemplating, filtering, masking, grounding, translation, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class ModuleConfigs {\n"); - sb.append(" promptTemplating: ").append(toIndentedString(promptTemplating)).append("\n"); - sb.append(" filtering: ").append(toIndentedString(filtering)).append("\n"); - sb.append(" masking: ").append(toIndentedString(masking)).append("\n"); - sb.append(" grounding: ").append(toIndentedString(grounding)).append("\n"); - sb.append(" translation: ").append(toIndentedString(translation)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MultiChatTemplate.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MultiChatTemplate.java deleted file mode 100644 index 63a5be7fd..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MultiChatTemplate.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * MultiChatTemplate - */ - -@Beta // CHECKSTYLE:OFF -public class MultiChatTemplate implements PromptTemplate -// CHECKSTYLE:ON -{ - @JsonProperty( "role" ) - private String role; - - @JsonProperty( "content" ) - private List content = new ArrayList<>(); - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for MultiChatTemplate. - */ - protected MultiChatTemplate() - { - } - - /** - * Set the role of this {@link MultiChatTemplate} instance and return the same instance. - * - * @param role - * The role of this {@link MultiChatTemplate} - * @return The same instance of this {@link MultiChatTemplate} class - */ - @Nonnull - public MultiChatTemplate role( @Nonnull final String role ) - { - this.role = role; - return this; - } - - /** - * Get role - * - * @return role The role of this {@link MultiChatTemplate} instance. - */ - @Nonnull - public String getRole() - { - return role; - } - - /** - * Set the role of this {@link MultiChatTemplate} instance. - * - * @param role - * The role of this {@link MultiChatTemplate} - */ - public void setRole( @Nonnull final String role ) - { - this.role = role; - } - - /** - * Set the content of this {@link MultiChatTemplate} instance and return the same instance. - * - * @param content - * The content of this {@link MultiChatTemplate} - * @return The same instance of this {@link MultiChatTemplate} class - */ - @Nonnull - public MultiChatTemplate content( @Nonnull final List content ) - { - this.content = content; - return this; - } - - /** - * Add one content instance to this {@link MultiChatTemplate}. - * - * @param contentItem - * The content that should be added - * @return The same instance of type {@link MultiChatTemplate} - */ - @Nonnull - public MultiChatTemplate addContentItem( @Nonnull final MultiChatContent contentItem ) - { - if( this.content == null ) { - this.content = new ArrayList<>(); - } - this.content.add(contentItem); - return this; - } - - /** - * Get content - * - * @return content The content of this {@link MultiChatTemplate} instance. - */ - @Nonnull - public List getContent() - { - return content; - } - - /** - * Set the content of this {@link MultiChatTemplate} instance. - * - * @param content - * The content of this {@link MultiChatTemplate} - */ - public void setContent( @Nonnull final List content ) - { - this.content = content; - } - - /** - * Get the names of the unrecognizable properties of the {@link MultiChatTemplate}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link MultiChatTemplate} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("MultiChatTemplate has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link MultiChatTemplate} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( role != null ) - declaredFields.put("role", role); - if( content != null ) - declaredFields.put("content", content); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link MultiChatTemplate} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final MultiChatTemplate multiChatTemplate = (MultiChatTemplate) o; - return Objects.equals(this.cloudSdkCustomFields, multiChatTemplate.cloudSdkCustomFields) - && Objects.equals(this.role, multiChatTemplate.role) - && Objects.equals(this.content, multiChatTemplate.content); - } - - @Override - public int hashCode() - { - return Objects.hash(role, content, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class MultiChatTemplate {\n"); - sb.append(" role: ").append(toIndentedString(role)).append("\n"); - sb.append(" content: ").append(toIndentedString(content)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MultiChatContent.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOf.java similarity index 67% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MultiChatContent.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOf.java index 1c48f4e11..491aeb64a 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MultiChatContent.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOf.java @@ -3,8 +3,8 @@ */ /* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. + * SodaStore API + * API for managing soda products and orders in SodaStore. * * * @@ -20,12 +20,12 @@ import com.google.common.annotations.Beta; /** - * MultiChatContent + * OneOf */ @Beta @JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) -@JsonSubTypes( { @JsonSubTypes.Type( value = ImageContent.class ), @JsonSubTypes.Type( value = TextContent.class ), } ) +@JsonSubTypes( { @JsonSubTypes.Type( value = Cola.class ), @JsonSubTypes.Type( value = Fanta.class ), } ) -public interface MultiChatContent +public interface OneOf { } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminator.java similarity index 57% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfig.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminator.java index 2a4474192..f71818d41 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/MaskingModuleConfig.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminator.java @@ -3,8 +3,8 @@ */ /* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. + * SodaStore API + * API for managing soda products and orders in SodaStore. * * * @@ -20,14 +20,15 @@ import com.google.common.annotations.Beta; /** - * MaskingModuleConfig + * OneOfWithDiscriminator */ @Beta -@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) +@JsonTypeInfo( use = JsonTypeInfo.Id.NAME, property = "sodaType", visible = true ) @JsonSubTypes( { - @JsonSubTypes.Type( value = MaskingModuleConfigMaskingProviders.class ), - @JsonSubTypes.Type( value = MaskingModuleConfigProviders.class ), } ) + @JsonSubTypes.Type( value = Cola.class, name = "Cola" ), + @JsonSubTypes.Type( value = Fanta.class, name = "Fanta" ), } ) -public interface MaskingModuleConfig +public interface OneOfWithDiscriminator { + Object getSodaType(); } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIEntityConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminatorAndMapping.java similarity index 55% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIEntityConfig.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminatorAndMapping.java index cf8526425..f9742cbd8 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/DPIEntityConfig.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminatorAndMapping.java @@ -3,8 +3,8 @@ */ /* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. + * SodaStore API + * API for managing soda products and orders in SodaStore. * * * @@ -20,14 +20,15 @@ import com.google.common.annotations.Beta; /** - * DPIEntityConfig + * OneOfWithDiscriminatorAndMapping */ @Beta -@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) +@JsonTypeInfo( use = JsonTypeInfo.Id.NAME, property = "sodaType", visible = true ) @JsonSubTypes( { - @JsonSubTypes.Type( value = DPICustomEntity.class ), - @JsonSubTypes.Type( value = DPIStandardEntity.class ), } ) + @JsonSubTypes.Type( value = Cola.class, name = "cool_cola" ), + @JsonSubTypes.Type( value = Fanta.class, name = "fancy_fanta" ), } ) -public interface DPIEntityConfig +public interface OneOfWithDiscriminatorAndMapping { + Object getSodaType(); } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/InputFilterConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithEnumDiscriminator.java similarity index 57% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/InputFilterConfig.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithEnumDiscriminator.java index 3bb81df8e..c8657f4cb 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/InputFilterConfig.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithEnumDiscriminator.java @@ -3,8 +3,8 @@ */ /* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. + * SodaStore API + * API for managing soda products and orders in SodaStore. * * * @@ -20,14 +20,15 @@ import com.google.common.annotations.Beta; /** - * InputFilterConfig + * OneOfWithEnumDiscriminator */ @Beta -@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) +@JsonTypeInfo( use = JsonTypeInfo.Id.NAME, property = "disc", visible = true ) @JsonSubTypes( { - @JsonSubTypes.Type( value = AzureContentSafetyInputFilterConfig.class ), - @JsonSubTypes.Type( value = LlamaGuard38bFilterConfig.class ), } ) + @JsonSubTypes.Type( value = Bar.class, name = "disc_bar" ), + @JsonSubTypes.Type( value = Foo.class, name = "disc_foo" ), } ) -public interface InputFilterConfig +public interface OneOfWithEnumDiscriminator { + Object getDisc(); } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfig.java deleted file mode 100644 index 41863b943..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfig.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * OrchestrationConfig - */ - -@Beta // CHECKSTYLE:OFF -public class OrchestrationConfig -// CHECKSTYLE:ON -{ - @JsonProperty( "modules" ) - private ModuleConfigs modules; - - @JsonProperty( "stream" ) - private GlobalStreamOptions stream; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for OrchestrationConfig. - */ - protected OrchestrationConfig() - { - } - - /** - * Set the modules of this {@link OrchestrationConfig} instance and return the same instance. - * - * @param modules - * The modules of this {@link OrchestrationConfig} - * @return The same instance of this {@link OrchestrationConfig} class - */ - @Nonnull - public OrchestrationConfig modules( @Nonnull final ModuleConfigs modules ) - { - this.modules = modules; - return this; - } - - /** - * Get modules - * - * @return modules The modules of this {@link OrchestrationConfig} instance. - */ - @Nonnull - public ModuleConfigs getModules() - { - return modules; - } - - /** - * Set the modules of this {@link OrchestrationConfig} instance. - * - * @param modules - * The modules of this {@link OrchestrationConfig} - */ - public void setModules( @Nonnull final ModuleConfigs modules ) - { - this.modules = modules; - } - - /** - * Set the stream of this {@link OrchestrationConfig} instance and return the same instance. - * - * @param stream - * The stream of this {@link OrchestrationConfig} - * @return The same instance of this {@link OrchestrationConfig} class - */ - @Nonnull - public OrchestrationConfig stream( @Nullable final GlobalStreamOptions stream ) - { - this.stream = stream; - return this; - } - - /** - * Get stream - * - * @return stream The stream of this {@link OrchestrationConfig} instance. - */ - @Nonnull - public GlobalStreamOptions getStream() - { - return stream; - } - - /** - * Set the stream of this {@link OrchestrationConfig} instance. - * - * @param stream - * The stream of this {@link OrchestrationConfig} - */ - public void setStream( @Nullable final GlobalStreamOptions stream ) - { - this.stream = stream; - } - - /** - * Get the names of the unrecognizable properties of the {@link OrchestrationConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link OrchestrationConfig} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("OrchestrationConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link OrchestrationConfig} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( modules != null ) - declaredFields.put("modules", modules); - if( stream != null ) - declaredFields.put("stream", stream); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link OrchestrationConfig} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final OrchestrationConfig orchestrationConfig = (OrchestrationConfig) o; - return Objects.equals(this.cloudSdkCustomFields, orchestrationConfig.cloudSdkCustomFields) - && Objects.equals(this.modules, orchestrationConfig.modules) - && Objects.equals(this.stream, orchestrationConfig.stream); - } - - @Override - public int hashCode() - { - return Objects.hash(modules, stream, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class OrchestrationConfig {\n"); - sb.append(" modules: ").append(toIndentedString(modules)).append("\n"); - sb.append(" stream: ").append(toIndentedString(stream)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigDeleteResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigDeleteResponse.java deleted file mode 100644 index 220347c72..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigDeleteResponse.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * OrchestrationConfigDeleteResponse - */ - -@Beta // CHECKSTYLE:OFF -public class OrchestrationConfigDeleteResponse -// CHECKSTYLE:ON -{ - @JsonProperty( "message" ) - private String message; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for OrchestrationConfigDeleteResponse. - */ - protected OrchestrationConfigDeleteResponse() - { - } - - /** - * Set the message of this {@link OrchestrationConfigDeleteResponse} instance and return the same instance. - * - * @param message - * The message of this {@link OrchestrationConfigDeleteResponse} - * @return The same instance of this {@link OrchestrationConfigDeleteResponse} class - */ - @Nonnull - public OrchestrationConfigDeleteResponse message( @Nonnull final String message ) - { - this.message = message; - return this; - } - - /** - * Get message - * - * @return message The message of this {@link OrchestrationConfigDeleteResponse} instance. - */ - @Nonnull - public String getMessage() - { - return message; - } - - /** - * Set the message of this {@link OrchestrationConfigDeleteResponse} instance. - * - * @param message - * The message of this {@link OrchestrationConfigDeleteResponse} - */ - public void setMessage( @Nonnull final String message ) - { - this.message = message; - } - - /** - * Get the names of the unrecognizable properties of the {@link OrchestrationConfigDeleteResponse}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link OrchestrationConfigDeleteResponse} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException( - "OrchestrationConfigDeleteResponse has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link OrchestrationConfigDeleteResponse} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( message != null ) - declaredFields.put("message", message); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link OrchestrationConfigDeleteResponse} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final OrchestrationConfigDeleteResponse orchestrationConfigDeleteResponse = - (OrchestrationConfigDeleteResponse) o; - return Objects.equals(this.cloudSdkCustomFields, orchestrationConfigDeleteResponse.cloudSdkCustomFields) - && Objects.equals(this.message, orchestrationConfigDeleteResponse.message); - } - - @Override - public int hashCode() - { - return Objects.hash(message, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class OrchestrationConfigDeleteResponse {\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigGetResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigGetResponse.java deleted file mode 100644 index 4981e48cc..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigGetResponse.java +++ /dev/null @@ -1,555 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * OrchestrationConfigGetResponse - */ - -@Beta // CHECKSTYLE:OFF -public class OrchestrationConfigGetResponse -// CHECKSTYLE:ON -{ - @JsonProperty( "id" ) - private UUID id; - - @JsonProperty( "name" ) - private String name; - - @JsonProperty( "version" ) - private String version; - - @JsonProperty( "scenario" ) - private String scenario; - - @JsonProperty( "creation_timestamp" ) - private String creationTimestamp; - - @JsonProperty( "managed_by" ) - private String managedBy; - - @JsonProperty( "is_version_head" ) - private Boolean isVersionHead; - - @JsonProperty( "resource_group_id" ) - private String resourceGroupId; - - @JsonProperty( "spec" ) - private OrchestrationConfig spec; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for OrchestrationConfigGetResponse. - */ - protected OrchestrationConfigGetResponse() - { - } - - /** - * Set the id of this {@link OrchestrationConfigGetResponse} instance and return the same instance. - * - * @param id - * The id of this {@link OrchestrationConfigGetResponse} - * @return The same instance of this {@link OrchestrationConfigGetResponse} class - */ - @Nonnull - public OrchestrationConfigGetResponse id( @Nullable final UUID id ) - { - this.id = id; - return this; - } - - /** - * Get id - * - * @return id The id of this {@link OrchestrationConfigGetResponse} instance. - */ - @Nonnull - public UUID getId() - { - return id; - } - - /** - * Set the id of this {@link OrchestrationConfigGetResponse} instance. - * - * @param id - * The id of this {@link OrchestrationConfigGetResponse} - */ - public void setId( @Nullable final UUID id ) - { - this.id = id; - } - - /** - * Set the name of this {@link OrchestrationConfigGetResponse} instance and return the same instance. - * - * @param name - * The name of this {@link OrchestrationConfigGetResponse} - * @return The same instance of this {@link OrchestrationConfigGetResponse} class - */ - @Nonnull - public OrchestrationConfigGetResponse name( @Nullable final String name ) - { - this.name = name; - return this; - } - - /** - * Get name - * - * @return name The name of this {@link OrchestrationConfigGetResponse} instance. - */ - @Nonnull - public String getName() - { - return name; - } - - /** - * Set the name of this {@link OrchestrationConfigGetResponse} instance. - * - * @param name - * The name of this {@link OrchestrationConfigGetResponse} - */ - public void setName( @Nullable final String name ) - { - this.name = name; - } - - /** - * Set the version of this {@link OrchestrationConfigGetResponse} instance and return the same instance. - * - * @param version - * The version of this {@link OrchestrationConfigGetResponse} - * @return The same instance of this {@link OrchestrationConfigGetResponse} class - */ - @Nonnull - public OrchestrationConfigGetResponse version( @Nullable final String version ) - { - this.version = version; - return this; - } - - /** - * Get version - * - * @return version The version of this {@link OrchestrationConfigGetResponse} instance. - */ - @Nonnull - public String getVersion() - { - return version; - } - - /** - * Set the version of this {@link OrchestrationConfigGetResponse} instance. - * - * @param version - * The version of this {@link OrchestrationConfigGetResponse} - */ - public void setVersion( @Nullable final String version ) - { - this.version = version; - } - - /** - * Set the scenario of this {@link OrchestrationConfigGetResponse} instance and return the same instance. - * - * @param scenario - * The scenario of this {@link OrchestrationConfigGetResponse} - * @return The same instance of this {@link OrchestrationConfigGetResponse} class - */ - @Nonnull - public OrchestrationConfigGetResponse scenario( @Nullable final String scenario ) - { - this.scenario = scenario; - return this; - } - - /** - * Get scenario - * - * @return scenario The scenario of this {@link OrchestrationConfigGetResponse} instance. - */ - @Nonnull - public String getScenario() - { - return scenario; - } - - /** - * Set the scenario of this {@link OrchestrationConfigGetResponse} instance. - * - * @param scenario - * The scenario of this {@link OrchestrationConfigGetResponse} - */ - public void setScenario( @Nullable final String scenario ) - { - this.scenario = scenario; - } - - /** - * Set the creationTimestamp of this {@link OrchestrationConfigGetResponse} instance and return the same instance. - * - * @param creationTimestamp - * The creationTimestamp of this {@link OrchestrationConfigGetResponse} - * @return The same instance of this {@link OrchestrationConfigGetResponse} class - */ - @Nonnull - public OrchestrationConfigGetResponse creationTimestamp( @Nullable final String creationTimestamp ) - { - this.creationTimestamp = creationTimestamp; - return this; - } - - /** - * Get creationTimestamp - * - * @return creationTimestamp The creationTimestamp of this {@link OrchestrationConfigGetResponse} instance. - */ - @Nonnull - public String getCreationTimestamp() - { - return creationTimestamp; - } - - /** - * Set the creationTimestamp of this {@link OrchestrationConfigGetResponse} instance. - * - * @param creationTimestamp - * The creationTimestamp of this {@link OrchestrationConfigGetResponse} - */ - public void setCreationTimestamp( @Nullable final String creationTimestamp ) - { - this.creationTimestamp = creationTimestamp; - } - - /** - * Set the managedBy of this {@link OrchestrationConfigGetResponse} instance and return the same instance. - * - * @param managedBy - * The managedBy of this {@link OrchestrationConfigGetResponse} - * @return The same instance of this {@link OrchestrationConfigGetResponse} class - */ - @Nonnull - public OrchestrationConfigGetResponse managedBy( @Nullable final String managedBy ) - { - this.managedBy = managedBy; - return this; - } - - /** - * Get managedBy - * - * @return managedBy The managedBy of this {@link OrchestrationConfigGetResponse} instance. - */ - @Nonnull - public String getManagedBy() - { - return managedBy; - } - - /** - * Set the managedBy of this {@link OrchestrationConfigGetResponse} instance. - * - * @param managedBy - * The managedBy of this {@link OrchestrationConfigGetResponse} - */ - public void setManagedBy( @Nullable final String managedBy ) - { - this.managedBy = managedBy; - } - - /** - * Set the isVersionHead of this {@link OrchestrationConfigGetResponse} instance and return the same instance. - * - * @param isVersionHead - * The isVersionHead of this {@link OrchestrationConfigGetResponse} - * @return The same instance of this {@link OrchestrationConfigGetResponse} class - */ - @Nonnull - public OrchestrationConfigGetResponse isVersionHead( @Nullable final Boolean isVersionHead ) - { - this.isVersionHead = isVersionHead; - return this; - } - - /** - * Get isVersionHead - * - * @return isVersionHead The isVersionHead of this {@link OrchestrationConfigGetResponse} instance. - */ - @Nonnull - public Boolean isIsVersionHead() - { - return isVersionHead; - } - - /** - * Set the isVersionHead of this {@link OrchestrationConfigGetResponse} instance. - * - * @param isVersionHead - * The isVersionHead of this {@link OrchestrationConfigGetResponse} - */ - public void setIsVersionHead( @Nullable final Boolean isVersionHead ) - { - this.isVersionHead = isVersionHead; - } - - /** - * Set the resourceGroupId of this {@link OrchestrationConfigGetResponse} instance and return the same instance. - * - * @param resourceGroupId - * The resourceGroupId of this {@link OrchestrationConfigGetResponse} - * @return The same instance of this {@link OrchestrationConfigGetResponse} class - */ - @Nonnull - public OrchestrationConfigGetResponse resourceGroupId( @Nullable final String resourceGroupId ) - { - this.resourceGroupId = resourceGroupId; - return this; - } - - /** - * Get resourceGroupId - * - * @return resourceGroupId The resourceGroupId of this {@link OrchestrationConfigGetResponse} instance. - */ - @Nonnull - public String getResourceGroupId() - { - return resourceGroupId; - } - - /** - * Set the resourceGroupId of this {@link OrchestrationConfigGetResponse} instance. - * - * @param resourceGroupId - * The resourceGroupId of this {@link OrchestrationConfigGetResponse} - */ - public void setResourceGroupId( @Nullable final String resourceGroupId ) - { - this.resourceGroupId = resourceGroupId; - } - - /** - * Set the spec of this {@link OrchestrationConfigGetResponse} instance and return the same instance. - * - * @param spec - * The spec of this {@link OrchestrationConfigGetResponse} - * @return The same instance of this {@link OrchestrationConfigGetResponse} class - */ - @Nonnull - public OrchestrationConfigGetResponse spec( @Nullable final OrchestrationConfig spec ) - { - this.spec = spec; - return this; - } - - /** - * Get spec - * - * @return spec The spec of this {@link OrchestrationConfigGetResponse} instance. - */ - @Nonnull - public OrchestrationConfig getSpec() - { - return spec; - } - - /** - * Set the spec of this {@link OrchestrationConfigGetResponse} instance. - * - * @param spec - * The spec of this {@link OrchestrationConfigGetResponse} - */ - public void setSpec( @Nullable final OrchestrationConfig spec ) - { - this.spec = spec; - } - - /** - * Get the names of the unrecognizable properties of the {@link OrchestrationConfigGetResponse}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link OrchestrationConfigGetResponse} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("OrchestrationConfigGetResponse has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link OrchestrationConfigGetResponse} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( id != null ) - declaredFields.put("id", id); - if( name != null ) - declaredFields.put("name", name); - if( version != null ) - declaredFields.put("version", version); - if( scenario != null ) - declaredFields.put("scenario", scenario); - if( creationTimestamp != null ) - declaredFields.put("creationTimestamp", creationTimestamp); - if( managedBy != null ) - declaredFields.put("managedBy", managedBy); - if( isVersionHead != null ) - declaredFields.put("isVersionHead", isVersionHead); - if( resourceGroupId != null ) - declaredFields.put("resourceGroupId", resourceGroupId); - if( spec != null ) - declaredFields.put("spec", spec); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link OrchestrationConfigGetResponse} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final OrchestrationConfigGetResponse orchestrationConfigGetResponse = (OrchestrationConfigGetResponse) o; - return Objects.equals(this.cloudSdkCustomFields, orchestrationConfigGetResponse.cloudSdkCustomFields) - && Objects.equals(this.id, orchestrationConfigGetResponse.id) - && Objects.equals(this.name, orchestrationConfigGetResponse.name) - && Objects.equals(this.version, orchestrationConfigGetResponse.version) - && Objects.equals(this.scenario, orchestrationConfigGetResponse.scenario) - && Objects.equals(this.creationTimestamp, orchestrationConfigGetResponse.creationTimestamp) - && Objects.equals(this.managedBy, orchestrationConfigGetResponse.managedBy) - && Objects.equals(this.isVersionHead, orchestrationConfigGetResponse.isVersionHead) - && Objects.equals(this.resourceGroupId, orchestrationConfigGetResponse.resourceGroupId) - && Objects.equals(this.spec, orchestrationConfigGetResponse.spec); - } - - @Override - public int hashCode() - { - return Objects - .hash( - id, - name, - version, - scenario, - creationTimestamp, - managedBy, - isVersionHead, - resourceGroupId, - spec, - cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class OrchestrationConfigGetResponse {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); - sb.append(" creationTimestamp: ").append(toIndentedString(creationTimestamp)).append("\n"); - sb.append(" managedBy: ").append(toIndentedString(managedBy)).append("\n"); - sb.append(" isVersionHead: ").append(toIndentedString(isVersionHead)).append("\n"); - sb.append(" resourceGroupId: ").append(toIndentedString(resourceGroupId)).append("\n"); - sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigListResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigListResponse.java deleted file mode 100644 index bbb96af9f..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigListResponse.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * OrchestrationConfigListResponse - */ - -@Beta // CHECKSTYLE:OFF -public class OrchestrationConfigListResponse -// CHECKSTYLE:ON -{ - @JsonProperty( "count" ) - private Integer count; - - @JsonProperty( "resources" ) - private List resources = new ArrayList<>(); - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for OrchestrationConfigListResponse. - */ - protected OrchestrationConfigListResponse() - { - } - - /** - * Set the count of this {@link OrchestrationConfigListResponse} instance and return the same instance. - * - * @param count - * The count of this {@link OrchestrationConfigListResponse} - * @return The same instance of this {@link OrchestrationConfigListResponse} class - */ - @Nonnull - public OrchestrationConfigListResponse count( @Nonnull final Integer count ) - { - this.count = count; - return this; - } - - /** - * Get count - * - * @return count The count of this {@link OrchestrationConfigListResponse} instance. - */ - @Nonnull - public Integer getCount() - { - return count; - } - - /** - * Set the count of this {@link OrchestrationConfigListResponse} instance. - * - * @param count - * The count of this {@link OrchestrationConfigListResponse} - */ - public void setCount( @Nonnull final Integer count ) - { - this.count = count; - } - - /** - * Set the resources of this {@link OrchestrationConfigListResponse} instance and return the same instance. - * - * @param resources - * The resources of this {@link OrchestrationConfigListResponse} - * @return The same instance of this {@link OrchestrationConfigListResponse} class - */ - @Nonnull - public OrchestrationConfigListResponse resources( @Nonnull final List resources ) - { - this.resources = resources; - return this; - } - - /** - * Add one resources instance to this {@link OrchestrationConfigListResponse}. - * - * @param resourcesItem - * The resources that should be added - * @return The same instance of type {@link OrchestrationConfigListResponse} - */ - @Nonnull - public OrchestrationConfigListResponse addResourcesItem( - @Nonnull final OrchestrationConfigGetResponse resourcesItem ) - { - if( this.resources == null ) { - this.resources = new ArrayList<>(); - } - this.resources.add(resourcesItem); - return this; - } - - /** - * Get resources - * - * @return resources The resources of this {@link OrchestrationConfigListResponse} instance. - */ - @Nonnull - public List getResources() - { - return resources; - } - - /** - * Set the resources of this {@link OrchestrationConfigListResponse} instance. - * - * @param resources - * The resources of this {@link OrchestrationConfigListResponse} - */ - public void setResources( @Nonnull final List resources ) - { - this.resources = resources; - } - - /** - * Get the names of the unrecognizable properties of the {@link OrchestrationConfigListResponse}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link OrchestrationConfigListResponse} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("OrchestrationConfigListResponse has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link OrchestrationConfigListResponse} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( count != null ) - declaredFields.put("count", count); - if( resources != null ) - declaredFields.put("resources", resources); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link OrchestrationConfigListResponse} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final OrchestrationConfigListResponse orchestrationConfigListResponse = (OrchestrationConfigListResponse) o; - return Objects.equals(this.cloudSdkCustomFields, orchestrationConfigListResponse.cloudSdkCustomFields) - && Objects.equals(this.count, orchestrationConfigListResponse.count) - && Objects.equals(this.resources, orchestrationConfigListResponse.resources); - } - - @Override - public int hashCode() - { - return Objects.hash(count, resources, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class OrchestrationConfigListResponse {\n"); - sb.append(" count: ").append(toIndentedString(count)).append("\n"); - sb.append(" resources: ").append(toIndentedString(resources)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigPostRequest.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigPostRequest.java deleted file mode 100644 index 3d13ac2ac..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigPostRequest.java +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * OrchestrationConfigPostRequest - */ - -@Beta // CHECKSTYLE:OFF -public class OrchestrationConfigPostRequest -// CHECKSTYLE:ON -{ - @JsonProperty( "name" ) - private String name; - - @JsonProperty( "version" ) - private String version; - - @JsonProperty( "scenario" ) - private String scenario; - - @JsonProperty( "spec" ) - private OrchestrationConfig spec; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for OrchestrationConfigPostRequest. - */ - protected OrchestrationConfigPostRequest() - { - } - - /** - * Set the name of this {@link OrchestrationConfigPostRequest} instance and return the same instance. - * - * @param name - * The name of this {@link OrchestrationConfigPostRequest} - * @return The same instance of this {@link OrchestrationConfigPostRequest} class - */ - @Nonnull - public OrchestrationConfigPostRequest name( @Nonnull final String name ) - { - this.name = name; - return this; - } - - /** - * Get name - * - * @return name The name of this {@link OrchestrationConfigPostRequest} instance. - */ - @Nonnull - public String getName() - { - return name; - } - - /** - * Set the name of this {@link OrchestrationConfigPostRequest} instance. - * - * @param name - * The name of this {@link OrchestrationConfigPostRequest} - */ - public void setName( @Nonnull final String name ) - { - this.name = name; - } - - /** - * Set the version of this {@link OrchestrationConfigPostRequest} instance and return the same instance. - * - * @param version - * The version of this {@link OrchestrationConfigPostRequest} - * @return The same instance of this {@link OrchestrationConfigPostRequest} class - */ - @Nonnull - public OrchestrationConfigPostRequest version( @Nonnull final String version ) - { - this.version = version; - return this; - } - - /** - * Get version - * - * @return version The version of this {@link OrchestrationConfigPostRequest} instance. - */ - @Nonnull - public String getVersion() - { - return version; - } - - /** - * Set the version of this {@link OrchestrationConfigPostRequest} instance. - * - * @param version - * The version of this {@link OrchestrationConfigPostRequest} - */ - public void setVersion( @Nonnull final String version ) - { - this.version = version; - } - - /** - * Set the scenario of this {@link OrchestrationConfigPostRequest} instance and return the same instance. - * - * @param scenario - * The scenario of this {@link OrchestrationConfigPostRequest} - * @return The same instance of this {@link OrchestrationConfigPostRequest} class - */ - @Nonnull - public OrchestrationConfigPostRequest scenario( @Nonnull final String scenario ) - { - this.scenario = scenario; - return this; - } - - /** - * Get scenario - * - * @return scenario The scenario of this {@link OrchestrationConfigPostRequest} instance. - */ - @Nonnull - public String getScenario() - { - return scenario; - } - - /** - * Set the scenario of this {@link OrchestrationConfigPostRequest} instance. - * - * @param scenario - * The scenario of this {@link OrchestrationConfigPostRequest} - */ - public void setScenario( @Nonnull final String scenario ) - { - this.scenario = scenario; - } - - /** - * Set the spec of this {@link OrchestrationConfigPostRequest} instance and return the same instance. - * - * @param spec - * The spec of this {@link OrchestrationConfigPostRequest} - * @return The same instance of this {@link OrchestrationConfigPostRequest} class - */ - @Nonnull - public OrchestrationConfigPostRequest spec( @Nonnull final OrchestrationConfig spec ) - { - this.spec = spec; - return this; - } - - /** - * Get spec - * - * @return spec The spec of this {@link OrchestrationConfigPostRequest} instance. - */ - @Nonnull - public OrchestrationConfig getSpec() - { - return spec; - } - - /** - * Set the spec of this {@link OrchestrationConfigPostRequest} instance. - * - * @param spec - * The spec of this {@link OrchestrationConfigPostRequest} - */ - public void setSpec( @Nonnull final OrchestrationConfig spec ) - { - this.spec = spec; - } - - /** - * Get the names of the unrecognizable properties of the {@link OrchestrationConfigPostRequest}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link OrchestrationConfigPostRequest} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("OrchestrationConfigPostRequest has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link OrchestrationConfigPostRequest} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( name != null ) - declaredFields.put("name", name); - if( version != null ) - declaredFields.put("version", version); - if( scenario != null ) - declaredFields.put("scenario", scenario); - if( spec != null ) - declaredFields.put("spec", spec); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link OrchestrationConfigPostRequest} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final OrchestrationConfigPostRequest orchestrationConfigPostRequest = (OrchestrationConfigPostRequest) o; - return Objects.equals(this.cloudSdkCustomFields, orchestrationConfigPostRequest.cloudSdkCustomFields) - && Objects.equals(this.name, orchestrationConfigPostRequest.name) - && Objects.equals(this.version, orchestrationConfigPostRequest.version) - && Objects.equals(this.scenario, orchestrationConfigPostRequest.scenario) - && Objects.equals(this.spec, orchestrationConfigPostRequest.spec); - } - - @Override - public int hashCode() - { - return Objects.hash(name, version, scenario, spec, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class OrchestrationConfigPostRequest {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); - sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigPostResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigPostResponse.java deleted file mode 100644 index 55b98baba..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigPostResponse.java +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * OrchestrationConfigPostResponse - */ - -@Beta // CHECKSTYLE:OFF -public class OrchestrationConfigPostResponse -// CHECKSTYLE:ON -{ - @JsonProperty( "message" ) - private String message; - - @JsonProperty( "id" ) - private UUID id; - - @JsonProperty( "scenario" ) - private String scenario; - - @JsonProperty( "name" ) - private String name; - - @JsonProperty( "version" ) - private String version; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for OrchestrationConfigPostResponse. - */ - protected OrchestrationConfigPostResponse() - { - } - - /** - * Set the message of this {@link OrchestrationConfigPostResponse} instance and return the same instance. - * - * @param message - * The message of this {@link OrchestrationConfigPostResponse} - * @return The same instance of this {@link OrchestrationConfigPostResponse} class - */ - @Nonnull - public OrchestrationConfigPostResponse message( @Nonnull final String message ) - { - this.message = message; - return this; - } - - /** - * Get message - * - * @return message The message of this {@link OrchestrationConfigPostResponse} instance. - */ - @Nonnull - public String getMessage() - { - return message; - } - - /** - * Set the message of this {@link OrchestrationConfigPostResponse} instance. - * - * @param message - * The message of this {@link OrchestrationConfigPostResponse} - */ - public void setMessage( @Nonnull final String message ) - { - this.message = message; - } - - /** - * Set the id of this {@link OrchestrationConfigPostResponse} instance and return the same instance. - * - * @param id - * The id of this {@link OrchestrationConfigPostResponse} - * @return The same instance of this {@link OrchestrationConfigPostResponse} class - */ - @Nonnull - public OrchestrationConfigPostResponse id( @Nonnull final UUID id ) - { - this.id = id; - return this; - } - - /** - * Get id - * - * @return id The id of this {@link OrchestrationConfigPostResponse} instance. - */ - @Nonnull - public UUID getId() - { - return id; - } - - /** - * Set the id of this {@link OrchestrationConfigPostResponse} instance. - * - * @param id - * The id of this {@link OrchestrationConfigPostResponse} - */ - public void setId( @Nonnull final UUID id ) - { - this.id = id; - } - - /** - * Set the scenario of this {@link OrchestrationConfigPostResponse} instance and return the same instance. - * - * @param scenario - * The scenario of this {@link OrchestrationConfigPostResponse} - * @return The same instance of this {@link OrchestrationConfigPostResponse} class - */ - @Nonnull - public OrchestrationConfigPostResponse scenario( @Nonnull final String scenario ) - { - this.scenario = scenario; - return this; - } - - /** - * Get scenario - * - * @return scenario The scenario of this {@link OrchestrationConfigPostResponse} instance. - */ - @Nonnull - public String getScenario() - { - return scenario; - } - - /** - * Set the scenario of this {@link OrchestrationConfigPostResponse} instance. - * - * @param scenario - * The scenario of this {@link OrchestrationConfigPostResponse} - */ - public void setScenario( @Nonnull final String scenario ) - { - this.scenario = scenario; - } - - /** - * Set the name of this {@link OrchestrationConfigPostResponse} instance and return the same instance. - * - * @param name - * The name of this {@link OrchestrationConfigPostResponse} - * @return The same instance of this {@link OrchestrationConfigPostResponse} class - */ - @Nonnull - public OrchestrationConfigPostResponse name( @Nonnull final String name ) - { - this.name = name; - return this; - } - - /** - * Get name - * - * @return name The name of this {@link OrchestrationConfigPostResponse} instance. - */ - @Nonnull - public String getName() - { - return name; - } - - /** - * Set the name of this {@link OrchestrationConfigPostResponse} instance. - * - * @param name - * The name of this {@link OrchestrationConfigPostResponse} - */ - public void setName( @Nonnull final String name ) - { - this.name = name; - } - - /** - * Set the version of this {@link OrchestrationConfigPostResponse} instance and return the same instance. - * - * @param version - * The version of this {@link OrchestrationConfigPostResponse} - * @return The same instance of this {@link OrchestrationConfigPostResponse} class - */ - @Nonnull - public OrchestrationConfigPostResponse version( @Nonnull final String version ) - { - this.version = version; - return this; - } - - /** - * Get version - * - * @return version The version of this {@link OrchestrationConfigPostResponse} instance. - */ - @Nonnull - public String getVersion() - { - return version; - } - - /** - * Set the version of this {@link OrchestrationConfigPostResponse} instance. - * - * @param version - * The version of this {@link OrchestrationConfigPostResponse} - */ - public void setVersion( @Nonnull final String version ) - { - this.version = version; - } - - /** - * Get the names of the unrecognizable properties of the {@link OrchestrationConfigPostResponse}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link OrchestrationConfigPostResponse} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("OrchestrationConfigPostResponse has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link OrchestrationConfigPostResponse} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( message != null ) - declaredFields.put("message", message); - if( id != null ) - declaredFields.put("id", id); - if( scenario != null ) - declaredFields.put("scenario", scenario); - if( name != null ) - declaredFields.put("name", name); - if( version != null ) - declaredFields.put("version", version); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link OrchestrationConfigPostResponse} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final OrchestrationConfigPostResponse orchestrationConfigPostResponse = (OrchestrationConfigPostResponse) o; - return Objects.equals(this.cloudSdkCustomFields, orchestrationConfigPostResponse.cloudSdkCustomFields) - && Objects.equals(this.message, orchestrationConfigPostResponse.message) - && Objects.equals(this.id, orchestrationConfigPostResponse.id) - && Objects.equals(this.scenario, orchestrationConfigPostResponse.scenario) - && Objects.equals(this.name, orchestrationConfigPostResponse.name) - && Objects.equals(this.version, orchestrationConfigPostResponse.version); - } - - @Override - public int hashCode() - { - return Objects.hash(message, id, scenario, name, version, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class OrchestrationConfigPostResponse {\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigResource.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigResource.java deleted file mode 100644 index a5850409a..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrchestrationConfigResource.java +++ /dev/null @@ -1,555 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * OrchestrationConfigResource - */ - -@Beta // CHECKSTYLE:OFF -public class OrchestrationConfigResource -// CHECKSTYLE:ON -{ - @JsonProperty( "id" ) - private UUID id; - - @JsonProperty( "name" ) - private String name; - - @JsonProperty( "version" ) - private String version; - - @JsonProperty( "scenario" ) - private String scenario; - - @JsonProperty( "creation_timestamp" ) - private String creationTimestamp; - - @JsonProperty( "managed_by" ) - private String managedBy; - - @JsonProperty( "is_version_head" ) - private Boolean isVersionHead; - - @JsonProperty( "resource_group_id" ) - private String resourceGroupId; - - @JsonProperty( "spec" ) - private OrchestrationConfig spec; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for OrchestrationConfigResource. - */ - protected OrchestrationConfigResource() - { - } - - /** - * Set the id of this {@link OrchestrationConfigResource} instance and return the same instance. - * - * @param id - * The id of this {@link OrchestrationConfigResource} - * @return The same instance of this {@link OrchestrationConfigResource} class - */ - @Nonnull - public OrchestrationConfigResource id( @Nullable final UUID id ) - { - this.id = id; - return this; - } - - /** - * Get id - * - * @return id The id of this {@link OrchestrationConfigResource} instance. - */ - @Nonnull - public UUID getId() - { - return id; - } - - /** - * Set the id of this {@link OrchestrationConfigResource} instance. - * - * @param id - * The id of this {@link OrchestrationConfigResource} - */ - public void setId( @Nullable final UUID id ) - { - this.id = id; - } - - /** - * Set the name of this {@link OrchestrationConfigResource} instance and return the same instance. - * - * @param name - * The name of this {@link OrchestrationConfigResource} - * @return The same instance of this {@link OrchestrationConfigResource} class - */ - @Nonnull - public OrchestrationConfigResource name( @Nullable final String name ) - { - this.name = name; - return this; - } - - /** - * Get name - * - * @return name The name of this {@link OrchestrationConfigResource} instance. - */ - @Nonnull - public String getName() - { - return name; - } - - /** - * Set the name of this {@link OrchestrationConfigResource} instance. - * - * @param name - * The name of this {@link OrchestrationConfigResource} - */ - public void setName( @Nullable final String name ) - { - this.name = name; - } - - /** - * Set the version of this {@link OrchestrationConfigResource} instance and return the same instance. - * - * @param version - * The version of this {@link OrchestrationConfigResource} - * @return The same instance of this {@link OrchestrationConfigResource} class - */ - @Nonnull - public OrchestrationConfigResource version( @Nullable final String version ) - { - this.version = version; - return this; - } - - /** - * Get version - * - * @return version The version of this {@link OrchestrationConfigResource} instance. - */ - @Nonnull - public String getVersion() - { - return version; - } - - /** - * Set the version of this {@link OrchestrationConfigResource} instance. - * - * @param version - * The version of this {@link OrchestrationConfigResource} - */ - public void setVersion( @Nullable final String version ) - { - this.version = version; - } - - /** - * Set the scenario of this {@link OrchestrationConfigResource} instance and return the same instance. - * - * @param scenario - * The scenario of this {@link OrchestrationConfigResource} - * @return The same instance of this {@link OrchestrationConfigResource} class - */ - @Nonnull - public OrchestrationConfigResource scenario( @Nullable final String scenario ) - { - this.scenario = scenario; - return this; - } - - /** - * Get scenario - * - * @return scenario The scenario of this {@link OrchestrationConfigResource} instance. - */ - @Nonnull - public String getScenario() - { - return scenario; - } - - /** - * Set the scenario of this {@link OrchestrationConfigResource} instance. - * - * @param scenario - * The scenario of this {@link OrchestrationConfigResource} - */ - public void setScenario( @Nullable final String scenario ) - { - this.scenario = scenario; - } - - /** - * Set the creationTimestamp of this {@link OrchestrationConfigResource} instance and return the same instance. - * - * @param creationTimestamp - * The creationTimestamp of this {@link OrchestrationConfigResource} - * @return The same instance of this {@link OrchestrationConfigResource} class - */ - @Nonnull - public OrchestrationConfigResource creationTimestamp( @Nullable final String creationTimestamp ) - { - this.creationTimestamp = creationTimestamp; - return this; - } - - /** - * Get creationTimestamp - * - * @return creationTimestamp The creationTimestamp of this {@link OrchestrationConfigResource} instance. - */ - @Nonnull - public String getCreationTimestamp() - { - return creationTimestamp; - } - - /** - * Set the creationTimestamp of this {@link OrchestrationConfigResource} instance. - * - * @param creationTimestamp - * The creationTimestamp of this {@link OrchestrationConfigResource} - */ - public void setCreationTimestamp( @Nullable final String creationTimestamp ) - { - this.creationTimestamp = creationTimestamp; - } - - /** - * Set the managedBy of this {@link OrchestrationConfigResource} instance and return the same instance. - * - * @param managedBy - * The managedBy of this {@link OrchestrationConfigResource} - * @return The same instance of this {@link OrchestrationConfigResource} class - */ - @Nonnull - public OrchestrationConfigResource managedBy( @Nullable final String managedBy ) - { - this.managedBy = managedBy; - return this; - } - - /** - * Get managedBy - * - * @return managedBy The managedBy of this {@link OrchestrationConfigResource} instance. - */ - @Nonnull - public String getManagedBy() - { - return managedBy; - } - - /** - * Set the managedBy of this {@link OrchestrationConfigResource} instance. - * - * @param managedBy - * The managedBy of this {@link OrchestrationConfigResource} - */ - public void setManagedBy( @Nullable final String managedBy ) - { - this.managedBy = managedBy; - } - - /** - * Set the isVersionHead of this {@link OrchestrationConfigResource} instance and return the same instance. - * - * @param isVersionHead - * The isVersionHead of this {@link OrchestrationConfigResource} - * @return The same instance of this {@link OrchestrationConfigResource} class - */ - @Nonnull - public OrchestrationConfigResource isVersionHead( @Nullable final Boolean isVersionHead ) - { - this.isVersionHead = isVersionHead; - return this; - } - - /** - * Get isVersionHead - * - * @return isVersionHead The isVersionHead of this {@link OrchestrationConfigResource} instance. - */ - @Nonnull - public Boolean isIsVersionHead() - { - return isVersionHead; - } - - /** - * Set the isVersionHead of this {@link OrchestrationConfigResource} instance. - * - * @param isVersionHead - * The isVersionHead of this {@link OrchestrationConfigResource} - */ - public void setIsVersionHead( @Nullable final Boolean isVersionHead ) - { - this.isVersionHead = isVersionHead; - } - - /** - * Set the resourceGroupId of this {@link OrchestrationConfigResource} instance and return the same instance. - * - * @param resourceGroupId - * The resourceGroupId of this {@link OrchestrationConfigResource} - * @return The same instance of this {@link OrchestrationConfigResource} class - */ - @Nonnull - public OrchestrationConfigResource resourceGroupId( @Nullable final String resourceGroupId ) - { - this.resourceGroupId = resourceGroupId; - return this; - } - - /** - * Get resourceGroupId - * - * @return resourceGroupId The resourceGroupId of this {@link OrchestrationConfigResource} instance. - */ - @Nonnull - public String getResourceGroupId() - { - return resourceGroupId; - } - - /** - * Set the resourceGroupId of this {@link OrchestrationConfigResource} instance. - * - * @param resourceGroupId - * The resourceGroupId of this {@link OrchestrationConfigResource} - */ - public void setResourceGroupId( @Nullable final String resourceGroupId ) - { - this.resourceGroupId = resourceGroupId; - } - - /** - * Set the spec of this {@link OrchestrationConfigResource} instance and return the same instance. - * - * @param spec - * The spec of this {@link OrchestrationConfigResource} - * @return The same instance of this {@link OrchestrationConfigResource} class - */ - @Nonnull - public OrchestrationConfigResource spec( @Nullable final OrchestrationConfig spec ) - { - this.spec = spec; - return this; - } - - /** - * Get spec - * - * @return spec The spec of this {@link OrchestrationConfigResource} instance. - */ - @Nonnull - public OrchestrationConfig getSpec() - { - return spec; - } - - /** - * Set the spec of this {@link OrchestrationConfigResource} instance. - * - * @param spec - * The spec of this {@link OrchestrationConfigResource} - */ - public void setSpec( @Nullable final OrchestrationConfig spec ) - { - this.spec = spec; - } - - /** - * Get the names of the unrecognizable properties of the {@link OrchestrationConfigResource}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link OrchestrationConfigResource} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("OrchestrationConfigResource has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link OrchestrationConfigResource} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( id != null ) - declaredFields.put("id", id); - if( name != null ) - declaredFields.put("name", name); - if( version != null ) - declaredFields.put("version", version); - if( scenario != null ) - declaredFields.put("scenario", scenario); - if( creationTimestamp != null ) - declaredFields.put("creationTimestamp", creationTimestamp); - if( managedBy != null ) - declaredFields.put("managedBy", managedBy); - if( isVersionHead != null ) - declaredFields.put("isVersionHead", isVersionHead); - if( resourceGroupId != null ) - declaredFields.put("resourceGroupId", resourceGroupId); - if( spec != null ) - declaredFields.put("spec", spec); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link OrchestrationConfigResource} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final OrchestrationConfigResource orchestrationConfigResource = (OrchestrationConfigResource) o; - return Objects.equals(this.cloudSdkCustomFields, orchestrationConfigResource.cloudSdkCustomFields) - && Objects.equals(this.id, orchestrationConfigResource.id) - && Objects.equals(this.name, orchestrationConfigResource.name) - && Objects.equals(this.version, orchestrationConfigResource.version) - && Objects.equals(this.scenario, orchestrationConfigResource.scenario) - && Objects.equals(this.creationTimestamp, orchestrationConfigResource.creationTimestamp) - && Objects.equals(this.managedBy, orchestrationConfigResource.managedBy) - && Objects.equals(this.isVersionHead, orchestrationConfigResource.isVersionHead) - && Objects.equals(this.resourceGroupId, orchestrationConfigResource.resourceGroupId) - && Objects.equals(this.spec, orchestrationConfigResource.spec); - } - - @Override - public int hashCode() - { - return Objects - .hash( - id, - name, - version, - scenario, - creationTimestamp, - managedBy, - isVersionHead, - resourceGroupId, - spec, - cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class OrchestrationConfigResource {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); - sb.append(" creationTimestamp: ").append(toIndentedString(creationTimestamp)).append("\n"); - sb.append(" managedBy: ").append(toIndentedString(managedBy)).append("\n"); - sb.append(" isVersionHead: ").append(toIndentedString(isVersionHead)).append("\n"); - sb.append(" resourceGroupId: ").append(toIndentedString(resourceGroupId)).append("\n"); - sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Order.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Order.java new file mode 100644 index 000000000..dfae11431 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Order.java @@ -0,0 +1,370 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * SodaStore API + * API for managing soda products and orders in SodaStore. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * Order + */ + +@Beta // CHECKSTYLE:OFF +public class Order +// CHECKSTYLE:ON +{ + @JsonProperty( "productId" ) + private Long productId; + + @JsonProperty( "quantity" ) + private Integer quantity; + + @JsonProperty( "totalPrice" ) + private Float totalPrice; + + @JsonProperty( "typelessProperty" ) + private Object typelessProperty = null; + + @JsonProperty( "nullableProperty" ) + private String nullableProperty; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for Order. + */ + protected Order() + { + } + + /** + * Set the productId of this {@link Order} instance and return the same instance. + * + * @param productId + * The productId of this {@link Order} + * @return The same instance of this {@link Order} class + */ + @Nonnull + public Order productId( @Nonnull final Long productId ) + { + this.productId = productId; + return this; + } + + /** + * Get productId + * + * @return productId The productId of this {@link Order} instance. + */ + @Nonnull + public Long getProductId() + { + return productId; + } + + /** + * Set the productId of this {@link Order} instance. + * + * @param productId + * The productId of this {@link Order} + */ + public void setProductId( @Nonnull final Long productId ) + { + this.productId = productId; + } + + /** + * Set the quantity of this {@link Order} instance and return the same instance. + * + * @param quantity + * The quantity of this {@link Order} + * @return The same instance of this {@link Order} class + */ + @Nonnull + public Order quantity( @Nonnull final Integer quantity ) + { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * + * @return quantity The quantity of this {@link Order} instance. + */ + @Nonnull + public Integer getQuantity() + { + return quantity; + } + + /** + * Set the quantity of this {@link Order} instance. + * + * @param quantity + * The quantity of this {@link Order} + */ + public void setQuantity( @Nonnull final Integer quantity ) + { + this.quantity = quantity; + } + + /** + * Set the totalPrice of this {@link Order} instance and return the same instance. + * + * @param totalPrice + * The totalPrice of this {@link Order} + * @return The same instance of this {@link Order} class + */ + @Nonnull + public Order totalPrice( @Nullable final Float totalPrice ) + { + this.totalPrice = totalPrice; + return this; + } + + /** + * Get totalPrice + * + * @return totalPrice The totalPrice of this {@link Order} instance. + */ + @Nonnull + public Float getTotalPrice() + { + return totalPrice; + } + + /** + * Set the totalPrice of this {@link Order} instance. + * + * @param totalPrice + * The totalPrice of this {@link Order} + */ + public void setTotalPrice( @Nullable final Float totalPrice ) + { + this.totalPrice = totalPrice; + } + + /** + * Set the typelessProperty of this {@link Order} instance and return the same instance. + * + * @param typelessProperty + * Some typeless property, interpreted by the generator as nullable by default (because typeless) + * @return The same instance of this {@link Order} class + */ + @Nonnull + public Order typelessProperty( @Nullable final Object typelessProperty ) + { + this.typelessProperty = typelessProperty; + return this; + } + + /** + * Some typeless property, interpreted by the generator as nullable by default (because typeless) + * + * @return typelessProperty The typelessProperty of this {@link Order} instance. + */ + @Nullable + public Object getTypelessProperty() + { + return typelessProperty; + } + + /** + * Set the typelessProperty of this {@link Order} instance. + * + * @param typelessProperty + * Some typeless property, interpreted by the generator as nullable by default (because typeless) + */ + public void setTypelessProperty( @Nullable final Object typelessProperty ) + { + this.typelessProperty = typelessProperty; + } + + /** + * Set the nullableProperty of this {@link Order} instance and return the same instance. + * + * @param nullableProperty + * Some typed property that is deliberately made nullable + * @return The same instance of this {@link Order} class + */ + @Nonnull + public Order nullableProperty( @Nullable final String nullableProperty ) + { + this.nullableProperty = nullableProperty; + return this; + } + + /** + * Some typed property that is deliberately made nullable + * + * @return nullableProperty The nullableProperty of this {@link Order} instance. + */ + @Nullable + public String getNullableProperty() + { + return nullableProperty; + } + + /** + * Set the nullableProperty of this {@link Order} instance. + * + * @param nullableProperty + * Some typed property that is deliberately made nullable + */ + public void setNullableProperty( @Nullable final String nullableProperty ) + { + this.nullableProperty = nullableProperty; + } + + /** + * Get the names of the unrecognizable properties of the {@link Order}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Order} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("Order has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Order} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( productId != null ) + declaredFields.put("productId", productId); + if( quantity != null ) + declaredFields.put("quantity", quantity); + if( totalPrice != null ) + declaredFields.put("totalPrice", totalPrice); + if( typelessProperty != null ) + declaredFields.put("typelessProperty", typelessProperty); + if( nullableProperty != null ) + declaredFields.put("nullableProperty", nullableProperty); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Order} instance. If the map previously contained a mapping for the + * key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final Order order = (Order) o; + return Objects.equals(this.cloudSdkCustomFields, order.cloudSdkCustomFields) + && Objects.equals(this.productId, order.productId) + && Objects.equals(this.quantity, order.quantity) + && Objects.equals(this.totalPrice, order.totalPrice) + && Objects.equals(this.typelessProperty, order.typelessProperty) + && Objects.equals(this.nullableProperty, order.nullableProperty); + } + + @Override + public int hashCode() + { + return Objects.hash(productId, quantity, totalPrice, typelessProperty, nullableProperty, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + sb.append(" productId: ").append(toIndentedString(productId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" totalPrice: ").append(toIndentedString(totalPrice)).append("\n"); + sb.append(" typelessProperty: ").append(toIndentedString(typelessProperty)).append("\n"); + sb.append(" nullableProperty: ").append(toIndentedString(nullableProperty)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrderWithTimestamp.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrderWithTimestamp.java new file mode 100644 index 000000000..709b90bb9 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrderWithTimestamp.java @@ -0,0 +1,415 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * SodaStore API + * API for managing soda products and orders in SodaStore. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.time.OffsetDateTime; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.Beta; + +/** + * OrderWithTimestamp + */ + +@Beta // CHECKSTYLE:OFF +public class OrderWithTimestamp +// CHECKSTYLE:ON +{ + @JsonProperty( "productId" ) + private Long productId; + + @JsonProperty( "quantity" ) + private Integer quantity; + + @JsonProperty( "totalPrice" ) + private Float totalPrice; + + @JsonProperty( "typelessProperty" ) + private Object typelessProperty; + + @JsonProperty( "nullableProperty" ) + private String nullableProperty; + + @JsonProperty( "timestamp" ) + private OffsetDateTime timestamp; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for OrderWithTimestamp. + */ + protected OrderWithTimestamp() + { + } + + /** + * Set the productId of this {@link OrderWithTimestamp} instance and return the same instance. + * + * @param productId + * The productId of this {@link OrderWithTimestamp} + * @return The same instance of this {@link OrderWithTimestamp} class + */ + @Nonnull + public OrderWithTimestamp productId( @Nonnull final Long productId ) + { + this.productId = productId; + return this; + } + + /** + * Get productId + * + * @return productId The productId of this {@link OrderWithTimestamp} instance. + */ + @Nonnull + public Long getProductId() + { + return productId; + } + + /** + * Set the productId of this {@link OrderWithTimestamp} instance. + * + * @param productId + * The productId of this {@link OrderWithTimestamp} + */ + public void setProductId( @Nonnull final Long productId ) + { + this.productId = productId; + } + + /** + * Set the quantity of this {@link OrderWithTimestamp} instance and return the same instance. + * + * @param quantity + * The quantity of this {@link OrderWithTimestamp} + * @return The same instance of this {@link OrderWithTimestamp} class + */ + @Nonnull + public OrderWithTimestamp quantity( @Nonnull final Integer quantity ) + { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * + * @return quantity The quantity of this {@link OrderWithTimestamp} instance. + */ + @Nonnull + public Integer getQuantity() + { + return quantity; + } + + /** + * Set the quantity of this {@link OrderWithTimestamp} instance. + * + * @param quantity + * The quantity of this {@link OrderWithTimestamp} + */ + public void setQuantity( @Nonnull final Integer quantity ) + { + this.quantity = quantity; + } + + /** + * Set the totalPrice of this {@link OrderWithTimestamp} instance and return the same instance. + * + * @param totalPrice + * The totalPrice of this {@link OrderWithTimestamp} + * @return The same instance of this {@link OrderWithTimestamp} class + */ + @Nonnull + public OrderWithTimestamp totalPrice( @Nullable final Float totalPrice ) + { + this.totalPrice = totalPrice; + return this; + } + + /** + * Get totalPrice + * + * @return totalPrice The totalPrice of this {@link OrderWithTimestamp} instance. + */ + @Nonnull + public Float getTotalPrice() + { + return totalPrice; + } + + /** + * Set the totalPrice of this {@link OrderWithTimestamp} instance. + * + * @param totalPrice + * The totalPrice of this {@link OrderWithTimestamp} + */ + public void setTotalPrice( @Nullable final Float totalPrice ) + { + this.totalPrice = totalPrice; + } + + /** + * Set the typelessProperty of this {@link OrderWithTimestamp} instance and return the same instance. + * + * @param typelessProperty + * Some typeless property, interpreted by the generator as nullable by default (because typeless) + * @return The same instance of this {@link OrderWithTimestamp} class + */ + @Nonnull + public OrderWithTimestamp typelessProperty( @Nullable final Object typelessProperty ) + { + this.typelessProperty = typelessProperty; + return this; + } + + /** + * Some typeless property, interpreted by the generator as nullable by default (because typeless) + * + * @return typelessProperty The typelessProperty of this {@link OrderWithTimestamp} instance. + */ + @Nullable + public Object getTypelessProperty() + { + return typelessProperty; + } + + /** + * Set the typelessProperty of this {@link OrderWithTimestamp} instance. + * + * @param typelessProperty + * Some typeless property, interpreted by the generator as nullable by default (because typeless) + */ + public void setTypelessProperty( @Nullable final Object typelessProperty ) + { + this.typelessProperty = typelessProperty; + } + + /** + * Set the nullableProperty of this {@link OrderWithTimestamp} instance and return the same instance. + * + * @param nullableProperty + * Some typed property that is deliberately made nullable + * @return The same instance of this {@link OrderWithTimestamp} class + */ + @Nonnull + public OrderWithTimestamp nullableProperty( @Nullable final String nullableProperty ) + { + this.nullableProperty = nullableProperty; + return this; + } + + /** + * Some typed property that is deliberately made nullable + * + * @return nullableProperty The nullableProperty of this {@link OrderWithTimestamp} instance. + */ + @Nullable + public String getNullableProperty() + { + return nullableProperty; + } + + /** + * Set the nullableProperty of this {@link OrderWithTimestamp} instance. + * + * @param nullableProperty + * Some typed property that is deliberately made nullable + */ + public void setNullableProperty( @Nullable final String nullableProperty ) + { + this.nullableProperty = nullableProperty; + } + + /** + * Set the timestamp of this {@link OrderWithTimestamp} instance and return the same instance. + * + * @param timestamp + * The timestamp of this {@link OrderWithTimestamp} + * @return The same instance of this {@link OrderWithTimestamp} class + */ + @Nonnull + public OrderWithTimestamp timestamp( @Nullable final OffsetDateTime timestamp ) + { + this.timestamp = timestamp; + return this; + } + + /** + * Get timestamp + * + * @return timestamp The timestamp of this {@link OrderWithTimestamp} instance. + */ + @Nonnull + public OffsetDateTime getTimestamp() + { + return timestamp; + } + + /** + * Set the timestamp of this {@link OrderWithTimestamp} instance. + * + * @param timestamp + * The timestamp of this {@link OrderWithTimestamp} + */ + public void setTimestamp( @Nullable final OffsetDateTime timestamp ) + { + this.timestamp = timestamp; + } + + /** + * Get the names of the unrecognizable properties of the {@link OrderWithTimestamp}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link OrderWithTimestamp} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("OrderWithTimestamp has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link OrderWithTimestamp} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( productId != null ) + declaredFields.put("productId", productId); + if( quantity != null ) + declaredFields.put("quantity", quantity); + if( totalPrice != null ) + declaredFields.put("totalPrice", totalPrice); + if( typelessProperty != null ) + declaredFields.put("typelessProperty", typelessProperty); + if( nullableProperty != null ) + declaredFields.put("nullableProperty", nullableProperty); + if( timestamp != null ) + declaredFields.put("timestamp", timestamp); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link OrderWithTimestamp} instance. If the map previously contained a + * mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final OrderWithTimestamp orderWithTimestamp = (OrderWithTimestamp) o; + return Objects.equals(this.cloudSdkCustomFields, orderWithTimestamp.cloudSdkCustomFields) + && Objects.equals(this.productId, orderWithTimestamp.productId) + && Objects.equals(this.quantity, orderWithTimestamp.quantity) + && Objects.equals(this.totalPrice, orderWithTimestamp.totalPrice) + && Objects.equals(this.typelessProperty, orderWithTimestamp.typelessProperty) + && Objects.equals(this.nullableProperty, orderWithTimestamp.nullableProperty) + && Objects.equals(this.timestamp, orderWithTimestamp.timestamp); + } + + @Override + public int hashCode() + { + return Objects + .hash(productId, quantity, totalPrice, typelessProperty, nullableProperty, timestamp, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class OrderWithTimestamp {\n"); + sb.append(" productId: ").append(toIndentedString(productId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" totalPrice: ").append(toIndentedString(totalPrice)).append("\n"); + sb.append(" typelessProperty: ").append(toIndentedString(typelessProperty)).append("\n"); + sb.append(" nullableProperty: ").append(toIndentedString(nullableProperty)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OutputFilterConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OutputFilterConfig.java deleted file mode 100644 index ee970066b..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OutputFilterConfig.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.google.common.annotations.Beta; - -/** - * OutputFilterConfig - */ -@Beta -@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) -@JsonSubTypes( { - @JsonSubTypes.Type( value = AzureContentSafetyOutputFilterConfig.class ), - @JsonSubTypes.Type( value = LlamaGuard38bFilterConfig.class ), } ) - -public interface OutputFilterConfig -{ -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OutputFilteringConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OutputFilteringConfig.java deleted file mode 100644 index e36747309..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OutputFilteringConfig.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * OutputFilteringConfig - */ - -@Beta // CHECKSTYLE:OFF -public class OutputFilteringConfig -// CHECKSTYLE:ON -{ - @JsonProperty( "filters" ) - private List filters = new ArrayList<>(); - - @JsonProperty( "stream_options" ) - private FilteringStreamOptions streamOptions; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for OutputFilteringConfig. - */ - protected OutputFilteringConfig() - { - } - - /** - * Set the filters of this {@link OutputFilteringConfig} instance and return the same instance. - * - * @param filters - * Configuration for content filtering services that should be used for the given filtering step (output - * filtering). - * @return The same instance of this {@link OutputFilteringConfig} class - */ - @Nonnull - public OutputFilteringConfig filters( @Nonnull final List filters ) - { - this.filters = filters; - return this; - } - - /** - * Add one filters instance to this {@link OutputFilteringConfig}. - * - * @param filtersItem - * The filters that should be added - * @return The same instance of type {@link OutputFilteringConfig} - */ - @Nonnull - public OutputFilteringConfig addFiltersItem( @Nonnull final OutputFilterConfig filtersItem ) - { - if( this.filters == null ) { - this.filters = new ArrayList<>(); - } - this.filters.add(filtersItem); - return this; - } - - /** - * Configuration for content filtering services that should be used for the given filtering step (output filtering). - * - * @return filters The filters of this {@link OutputFilteringConfig} instance. - */ - @Nonnull - public List getFilters() - { - return filters; - } - - /** - * Set the filters of this {@link OutputFilteringConfig} instance. - * - * @param filters - * Configuration for content filtering services that should be used for the given filtering step (output - * filtering). - */ - public void setFilters( @Nonnull final List filters ) - { - this.filters = filters; - } - - /** - * Set the streamOptions of this {@link OutputFilteringConfig} instance and return the same instance. - * - * @param streamOptions - * The streamOptions of this {@link OutputFilteringConfig} - * @return The same instance of this {@link OutputFilteringConfig} class - */ - @Nonnull - public OutputFilteringConfig streamOptions( @Nullable final FilteringStreamOptions streamOptions ) - { - this.streamOptions = streamOptions; - return this; - } - - /** - * Get streamOptions - * - * @return streamOptions The streamOptions of this {@link OutputFilteringConfig} instance. - */ - @Nonnull - public FilteringStreamOptions getStreamOptions() - { - return streamOptions; - } - - /** - * Set the streamOptions of this {@link OutputFilteringConfig} instance. - * - * @param streamOptions - * The streamOptions of this {@link OutputFilteringConfig} - */ - public void setStreamOptions( @Nullable final FilteringStreamOptions streamOptions ) - { - this.streamOptions = streamOptions; - } - - /** - * Get the names of the unrecognizable properties of the {@link OutputFilteringConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link OutputFilteringConfig} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("OutputFilteringConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link OutputFilteringConfig} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( filters != null ) - declaredFields.put("filters", filters); - if( streamOptions != null ) - declaredFields.put("streamOptions", streamOptions); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link OutputFilteringConfig} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final OutputFilteringConfig outputFilteringConfig = (OutputFilteringConfig) o; - return Objects.equals(this.cloudSdkCustomFields, outputFilteringConfig.cloudSdkCustomFields) - && Objects.equals(this.filters, outputFilteringConfig.filters) - && Objects.equals(this.streamOptions, outputFilteringConfig.streamOptions); - } - - @Override - public int hashCode() - { - return Objects.hash(filters, streamOptions, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class OutputFilteringConfig {\n"); - sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); - sb.append(" streamOptions: ").append(toIndentedString(streamOptions)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplate.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplate.java deleted file mode 100644 index 3f75bd4e6..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplate.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.google.common.annotations.Beta; - -/** - * PromptTemplate - */ -@Beta -@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) -@JsonSubTypes( { - @JsonSubTypes.Type( value = MultiChatTemplate.class ), - @JsonSubTypes.Type( value = SingleChatTemplate.class ), } ) - -public interface PromptTemplate -{ -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateDeleteResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateDeleteResponse.java deleted file mode 100644 index 8eab815bf..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateDeleteResponse.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * PromptTemplateDeleteResponse - */ - -@Beta // CHECKSTYLE:OFF -public class PromptTemplateDeleteResponse -// CHECKSTYLE:ON -{ - @JsonProperty( "message" ) - private String message; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for PromptTemplateDeleteResponse. - */ - protected PromptTemplateDeleteResponse() - { - } - - /** - * Set the message of this {@link PromptTemplateDeleteResponse} instance and return the same instance. - * - * @param message - * The message of this {@link PromptTemplateDeleteResponse} - * @return The same instance of this {@link PromptTemplateDeleteResponse} class - */ - @Nonnull - public PromptTemplateDeleteResponse message( @Nonnull final String message ) - { - this.message = message; - return this; - } - - /** - * Get message - * - * @return message The message of this {@link PromptTemplateDeleteResponse} instance. - */ - @Nonnull - public String getMessage() - { - return message; - } - - /** - * Set the message of this {@link PromptTemplateDeleteResponse} instance. - * - * @param message - * The message of this {@link PromptTemplateDeleteResponse} - */ - public void setMessage( @Nonnull final String message ) - { - this.message = message; - } - - /** - * Get the names of the unrecognizable properties of the {@link PromptTemplateDeleteResponse}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link PromptTemplateDeleteResponse} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("PromptTemplateDeleteResponse has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link PromptTemplateDeleteResponse} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( message != null ) - declaredFields.put("message", message); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link PromptTemplateDeleteResponse} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final PromptTemplateDeleteResponse promptTemplateDeleteResponse = (PromptTemplateDeleteResponse) o; - return Objects.equals(this.cloudSdkCustomFields, promptTemplateDeleteResponse.cloudSdkCustomFields) - && Objects.equals(this.message, promptTemplateDeleteResponse.message); - } - - @Override - public int hashCode() - { - return Objects.hash(message, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class PromptTemplateDeleteResponse {\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateGetResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateGetResponse.java deleted file mode 100644 index 62eb8761d..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateGetResponse.java +++ /dev/null @@ -1,555 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * PromptTemplateGetResponse - */ - -@Beta // CHECKSTYLE:OFF -public class PromptTemplateGetResponse -// CHECKSTYLE:ON -{ - @JsonProperty( "id" ) - private UUID id; - - @JsonProperty( "name" ) - private String name; - - @JsonProperty( "version" ) - private String version; - - @JsonProperty( "scenario" ) - private String scenario; - - @JsonProperty( "creationTimestamp" ) - private String creationTimestamp; - - @JsonProperty( "managedBy" ) - private String managedBy; - - @JsonProperty( "isVersionHead" ) - private Boolean isVersionHead; - - @JsonProperty( "resourceGroupId" ) - private String resourceGroupId; - - @JsonProperty( "spec" ) - private PromptTemplateSpec spec; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for PromptTemplateGetResponse. - */ - protected PromptTemplateGetResponse() - { - } - - /** - * Set the id of this {@link PromptTemplateGetResponse} instance and return the same instance. - * - * @param id - * The id of this {@link PromptTemplateGetResponse} - * @return The same instance of this {@link PromptTemplateGetResponse} class - */ - @Nonnull - public PromptTemplateGetResponse id( @Nullable final UUID id ) - { - this.id = id; - return this; - } - - /** - * Get id - * - * @return id The id of this {@link PromptTemplateGetResponse} instance. - */ - @Nonnull - public UUID getId() - { - return id; - } - - /** - * Set the id of this {@link PromptTemplateGetResponse} instance. - * - * @param id - * The id of this {@link PromptTemplateGetResponse} - */ - public void setId( @Nullable final UUID id ) - { - this.id = id; - } - - /** - * Set the name of this {@link PromptTemplateGetResponse} instance and return the same instance. - * - * @param name - * The name of this {@link PromptTemplateGetResponse} - * @return The same instance of this {@link PromptTemplateGetResponse} class - */ - @Nonnull - public PromptTemplateGetResponse name( @Nullable final String name ) - { - this.name = name; - return this; - } - - /** - * Get name - * - * @return name The name of this {@link PromptTemplateGetResponse} instance. - */ - @Nonnull - public String getName() - { - return name; - } - - /** - * Set the name of this {@link PromptTemplateGetResponse} instance. - * - * @param name - * The name of this {@link PromptTemplateGetResponse} - */ - public void setName( @Nullable final String name ) - { - this.name = name; - } - - /** - * Set the version of this {@link PromptTemplateGetResponse} instance and return the same instance. - * - * @param version - * The version of this {@link PromptTemplateGetResponse} - * @return The same instance of this {@link PromptTemplateGetResponse} class - */ - @Nonnull - public PromptTemplateGetResponse version( @Nullable final String version ) - { - this.version = version; - return this; - } - - /** - * Get version - * - * @return version The version of this {@link PromptTemplateGetResponse} instance. - */ - @Nonnull - public String getVersion() - { - return version; - } - - /** - * Set the version of this {@link PromptTemplateGetResponse} instance. - * - * @param version - * The version of this {@link PromptTemplateGetResponse} - */ - public void setVersion( @Nullable final String version ) - { - this.version = version; - } - - /** - * Set the scenario of this {@link PromptTemplateGetResponse} instance and return the same instance. - * - * @param scenario - * The scenario of this {@link PromptTemplateGetResponse} - * @return The same instance of this {@link PromptTemplateGetResponse} class - */ - @Nonnull - public PromptTemplateGetResponse scenario( @Nullable final String scenario ) - { - this.scenario = scenario; - return this; - } - - /** - * Get scenario - * - * @return scenario The scenario of this {@link PromptTemplateGetResponse} instance. - */ - @Nonnull - public String getScenario() - { - return scenario; - } - - /** - * Set the scenario of this {@link PromptTemplateGetResponse} instance. - * - * @param scenario - * The scenario of this {@link PromptTemplateGetResponse} - */ - public void setScenario( @Nullable final String scenario ) - { - this.scenario = scenario; - } - - /** - * Set the creationTimestamp of this {@link PromptTemplateGetResponse} instance and return the same instance. - * - * @param creationTimestamp - * The creationTimestamp of this {@link PromptTemplateGetResponse} - * @return The same instance of this {@link PromptTemplateGetResponse} class - */ - @Nonnull - public PromptTemplateGetResponse creationTimestamp( @Nullable final String creationTimestamp ) - { - this.creationTimestamp = creationTimestamp; - return this; - } - - /** - * Get creationTimestamp - * - * @return creationTimestamp The creationTimestamp of this {@link PromptTemplateGetResponse} instance. - */ - @Nonnull - public String getCreationTimestamp() - { - return creationTimestamp; - } - - /** - * Set the creationTimestamp of this {@link PromptTemplateGetResponse} instance. - * - * @param creationTimestamp - * The creationTimestamp of this {@link PromptTemplateGetResponse} - */ - public void setCreationTimestamp( @Nullable final String creationTimestamp ) - { - this.creationTimestamp = creationTimestamp; - } - - /** - * Set the managedBy of this {@link PromptTemplateGetResponse} instance and return the same instance. - * - * @param managedBy - * The managedBy of this {@link PromptTemplateGetResponse} - * @return The same instance of this {@link PromptTemplateGetResponse} class - */ - @Nonnull - public PromptTemplateGetResponse managedBy( @Nullable final String managedBy ) - { - this.managedBy = managedBy; - return this; - } - - /** - * Get managedBy - * - * @return managedBy The managedBy of this {@link PromptTemplateGetResponse} instance. - */ - @Nonnull - public String getManagedBy() - { - return managedBy; - } - - /** - * Set the managedBy of this {@link PromptTemplateGetResponse} instance. - * - * @param managedBy - * The managedBy of this {@link PromptTemplateGetResponse} - */ - public void setManagedBy( @Nullable final String managedBy ) - { - this.managedBy = managedBy; - } - - /** - * Set the isVersionHead of this {@link PromptTemplateGetResponse} instance and return the same instance. - * - * @param isVersionHead - * The isVersionHead of this {@link PromptTemplateGetResponse} - * @return The same instance of this {@link PromptTemplateGetResponse} class - */ - @Nonnull - public PromptTemplateGetResponse isVersionHead( @Nullable final Boolean isVersionHead ) - { - this.isVersionHead = isVersionHead; - return this; - } - - /** - * Get isVersionHead - * - * @return isVersionHead The isVersionHead of this {@link PromptTemplateGetResponse} instance. - */ - @Nonnull - public Boolean isIsVersionHead() - { - return isVersionHead; - } - - /** - * Set the isVersionHead of this {@link PromptTemplateGetResponse} instance. - * - * @param isVersionHead - * The isVersionHead of this {@link PromptTemplateGetResponse} - */ - public void setIsVersionHead( @Nullable final Boolean isVersionHead ) - { - this.isVersionHead = isVersionHead; - } - - /** - * Set the resourceGroupId of this {@link PromptTemplateGetResponse} instance and return the same instance. - * - * @param resourceGroupId - * The resourceGroupId of this {@link PromptTemplateGetResponse} - * @return The same instance of this {@link PromptTemplateGetResponse} class - */ - @Nonnull - public PromptTemplateGetResponse resourceGroupId( @Nullable final String resourceGroupId ) - { - this.resourceGroupId = resourceGroupId; - return this; - } - - /** - * Get resourceGroupId - * - * @return resourceGroupId The resourceGroupId of this {@link PromptTemplateGetResponse} instance. - */ - @Nonnull - public String getResourceGroupId() - { - return resourceGroupId; - } - - /** - * Set the resourceGroupId of this {@link PromptTemplateGetResponse} instance. - * - * @param resourceGroupId - * The resourceGroupId of this {@link PromptTemplateGetResponse} - */ - public void setResourceGroupId( @Nullable final String resourceGroupId ) - { - this.resourceGroupId = resourceGroupId; - } - - /** - * Set the spec of this {@link PromptTemplateGetResponse} instance and return the same instance. - * - * @param spec - * The spec of this {@link PromptTemplateGetResponse} - * @return The same instance of this {@link PromptTemplateGetResponse} class - */ - @Nonnull - public PromptTemplateGetResponse spec( @Nullable final PromptTemplateSpec spec ) - { - this.spec = spec; - return this; - } - - /** - * Get spec - * - * @return spec The spec of this {@link PromptTemplateGetResponse} instance. - */ - @Nonnull - public PromptTemplateSpec getSpec() - { - return spec; - } - - /** - * Set the spec of this {@link PromptTemplateGetResponse} instance. - * - * @param spec - * The spec of this {@link PromptTemplateGetResponse} - */ - public void setSpec( @Nullable final PromptTemplateSpec spec ) - { - this.spec = spec; - } - - /** - * Get the names of the unrecognizable properties of the {@link PromptTemplateGetResponse}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link PromptTemplateGetResponse} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("PromptTemplateGetResponse has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link PromptTemplateGetResponse} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( id != null ) - declaredFields.put("id", id); - if( name != null ) - declaredFields.put("name", name); - if( version != null ) - declaredFields.put("version", version); - if( scenario != null ) - declaredFields.put("scenario", scenario); - if( creationTimestamp != null ) - declaredFields.put("creationTimestamp", creationTimestamp); - if( managedBy != null ) - declaredFields.put("managedBy", managedBy); - if( isVersionHead != null ) - declaredFields.put("isVersionHead", isVersionHead); - if( resourceGroupId != null ) - declaredFields.put("resourceGroupId", resourceGroupId); - if( spec != null ) - declaredFields.put("spec", spec); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link PromptTemplateGetResponse} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final PromptTemplateGetResponse promptTemplateGetResponse = (PromptTemplateGetResponse) o; - return Objects.equals(this.cloudSdkCustomFields, promptTemplateGetResponse.cloudSdkCustomFields) - && Objects.equals(this.id, promptTemplateGetResponse.id) - && Objects.equals(this.name, promptTemplateGetResponse.name) - && Objects.equals(this.version, promptTemplateGetResponse.version) - && Objects.equals(this.scenario, promptTemplateGetResponse.scenario) - && Objects.equals(this.creationTimestamp, promptTemplateGetResponse.creationTimestamp) - && Objects.equals(this.managedBy, promptTemplateGetResponse.managedBy) - && Objects.equals(this.isVersionHead, promptTemplateGetResponse.isVersionHead) - && Objects.equals(this.resourceGroupId, promptTemplateGetResponse.resourceGroupId) - && Objects.equals(this.spec, promptTemplateGetResponse.spec); - } - - @Override - public int hashCode() - { - return Objects - .hash( - id, - name, - version, - scenario, - creationTimestamp, - managedBy, - isVersionHead, - resourceGroupId, - spec, - cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class PromptTemplateGetResponse {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); - sb.append(" creationTimestamp: ").append(toIndentedString(creationTimestamp)).append("\n"); - sb.append(" managedBy: ").append(toIndentedString(managedBy)).append("\n"); - sb.append(" isVersionHead: ").append(toIndentedString(isVersionHead)).append("\n"); - sb.append(" resourceGroupId: ").append(toIndentedString(resourceGroupId)).append("\n"); - sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateListResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateListResponse.java deleted file mode 100644 index 52fb91df9..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateListResponse.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * PromptTemplateListResponse - */ - -@Beta // CHECKSTYLE:OFF -public class PromptTemplateListResponse -// CHECKSTYLE:ON -{ - @JsonProperty( "count" ) - private Integer count; - - @JsonProperty( "resources" ) - private List resources = new ArrayList<>(); - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for PromptTemplateListResponse. - */ - protected PromptTemplateListResponse() - { - } - - /** - * Set the count of this {@link PromptTemplateListResponse} instance and return the same instance. - * - * @param count - * The count of this {@link PromptTemplateListResponse} - * @return The same instance of this {@link PromptTemplateListResponse} class - */ - @Nonnull - public PromptTemplateListResponse count( @Nonnull final Integer count ) - { - this.count = count; - return this; - } - - /** - * Get count - * - * @return count The count of this {@link PromptTemplateListResponse} instance. - */ - @Nonnull - public Integer getCount() - { - return count; - } - - /** - * Set the count of this {@link PromptTemplateListResponse} instance. - * - * @param count - * The count of this {@link PromptTemplateListResponse} - */ - public void setCount( @Nonnull final Integer count ) - { - this.count = count; - } - - /** - * Set the resources of this {@link PromptTemplateListResponse} instance and return the same instance. - * - * @param resources - * The resources of this {@link PromptTemplateListResponse} - * @return The same instance of this {@link PromptTemplateListResponse} class - */ - @Nonnull - public PromptTemplateListResponse resources( @Nonnull final List resources ) - { - this.resources = resources; - return this; - } - - /** - * Add one resources instance to this {@link PromptTemplateListResponse}. - * - * @param resourcesItem - * The resources that should be added - * @return The same instance of type {@link PromptTemplateListResponse} - */ - @Nonnull - public PromptTemplateListResponse addResourcesItem( @Nonnull final PromptTemplateGetResponse resourcesItem ) - { - if( this.resources == null ) { - this.resources = new ArrayList<>(); - } - this.resources.add(resourcesItem); - return this; - } - - /** - * Get resources - * - * @return resources The resources of this {@link PromptTemplateListResponse} instance. - */ - @Nonnull - public List getResources() - { - return resources; - } - - /** - * Set the resources of this {@link PromptTemplateListResponse} instance. - * - * @param resources - * The resources of this {@link PromptTemplateListResponse} - */ - public void setResources( @Nonnull final List resources ) - { - this.resources = resources; - } - - /** - * Get the names of the unrecognizable properties of the {@link PromptTemplateListResponse}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link PromptTemplateListResponse} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("PromptTemplateListResponse has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link PromptTemplateListResponse} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( count != null ) - declaredFields.put("count", count); - if( resources != null ) - declaredFields.put("resources", resources); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link PromptTemplateListResponse} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final PromptTemplateListResponse promptTemplateListResponse = (PromptTemplateListResponse) o; - return Objects.equals(this.cloudSdkCustomFields, promptTemplateListResponse.cloudSdkCustomFields) - && Objects.equals(this.count, promptTemplateListResponse.count) - && Objects.equals(this.resources, promptTemplateListResponse.resources); - } - - @Override - public int hashCode() - { - return Objects.hash(count, resources, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class PromptTemplateListResponse {\n"); - sb.append(" count: ").append(toIndentedString(count)).append("\n"); - sb.append(" resources: ").append(toIndentedString(resources)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatePostRequest.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatePostRequest.java deleted file mode 100644 index dde36cd5d..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatePostRequest.java +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * PromptTemplatePostRequest - */ - -@Beta // CHECKSTYLE:OFF -public class PromptTemplatePostRequest -// CHECKSTYLE:ON -{ - @JsonProperty( "name" ) - private String name; - - @JsonProperty( "version" ) - private String version; - - @JsonProperty( "scenario" ) - private String scenario; - - @JsonProperty( "spec" ) - private PromptTemplateSpec spec; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for PromptTemplatePostRequest. - */ - protected PromptTemplatePostRequest() - { - } - - /** - * Set the name of this {@link PromptTemplatePostRequest} instance and return the same instance. - * - * @param name - * The name of this {@link PromptTemplatePostRequest} - * @return The same instance of this {@link PromptTemplatePostRequest} class - */ - @Nonnull - public PromptTemplatePostRequest name( @Nonnull final String name ) - { - this.name = name; - return this; - } - - /** - * Get name - * - * @return name The name of this {@link PromptTemplatePostRequest} instance. - */ - @Nonnull - public String getName() - { - return name; - } - - /** - * Set the name of this {@link PromptTemplatePostRequest} instance. - * - * @param name - * The name of this {@link PromptTemplatePostRequest} - */ - public void setName( @Nonnull final String name ) - { - this.name = name; - } - - /** - * Set the version of this {@link PromptTemplatePostRequest} instance and return the same instance. - * - * @param version - * The version of this {@link PromptTemplatePostRequest} - * @return The same instance of this {@link PromptTemplatePostRequest} class - */ - @Nonnull - public PromptTemplatePostRequest version( @Nonnull final String version ) - { - this.version = version; - return this; - } - - /** - * Get version - * - * @return version The version of this {@link PromptTemplatePostRequest} instance. - */ - @Nonnull - public String getVersion() - { - return version; - } - - /** - * Set the version of this {@link PromptTemplatePostRequest} instance. - * - * @param version - * The version of this {@link PromptTemplatePostRequest} - */ - public void setVersion( @Nonnull final String version ) - { - this.version = version; - } - - /** - * Set the scenario of this {@link PromptTemplatePostRequest} instance and return the same instance. - * - * @param scenario - * The scenario of this {@link PromptTemplatePostRequest} - * @return The same instance of this {@link PromptTemplatePostRequest} class - */ - @Nonnull - public PromptTemplatePostRequest scenario( @Nonnull final String scenario ) - { - this.scenario = scenario; - return this; - } - - /** - * Get scenario - * - * @return scenario The scenario of this {@link PromptTemplatePostRequest} instance. - */ - @Nonnull - public String getScenario() - { - return scenario; - } - - /** - * Set the scenario of this {@link PromptTemplatePostRequest} instance. - * - * @param scenario - * The scenario of this {@link PromptTemplatePostRequest} - */ - public void setScenario( @Nonnull final String scenario ) - { - this.scenario = scenario; - } - - /** - * Set the spec of this {@link PromptTemplatePostRequest} instance and return the same instance. - * - * @param spec - * The spec of this {@link PromptTemplatePostRequest} - * @return The same instance of this {@link PromptTemplatePostRequest} class - */ - @Nonnull - public PromptTemplatePostRequest spec( @Nonnull final PromptTemplateSpec spec ) - { - this.spec = spec; - return this; - } - - /** - * Get spec - * - * @return spec The spec of this {@link PromptTemplatePostRequest} instance. - */ - @Nonnull - public PromptTemplateSpec getSpec() - { - return spec; - } - - /** - * Set the spec of this {@link PromptTemplatePostRequest} instance. - * - * @param spec - * The spec of this {@link PromptTemplatePostRequest} - */ - public void setSpec( @Nonnull final PromptTemplateSpec spec ) - { - this.spec = spec; - } - - /** - * Get the names of the unrecognizable properties of the {@link PromptTemplatePostRequest}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link PromptTemplatePostRequest} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("PromptTemplatePostRequest has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link PromptTemplatePostRequest} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( name != null ) - declaredFields.put("name", name); - if( version != null ) - declaredFields.put("version", version); - if( scenario != null ) - declaredFields.put("scenario", scenario); - if( spec != null ) - declaredFields.put("spec", spec); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link PromptTemplatePostRequest} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final PromptTemplatePostRequest promptTemplatePostRequest = (PromptTemplatePostRequest) o; - return Objects.equals(this.cloudSdkCustomFields, promptTemplatePostRequest.cloudSdkCustomFields) - && Objects.equals(this.name, promptTemplatePostRequest.name) - && Objects.equals(this.version, promptTemplatePostRequest.version) - && Objects.equals(this.scenario, promptTemplatePostRequest.scenario) - && Objects.equals(this.spec, promptTemplatePostRequest.spec); - } - - @Override - public int hashCode() - { - return Objects.hash(name, version, scenario, spec, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class PromptTemplatePostRequest {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); - sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatePostResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatePostResponse.java deleted file mode 100644 index 11507bb3f..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatePostResponse.java +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * PromptTemplatePostResponse - */ - -@Beta // CHECKSTYLE:OFF -public class PromptTemplatePostResponse -// CHECKSTYLE:ON -{ - @JsonProperty( "message" ) - private String message; - - @JsonProperty( "id" ) - private UUID id; - - @JsonProperty( "scenario" ) - private String scenario; - - @JsonProperty( "name" ) - private String name; - - @JsonProperty( "version" ) - private String version; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for PromptTemplatePostResponse. - */ - protected PromptTemplatePostResponse() - { - } - - /** - * Set the message of this {@link PromptTemplatePostResponse} instance and return the same instance. - * - * @param message - * The message of this {@link PromptTemplatePostResponse} - * @return The same instance of this {@link PromptTemplatePostResponse} class - */ - @Nonnull - public PromptTemplatePostResponse message( @Nonnull final String message ) - { - this.message = message; - return this; - } - - /** - * Get message - * - * @return message The message of this {@link PromptTemplatePostResponse} instance. - */ - @Nonnull - public String getMessage() - { - return message; - } - - /** - * Set the message of this {@link PromptTemplatePostResponse} instance. - * - * @param message - * The message of this {@link PromptTemplatePostResponse} - */ - public void setMessage( @Nonnull final String message ) - { - this.message = message; - } - - /** - * Set the id of this {@link PromptTemplatePostResponse} instance and return the same instance. - * - * @param id - * The id of this {@link PromptTemplatePostResponse} - * @return The same instance of this {@link PromptTemplatePostResponse} class - */ - @Nonnull - public PromptTemplatePostResponse id( @Nonnull final UUID id ) - { - this.id = id; - return this; - } - - /** - * Get id - * - * @return id The id of this {@link PromptTemplatePostResponse} instance. - */ - @Nonnull - public UUID getId() - { - return id; - } - - /** - * Set the id of this {@link PromptTemplatePostResponse} instance. - * - * @param id - * The id of this {@link PromptTemplatePostResponse} - */ - public void setId( @Nonnull final UUID id ) - { - this.id = id; - } - - /** - * Set the scenario of this {@link PromptTemplatePostResponse} instance and return the same instance. - * - * @param scenario - * The scenario of this {@link PromptTemplatePostResponse} - * @return The same instance of this {@link PromptTemplatePostResponse} class - */ - @Nonnull - public PromptTemplatePostResponse scenario( @Nonnull final String scenario ) - { - this.scenario = scenario; - return this; - } - - /** - * Get scenario - * - * @return scenario The scenario of this {@link PromptTemplatePostResponse} instance. - */ - @Nonnull - public String getScenario() - { - return scenario; - } - - /** - * Set the scenario of this {@link PromptTemplatePostResponse} instance. - * - * @param scenario - * The scenario of this {@link PromptTemplatePostResponse} - */ - public void setScenario( @Nonnull final String scenario ) - { - this.scenario = scenario; - } - - /** - * Set the name of this {@link PromptTemplatePostResponse} instance and return the same instance. - * - * @param name - * The name of this {@link PromptTemplatePostResponse} - * @return The same instance of this {@link PromptTemplatePostResponse} class - */ - @Nonnull - public PromptTemplatePostResponse name( @Nonnull final String name ) - { - this.name = name; - return this; - } - - /** - * Get name - * - * @return name The name of this {@link PromptTemplatePostResponse} instance. - */ - @Nonnull - public String getName() - { - return name; - } - - /** - * Set the name of this {@link PromptTemplatePostResponse} instance. - * - * @param name - * The name of this {@link PromptTemplatePostResponse} - */ - public void setName( @Nonnull final String name ) - { - this.name = name; - } - - /** - * Set the version of this {@link PromptTemplatePostResponse} instance and return the same instance. - * - * @param version - * The version of this {@link PromptTemplatePostResponse} - * @return The same instance of this {@link PromptTemplatePostResponse} class - */ - @Nonnull - public PromptTemplatePostResponse version( @Nonnull final String version ) - { - this.version = version; - return this; - } - - /** - * Get version - * - * @return version The version of this {@link PromptTemplatePostResponse} instance. - */ - @Nonnull - public String getVersion() - { - return version; - } - - /** - * Set the version of this {@link PromptTemplatePostResponse} instance. - * - * @param version - * The version of this {@link PromptTemplatePostResponse} - */ - public void setVersion( @Nonnull final String version ) - { - this.version = version; - } - - /** - * Get the names of the unrecognizable properties of the {@link PromptTemplatePostResponse}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link PromptTemplatePostResponse} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("PromptTemplatePostResponse has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link PromptTemplatePostResponse} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( message != null ) - declaredFields.put("message", message); - if( id != null ) - declaredFields.put("id", id); - if( scenario != null ) - declaredFields.put("scenario", scenario); - if( name != null ) - declaredFields.put("name", name); - if( version != null ) - declaredFields.put("version", version); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link PromptTemplatePostResponse} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final PromptTemplatePostResponse promptTemplatePostResponse = (PromptTemplatePostResponse) o; - return Objects.equals(this.cloudSdkCustomFields, promptTemplatePostResponse.cloudSdkCustomFields) - && Objects.equals(this.message, promptTemplatePostResponse.message) - && Objects.equals(this.id, promptTemplatePostResponse.id) - && Objects.equals(this.scenario, promptTemplatePostResponse.scenario) - && Objects.equals(this.name, promptTemplatePostResponse.name) - && Objects.equals(this.version, promptTemplatePostResponse.version); - } - - @Override - public int hashCode() - { - return Objects.hash(message, id, scenario, name, version, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class PromptTemplatePostResponse {\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSpec.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSpec.java deleted file mode 100644 index fc354f94c..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSpec.java +++ /dev/null @@ -1,411 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * PromptTemplateSpec - */ - -@Beta // CHECKSTYLE:OFF -public class PromptTemplateSpec -// CHECKSTYLE:ON -{ - @JsonProperty( "template" ) - private List template = new ArrayList<>(); - - @JsonProperty( "defaults" ) - private Object defaults; - - @JsonProperty( "additionalFields" ) - private Object additionalFields; - - @JsonProperty( "response_format" ) - private PromptTemplateSpecResponseFormat responseFormat; - - @JsonProperty( "tools" ) - private List tools = new ArrayList<>(); - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for PromptTemplateSpec. - */ - protected PromptTemplateSpec() - { - } - - /** - * Set the template of this {@link PromptTemplateSpec} instance and return the same instance. - * - * @param template - * The template of this {@link PromptTemplateSpec} - * @return The same instance of this {@link PromptTemplateSpec} class - */ - @Nonnull - public PromptTemplateSpec template( @Nonnull final List template ) - { - this.template = template; - return this; - } - - /** - * Add one template instance to this {@link PromptTemplateSpec}. - * - * @param templateItem - * The template that should be added - * @return The same instance of type {@link PromptTemplateSpec} - */ - @Nonnull - public PromptTemplateSpec addTemplateItem( @Nonnull final PromptTemplate templateItem ) - { - if( this.template == null ) { - this.template = new ArrayList<>(); - } - this.template.add(templateItem); - return this; - } - - /** - * Get template - * - * @return template The template of this {@link PromptTemplateSpec} instance. - */ - @Nonnull - public List getTemplate() - { - return template; - } - - /** - * Set the template of this {@link PromptTemplateSpec} instance. - * - * @param template - * The template of this {@link PromptTemplateSpec} - */ - public void setTemplate( @Nonnull final List template ) - { - this.template = template; - } - - /** - * Set the defaults of this {@link PromptTemplateSpec} instance and return the same instance. - * - * @param defaults - * The defaults of this {@link PromptTemplateSpec} - * @return The same instance of this {@link PromptTemplateSpec} class - */ - @Nonnull - public PromptTemplateSpec defaults( @Nullable final Object defaults ) - { - this.defaults = defaults; - return this; - } - - /** - * Get defaults - * - * @return defaults The defaults of this {@link PromptTemplateSpec} instance. - */ - @Nonnull - public Object getDefaults() - { - return defaults; - } - - /** - * Set the defaults of this {@link PromptTemplateSpec} instance. - * - * @param defaults - * The defaults of this {@link PromptTemplateSpec} - */ - public void setDefaults( @Nullable final Object defaults ) - { - this.defaults = defaults; - } - - /** - * Set the additionalFields of this {@link PromptTemplateSpec} instance and return the same instance. - * - * @param additionalFields - * DEPRECATED. Please use additional_fields instead. - * @return The same instance of this {@link PromptTemplateSpec} class - */ - @Nonnull - public PromptTemplateSpec additionalFields( @Nullable final Object additionalFields ) - { - this.additionalFields = additionalFields; - return this; - } - - /** - * DEPRECATED. Please use additional_fields instead. - * - * @return additionalFields The additionalFields of this {@link PromptTemplateSpec} instance. - * @deprecated - */ - @Deprecated - @Nonnull - public Object getAdditionalFields() - { - return additionalFields; - } - - /** - * Set the additionalFields of this {@link PromptTemplateSpec} instance. - * - * @param additionalFields - * DEPRECATED. Please use additional_fields instead. - */ - public void setAdditionalFields( @Nullable final Object additionalFields ) - { - this.additionalFields = additionalFields; - } - - /** - * Set the responseFormat of this {@link PromptTemplateSpec} instance and return the same instance. - * - * @param responseFormat - * The responseFormat of this {@link PromptTemplateSpec} - * @return The same instance of this {@link PromptTemplateSpec} class - */ - @Nonnull - public PromptTemplateSpec responseFormat( @Nullable final PromptTemplateSpecResponseFormat responseFormat ) - { - this.responseFormat = responseFormat; - return this; - } - - /** - * Get responseFormat - * - * @return responseFormat The responseFormat of this {@link PromptTemplateSpec} instance. - */ - @Nonnull - public PromptTemplateSpecResponseFormat getResponseFormat() - { - return responseFormat; - } - - /** - * Set the responseFormat of this {@link PromptTemplateSpec} instance. - * - * @param responseFormat - * The responseFormat of this {@link PromptTemplateSpec} - */ - public void setResponseFormat( @Nullable final PromptTemplateSpecResponseFormat responseFormat ) - { - this.responseFormat = responseFormat; - } - - /** - * Set the tools of this {@link PromptTemplateSpec} instance and return the same instance. - * - * @param tools - * A list of tools the model may call. Used to provide a list of functions the model may generate JSON - * inputs for. This is the same as the OpenAI definition. - * @return The same instance of this {@link PromptTemplateSpec} class - */ - @Nonnull - public PromptTemplateSpec tools( @Nullable final List tools ) - { - this.tools = tools; - return this; - } - - /** - * Add one tools instance to this {@link PromptTemplateSpec}. - * - * @param toolsItem - * The tools that should be added - * @return The same instance of type {@link PromptTemplateSpec} - */ - @Nonnull - public PromptTemplateSpec addToolsItem( @Nonnull final ChatCompletionTool toolsItem ) - { - if( this.tools == null ) { - this.tools = new ArrayList<>(); - } - this.tools.add(toolsItem); - return this; - } - - /** - * A list of tools the model may call. Used to provide a list of functions the model may generate JSON inputs for. - * This is the same as the OpenAI definition. - * - * @return tools The tools of this {@link PromptTemplateSpec} instance. - */ - @Nonnull - public List getTools() - { - return tools; - } - - /** - * Set the tools of this {@link PromptTemplateSpec} instance. - * - * @param tools - * A list of tools the model may call. Used to provide a list of functions the model may generate JSON - * inputs for. This is the same as the OpenAI definition. - */ - public void setTools( @Nullable final List tools ) - { - this.tools = tools; - } - - /** - * Get the names of the unrecognizable properties of the {@link PromptTemplateSpec}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link PromptTemplateSpec} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("PromptTemplateSpec has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link PromptTemplateSpec} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( template != null ) - declaredFields.put("template", template); - if( defaults != null ) - declaredFields.put("defaults", defaults); - if( additionalFields != null ) - declaredFields.put("additionalFields", additionalFields); - if( responseFormat != null ) - declaredFields.put("responseFormat", responseFormat); - if( tools != null ) - declaredFields.put("tools", tools); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link PromptTemplateSpec} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final PromptTemplateSpec promptTemplateSpec = (PromptTemplateSpec) o; - return Objects.equals(this.cloudSdkCustomFields, promptTemplateSpec.cloudSdkCustomFields) - && Objects.equals(this.template, promptTemplateSpec.template) - && Objects.equals(this.defaults, promptTemplateSpec.defaults) - && Objects.equals(this.additionalFields, promptTemplateSpec.additionalFields) - && Objects.equals(this.responseFormat, promptTemplateSpec.responseFormat) - && Objects.equals(this.tools, promptTemplateSpec.tools); - } - - @Override - public int hashCode() - { - return Objects.hash(template, defaults, additionalFields, responseFormat, tools, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class PromptTemplateSpec {\n"); - sb.append(" template: ").append(toIndentedString(template)).append("\n"); - sb.append(" defaults: ").append(toIndentedString(defaults)).append("\n"); - sb.append(" additionalFields: ").append(toIndentedString(additionalFields)).append("\n"); - sb.append(" responseFormat: ").append(toIndentedString(responseFormat)).append("\n"); - sb.append(" tools: ").append(toIndentedString(tools)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSpecResponseFormat.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSpecResponseFormat.java deleted file mode 100644 index 0472f96ec..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSpecResponseFormat.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.google.common.annotations.Beta; - -/** - * Response format that the model output should adhere to. This is the same as the OpenAI definition. Compatible with - * GPT-4o, GPT-4o mini, GPT-4 (Turbo) and all GPT-3.5 Turbo models newer than gpt-3.5-turbo-1106. - */ -@Beta -@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) -@JsonSubTypes( { - @JsonSubTypes.Type( value = ResponseFormatJsonObject.class ), - @JsonSubTypes.Type( value = ResponseFormatJsonSchema.class ), - @JsonSubTypes.Type( value = ResponseFormatText.class ), } ) - -public interface PromptTemplateSpecResponseFormat -{ -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSubstitutionRequest.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSubstitutionRequest.java deleted file mode 100644 index dbd20f8ba..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSubstitutionRequest.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * PromptTemplateSubstitutionRequest - */ - -@Beta // CHECKSTYLE:OFF -public class PromptTemplateSubstitutionRequest -// CHECKSTYLE:ON -{ - @JsonProperty( "inputParams" ) - private Object inputParams; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for PromptTemplateSubstitutionRequest. - */ - protected PromptTemplateSubstitutionRequest() - { - } - - /** - * Set the inputParams of this {@link PromptTemplateSubstitutionRequest} instance and return the same instance. - * - * @param inputParams - * The inputParams of this {@link PromptTemplateSubstitutionRequest} - * @return The same instance of this {@link PromptTemplateSubstitutionRequest} class - */ - @Nonnull - public PromptTemplateSubstitutionRequest inputParams( @Nullable final Object inputParams ) - { - this.inputParams = inputParams; - return this; - } - - /** - * Get inputParams - * - * @return inputParams The inputParams of this {@link PromptTemplateSubstitutionRequest} instance. - */ - @Nonnull - public Object getInputParams() - { - return inputParams; - } - - /** - * Set the inputParams of this {@link PromptTemplateSubstitutionRequest} instance. - * - * @param inputParams - * The inputParams of this {@link PromptTemplateSubstitutionRequest} - */ - public void setInputParams( @Nullable final Object inputParams ) - { - this.inputParams = inputParams; - } - - /** - * Get the names of the unrecognizable properties of the {@link PromptTemplateSubstitutionRequest}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link PromptTemplateSubstitutionRequest} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException( - "PromptTemplateSubstitutionRequest has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link PromptTemplateSubstitutionRequest} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( inputParams != null ) - declaredFields.put("inputParams", inputParams); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link PromptTemplateSubstitutionRequest} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final PromptTemplateSubstitutionRequest promptTemplateSubstitutionRequest = - (PromptTemplateSubstitutionRequest) o; - return Objects.equals(this.cloudSdkCustomFields, promptTemplateSubstitutionRequest.cloudSdkCustomFields) - && Objects.equals(this.inputParams, promptTemplateSubstitutionRequest.inputParams); - } - - @Override - public int hashCode() - { - return Objects.hash(inputParams, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class PromptTemplateSubstitutionRequest {\n"); - sb.append(" inputParams: ").append(toIndentedString(inputParams)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSubstitutionResponse.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSubstitutionResponse.java deleted file mode 100644 index dcf52de93..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplateSubstitutionResponse.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * PromptTemplateSubstitutionResponse - */ - -@Beta // CHECKSTYLE:OFF -public class PromptTemplateSubstitutionResponse -// CHECKSTYLE:ON -{ - @JsonProperty( "parsedPrompt" ) - private List parsedPrompt = new ArrayList<>(); - - @JsonProperty( "resource" ) - private PromptTemplateGetResponse resource; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for PromptTemplateSubstitutionResponse. - */ - protected PromptTemplateSubstitutionResponse() - { - } - - /** - * Set the parsedPrompt of this {@link PromptTemplateSubstitutionResponse} instance and return the same instance. - * - * @param parsedPrompt - * The parsedPrompt of this {@link PromptTemplateSubstitutionResponse} - * @return The same instance of this {@link PromptTemplateSubstitutionResponse} class - */ - @Nonnull - public PromptTemplateSubstitutionResponse parsedPrompt( @Nullable final List parsedPrompt ) - { - this.parsedPrompt = parsedPrompt; - return this; - } - - /** - * Add one parsedPrompt instance to this {@link PromptTemplateSubstitutionResponse}. - * - * @param parsedPromptItem - * The parsedPrompt that should be added - * @return The same instance of type {@link PromptTemplateSubstitutionResponse} - */ - @Nonnull - public PromptTemplateSubstitutionResponse addParsedPromptItem( @Nonnull final PromptTemplate parsedPromptItem ) - { - if( this.parsedPrompt == null ) { - this.parsedPrompt = new ArrayList<>(); - } - this.parsedPrompt.add(parsedPromptItem); - return this; - } - - /** - * Get parsedPrompt - * - * @return parsedPrompt The parsedPrompt of this {@link PromptTemplateSubstitutionResponse} instance. - */ - @Nonnull - public List getParsedPrompt() - { - return parsedPrompt; - } - - /** - * Set the parsedPrompt of this {@link PromptTemplateSubstitutionResponse} instance. - * - * @param parsedPrompt - * The parsedPrompt of this {@link PromptTemplateSubstitutionResponse} - */ - public void setParsedPrompt( @Nullable final List parsedPrompt ) - { - this.parsedPrompt = parsedPrompt; - } - - /** - * Set the resource of this {@link PromptTemplateSubstitutionResponse} instance and return the same instance. - * - * @param resource - * The resource of this {@link PromptTemplateSubstitutionResponse} - * @return The same instance of this {@link PromptTemplateSubstitutionResponse} class - */ - @Nonnull - public PromptTemplateSubstitutionResponse resource( @Nullable final PromptTemplateGetResponse resource ) - { - this.resource = resource; - return this; - } - - /** - * Get resource - * - * @return resource The resource of this {@link PromptTemplateSubstitutionResponse} instance. - */ - @Nonnull - public PromptTemplateGetResponse getResource() - { - return resource; - } - - /** - * Set the resource of this {@link PromptTemplateSubstitutionResponse} instance. - * - * @param resource - * The resource of this {@link PromptTemplateSubstitutionResponse} - */ - public void setResource( @Nullable final PromptTemplateGetResponse resource ) - { - this.resource = resource; - } - - /** - * Get the names of the unrecognizable properties of the {@link PromptTemplateSubstitutionResponse}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link PromptTemplateSubstitutionResponse} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException( - "PromptTemplateSubstitutionResponse has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link PromptTemplateSubstitutionResponse} instance including - * unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( parsedPrompt != null ) - declaredFields.put("parsedPrompt", parsedPrompt); - if( resource != null ) - declaredFields.put("resource", resource); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link PromptTemplateSubstitutionResponse} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final PromptTemplateSubstitutionResponse promptTemplateSubstitutionResponse = - (PromptTemplateSubstitutionResponse) o; - return Objects.equals(this.cloudSdkCustomFields, promptTemplateSubstitutionResponse.cloudSdkCustomFields) - && Objects.equals(this.parsedPrompt, promptTemplateSubstitutionResponse.parsedPrompt) - && Objects.equals(this.resource, promptTemplateSubstitutionResponse.resource); - } - - @Override - public int hashCode() - { - return Objects.hash(parsedPrompt, resource, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class PromptTemplateSubstitutionResponse {\n"); - sb.append(" parsedPrompt: ").append(toIndentedString(parsedPrompt)).append("\n"); - sb.append(" resource: ").append(toIndentedString(resource)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatingModuleConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatingModuleConfig.java deleted file mode 100644 index 926da7f49..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatingModuleConfig.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * PromptTemplatingModuleConfig - */ - -@Beta // CHECKSTYLE:OFF -public class PromptTemplatingModuleConfig -// CHECKSTYLE:ON -{ - @JsonProperty( "prompt" ) - private PromptTemplatingModuleConfigPrompt prompt; - - @JsonProperty( "model" ) - private LLMModelDetails model; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for PromptTemplatingModuleConfig. - */ - protected PromptTemplatingModuleConfig() - { - } - - /** - * Set the prompt of this {@link PromptTemplatingModuleConfig} instance and return the same instance. - * - * @param prompt - * The prompt of this {@link PromptTemplatingModuleConfig} - * @return The same instance of this {@link PromptTemplatingModuleConfig} class - */ - @Nonnull - public PromptTemplatingModuleConfig prompt( @Nonnull final PromptTemplatingModuleConfigPrompt prompt ) - { - this.prompt = prompt; - return this; - } - - /** - * Get prompt - * - * @return prompt The prompt of this {@link PromptTemplatingModuleConfig} instance. - */ - @Nonnull - public PromptTemplatingModuleConfigPrompt getPrompt() - { - return prompt; - } - - /** - * Set the prompt of this {@link PromptTemplatingModuleConfig} instance. - * - * @param prompt - * The prompt of this {@link PromptTemplatingModuleConfig} - */ - public void setPrompt( @Nonnull final PromptTemplatingModuleConfigPrompt prompt ) - { - this.prompt = prompt; - } - - /** - * Set the model of this {@link PromptTemplatingModuleConfig} instance and return the same instance. - * - * @param model - * The model of this {@link PromptTemplatingModuleConfig} - * @return The same instance of this {@link PromptTemplatingModuleConfig} class - */ - @Nonnull - public PromptTemplatingModuleConfig model( @Nonnull final LLMModelDetails model ) - { - this.model = model; - return this; - } - - /** - * Get model - * - * @return model The model of this {@link PromptTemplatingModuleConfig} instance. - */ - @Nonnull - public LLMModelDetails getModel() - { - return model; - } - - /** - * Set the model of this {@link PromptTemplatingModuleConfig} instance. - * - * @param model - * The model of this {@link PromptTemplatingModuleConfig} - */ - public void setModel( @Nonnull final LLMModelDetails model ) - { - this.model = model; - } - - /** - * Get the names of the unrecognizable properties of the {@link PromptTemplatingModuleConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link PromptTemplatingModuleConfig} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("PromptTemplatingModuleConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link PromptTemplatingModuleConfig} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( prompt != null ) - declaredFields.put("prompt", prompt); - if( model != null ) - declaredFields.put("model", model); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link PromptTemplatingModuleConfig} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final PromptTemplatingModuleConfig promptTemplatingModuleConfig = (PromptTemplatingModuleConfig) o; - return Objects.equals(this.cloudSdkCustomFields, promptTemplatingModuleConfig.cloudSdkCustomFields) - && Objects.equals(this.prompt, promptTemplatingModuleConfig.prompt) - && Objects.equals(this.model, promptTemplatingModuleConfig.model); - } - - @Override - public int hashCode() - { - return Objects.hash(prompt, model, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class PromptTemplatingModuleConfig {\n"); - sb.append(" prompt: ").append(toIndentedString(prompt)).append("\n"); - sb.append(" model: ").append(toIndentedString(model)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatingModuleConfigPrompt.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatingModuleConfigPrompt.java deleted file mode 100644 index 63cdc26e7..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/PromptTemplatingModuleConfigPrompt.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.google.common.annotations.Beta; - -/** - * The prompt template to be used. Can be either a user defined template or a reference to a template in the prompt - * registry. - */ -@Beta -@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) -@JsonSubTypes( { @JsonSubTypes.Type( value = Template.class ), @JsonSubTypes.Type( value = TemplateRef.class ), } ) - -public interface PromptTemplatingModuleConfigPrompt -{ -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonSchema.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonSchema.java deleted file mode 100644 index f43b74801..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonSchema.java +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * ResponseFormatJsonSchema - */ - -@Beta // CHECKSTYLE:OFF -public class ResponseFormatJsonSchema implements PromptTemplateSpecResponseFormat, TemplateResponseFormat -// CHECKSTYLE:ON -{ - /** - * The type of response format being defined: `json_schema` - */ - public enum TypeEnum - { - /** - * The JSON_SCHEMA option of this ResponseFormatJsonSchema - */ - JSON_SCHEMA("json_schema"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this ResponseFormatJsonSchema - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type ResponseFormatJsonSchema - */ - @JsonCreator - @Nonnull - public static TypeEnum fromValue( @Nonnull final String value ) - { - for( TypeEnum b : TypeEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "type" ) - private TypeEnum type; - - @JsonProperty( "json_schema" ) - private ResponseFormatJsonSchemaJsonSchema jsonSchema; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for ResponseFormatJsonSchema. - */ - protected ResponseFormatJsonSchema() - { - } - - /** - * Set the type of this {@link ResponseFormatJsonSchema} instance and return the same instance. - * - * @param type - * The type of response format being defined: `json_schema` - * @return The same instance of this {@link ResponseFormatJsonSchema} class - */ - @Nonnull - public ResponseFormatJsonSchema type( @Nonnull final TypeEnum type ) - { - this.type = type; - return this; - } - - /** - * The type of response format being defined: `json_schema` - * - * @return type The type of this {@link ResponseFormatJsonSchema} instance. - */ - @Nonnull - public TypeEnum getType() - { - return type; - } - - /** - * Set the type of this {@link ResponseFormatJsonSchema} instance. - * - * @param type - * The type of response format being defined: `json_schema` - */ - public void setType( @Nonnull final TypeEnum type ) - { - this.type = type; - } - - /** - * Set the jsonSchema of this {@link ResponseFormatJsonSchema} instance and return the same instance. - * - * @param jsonSchema - * The jsonSchema of this {@link ResponseFormatJsonSchema} - * @return The same instance of this {@link ResponseFormatJsonSchema} class - */ - @Nonnull - public ResponseFormatJsonSchema jsonSchema( @Nonnull final ResponseFormatJsonSchemaJsonSchema jsonSchema ) - { - this.jsonSchema = jsonSchema; - return this; - } - - /** - * Get jsonSchema - * - * @return jsonSchema The jsonSchema of this {@link ResponseFormatJsonSchema} instance. - */ - @Nonnull - public ResponseFormatJsonSchemaJsonSchema getJsonSchema() - { - return jsonSchema; - } - - /** - * Set the jsonSchema of this {@link ResponseFormatJsonSchema} instance. - * - * @param jsonSchema - * The jsonSchema of this {@link ResponseFormatJsonSchema} - */ - public void setJsonSchema( @Nonnull final ResponseFormatJsonSchemaJsonSchema jsonSchema ) - { - this.jsonSchema = jsonSchema; - } - - /** - * Get the names of the unrecognizable properties of the {@link ResponseFormatJsonSchema}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link ResponseFormatJsonSchema} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("ResponseFormatJsonSchema has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link ResponseFormatJsonSchema} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( type != null ) - declaredFields.put("type", type); - if( jsonSchema != null ) - declaredFields.put("jsonSchema", jsonSchema); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link ResponseFormatJsonSchema} instance. If the map previously contained - * a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final ResponseFormatJsonSchema responseFormatJsonSchema = (ResponseFormatJsonSchema) o; - return Objects.equals(this.cloudSdkCustomFields, responseFormatJsonSchema.cloudSdkCustomFields) - && Objects.equals(this.type, responseFormatJsonSchema.type) - && Objects.equals(this.jsonSchema, responseFormatJsonSchema.jsonSchema); - } - - @Override - public int hashCode() - { - return Objects.hash(type, jsonSchema, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class ResponseFormatJsonSchema {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" jsonSchema: ").append(toIndentedString(jsonSchema)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonSchemaJsonSchema.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonSchemaJsonSchema.java deleted file mode 100644 index 37f9ed0c9..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ResponseFormatJsonSchemaJsonSchema.java +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * ResponseFormatJsonSchemaJsonSchema - */ - -@Beta // CHECKSTYLE:OFF -public class ResponseFormatJsonSchemaJsonSchema -// CHECKSTYLE:ON -{ - @JsonProperty( "description" ) - private String description; - - @JsonProperty( "name" ) - private String name; - - @JsonProperty( "schema" ) - private Map schema = new HashMap<>(); - - @JsonProperty( "strict" ) - private Boolean strict = false; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for ResponseFormatJsonSchemaJsonSchema. - */ - protected ResponseFormatJsonSchemaJsonSchema() - { - } - - /** - * Set the description of this {@link ResponseFormatJsonSchemaJsonSchema} instance and return the same instance. - * - * @param description - * A description of what the response format is for, used by the model to determine how to respond in the - * format. - * @return The same instance of this {@link ResponseFormatJsonSchemaJsonSchema} class - */ - @Nonnull - public ResponseFormatJsonSchemaJsonSchema description( @Nullable final String description ) - { - this.description = description; - return this; - } - - /** - * A description of what the response format is for, used by the model to determine how to respond in the format. - * - * @return description The description of this {@link ResponseFormatJsonSchemaJsonSchema} instance. - */ - @Nonnull - public String getDescription() - { - return description; - } - - /** - * Set the description of this {@link ResponseFormatJsonSchemaJsonSchema} instance. - * - * @param description - * A description of what the response format is for, used by the model to determine how to respond in the - * format. - */ - public void setDescription( @Nullable final String description ) - { - this.description = description; - } - - /** - * Set the name of this {@link ResponseFormatJsonSchemaJsonSchema} instance and return the same instance. - * - * @param name - * The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a - * maximum length of 64. - * @return The same instance of this {@link ResponseFormatJsonSchemaJsonSchema} class - */ - @Nonnull - public ResponseFormatJsonSchemaJsonSchema name( @Nonnull final String name ) - { - this.name = name; - return this; - } - - /** - * The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length - * of 64. - * - * @return name The name of this {@link ResponseFormatJsonSchemaJsonSchema} instance. - */ - @Nonnull - public String getName() - { - return name; - } - - /** - * Set the name of this {@link ResponseFormatJsonSchemaJsonSchema} instance. - * - * @param name - * The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a - * maximum length of 64. - */ - public void setName( @Nonnull final String name ) - { - this.name = name; - } - - /** - * Set the schema of this {@link ResponseFormatJsonSchemaJsonSchema} instance and return the same instance. - * - * @param schema - * The schema for the response format, described as a JSON Schema object. - * @return The same instance of this {@link ResponseFormatJsonSchemaJsonSchema} class - */ - @Nonnull - public ResponseFormatJsonSchemaJsonSchema schema( @Nullable final Map schema ) - { - this.schema = schema; - return this; - } - - /** - * Put one schema instance to this {@link ResponseFormatJsonSchemaJsonSchema} instance. - * - * @param key - * The String key of this schema instance - * @param schemaItem - * The schema that should be added under the given key - * @return The same instance of type {@link ResponseFormatJsonSchemaJsonSchema} - */ - @Nonnull - public - ResponseFormatJsonSchemaJsonSchema - putschemaItem( @Nonnull final String key, @Nullable final Object schemaItem ) - { - if( this.schema == null ) { - this.schema = new HashMap<>(); - } - this.schema.put(key, schemaItem); - return this; - } - - /** - * The schema for the response format, described as a JSON Schema object. - * - * @return schema The schema of this {@link ResponseFormatJsonSchemaJsonSchema} instance. - */ - @Nonnull - public Map getSchema() - { - return schema; - } - - /** - * Set the schema of this {@link ResponseFormatJsonSchemaJsonSchema} instance. - * - * @param schema - * The schema for the response format, described as a JSON Schema object. - */ - public void setSchema( @Nullable final Map schema ) - { - this.schema = schema; - } - - /** - * Set the strict of this {@link ResponseFormatJsonSchemaJsonSchema} instance and return the same instance. - * - * @param strict - * Whether to enable strict schema adherence when generating the output. If set to true, the model will - * always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema - * is supported when `strict` is `true`. To learn more, read the [Structured Outputs - * guide](https://platform.openai.com/docs/guides/structured-outputs). - * @return The same instance of this {@link ResponseFormatJsonSchemaJsonSchema} class - */ - @Nonnull - public ResponseFormatJsonSchemaJsonSchema strict( @Nullable final Boolean strict ) - { - this.strict = strict; - return this; - } - - /** - * Whether to enable strict schema adherence when generating the output. If set to true, the model will always - * follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when - * `strict` is `true`. To learn more, read the [Structured Outputs - * guide](https://platform.openai.com/docs/guides/structured-outputs). - * - * @return strict The strict of this {@link ResponseFormatJsonSchemaJsonSchema} instance. - */ - @Nullable - public Boolean isStrict() - { - return strict; - } - - /** - * Set the strict of this {@link ResponseFormatJsonSchemaJsonSchema} instance. - * - * @param strict - * Whether to enable strict schema adherence when generating the output. If set to true, the model will - * always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema - * is supported when `strict` is `true`. To learn more, read the [Structured Outputs - * guide](https://platform.openai.com/docs/guides/structured-outputs). - */ - public void setStrict( @Nullable final Boolean strict ) - { - this.strict = strict; - } - - /** - * Get the names of the unrecognizable properties of the {@link ResponseFormatJsonSchemaJsonSchema}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link ResponseFormatJsonSchemaJsonSchema} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException( - "ResponseFormatJsonSchemaJsonSchema has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link ResponseFormatJsonSchemaJsonSchema} instance including - * unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( description != null ) - declaredFields.put("description", description); - if( name != null ) - declaredFields.put("name", name); - if( schema != null ) - declaredFields.put("schema", schema); - if( strict != null ) - declaredFields.put("strict", strict); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link ResponseFormatJsonSchemaJsonSchema} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final ResponseFormatJsonSchemaJsonSchema responseFormatJsonSchemaJsonSchema = - (ResponseFormatJsonSchemaJsonSchema) o; - return Objects.equals(this.cloudSdkCustomFields, responseFormatJsonSchemaJsonSchema.cloudSdkCustomFields) - && Objects.equals(this.description, responseFormatJsonSchemaJsonSchema.description) - && Objects.equals(this.name, responseFormatJsonSchemaJsonSchema.name) - && Objects.equals(this.schema, responseFormatJsonSchemaJsonSchema.schema) - && Objects.equals(this.strict, responseFormatJsonSchemaJsonSchema.strict); - } - - @Override - public int hashCode() - { - return Objects.hash(description, name, schema, strict, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class ResponseFormatJsonSchemaJsonSchema {\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" schema: ").append(toIndentedString(schema)).append("\n"); - sb.append(" strict: ").append(toIndentedString(strict)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimeOrchestrationConfigFile.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimeOrchestrationConfigFile.java deleted file mode 100644 index be9336af5..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimeOrchestrationConfigFile.java +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * RuntimeOrchestrationConfigFile - */ - -@Beta // CHECKSTYLE:OFF -public class RuntimeOrchestrationConfigFile -// CHECKSTYLE:ON -{ - @JsonProperty( "apiVersion" ) - private String apiVersion; - - @JsonProperty( "kind" ) - private String kind; - - @JsonProperty( "metadata" ) - private RuntimePromptTemplateFileMetadata metadata; - - @JsonProperty( "spec" ) - private OrchestrationConfig spec; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for RuntimeOrchestrationConfigFile. - */ - protected RuntimeOrchestrationConfigFile() - { - } - - /** - * Set the apiVersion of this {@link RuntimeOrchestrationConfigFile} instance and return the same instance. - * - * @param apiVersion - * The apiVersion of this {@link RuntimeOrchestrationConfigFile} - * @return The same instance of this {@link RuntimeOrchestrationConfigFile} class - */ - @Nonnull - public RuntimeOrchestrationConfigFile apiVersion( @Nullable final String apiVersion ) - { - this.apiVersion = apiVersion; - return this; - } - - /** - * Get apiVersion - * - * @return apiVersion The apiVersion of this {@link RuntimeOrchestrationConfigFile} instance. - */ - @Nonnull - public String getApiVersion() - { - return apiVersion; - } - - /** - * Set the apiVersion of this {@link RuntimeOrchestrationConfigFile} instance. - * - * @param apiVersion - * The apiVersion of this {@link RuntimeOrchestrationConfigFile} - */ - public void setApiVersion( @Nullable final String apiVersion ) - { - this.apiVersion = apiVersion; - } - - /** - * Set the kind of this {@link RuntimeOrchestrationConfigFile} instance and return the same instance. - * - * @param kind - * The kind of this {@link RuntimeOrchestrationConfigFile} - * @return The same instance of this {@link RuntimeOrchestrationConfigFile} class - */ - @Nonnull - public RuntimeOrchestrationConfigFile kind( @Nullable final String kind ) - { - this.kind = kind; - return this; - } - - /** - * Get kind - * - * @return kind The kind of this {@link RuntimeOrchestrationConfigFile} instance. - */ - @Nonnull - public String getKind() - { - return kind; - } - - /** - * Set the kind of this {@link RuntimeOrchestrationConfigFile} instance. - * - * @param kind - * The kind of this {@link RuntimeOrchestrationConfigFile} - */ - public void setKind( @Nullable final String kind ) - { - this.kind = kind; - } - - /** - * Set the metadata of this {@link RuntimeOrchestrationConfigFile} instance and return the same instance. - * - * @param metadata - * The metadata of this {@link RuntimeOrchestrationConfigFile} - * @return The same instance of this {@link RuntimeOrchestrationConfigFile} class - */ - @Nonnull - public RuntimeOrchestrationConfigFile metadata( @Nullable final RuntimePromptTemplateFileMetadata metadata ) - { - this.metadata = metadata; - return this; - } - - /** - * Get metadata - * - * @return metadata The metadata of this {@link RuntimeOrchestrationConfigFile} instance. - */ - @Nonnull - public RuntimePromptTemplateFileMetadata getMetadata() - { - return metadata; - } - - /** - * Set the metadata of this {@link RuntimeOrchestrationConfigFile} instance. - * - * @param metadata - * The metadata of this {@link RuntimeOrchestrationConfigFile} - */ - public void setMetadata( @Nullable final RuntimePromptTemplateFileMetadata metadata ) - { - this.metadata = metadata; - } - - /** - * Set the spec of this {@link RuntimeOrchestrationConfigFile} instance and return the same instance. - * - * @param spec - * The spec of this {@link RuntimeOrchestrationConfigFile} - * @return The same instance of this {@link RuntimeOrchestrationConfigFile} class - */ - @Nonnull - public RuntimeOrchestrationConfigFile spec( @Nullable final OrchestrationConfig spec ) - { - this.spec = spec; - return this; - } - - /** - * Get spec - * - * @return spec The spec of this {@link RuntimeOrchestrationConfigFile} instance. - */ - @Nonnull - public OrchestrationConfig getSpec() - { - return spec; - } - - /** - * Set the spec of this {@link RuntimeOrchestrationConfigFile} instance. - * - * @param spec - * The spec of this {@link RuntimeOrchestrationConfigFile} - */ - public void setSpec( @Nullable final OrchestrationConfig spec ) - { - this.spec = spec; - } - - /** - * Get the names of the unrecognizable properties of the {@link RuntimeOrchestrationConfigFile}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link RuntimeOrchestrationConfigFile} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("RuntimeOrchestrationConfigFile has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link RuntimeOrchestrationConfigFile} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( apiVersion != null ) - declaredFields.put("apiVersion", apiVersion); - if( kind != null ) - declaredFields.put("kind", kind); - if( metadata != null ) - declaredFields.put("metadata", metadata); - if( spec != null ) - declaredFields.put("spec", spec); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link RuntimeOrchestrationConfigFile} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final RuntimeOrchestrationConfigFile runtimeOrchestrationConfigFile = (RuntimeOrchestrationConfigFile) o; - return Objects.equals(this.cloudSdkCustomFields, runtimeOrchestrationConfigFile.cloudSdkCustomFields) - && Objects.equals(this.apiVersion, runtimeOrchestrationConfigFile.apiVersion) - && Objects.equals(this.kind, runtimeOrchestrationConfigFile.kind) - && Objects.equals(this.metadata, runtimeOrchestrationConfigFile.metadata) - && Objects.equals(this.spec, runtimeOrchestrationConfigFile.spec); - } - - @Override - public int hashCode() - { - return Objects.hash(apiVersion, kind, metadata, spec, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class RuntimeOrchestrationConfigFile {\n"); - sb.append(" apiVersion: ").append(toIndentedString(apiVersion)).append("\n"); - sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimePromptTemplateFile.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimePromptTemplateFile.java deleted file mode 100644 index e83eb630b..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimePromptTemplateFile.java +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * RuntimePromptTemplateFile - */ - -@Beta // CHECKSTYLE:OFF -public class RuntimePromptTemplateFile -// CHECKSTYLE:ON -{ - @JsonProperty( "apiVersion" ) - private String apiVersion; - - @JsonProperty( "kind" ) - private String kind; - - @JsonProperty( "metadata" ) - private RuntimePromptTemplateFileMetadata metadata; - - @JsonProperty( "spec" ) - private PromptTemplateSpec spec; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for RuntimePromptTemplateFile. - */ - protected RuntimePromptTemplateFile() - { - } - - /** - * Set the apiVersion of this {@link RuntimePromptTemplateFile} instance and return the same instance. - * - * @param apiVersion - * The apiVersion of this {@link RuntimePromptTemplateFile} - * @return The same instance of this {@link RuntimePromptTemplateFile} class - */ - @Nonnull - public RuntimePromptTemplateFile apiVersion( @Nullable final String apiVersion ) - { - this.apiVersion = apiVersion; - return this; - } - - /** - * Get apiVersion - * - * @return apiVersion The apiVersion of this {@link RuntimePromptTemplateFile} instance. - */ - @Nonnull - public String getApiVersion() - { - return apiVersion; - } - - /** - * Set the apiVersion of this {@link RuntimePromptTemplateFile} instance. - * - * @param apiVersion - * The apiVersion of this {@link RuntimePromptTemplateFile} - */ - public void setApiVersion( @Nullable final String apiVersion ) - { - this.apiVersion = apiVersion; - } - - /** - * Set the kind of this {@link RuntimePromptTemplateFile} instance and return the same instance. - * - * @param kind - * The kind of this {@link RuntimePromptTemplateFile} - * @return The same instance of this {@link RuntimePromptTemplateFile} class - */ - @Nonnull - public RuntimePromptTemplateFile kind( @Nullable final String kind ) - { - this.kind = kind; - return this; - } - - /** - * Get kind - * - * @return kind The kind of this {@link RuntimePromptTemplateFile} instance. - */ - @Nonnull - public String getKind() - { - return kind; - } - - /** - * Set the kind of this {@link RuntimePromptTemplateFile} instance. - * - * @param kind - * The kind of this {@link RuntimePromptTemplateFile} - */ - public void setKind( @Nullable final String kind ) - { - this.kind = kind; - } - - /** - * Set the metadata of this {@link RuntimePromptTemplateFile} instance and return the same instance. - * - * @param metadata - * The metadata of this {@link RuntimePromptTemplateFile} - * @return The same instance of this {@link RuntimePromptTemplateFile} class - */ - @Nonnull - public RuntimePromptTemplateFile metadata( @Nullable final RuntimePromptTemplateFileMetadata metadata ) - { - this.metadata = metadata; - return this; - } - - /** - * Get metadata - * - * @return metadata The metadata of this {@link RuntimePromptTemplateFile} instance. - */ - @Nonnull - public RuntimePromptTemplateFileMetadata getMetadata() - { - return metadata; - } - - /** - * Set the metadata of this {@link RuntimePromptTemplateFile} instance. - * - * @param metadata - * The metadata of this {@link RuntimePromptTemplateFile} - */ - public void setMetadata( @Nullable final RuntimePromptTemplateFileMetadata metadata ) - { - this.metadata = metadata; - } - - /** - * Set the spec of this {@link RuntimePromptTemplateFile} instance and return the same instance. - * - * @param spec - * The spec of this {@link RuntimePromptTemplateFile} - * @return The same instance of this {@link RuntimePromptTemplateFile} class - */ - @Nonnull - public RuntimePromptTemplateFile spec( @Nullable final PromptTemplateSpec spec ) - { - this.spec = spec; - return this; - } - - /** - * Get spec - * - * @return spec The spec of this {@link RuntimePromptTemplateFile} instance. - */ - @Nonnull - public PromptTemplateSpec getSpec() - { - return spec; - } - - /** - * Set the spec of this {@link RuntimePromptTemplateFile} instance. - * - * @param spec - * The spec of this {@link RuntimePromptTemplateFile} - */ - public void setSpec( @Nullable final PromptTemplateSpec spec ) - { - this.spec = spec; - } - - /** - * Get the names of the unrecognizable properties of the {@link RuntimePromptTemplateFile}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link RuntimePromptTemplateFile} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("RuntimePromptTemplateFile has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link RuntimePromptTemplateFile} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( apiVersion != null ) - declaredFields.put("apiVersion", apiVersion); - if( kind != null ) - declaredFields.put("kind", kind); - if( metadata != null ) - declaredFields.put("metadata", metadata); - if( spec != null ) - declaredFields.put("spec", spec); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link RuntimePromptTemplateFile} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final RuntimePromptTemplateFile runtimePromptTemplateFile = (RuntimePromptTemplateFile) o; - return Objects.equals(this.cloudSdkCustomFields, runtimePromptTemplateFile.cloudSdkCustomFields) - && Objects.equals(this.apiVersion, runtimePromptTemplateFile.apiVersion) - && Objects.equals(this.kind, runtimePromptTemplateFile.kind) - && Objects.equals(this.metadata, runtimePromptTemplateFile.metadata) - && Objects.equals(this.spec, runtimePromptTemplateFile.spec); - } - - @Override - public int hashCode() - { - return Objects.hash(apiVersion, kind, metadata, spec, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class RuntimePromptTemplateFile {\n"); - sb.append(" apiVersion: ").append(toIndentedString(apiVersion)).append("\n"); - sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimePromptTemplateFileMetadata.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimePromptTemplateFileMetadata.java deleted file mode 100644 index c9aff79ee..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/RuntimePromptTemplateFileMetadata.java +++ /dev/null @@ -1,287 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * RuntimePromptTemplateFileMetadata - */ - -@Beta // CHECKSTYLE:OFF -public class RuntimePromptTemplateFileMetadata -// CHECKSTYLE:ON -{ - @JsonProperty( "name" ) - private String name; - - @JsonProperty( "version" ) - private String version; - - @JsonProperty( "scenario" ) - private String scenario; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for RuntimePromptTemplateFileMetadata. - */ - protected RuntimePromptTemplateFileMetadata() - { - } - - /** - * Set the name of this {@link RuntimePromptTemplateFileMetadata} instance and return the same instance. - * - * @param name - * The name of this {@link RuntimePromptTemplateFileMetadata} - * @return The same instance of this {@link RuntimePromptTemplateFileMetadata} class - */ - @Nonnull - public RuntimePromptTemplateFileMetadata name( @Nullable final String name ) - { - this.name = name; - return this; - } - - /** - * Get name - * - * @return name The name of this {@link RuntimePromptTemplateFileMetadata} instance. - */ - @Nonnull - public String getName() - { - return name; - } - - /** - * Set the name of this {@link RuntimePromptTemplateFileMetadata} instance. - * - * @param name - * The name of this {@link RuntimePromptTemplateFileMetadata} - */ - public void setName( @Nullable final String name ) - { - this.name = name; - } - - /** - * Set the version of this {@link RuntimePromptTemplateFileMetadata} instance and return the same instance. - * - * @param version - * The version of this {@link RuntimePromptTemplateFileMetadata} - * @return The same instance of this {@link RuntimePromptTemplateFileMetadata} class - */ - @Nonnull - public RuntimePromptTemplateFileMetadata version( @Nullable final String version ) - { - this.version = version; - return this; - } - - /** - * Get version - * - * @return version The version of this {@link RuntimePromptTemplateFileMetadata} instance. - */ - @Nonnull - public String getVersion() - { - return version; - } - - /** - * Set the version of this {@link RuntimePromptTemplateFileMetadata} instance. - * - * @param version - * The version of this {@link RuntimePromptTemplateFileMetadata} - */ - public void setVersion( @Nullable final String version ) - { - this.version = version; - } - - /** - * Set the scenario of this {@link RuntimePromptTemplateFileMetadata} instance and return the same instance. - * - * @param scenario - * The scenario of this {@link RuntimePromptTemplateFileMetadata} - * @return The same instance of this {@link RuntimePromptTemplateFileMetadata} class - */ - @Nonnull - public RuntimePromptTemplateFileMetadata scenario( @Nullable final String scenario ) - { - this.scenario = scenario; - return this; - } - - /** - * Get scenario - * - * @return scenario The scenario of this {@link RuntimePromptTemplateFileMetadata} instance. - */ - @Nonnull - public String getScenario() - { - return scenario; - } - - /** - * Set the scenario of this {@link RuntimePromptTemplateFileMetadata} instance. - * - * @param scenario - * The scenario of this {@link RuntimePromptTemplateFileMetadata} - */ - public void setScenario( @Nullable final String scenario ) - { - this.scenario = scenario; - } - - /** - * Get the names of the unrecognizable properties of the {@link RuntimePromptTemplateFileMetadata}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link RuntimePromptTemplateFileMetadata} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException( - "RuntimePromptTemplateFileMetadata has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link RuntimePromptTemplateFileMetadata} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( name != null ) - declaredFields.put("name", name); - if( version != null ) - declaredFields.put("version", version); - if( scenario != null ) - declaredFields.put("scenario", scenario); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link RuntimePromptTemplateFileMetadata} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final RuntimePromptTemplateFileMetadata runtimePromptTemplateFileMetadata = - (RuntimePromptTemplateFileMetadata) o; - return Objects.equals(this.cloudSdkCustomFields, runtimePromptTemplateFileMetadata.cloudSdkCustomFields) - && Objects.equals(this.name, runtimePromptTemplateFileMetadata.name) - && Objects.equals(this.version, runtimePromptTemplateFileMetadata.version) - && Objects.equals(this.scenario, runtimePromptTemplateFileMetadata.scenario); - } - - @Override - public int hashCode() - { - return Objects.hash(name, version, scenario, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class RuntimePromptTemplateFileMetadata {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationApplyToSelector.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationApplyToSelector.java deleted file mode 100644 index 9371a8ab2..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationApplyToSelector.java +++ /dev/null @@ -1,384 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * This selector allows you to define the scope of translation, such as specific placeholders or messages with specific - * roles. For example, `{\"category\": \"placeholders\", \"items\": - * [\"user_input\"], \"source_language\": \"de-DE\"}` targets the value of - * \"user_input\" in `placeholder_values` specified in the request payload; and considers the value - * to be in German. - */ - -@Beta // CHECKSTYLE:OFF -public class SAPDocumentTranslationApplyToSelector -// CHECKSTYLE:ON -{ - /** - * Category to apply translation to. - */ - public enum CategoryEnum - { - /** - * The PLACEHOLDERS option of this SAPDocumentTranslationApplyToSelector - */ - PLACEHOLDERS("placeholders"), - - /** - * The TEMPLATE_ROLES option of this SAPDocumentTranslationApplyToSelector - */ - TEMPLATE_ROLES("template_roles"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this SAPDocumentTranslationApplyToSelector - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - CategoryEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type SAPDocumentTranslationApplyToSelector - */ - @JsonCreator - @Nonnull - public static CategoryEnum fromValue( @Nonnull final String value ) - { - for( CategoryEnum b : CategoryEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "category" ) - private CategoryEnum category; - - @JsonProperty( "items" ) - private List items = new ArrayList<>(); - - @JsonProperty( "source_language" ) - private String sourceLanguage; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for SAPDocumentTranslationApplyToSelector. - */ - protected SAPDocumentTranslationApplyToSelector() - { - } - - /** - * Set the category of this {@link SAPDocumentTranslationApplyToSelector} instance and return the same instance. - * - * @param category - * Category to apply translation to. - * @return The same instance of this {@link SAPDocumentTranslationApplyToSelector} class - */ - @Nonnull - public SAPDocumentTranslationApplyToSelector category( @Nonnull final CategoryEnum category ) - { - this.category = category; - return this; - } - - /** - * Category to apply translation to. - * - * @return category The category of this {@link SAPDocumentTranslationApplyToSelector} instance. - */ - @Nonnull - public CategoryEnum getCategory() - { - return category; - } - - /** - * Set the category of this {@link SAPDocumentTranslationApplyToSelector} instance. - * - * @param category - * Category to apply translation to. - */ - public void setCategory( @Nonnull final CategoryEnum category ) - { - this.category = category; - } - - /** - * Set the items of this {@link SAPDocumentTranslationApplyToSelector} instance and return the same instance. - * - * @param items - * List of placeholders or roles to apply translation to - * @return The same instance of this {@link SAPDocumentTranslationApplyToSelector} class - */ - @Nonnull - public SAPDocumentTranslationApplyToSelector items( @Nonnull final List items ) - { - this.items = items; - return this; - } - - /** - * Add one items instance to this {@link SAPDocumentTranslationApplyToSelector}. - * - * @param itemsItem - * The items that should be added - * @return The same instance of type {@link SAPDocumentTranslationApplyToSelector} - */ - @Nonnull - public SAPDocumentTranslationApplyToSelector addItemsItem( @Nonnull final String itemsItem ) - { - if( this.items == null ) { - this.items = new ArrayList<>(); - } - this.items.add(itemsItem); - return this; - } - - /** - * List of placeholders or roles to apply translation to - * - * @return items The items of this {@link SAPDocumentTranslationApplyToSelector} instance. - */ - @Nonnull - public List getItems() - { - return items; - } - - /** - * Set the items of this {@link SAPDocumentTranslationApplyToSelector} instance. - * - * @param items - * List of placeholders or roles to apply translation to - */ - public void setItems( @Nonnull final List items ) - { - this.items = items; - } - - /** - * Set the sourceLanguage of this {@link SAPDocumentTranslationApplyToSelector} instance and return the same - * instance. - * - * @param sourceLanguage - * Language of the text to be translated. - * @return The same instance of this {@link SAPDocumentTranslationApplyToSelector} class - */ - @Nonnull - public SAPDocumentTranslationApplyToSelector sourceLanguage( @Nullable final String sourceLanguage ) - { - this.sourceLanguage = sourceLanguage; - return this; - } - - /** - * Language of the text to be translated. - * - * @return sourceLanguage The sourceLanguage of this {@link SAPDocumentTranslationApplyToSelector} instance. - */ - @Nonnull - public String getSourceLanguage() - { - return sourceLanguage; - } - - /** - * Set the sourceLanguage of this {@link SAPDocumentTranslationApplyToSelector} instance. - * - * @param sourceLanguage - * Language of the text to be translated. - */ - public void setSourceLanguage( @Nullable final String sourceLanguage ) - { - this.sourceLanguage = sourceLanguage; - } - - /** - * Get the names of the unrecognizable properties of the {@link SAPDocumentTranslationApplyToSelector}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link SAPDocumentTranslationApplyToSelector} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException( - "SAPDocumentTranslationApplyToSelector has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link SAPDocumentTranslationApplyToSelector} instance including - * unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( category != null ) - declaredFields.put("category", category); - if( items != null ) - declaredFields.put("items", items); - if( sourceLanguage != null ) - declaredFields.put("sourceLanguage", sourceLanguage); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link SAPDocumentTranslationApplyToSelector} instance. If the map - * previously contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final SAPDocumentTranslationApplyToSelector saPDocumentTranslationApplyToSelector = - (SAPDocumentTranslationApplyToSelector) o; - return Objects.equals(this.cloudSdkCustomFields, saPDocumentTranslationApplyToSelector.cloudSdkCustomFields) - && Objects.equals(this.category, saPDocumentTranslationApplyToSelector.category) - && Objects.equals(this.items, saPDocumentTranslationApplyToSelector.items) - && Objects.equals(this.sourceLanguage, saPDocumentTranslationApplyToSelector.sourceLanguage); - } - - @Override - public int hashCode() - { - return Objects.hash(category, items, sourceLanguage, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class SAPDocumentTranslationApplyToSelector {\n"); - sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" items: ").append(toIndentedString(items)).append("\n"); - sb.append(" sourceLanguage: ").append(toIndentedString(sourceLanguage)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationInput.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationInput.java deleted file mode 100644 index b8cff778a..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationInput.java +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * SAPDocumentTranslationInput - */ - -@Beta // CHECKSTYLE:OFF -public class SAPDocumentTranslationInput -// CHECKSTYLE:ON -{ - /** - * Type of document translation provider - */ - public enum TypeEnum - { - /** - * The SAP_DOCUMENT_TRANSLATION option of this SAPDocumentTranslationInput - */ - SAP_DOCUMENT_TRANSLATION("sap_document_translation"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this SAPDocumentTranslationInput - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type SAPDocumentTranslationInput - */ - @JsonCreator - @Nonnull - public static TypeEnum fromValue( @Nonnull final String value ) - { - for( TypeEnum b : TypeEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "type" ) - private TypeEnum type; - - @JsonProperty( "translate_messages_history" ) - private Boolean translateMessagesHistory = true; - - @JsonProperty( "config" ) - private SAPDocumentTranslationInputConfig config; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for SAPDocumentTranslationInput. - */ - protected SAPDocumentTranslationInput() - { - } - - /** - * Set the type of this {@link SAPDocumentTranslationInput} instance and return the same instance. - * - * @param type - * Type of document translation provider - * @return The same instance of this {@link SAPDocumentTranslationInput} class - */ - @Nonnull - public SAPDocumentTranslationInput type( @Nonnull final TypeEnum type ) - { - this.type = type; - return this; - } - - /** - * Type of document translation provider - * - * @return type The type of this {@link SAPDocumentTranslationInput} instance. - */ - @Nonnull - public TypeEnum getType() - { - return type; - } - - /** - * Set the type of this {@link SAPDocumentTranslationInput} instance. - * - * @param type - * Type of document translation provider - */ - public void setType( @Nonnull final TypeEnum type ) - { - this.type = type; - } - - /** - * Set the translateMessagesHistory of this {@link SAPDocumentTranslationInput} instance and return the same - * instance. - * - * @param translateMessagesHistory - * If true, the messages history will be translated as well. - * @return The same instance of this {@link SAPDocumentTranslationInput} class - */ - @Nonnull - public SAPDocumentTranslationInput translateMessagesHistory( @Nullable final Boolean translateMessagesHistory ) - { - this.translateMessagesHistory = translateMessagesHistory; - return this; - } - - /** - * If true, the messages history will be translated as well. - * - * @return translateMessagesHistory The translateMessagesHistory of this {@link SAPDocumentTranslationInput} - * instance. - */ - @Nonnull - public Boolean isTranslateMessagesHistory() - { - return translateMessagesHistory; - } - - /** - * Set the translateMessagesHistory of this {@link SAPDocumentTranslationInput} instance. - * - * @param translateMessagesHistory - * If true, the messages history will be translated as well. - */ - public void setTranslateMessagesHistory( @Nullable final Boolean translateMessagesHistory ) - { - this.translateMessagesHistory = translateMessagesHistory; - } - - /** - * Set the config of this {@link SAPDocumentTranslationInput} instance and return the same instance. - * - * @param config - * The config of this {@link SAPDocumentTranslationInput} - * @return The same instance of this {@link SAPDocumentTranslationInput} class - */ - @Nonnull - public SAPDocumentTranslationInput config( @Nonnull final SAPDocumentTranslationInputConfig config ) - { - this.config = config; - return this; - } - - /** - * Get config - * - * @return config The config of this {@link SAPDocumentTranslationInput} instance. - */ - @Nonnull - public SAPDocumentTranslationInputConfig getConfig() - { - return config; - } - - /** - * Set the config of this {@link SAPDocumentTranslationInput} instance. - * - * @param config - * The config of this {@link SAPDocumentTranslationInput} - */ - public void setConfig( @Nonnull final SAPDocumentTranslationInputConfig config ) - { - this.config = config; - } - - /** - * Get the names of the unrecognizable properties of the {@link SAPDocumentTranslationInput}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link SAPDocumentTranslationInput} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("SAPDocumentTranslationInput has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link SAPDocumentTranslationInput} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( type != null ) - declaredFields.put("type", type); - if( translateMessagesHistory != null ) - declaredFields.put("translateMessagesHistory", translateMessagesHistory); - if( config != null ) - declaredFields.put("config", config); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link SAPDocumentTranslationInput} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final SAPDocumentTranslationInput saPDocumentTranslationInput = (SAPDocumentTranslationInput) o; - return Objects.equals(this.cloudSdkCustomFields, saPDocumentTranslationInput.cloudSdkCustomFields) - && Objects.equals(this.type, saPDocumentTranslationInput.type) - && Objects.equals(this.translateMessagesHistory, saPDocumentTranslationInput.translateMessagesHistory) - && Objects.equals(this.config, saPDocumentTranslationInput.config); - } - - @Override - public int hashCode() - { - return Objects.hash(type, translateMessagesHistory, config, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class SAPDocumentTranslationInput {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" translateMessagesHistory: ").append(toIndentedString(translateMessagesHistory)).append("\n"); - sb.append(" config: ").append(toIndentedString(config)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationInputConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationInputConfig.java deleted file mode 100644 index a07a1cc70..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationInputConfig.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * Configuration for `sap_document_translation` translation provider. - */ - -@Beta // CHECKSTYLE:OFF -public class SAPDocumentTranslationInputConfig -// CHECKSTYLE:ON -{ - @JsonProperty( "source_language" ) - private String sourceLanguage; - - @JsonProperty( "apply_to" ) - private List applyTo = new ArrayList<>(); - - @JsonProperty( "target_language" ) - private String targetLanguage; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for SAPDocumentTranslationInputConfig. - */ - protected SAPDocumentTranslationInputConfig() - { - } - - /** - * Set the sourceLanguage of this {@link SAPDocumentTranslationInputConfig} instance and return the same instance. - * - * @param sourceLanguage - * Language of the text to be translated. - * @return The same instance of this {@link SAPDocumentTranslationInputConfig} class - */ - @Nonnull - public SAPDocumentTranslationInputConfig sourceLanguage( @Nullable final String sourceLanguage ) - { - this.sourceLanguage = sourceLanguage; - return this; - } - - /** - * Language of the text to be translated. - * - * @return sourceLanguage The sourceLanguage of this {@link SAPDocumentTranslationInputConfig} instance. - */ - @Nonnull - public String getSourceLanguage() - { - return sourceLanguage; - } - - /** - * Set the sourceLanguage of this {@link SAPDocumentTranslationInputConfig} instance. - * - * @param sourceLanguage - * Language of the text to be translated. - */ - public void setSourceLanguage( @Nullable final String sourceLanguage ) - { - this.sourceLanguage = sourceLanguage; - } - - /** - * Set the applyTo of this {@link SAPDocumentTranslationInputConfig} instance and return the same instance. - * - * @param applyTo - * The applyTo of this {@link SAPDocumentTranslationInputConfig} - * @return The same instance of this {@link SAPDocumentTranslationInputConfig} class - */ - @Nonnull - public SAPDocumentTranslationInputConfig applyTo( - @Nullable final List applyTo ) - { - this.applyTo = applyTo; - return this; - } - - /** - * Add one applyTo instance to this {@link SAPDocumentTranslationInputConfig}. - * - * @param applyToItem - * The applyTo that should be added - * @return The same instance of type {@link SAPDocumentTranslationInputConfig} - */ - @Nonnull - public SAPDocumentTranslationInputConfig addApplyToItem( - @Nonnull final SAPDocumentTranslationApplyToSelector applyToItem ) - { - if( this.applyTo == null ) { - this.applyTo = new ArrayList<>(); - } - this.applyTo.add(applyToItem); - return this; - } - - /** - * Get applyTo - * - * @return applyTo The applyTo of this {@link SAPDocumentTranslationInputConfig} instance. - */ - @Nonnull - public List getApplyTo() - { - return applyTo; - } - - /** - * Set the applyTo of this {@link SAPDocumentTranslationInputConfig} instance. - * - * @param applyTo - * The applyTo of this {@link SAPDocumentTranslationInputConfig} - */ - public void setApplyTo( @Nullable final List applyTo ) - { - this.applyTo = applyTo; - } - - /** - * Set the targetLanguage of this {@link SAPDocumentTranslationInputConfig} instance and return the same instance. - * - * @param targetLanguage - * Language to which the text should be translated. - * @return The same instance of this {@link SAPDocumentTranslationInputConfig} class - */ - @Nonnull - public SAPDocumentTranslationInputConfig targetLanguage( @Nonnull final String targetLanguage ) - { - this.targetLanguage = targetLanguage; - return this; - } - - /** - * Language to which the text should be translated. - * - * @return targetLanguage The targetLanguage of this {@link SAPDocumentTranslationInputConfig} instance. - */ - @Nonnull - public String getTargetLanguage() - { - return targetLanguage; - } - - /** - * Set the targetLanguage of this {@link SAPDocumentTranslationInputConfig} instance. - * - * @param targetLanguage - * Language to which the text should be translated. - */ - public void setTargetLanguage( @Nonnull final String targetLanguage ) - { - this.targetLanguage = targetLanguage; - } - - /** - * Get the names of the unrecognizable properties of the {@link SAPDocumentTranslationInputConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link SAPDocumentTranslationInputConfig} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException( - "SAPDocumentTranslationInputConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link SAPDocumentTranslationInputConfig} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( sourceLanguage != null ) - declaredFields.put("sourceLanguage", sourceLanguage); - if( applyTo != null ) - declaredFields.put("applyTo", applyTo); - if( targetLanguage != null ) - declaredFields.put("targetLanguage", targetLanguage); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link SAPDocumentTranslationInputConfig} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final SAPDocumentTranslationInputConfig saPDocumentTranslationInputConfig = - (SAPDocumentTranslationInputConfig) o; - return Objects.equals(this.cloudSdkCustomFields, saPDocumentTranslationInputConfig.cloudSdkCustomFields) - && Objects.equals(this.sourceLanguage, saPDocumentTranslationInputConfig.sourceLanguage) - && Objects.equals(this.applyTo, saPDocumentTranslationInputConfig.applyTo) - && Objects.equals(this.targetLanguage, saPDocumentTranslationInputConfig.targetLanguage); - } - - @Override - public int hashCode() - { - return Objects.hash(sourceLanguage, applyTo, targetLanguage, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class SAPDocumentTranslationInputConfig {\n"); - sb.append(" sourceLanguage: ").append(toIndentedString(sourceLanguage)).append("\n"); - sb.append(" applyTo: ").append(toIndentedString(applyTo)).append("\n"); - sb.append(" targetLanguage: ").append(toIndentedString(targetLanguage)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutput.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutput.java deleted file mode 100644 index a9fbe4525..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutput.java +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * SAPDocumentTranslationOutput - */ - -@Beta // CHECKSTYLE:OFF -public class SAPDocumentTranslationOutput -// CHECKSTYLE:ON -{ - /** - * Configuration for `sap_document_translation` translation provider. - */ - public enum TypeEnum - { - /** - * The SAP_DOCUMENT_TRANSLATION option of this SAPDocumentTranslationOutput - */ - SAP_DOCUMENT_TRANSLATION("sap_document_translation"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this SAPDocumentTranslationOutput - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type SAPDocumentTranslationOutput - */ - @JsonCreator - @Nonnull - public static TypeEnum fromValue( @Nonnull final String value ) - { - for( TypeEnum b : TypeEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "type" ) - private TypeEnum type; - - @JsonProperty( "config" ) - private SAPDocumentTranslationOutputConfig config; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for SAPDocumentTranslationOutput. - */ - protected SAPDocumentTranslationOutput() - { - } - - /** - * Set the type of this {@link SAPDocumentTranslationOutput} instance and return the same instance. - * - * @param type - * Configuration for `sap_document_translation` translation provider. - * @return The same instance of this {@link SAPDocumentTranslationOutput} class - */ - @Nonnull - public SAPDocumentTranslationOutput type( @Nonnull final TypeEnum type ) - { - this.type = type; - return this; - } - - /** - * Configuration for `sap_document_translation` translation provider. - * - * @return type The type of this {@link SAPDocumentTranslationOutput} instance. - */ - @Nonnull - public TypeEnum getType() - { - return type; - } - - /** - * Set the type of this {@link SAPDocumentTranslationOutput} instance. - * - * @param type - * Configuration for `sap_document_translation` translation provider. - */ - public void setType( @Nonnull final TypeEnum type ) - { - this.type = type; - } - - /** - * Set the config of this {@link SAPDocumentTranslationOutput} instance and return the same instance. - * - * @param config - * The config of this {@link SAPDocumentTranslationOutput} - * @return The same instance of this {@link SAPDocumentTranslationOutput} class - */ - @Nonnull - public SAPDocumentTranslationOutput config( @Nonnull final SAPDocumentTranslationOutputConfig config ) - { - this.config = config; - return this; - } - - /** - * Get config - * - * @return config The config of this {@link SAPDocumentTranslationOutput} instance. - */ - @Nonnull - public SAPDocumentTranslationOutputConfig getConfig() - { - return config; - } - - /** - * Set the config of this {@link SAPDocumentTranslationOutput} instance. - * - * @param config - * The config of this {@link SAPDocumentTranslationOutput} - */ - public void setConfig( @Nonnull final SAPDocumentTranslationOutputConfig config ) - { - this.config = config; - } - - /** - * Get the names of the unrecognizable properties of the {@link SAPDocumentTranslationOutput}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link SAPDocumentTranslationOutput} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("SAPDocumentTranslationOutput has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link SAPDocumentTranslationOutput} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( type != null ) - declaredFields.put("type", type); - if( config != null ) - declaredFields.put("config", config); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link SAPDocumentTranslationOutput} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final SAPDocumentTranslationOutput saPDocumentTranslationOutput = (SAPDocumentTranslationOutput) o; - return Objects.equals(this.cloudSdkCustomFields, saPDocumentTranslationOutput.cloudSdkCustomFields) - && Objects.equals(this.type, saPDocumentTranslationOutput.type) - && Objects.equals(this.config, saPDocumentTranslationOutput.config); - } - - @Override - public int hashCode() - { - return Objects.hash(type, config, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class SAPDocumentTranslationOutput {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" config: ").append(toIndentedString(config)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutputConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutputConfig.java deleted file mode 100644 index 15d1e1891..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutputConfig.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * SAPDocumentTranslationOutputConfig - */ - -@Beta // CHECKSTYLE:OFF -public class SAPDocumentTranslationOutputConfig -// CHECKSTYLE:ON -{ - @JsonProperty( "source_language" ) - private String sourceLanguage; - - @JsonProperty( "target_language" ) - private SAPDocumentTranslationOutputTargetLanguage targetLanguage; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for SAPDocumentTranslationOutputConfig. - */ - protected SAPDocumentTranslationOutputConfig() - { - } - - /** - * Set the sourceLanguage of this {@link SAPDocumentTranslationOutputConfig} instance and return the same instance. - * - * @param sourceLanguage - * Language of the text to be translated. - * @return The same instance of this {@link SAPDocumentTranslationOutputConfig} class - */ - @Nonnull - public SAPDocumentTranslationOutputConfig sourceLanguage( @Nullable final String sourceLanguage ) - { - this.sourceLanguage = sourceLanguage; - return this; - } - - /** - * Language of the text to be translated. - * - * @return sourceLanguage The sourceLanguage of this {@link SAPDocumentTranslationOutputConfig} instance. - */ - @Nonnull - public String getSourceLanguage() - { - return sourceLanguage; - } - - /** - * Set the sourceLanguage of this {@link SAPDocumentTranslationOutputConfig} instance. - * - * @param sourceLanguage - * Language of the text to be translated. - */ - public void setSourceLanguage( @Nullable final String sourceLanguage ) - { - this.sourceLanguage = sourceLanguage; - } - - /** - * Set the targetLanguage of this {@link SAPDocumentTranslationOutputConfig} instance and return the same instance. - * - * @param targetLanguage - * The targetLanguage of this {@link SAPDocumentTranslationOutputConfig} - * @return The same instance of this {@link SAPDocumentTranslationOutputConfig} class - */ - @Nonnull - public SAPDocumentTranslationOutputConfig targetLanguage( - @Nonnull final SAPDocumentTranslationOutputTargetLanguage targetLanguage ) - { - this.targetLanguage = targetLanguage; - return this; - } - - /** - * Get targetLanguage - * - * @return targetLanguage The targetLanguage of this {@link SAPDocumentTranslationOutputConfig} instance. - */ - @Nonnull - public SAPDocumentTranslationOutputTargetLanguage getTargetLanguage() - { - return targetLanguage; - } - - /** - * Set the targetLanguage of this {@link SAPDocumentTranslationOutputConfig} instance. - * - * @param targetLanguage - * The targetLanguage of this {@link SAPDocumentTranslationOutputConfig} - */ - public void setTargetLanguage( @Nonnull final SAPDocumentTranslationOutputTargetLanguage targetLanguage ) - { - this.targetLanguage = targetLanguage; - } - - /** - * Get the names of the unrecognizable properties of the {@link SAPDocumentTranslationOutputConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link SAPDocumentTranslationOutputConfig} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException( - "SAPDocumentTranslationOutputConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link SAPDocumentTranslationOutputConfig} instance including - * unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( sourceLanguage != null ) - declaredFields.put("sourceLanguage", sourceLanguage); - if( targetLanguage != null ) - declaredFields.put("targetLanguage", targetLanguage); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link SAPDocumentTranslationOutputConfig} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final SAPDocumentTranslationOutputConfig saPDocumentTranslationOutputConfig = - (SAPDocumentTranslationOutputConfig) o; - return Objects.equals(this.cloudSdkCustomFields, saPDocumentTranslationOutputConfig.cloudSdkCustomFields) - && Objects.equals(this.sourceLanguage, saPDocumentTranslationOutputConfig.sourceLanguage) - && Objects.equals(this.targetLanguage, saPDocumentTranslationOutputConfig.targetLanguage); - } - - @Override - public int hashCode() - { - return Objects.hash(sourceLanguage, targetLanguage, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class SAPDocumentTranslationOutputConfig {\n"); - sb.append(" sourceLanguage: ").append(toIndentedString(sourceLanguage)).append("\n"); - sb.append(" targetLanguage: ").append(toIndentedString(targetLanguage)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutputTargetLanguage.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutputTargetLanguage.java deleted file mode 100644 index d5996e42c..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SAPDocumentTranslationOutputTargetLanguage.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import javax.annotation.Nonnull; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * SAPDocumentTranslationOutputTargetLanguage - */ -@Beta -public interface SAPDocumentTranslationOutputTargetLanguage -{ - /** - * Helper class to create {@code String } that implements {@link SAPDocumentTranslationOutputTargetLanguage}. - */ - record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) implements SAPDocumentTranslationOutputTargetLanguage {} - - /** - * Creator to enable deserialization of {@code String }. - * - * @param val - * the value to use - * @return a new instance of {@link InnerString}. - */ - @com.fasterxml.jackson.annotation.JsonCreator - @Nonnull - static InnerString create( @Nonnull final String val ) - { - return new InnerString(val); - } - - /** - * Helper class to create {@code SAPDocumentTranslationApplyToSelector } that implements {@link SAPDocumentTranslationOutputTargetLanguage}. - */ - record InnerSAPDocumentTranslationApplyToSelector(@com.fasterxml.jackson.annotation.JsonValue @Nonnull SAPDocumentTranslationApplyToSelector value) implements SAPDocumentTranslationOutputTargetLanguage {} - - /** - * Creator to enable deserialization of {@code SAPDocumentTranslationApplyToSelector }. - * - * @param val - * the value to use - * @return a new instance of {@link InnerSAPDocumentTranslationApplyToSelector}. - */ - @com.fasterxml.jackson.annotation.JsonCreator - @Nonnull - static InnerSAPDocumentTranslationApplyToSelector createInnerSAPDocumentTranslationApplyToSelector( - @Nonnull final SAPDocumentTranslationApplyToSelector val ) - { - return new InnerSAPDocumentTranslationApplyToSelector(val); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SearchDocumentKeyValueListPair.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SearchDocumentKeyValueListPair.java deleted file mode 100644 index 889ec4c43..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SearchDocumentKeyValueListPair.java +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * SearchDocumentKeyValueListPair - */ - -@Beta // CHECKSTYLE:OFF -public class SearchDocumentKeyValueListPair -// CHECKSTYLE:ON -{ - @JsonProperty( "key" ) - private String key; - - @JsonProperty( "value" ) - private List value = new ArrayList<>(); - - @JsonProperty( "select_mode" ) - private List selectMode = new ArrayList<>(); - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for SearchDocumentKeyValueListPair. - */ - protected SearchDocumentKeyValueListPair() - { - } - - /** - * Set the key of this {@link SearchDocumentKeyValueListPair} instance and return the same instance. - * - * @param key - * The key of this {@link SearchDocumentKeyValueListPair} - * @return The same instance of this {@link SearchDocumentKeyValueListPair} class - */ - @Nonnull - public SearchDocumentKeyValueListPair key( @Nonnull final String key ) - { - this.key = key; - return this; - } - - /** - * Get key - * - * @return key The key of this {@link SearchDocumentKeyValueListPair} instance. - */ - @Nonnull - public String getKey() - { - return key; - } - - /** - * Set the key of this {@link SearchDocumentKeyValueListPair} instance. - * - * @param key - * The key of this {@link SearchDocumentKeyValueListPair} - */ - public void setKey( @Nonnull final String key ) - { - this.key = key; - } - - /** - * Set the value of this {@link SearchDocumentKeyValueListPair} instance and return the same instance. - * - * @param value - * The value of this {@link SearchDocumentKeyValueListPair} - * @return The same instance of this {@link SearchDocumentKeyValueListPair} class - */ - @Nonnull - public SearchDocumentKeyValueListPair value( @Nonnull final List value ) - { - this.value = value; - return this; - } - - /** - * Add one value instance to this {@link SearchDocumentKeyValueListPair}. - * - * @param valueItem - * The value that should be added - * @return The same instance of type {@link SearchDocumentKeyValueListPair} - */ - @Nonnull - public SearchDocumentKeyValueListPair addValueItem( @Nonnull final String valueItem ) - { - if( this.value == null ) { - this.value = new ArrayList<>(); - } - this.value.add(valueItem); - return this; - } - - /** - * Get value - * - * @return value The value of this {@link SearchDocumentKeyValueListPair} instance. - */ - @Nonnull - public List getValue() - { - return value; - } - - /** - * Set the value of this {@link SearchDocumentKeyValueListPair} instance. - * - * @param value - * The value of this {@link SearchDocumentKeyValueListPair} - */ - public void setValue( @Nonnull final List value ) - { - this.value = value; - } - - /** - * Set the selectMode of this {@link SearchDocumentKeyValueListPair} instance and return the same instance. - * - * @param selectMode - * Select mode for search filters - * @return The same instance of this {@link SearchDocumentKeyValueListPair} class - */ - @Nonnull - public SearchDocumentKeyValueListPair selectMode( @Nullable final List selectMode ) - { - this.selectMode = selectMode; - return this; - } - - /** - * Add one selectMode instance to this {@link SearchDocumentKeyValueListPair}. - * - * @param selectModeItem - * The selectMode that should be added - * @return The same instance of type {@link SearchDocumentKeyValueListPair} - */ - @Nonnull - public SearchDocumentKeyValueListPair addSelectModeItem( @Nonnull final SearchSelectOptionEnum selectModeItem ) - { - if( this.selectMode == null ) { - this.selectMode = new ArrayList<>(); - } - this.selectMode.add(selectModeItem); - return this; - } - - /** - * Select mode for search filters - * - * @return selectMode The selectMode of this {@link SearchDocumentKeyValueListPair} instance. - */ - @Nonnull - public List getSelectMode() - { - return selectMode; - } - - /** - * Set the selectMode of this {@link SearchDocumentKeyValueListPair} instance. - * - * @param selectMode - * Select mode for search filters - */ - public void setSelectMode( @Nullable final List selectMode ) - { - this.selectMode = selectMode; - } - - /** - * Get the names of the unrecognizable properties of the {@link SearchDocumentKeyValueListPair}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link SearchDocumentKeyValueListPair} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("SearchDocumentKeyValueListPair has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link SearchDocumentKeyValueListPair} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( key != null ) - declaredFields.put("key", key); - if( value != null ) - declaredFields.put("value", value); - if( selectMode != null ) - declaredFields.put("selectMode", selectMode); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link SearchDocumentKeyValueListPair} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final SearchDocumentKeyValueListPair searchDocumentKeyValueListPair = (SearchDocumentKeyValueListPair) o; - return Objects.equals(this.cloudSdkCustomFields, searchDocumentKeyValueListPair.cloudSdkCustomFields) - && Objects.equals(this.key, searchDocumentKeyValueListPair.key) - && Objects.equals(this.value, searchDocumentKeyValueListPair.value) - && Objects.equals(this.selectMode, searchDocumentKeyValueListPair.selectMode); - } - - @Override - public int hashCode() - { - return Objects.hash(key, value, selectMode, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class SearchDocumentKeyValueListPair {\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append(" selectMode: ").append(toIndentedString(selectMode)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SearchSelectOptionEnum.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SearchSelectOptionEnum.java deleted file mode 100644 index 32b7bbe38..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SearchSelectOptionEnum.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import javax.annotation.Nonnull; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * Gets or Sets SearchSelectOptionEnum - */ - -@Beta -public enum SearchSelectOptionEnum -{ - - IGNORE_IF_KEY_ABSENT("ignoreIfKeyAbsent"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private final String value; - - SearchSelectOptionEnum( String value ) - { - this.value = value; - } - - /** - * @return The enum value. - */ - @JsonValue - public String getValue() - { - return value; - } - - /** - * @return The String representation of the enum value. - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Converts the given value to its enum representation. - * - * @param value - * The input value. - * - * @return The enum representation of the given value. - */ - @JsonCreator - public static SearchSelectOptionEnum fromValue( @Nonnull final String value ) - { - for( final SearchSelectOptionEnum b : SearchSelectOptionEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SingleChatTemplate.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SingleChatTemplate.java deleted file mode 100644 index d8bac9d11..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SingleChatTemplate.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * SingleChatTemplate - */ - -@Beta // CHECKSTYLE:OFF -public class SingleChatTemplate implements PromptTemplate -// CHECKSTYLE:ON -{ - @JsonProperty( "role" ) - private String role; - - @JsonProperty( "content" ) - private String content; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for SingleChatTemplate. - */ - protected SingleChatTemplate() - { - } - - /** - * Set the role of this {@link SingleChatTemplate} instance and return the same instance. - * - * @param role - * The role of this {@link SingleChatTemplate} - * @return The same instance of this {@link SingleChatTemplate} class - */ - @Nonnull - public SingleChatTemplate role( @Nonnull final String role ) - { - this.role = role; - return this; - } - - /** - * Get role - * - * @return role The role of this {@link SingleChatTemplate} instance. - */ - @Nonnull - public String getRole() - { - return role; - } - - /** - * Set the role of this {@link SingleChatTemplate} instance. - * - * @param role - * The role of this {@link SingleChatTemplate} - */ - public void setRole( @Nonnull final String role ) - { - this.role = role; - } - - /** - * Set the content of this {@link SingleChatTemplate} instance and return the same instance. - * - * @param content - * The content of this {@link SingleChatTemplate} - * @return The same instance of this {@link SingleChatTemplate} class - */ - @Nonnull - public SingleChatTemplate content( @Nonnull final String content ) - { - this.content = content; - return this; - } - - /** - * Get content - * - * @return content The content of this {@link SingleChatTemplate} instance. - */ - @Nonnull - public String getContent() - { - return content; - } - - /** - * Set the content of this {@link SingleChatTemplate} instance. - * - * @param content - * The content of this {@link SingleChatTemplate} - */ - public void setContent( @Nonnull final String content ) - { - this.content = content; - } - - /** - * Get the names of the unrecognizable properties of the {@link SingleChatTemplate}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link SingleChatTemplate} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("SingleChatTemplate has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link SingleChatTemplate} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( role != null ) - declaredFields.put("role", role); - if( content != null ) - declaredFields.put("content", content); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link SingleChatTemplate} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final SingleChatTemplate singleChatTemplate = (SingleChatTemplate) o; - return Objects.equals(this.cloudSdkCustomFields, singleChatTemplate.cloudSdkCustomFields) - && Objects.equals(this.role, singleChatTemplate.role) - && Objects.equals(this.content, singleChatTemplate.content); - } - - @Override - public int hashCode() - { - return Objects.hash(role, content, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class SingleChatTemplate {\n"); - sb.append(" role: ").append(toIndentedString(role)).append("\n"); - sb.append(" content: ").append(toIndentedString(content)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Soda.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Soda.java new file mode 100644 index 000000000..3f334cdf3 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Soda.java @@ -0,0 +1,448 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * SodaStore API + * API for managing soda products and orders in SodaStore. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * Soda + */ + +@Beta // CHECKSTYLE:OFF +public class Soda +// CHECKSTYLE:ON +{ + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "brand" ) + private String brand; + + @JsonProperty( "quantity" ) + private Integer quantity; + + /** + * Gets or Sets packaging + */ + public enum PackagingEnum + { + /** + * The GLASS option of this Soda + */ + GLASS("glass"), + + /** + * The CARTON option of this Soda + */ + CARTON("carton"), + + /** + * The CAN option of this Soda + */ + CAN("can"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this Soda + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + PackagingEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type Soda + */ + @JsonCreator + @Nonnull + public static PackagingEnum fromValue( @Nonnull final String value ) + { + for( PackagingEnum b : PackagingEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "packaging" ) + private PackagingEnum packaging; + + @JsonProperty( "price" ) + private Float price; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for Soda. + */ + protected Soda() + { + } + + /** + * Set the name of this {@link Soda} instance and return the same instance. + * + * @param name + * The name of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull + public Soda name( @Nonnull final String name ) + { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name The name of this {@link Soda} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link Soda} instance. + * + * @param name + * The name of this {@link Soda} + */ + public void setName( @Nonnull final String name ) + { + this.name = name; + } + + /** + * Set the brand of this {@link Soda} instance and return the same instance. + * + * @param brand + * The brand of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull + public Soda brand( @Nonnull final String brand ) + { + this.brand = brand; + return this; + } + + /** + * Get brand + * + * @return brand The brand of this {@link Soda} instance. + */ + @Nonnull + public String getBrand() + { + return brand; + } + + /** + * Set the brand of this {@link Soda} instance. + * + * @param brand + * The brand of this {@link Soda} + */ + public void setBrand( @Nonnull final String brand ) + { + this.brand = brand; + } + + /** + * Set the quantity of this {@link Soda} instance and return the same instance. + * + * @param quantity + * The quantity of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull + public Soda quantity( @Nonnull final Integer quantity ) + { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * + * @return quantity The quantity of this {@link Soda} instance. + */ + @Nonnull + public Integer getQuantity() + { + return quantity; + } + + /** + * Set the quantity of this {@link Soda} instance. + * + * @param quantity + * The quantity of this {@link Soda} + */ + public void setQuantity( @Nonnull final Integer quantity ) + { + this.quantity = quantity; + } + + /** + * Set the packaging of this {@link Soda} instance and return the same instance. + * + * @param packaging + * The packaging of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull + public Soda packaging( @Nullable final PackagingEnum packaging ) + { + this.packaging = packaging; + return this; + } + + /** + * Get packaging + * + * @return packaging The packaging of this {@link Soda} instance. + */ + @Nonnull + public PackagingEnum getPackaging() + { + return packaging; + } + + /** + * Set the packaging of this {@link Soda} instance. + * + * @param packaging + * The packaging of this {@link Soda} + */ + public void setPackaging( @Nullable final PackagingEnum packaging ) + { + this.packaging = packaging; + } + + /** + * Set the price of this {@link Soda} instance and return the same instance. + * + * @param price + * The price of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull + public Soda price( @Nonnull final Float price ) + { + this.price = price; + return this; + } + + /** + * Get price + * + * @return price The price of this {@link Soda} instance. + */ + @Nonnull + public Float getPrice() + { + return price; + } + + /** + * Set the price of this {@link Soda} instance. + * + * @param price + * The price of this {@link Soda} + */ + public void setPrice( @Nonnull final Float price ) + { + this.price = price; + } + + /** + * Get the names of the unrecognizable properties of the {@link Soda}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Soda} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("Soda has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Soda} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( name != null ) + declaredFields.put("name", name); + if( brand != null ) + declaredFields.put("brand", brand); + if( quantity != null ) + declaredFields.put("quantity", quantity); + if( packaging != null ) + declaredFields.put("packaging", packaging); + if( price != null ) + declaredFields.put("price", price); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Soda} instance. If the map previously contained a mapping for the + * key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final Soda soda = (Soda) o; + return Objects.equals(this.cloudSdkCustomFields, soda.cloudSdkCustomFields) + && Objects.equals(this.name, soda.name) + && Objects.equals(this.brand, soda.brand) + && Objects.equals(this.quantity, soda.quantity) + && Objects.equals(this.packaging, soda.packaging) + && Objects.equals(this.price, soda.price); + } + + @Override + public int hashCode() + { + return Objects.hash(name, brand, quantity, packaging, price, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class Soda {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" packaging: ").append(toIndentedString(packaging)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SodaWithId.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SodaWithId.java new file mode 100644 index 000000000..efe0b425e --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SodaWithId.java @@ -0,0 +1,491 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * SodaStore API + * API for managing soda products and orders in SodaStore. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.annotations.Beta; + +/** + * SodaWithId + */ + +@Beta // CHECKSTYLE:OFF +public class SodaWithId +// CHECKSTYLE:ON +{ + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "brand" ) + private String brand; + + @JsonProperty( "quantity" ) + private Integer quantity; + + /** + * Gets or Sets packaging + */ + public enum PackagingEnum + { + /** + * The GLASS option of this SodaWithId + */ + GLASS("glass"), + + /** + * The CARTON option of this SodaWithId + */ + CARTON("carton"), + + /** + * The CAN option of this SodaWithId + */ + CAN("can"), + + /** + * The UNKNOWN_DEFAULT_OPEN_API option of this SodaWithId + */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + PackagingEnum( String value ) + { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() + { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() + { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value + * The String value + * @return The enum value of type SodaWithId + */ + @JsonCreator + @Nonnull + public static PackagingEnum fromValue( @Nonnull final String value ) + { + for( PackagingEnum b : PackagingEnum.values() ) { + if( b.value.equals(value) ) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty( "packaging" ) + private PackagingEnum packaging; + + @JsonProperty( "price" ) + private Float price; + + @JsonProperty( "id" ) + private Long id; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Default constructor for SodaWithId. + */ + protected SodaWithId() + { + } + + /** + * Set the name of this {@link SodaWithId} instance and return the same instance. + * + * @param name + * The name of this {@link SodaWithId} + * @return The same instance of this {@link SodaWithId} class + */ + @Nonnull + public SodaWithId name( @Nonnull final String name ) + { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name The name of this {@link SodaWithId} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link SodaWithId} instance. + * + * @param name + * The name of this {@link SodaWithId} + */ + public void setName( @Nonnull final String name ) + { + this.name = name; + } + + /** + * Set the brand of this {@link SodaWithId} instance and return the same instance. + * + * @param brand + * The brand of this {@link SodaWithId} + * @return The same instance of this {@link SodaWithId} class + */ + @Nonnull + public SodaWithId brand( @Nonnull final String brand ) + { + this.brand = brand; + return this; + } + + /** + * Get brand + * + * @return brand The brand of this {@link SodaWithId} instance. + */ + @Nonnull + public String getBrand() + { + return brand; + } + + /** + * Set the brand of this {@link SodaWithId} instance. + * + * @param brand + * The brand of this {@link SodaWithId} + */ + public void setBrand( @Nonnull final String brand ) + { + this.brand = brand; + } + + /** + * Set the quantity of this {@link SodaWithId} instance and return the same instance. + * + * @param quantity + * The quantity of this {@link SodaWithId} + * @return The same instance of this {@link SodaWithId} class + */ + @Nonnull + public SodaWithId quantity( @Nonnull final Integer quantity ) + { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * + * @return quantity The quantity of this {@link SodaWithId} instance. + */ + @Nonnull + public Integer getQuantity() + { + return quantity; + } + + /** + * Set the quantity of this {@link SodaWithId} instance. + * + * @param quantity + * The quantity of this {@link SodaWithId} + */ + public void setQuantity( @Nonnull final Integer quantity ) + { + this.quantity = quantity; + } + + /** + * Set the packaging of this {@link SodaWithId} instance and return the same instance. + * + * @param packaging + * The packaging of this {@link SodaWithId} + * @return The same instance of this {@link SodaWithId} class + */ + @Nonnull + public SodaWithId packaging( @Nullable final PackagingEnum packaging ) + { + this.packaging = packaging; + return this; + } + + /** + * Get packaging + * + * @return packaging The packaging of this {@link SodaWithId} instance. + */ + @Nonnull + public PackagingEnum getPackaging() + { + return packaging; + } + + /** + * Set the packaging of this {@link SodaWithId} instance. + * + * @param packaging + * The packaging of this {@link SodaWithId} + */ + public void setPackaging( @Nullable final PackagingEnum packaging ) + { + this.packaging = packaging; + } + + /** + * Set the price of this {@link SodaWithId} instance and return the same instance. + * + * @param price + * The price of this {@link SodaWithId} + * @return The same instance of this {@link SodaWithId} class + */ + @Nonnull + public SodaWithId price( @Nonnull final Float price ) + { + this.price = price; + return this; + } + + /** + * Get price + * + * @return price The price of this {@link SodaWithId} instance. + */ + @Nonnull + public Float getPrice() + { + return price; + } + + /** + * Set the price of this {@link SodaWithId} instance. + * + * @param price + * The price of this {@link SodaWithId} + */ + public void setPrice( @Nonnull final Float price ) + { + this.price = price; + } + + /** + * Set the id of this {@link SodaWithId} instance and return the same instance. + * + * @param id + * The id of this {@link SodaWithId} + * @return The same instance of this {@link SodaWithId} class + */ + @Nonnull + public SodaWithId id( @Nullable final Long id ) + { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link SodaWithId} instance. + */ + @Nonnull + public Long getId() + { + return id; + } + + /** + * Set the id of this {@link SodaWithId} instance. + * + * @param id + * The id of this {@link SodaWithId} + */ + public void setId( @Nullable final Long id ) + { + this.id = id; + } + + /** + * Get the names of the unrecognizable properties of the {@link SodaWithId}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SodaWithId} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("SodaWithId has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SodaWithId} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( name != null ) + declaredFields.put("name", name); + if( brand != null ) + declaredFields.put("brand", brand); + if( quantity != null ) + declaredFields.put("quantity", quantity); + if( packaging != null ) + declaredFields.put("packaging", packaging); + if( price != null ) + declaredFields.put("price", price); + if( id != null ) + declaredFields.put("id", id); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SodaWithId} instance. If the map previously contained a mapping for + * the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final SodaWithId sodaWithId = (SodaWithId) o; + return Objects.equals(this.cloudSdkCustomFields, sodaWithId.cloudSdkCustomFields) + && Objects.equals(this.name, sodaWithId.name) + && Objects.equals(this.brand, sodaWithId.brand) + && Objects.equals(this.quantity, sodaWithId.quantity) + && Objects.equals(this.packaging, sodaWithId.packaging) + && Objects.equals(this.price, sodaWithId.price) + && Objects.equals(this.id, sodaWithId.id); + } + + @Override + public int hashCode() + { + return Objects.hash(name, brand, quantity, packaging, price, id, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class SodaWithId {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" packaging: ").append(toIndentedString(packaging)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SystemChatMessage.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SystemChatMessage.java deleted file mode 100644 index 5e9e203e2..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SystemChatMessage.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * SystemChatMessage - */ - -@Beta // CHECKSTYLE:OFF -public class SystemChatMessage implements ChatMessage -// CHECKSTYLE:ON -{ - /** - * Gets or Sets role - */ - public enum RoleEnum - { - /** - * The SYSTEM option of this SystemChatMessage - */ - SYSTEM("system"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this SystemChatMessage - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - RoleEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type SystemChatMessage - */ - @JsonCreator - @Nonnull - public static RoleEnum fromValue( @Nonnull final String value ) - { - for( RoleEnum b : RoleEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "role" ) - private RoleEnum role; - - @JsonProperty( "content" ) - private ChatMessageContent content; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for SystemChatMessage. - */ - protected SystemChatMessage() - { - } - - /** - * Set the role of this {@link SystemChatMessage} instance and return the same instance. - * - * @param role - * The role of this {@link SystemChatMessage} - * @return The same instance of this {@link SystemChatMessage} class - */ - @Nonnull - public SystemChatMessage role( @Nonnull final RoleEnum role ) - { - this.role = role; - return this; - } - - /** - * Get role - * - * @return role The role of this {@link SystemChatMessage} instance. - */ - @Nonnull - public RoleEnum getRole() - { - return role; - } - - /** - * Set the role of this {@link SystemChatMessage} instance. - * - * @param role - * The role of this {@link SystemChatMessage} - */ - public void setRole( @Nonnull final RoleEnum role ) - { - this.role = role; - } - - /** - * Set the content of this {@link SystemChatMessage} instance and return the same instance. - * - * @param content - * The content of this {@link SystemChatMessage} - * @return The same instance of this {@link SystemChatMessage} class - */ - @Nonnull - public SystemChatMessage content( @Nonnull final ChatMessageContent content ) - { - this.content = content; - return this; - } - - /** - * Get content - * - * @return content The content of this {@link SystemChatMessage} instance. - */ - @Nonnull - public ChatMessageContent getContent() - { - return content; - } - - /** - * Set the content of this {@link SystemChatMessage} instance. - * - * @param content - * The content of this {@link SystemChatMessage} - */ - public void setContent( @Nonnull final ChatMessageContent content ) - { - this.content = content; - } - - /** - * Get the names of the unrecognizable properties of the {@link SystemChatMessage}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link SystemChatMessage} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("SystemChatMessage has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link SystemChatMessage} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( role != null ) - declaredFields.put("role", role); - if( content != null ) - declaredFields.put("content", content); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link SystemChatMessage} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final SystemChatMessage systemChatMessage = (SystemChatMessage) o; - return Objects.equals(this.cloudSdkCustomFields, systemChatMessage.cloudSdkCustomFields) - && Objects.equals(this.role, systemChatMessage.role) - && Objects.equals(this.content, systemChatMessage.content); - } - - @Override - public int hashCode() - { - return Objects.hash(role, content, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class SystemChatMessage {\n"); - sb.append(" role: ").append(toIndentedString(role)).append("\n"); - sb.append(" content: ").append(toIndentedString(content)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Template.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Template.java deleted file mode 100644 index 7b39b3d5a..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Template.java +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * Template - */ - -@Beta // CHECKSTYLE:OFF -public class Template implements PromptTemplatingModuleConfigPrompt -// CHECKSTYLE:ON -{ - @JsonProperty( "template" ) - private List template; - - @JsonProperty( "defaults" ) - private Map defaults = new HashMap<>(); - - @JsonProperty( "response_format" ) - private TemplateResponseFormat responseFormat; - - @JsonProperty( "tools" ) - private List tools = new ArrayList<>(); - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for Template. - */ - protected Template() - { - } - - /** - * Set the template of this {@link Template} instance and return the same instance. - * - * @param template - * A chat message array to be formatted with values from placeholder_values. Both role and content can be - * templated. If messages_history is provided, the templated messages will be appended. - * @return The same instance of this {@link Template} class - */ - @Nonnull - public Template template( @Nonnull final List template ) - { - this.template = template; - return this; - } - - /** - * Add one template instance to this {@link Template}. - * - * @param templateItem - * The template that should be added - * @return The same instance of type {@link Template} - */ - @Nonnull - public Template addTemplateItem( @Nonnull final ChatMessage templateItem ) - { - if( this.template == null ) { - this.template = new ArrayList<>(); - } - this.template.add(templateItem); - return this; - } - - /** - * A chat message array to be formatted with values from placeholder_values. Both role and content can be templated. - * If messages_history is provided, the templated messages will be appended. - * - * @return template The template of this {@link Template} instance. - */ - @Nonnull - public List getTemplate() - { - return template; - } - - /** - * Set the template of this {@link Template} instance. - * - * @param template - * A chat message array to be formatted with values from placeholder_values. Both role and content can be - * templated. If messages_history is provided, the templated messages will be appended. - */ - public void setTemplate( @Nonnull final List template ) - { - this.template = template; - } - - /** - * Set the defaults of this {@link Template} instance and return the same instance. - * - * @param defaults - * Optional default values for the template. If a parameter has no default it is required. - * @return The same instance of this {@link Template} class - */ - @Nonnull - public Template defaults( @Nullable final Map defaults ) - { - this.defaults = defaults; - return this; - } - - /** - * Put one defaults instance to this {@link Template} instance. - * - * @param key - * The String key of this defaults instance - * @param defaultsItem - * The defaults that should be added under the given key - * @return The same instance of type {@link Template} - */ - @Nonnull - public Template putdefaultsItem( @Nonnull final String key, @Nonnull final String defaultsItem ) - { - if( this.defaults == null ) { - this.defaults = new HashMap<>(); - } - this.defaults.put(key, defaultsItem); - return this; - } - - /** - * Optional default values for the template. If a parameter has no default it is required. - * - * @return defaults The defaults of this {@link Template} instance. - */ - @Nonnull - public Map getDefaults() - { - return defaults; - } - - /** - * Set the defaults of this {@link Template} instance. - * - * @param defaults - * Optional default values for the template. If a parameter has no default it is required. - */ - public void setDefaults( @Nullable final Map defaults ) - { - this.defaults = defaults; - } - - /** - * Set the responseFormat of this {@link Template} instance and return the same instance. - * - * @param responseFormat - * The responseFormat of this {@link Template} - * @return The same instance of this {@link Template} class - */ - @Nonnull - public Template responseFormat( @Nullable final TemplateResponseFormat responseFormat ) - { - this.responseFormat = responseFormat; - return this; - } - - /** - * Get responseFormat - * - * @return responseFormat The responseFormat of this {@link Template} instance. - */ - @Nonnull - public TemplateResponseFormat getResponseFormat() - { - return responseFormat; - } - - /** - * Set the responseFormat of this {@link Template} instance. - * - * @param responseFormat - * The responseFormat of this {@link Template} - */ - public void setResponseFormat( @Nullable final TemplateResponseFormat responseFormat ) - { - this.responseFormat = responseFormat; - } - - /** - * Set the tools of this {@link Template} instance and return the same instance. - * - * @param tools - * A list of tools the model may call. Used to provide a list of functions the model may generate JSON - * inputs for. This is the same as the OpenAI definition. - * @return The same instance of this {@link Template} class - */ - @Nonnull - public Template tools( @Nullable final List tools ) - { - this.tools = tools; - return this; - } - - /** - * Add one tools instance to this {@link Template}. - * - * @param toolsItem - * The tools that should be added - * @return The same instance of type {@link Template} - */ - @Nonnull - public Template addToolsItem( @Nonnull final ChatCompletionTool toolsItem ) - { - if( this.tools == null ) { - this.tools = new ArrayList<>(); - } - this.tools.add(toolsItem); - return this; - } - - /** - * A list of tools the model may call. Used to provide a list of functions the model may generate JSON inputs for. - * This is the same as the OpenAI definition. - * - * @return tools The tools of this {@link Template} instance. - */ - @Nonnull - public List getTools() - { - return tools; - } - - /** - * Set the tools of this {@link Template} instance. - * - * @param tools - * A list of tools the model may call. Used to provide a list of functions the model may generate JSON - * inputs for. This is the same as the OpenAI definition. - */ - public void setTools( @Nullable final List tools ) - { - this.tools = tools; - } - - /** - * Get the names of the unrecognizable properties of the {@link Template}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link Template} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("Template has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link Template} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( template != null ) - declaredFields.put("template", template); - if( defaults != null ) - declaredFields.put("defaults", defaults); - if( responseFormat != null ) - declaredFields.put("responseFormat", responseFormat); - if( tools != null ) - declaredFields.put("tools", tools); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link Template} instance. If the map previously contained a mapping for - * the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final Template template = (Template) o; - return Objects.equals(this.cloudSdkCustomFields, template.cloudSdkCustomFields) - && Objects.equals(this.template, template.template) - && Objects.equals(this.defaults, template.defaults) - && Objects.equals(this.responseFormat, template.responseFormat) - && Objects.equals(this.tools, template.tools); - } - - @Override - public int hashCode() - { - return Objects.hash(template, defaults, responseFormat, tools, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class Template {\n"); - sb.append(" template: ").append(toIndentedString(template)).append("\n"); - sb.append(" defaults: ").append(toIndentedString(defaults)).append("\n"); - sb.append(" responseFormat: ").append(toIndentedString(responseFormat)).append("\n"); - sb.append(" tools: ").append(toIndentedString(tools)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRef.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRef.java deleted file mode 100644 index 52cc602df..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRef.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * TemplateRef - */ - -@Beta // CHECKSTYLE:OFF -public class TemplateRef implements PromptTemplatingModuleConfigPrompt -// CHECKSTYLE:ON -{ - @JsonProperty( "template_ref" ) - private TemplateRefTemplateRef templateRef; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for TemplateRef. - */ - protected TemplateRef() - { - } - - /** - * Set the templateRef of this {@link TemplateRef} instance and return the same instance. - * - * @param templateRef - * The templateRef of this {@link TemplateRef} - * @return The same instance of this {@link TemplateRef} class - */ - @Nonnull - public TemplateRef templateRef( @Nonnull final TemplateRefTemplateRef templateRef ) - { - this.templateRef = templateRef; - return this; - } - - /** - * Get templateRef - * - * @return templateRef The templateRef of this {@link TemplateRef} instance. - */ - @Nonnull - public TemplateRefTemplateRef getTemplateRef() - { - return templateRef; - } - - /** - * Set the templateRef of this {@link TemplateRef} instance. - * - * @param templateRef - * The templateRef of this {@link TemplateRef} - */ - public void setTemplateRef( @Nonnull final TemplateRefTemplateRef templateRef ) - { - this.templateRef = templateRef; - } - - /** - * Get the names of the unrecognizable properties of the {@link TemplateRef}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link TemplateRef} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("TemplateRef has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link TemplateRef} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( templateRef != null ) - declaredFields.put("templateRef", templateRef); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link TemplateRef} instance. If the map previously contained a mapping - * for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final TemplateRef templateRef = (TemplateRef) o; - return Objects.equals(this.cloudSdkCustomFields, templateRef.cloudSdkCustomFields) - && Objects.equals(this.templateRef, templateRef.templateRef); - } - - @Override - public int hashCode() - { - return Objects.hash(templateRef, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class TemplateRef {\n"); - sb.append(" templateRef: ").append(toIndentedString(templateRef)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefByID.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefByID.java deleted file mode 100644 index 31764a273..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefByID.java +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * TemplateRefByID - */ - -@Beta // CHECKSTYLE:OFF -public class TemplateRefByID implements TemplateRefTemplateRef -// CHECKSTYLE:ON -{ - @JsonProperty( "id" ) - private String id; - - /** - * Defines the scope that is searched for the referenced template. 'tenant' indicates the template is shared - * across all resource groups within the tenant, while 'resource_group' indicates the template is only - * accessible within the specific resource group. - */ - public enum ScopeEnum - { - /** - * The RESOURCE_GROUP option of this TemplateRefByID - */ - RESOURCE_GROUP("resource_group"), - - /** - * The TENANT option of this TemplateRefByID - */ - TENANT("tenant"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this TemplateRefByID - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - ScopeEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type TemplateRefByID - */ - @JsonCreator - @Nonnull - public static ScopeEnum fromValue( @Nonnull final String value ) - { - for( ScopeEnum b : ScopeEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "scope" ) - private ScopeEnum scope = ScopeEnum.TENANT; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for TemplateRefByID. - */ - protected TemplateRefByID() - { - } - - /** - * Set the id of this {@link TemplateRefByID} instance and return the same instance. - * - * @param id - * ID of the template in prompt registry - * @return The same instance of this {@link TemplateRefByID} class - */ - @Nonnull - public TemplateRefByID id( @Nonnull final String id ) - { - this.id = id; - return this; - } - - /** - * ID of the template in prompt registry - * - * @return id The id of this {@link TemplateRefByID} instance. - */ - @Nonnull - public String getId() - { - return id; - } - - /** - * Set the id of this {@link TemplateRefByID} instance. - * - * @param id - * ID of the template in prompt registry - */ - public void setId( @Nonnull final String id ) - { - this.id = id; - } - - /** - * Set the scope of this {@link TemplateRefByID} instance and return the same instance. - * - * @param scope - * Defines the scope that is searched for the referenced template. 'tenant' indicates the - * template is shared across all resource groups within the tenant, while 'resource_group' - * indicates the template is only accessible within the specific resource group. - * @return The same instance of this {@link TemplateRefByID} class - */ - @Nonnull - public TemplateRefByID scope( @Nullable final ScopeEnum scope ) - { - this.scope = scope; - return this; - } - - /** - * Defines the scope that is searched for the referenced template. 'tenant' indicates the template is shared - * across all resource groups within the tenant, while 'resource_group' indicates the template is only - * accessible within the specific resource group. - * - * @return scope The scope of this {@link TemplateRefByID} instance. - */ - @Nonnull - public ScopeEnum getScope() - { - return scope; - } - - /** - * Set the scope of this {@link TemplateRefByID} instance. - * - * @param scope - * Defines the scope that is searched for the referenced template. 'tenant' indicates the - * template is shared across all resource groups within the tenant, while 'resource_group' - * indicates the template is only accessible within the specific resource group. - */ - public void setScope( @Nullable final ScopeEnum scope ) - { - this.scope = scope; - } - - /** - * Get the names of the unrecognizable properties of the {@link TemplateRefByID}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link TemplateRefByID} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("TemplateRefByID has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link TemplateRefByID} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( id != null ) - declaredFields.put("id", id); - if( scope != null ) - declaredFields.put("scope", scope); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link TemplateRefByID} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final TemplateRefByID templateRefByID = (TemplateRefByID) o; - return Objects.equals(this.cloudSdkCustomFields, templateRefByID.cloudSdkCustomFields) - && Objects.equals(this.id, templateRefByID.id) - && Objects.equals(this.scope, templateRefByID.scope); - } - - @Override - public int hashCode() - { - return Objects.hash(id, scope, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class TemplateRefByID {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefByScenarioNameVersion.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefByScenarioNameVersion.java deleted file mode 100644 index 67ff64d40..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefByScenarioNameVersion.java +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * TemplateRefByScenarioNameVersion - */ - -@Beta // CHECKSTYLE:OFF -public class TemplateRefByScenarioNameVersion implements TemplateRefTemplateRef -// CHECKSTYLE:ON -{ - @JsonProperty( "scenario" ) - private String scenario; - - @JsonProperty( "name" ) - private String name; - - @JsonProperty( "version" ) - private String version; - - /** - * Defines the scope that is searched for the referenced template. 'tenant' indicates the template is shared - * across all resource groups within the tenant, while 'resource_group' indicates the template is only - * accessible within the specific resource group. - */ - public enum ScopeEnum - { - /** - * The RESOURCE_GROUP option of this TemplateRefByScenarioNameVersion - */ - RESOURCE_GROUP("resource_group"), - - /** - * The TENANT option of this TemplateRefByScenarioNameVersion - */ - TENANT("tenant"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this TemplateRefByScenarioNameVersion - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - ScopeEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type TemplateRefByScenarioNameVersion - */ - @JsonCreator - @Nonnull - public static ScopeEnum fromValue( @Nonnull final String value ) - { - for( ScopeEnum b : ScopeEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "scope" ) - private ScopeEnum scope = ScopeEnum.TENANT; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for TemplateRefByScenarioNameVersion. - */ - protected TemplateRefByScenarioNameVersion() - { - } - - /** - * Set the scenario of this {@link TemplateRefByScenarioNameVersion} instance and return the same instance. - * - * @param scenario - * Scenario name - * @return The same instance of this {@link TemplateRefByScenarioNameVersion} class - */ - @Nonnull - public TemplateRefByScenarioNameVersion scenario( @Nonnull final String scenario ) - { - this.scenario = scenario; - return this; - } - - /** - * Scenario name - * - * @return scenario The scenario of this {@link TemplateRefByScenarioNameVersion} instance. - */ - @Nonnull - public String getScenario() - { - return scenario; - } - - /** - * Set the scenario of this {@link TemplateRefByScenarioNameVersion} instance. - * - * @param scenario - * Scenario name - */ - public void setScenario( @Nonnull final String scenario ) - { - this.scenario = scenario; - } - - /** - * Set the name of this {@link TemplateRefByScenarioNameVersion} instance and return the same instance. - * - * @param name - * Name of the template - * @return The same instance of this {@link TemplateRefByScenarioNameVersion} class - */ - @Nonnull - public TemplateRefByScenarioNameVersion name( @Nonnull final String name ) - { - this.name = name; - return this; - } - - /** - * Name of the template - * - * @return name The name of this {@link TemplateRefByScenarioNameVersion} instance. - */ - @Nonnull - public String getName() - { - return name; - } - - /** - * Set the name of this {@link TemplateRefByScenarioNameVersion} instance. - * - * @param name - * Name of the template - */ - public void setName( @Nonnull final String name ) - { - this.name = name; - } - - /** - * Set the version of this {@link TemplateRefByScenarioNameVersion} instance and return the same instance. - * - * @param version - * Version of the template - * @return The same instance of this {@link TemplateRefByScenarioNameVersion} class - */ - @Nonnull - public TemplateRefByScenarioNameVersion version( @Nonnull final String version ) - { - this.version = version; - return this; - } - - /** - * Version of the template - * - * @return version The version of this {@link TemplateRefByScenarioNameVersion} instance. - */ - @Nonnull - public String getVersion() - { - return version; - } - - /** - * Set the version of this {@link TemplateRefByScenarioNameVersion} instance. - * - * @param version - * Version of the template - */ - public void setVersion( @Nonnull final String version ) - { - this.version = version; - } - - /** - * Set the scope of this {@link TemplateRefByScenarioNameVersion} instance and return the same instance. - * - * @param scope - * Defines the scope that is searched for the referenced template. 'tenant' indicates the - * template is shared across all resource groups within the tenant, while 'resource_group' - * indicates the template is only accessible within the specific resource group. - * @return The same instance of this {@link TemplateRefByScenarioNameVersion} class - */ - @Nonnull - public TemplateRefByScenarioNameVersion scope( @Nullable final ScopeEnum scope ) - { - this.scope = scope; - return this; - } - - /** - * Defines the scope that is searched for the referenced template. 'tenant' indicates the template is shared - * across all resource groups within the tenant, while 'resource_group' indicates the template is only - * accessible within the specific resource group. - * - * @return scope The scope of this {@link TemplateRefByScenarioNameVersion} instance. - */ - @Nonnull - public ScopeEnum getScope() - { - return scope; - } - - /** - * Set the scope of this {@link TemplateRefByScenarioNameVersion} instance. - * - * @param scope - * Defines the scope that is searched for the referenced template. 'tenant' indicates the - * template is shared across all resource groups within the tenant, while 'resource_group' - * indicates the template is only accessible within the specific resource group. - */ - public void setScope( @Nullable final ScopeEnum scope ) - { - this.scope = scope; - } - - /** - * Get the names of the unrecognizable properties of the {@link TemplateRefByScenarioNameVersion}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link TemplateRefByScenarioNameVersion} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("TemplateRefByScenarioNameVersion has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link TemplateRefByScenarioNameVersion} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( scenario != null ) - declaredFields.put("scenario", scenario); - if( name != null ) - declaredFields.put("name", name); - if( version != null ) - declaredFields.put("version", version); - if( scope != null ) - declaredFields.put("scope", scope); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link TemplateRefByScenarioNameVersion} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final TemplateRefByScenarioNameVersion templateRefByScenarioNameVersion = (TemplateRefByScenarioNameVersion) o; - return Objects.equals(this.cloudSdkCustomFields, templateRefByScenarioNameVersion.cloudSdkCustomFields) - && Objects.equals(this.scenario, templateRefByScenarioNameVersion.scenario) - && Objects.equals(this.name, templateRefByScenarioNameVersion.name) - && Objects.equals(this.version, templateRefByScenarioNameVersion.version) - && Objects.equals(this.scope, templateRefByScenarioNameVersion.scope); - } - - @Override - public int hashCode() - { - return Objects.hash(scenario, name, version, scope, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class TemplateRefByScenarioNameVersion {\n"); - sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefTemplateRef.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefTemplateRef.java deleted file mode 100644 index d9831432d..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateRefTemplateRef.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.google.common.annotations.Beta; - -/** - * Reference to a template in the prompt registry by ID or by scenario, name and version - */ -@Beta -@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) -@JsonSubTypes( { - @JsonSubTypes.Type( value = TemplateRefByID.class ), - @JsonSubTypes.Type( value = TemplateRefByScenarioNameVersion.class ), } ) - -public interface TemplateRefTemplateRef -{ -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateResponseFormat.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateResponseFormat.java deleted file mode 100644 index 205025c94..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TemplateResponseFormat.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.google.common.annotations.Beta; - -/** - * Response format that the model output should adhere to. This is the same as the OpenAI definition. - */ -@Beta -@JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) -@JsonSubTypes( { - @JsonSubTypes.Type( value = ResponseFormatJsonObject.class ), - @JsonSubTypes.Type( value = ResponseFormatJsonSchema.class ), - @JsonSubTypes.Type( value = ResponseFormatText.class ), } ) - -public interface TemplateResponseFormat -{ -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TextContent.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TextContent.java deleted file mode 100644 index 96480f22f..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TextContent.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * TextContent - */ - -@Beta // CHECKSTYLE:OFF -public class TextContent implements MultiChatContent -// CHECKSTYLE:ON -{ - /** - * Gets or Sets type - */ - public enum TypeEnum - { - /** - * The TEXT option of this TextContent - */ - TEXT("text"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this TextContent - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type TextContent - */ - @JsonCreator - @Nonnull - public static TypeEnum fromValue( @Nonnull final String value ) - { - for( TypeEnum b : TypeEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "type" ) - private TypeEnum type; - - @JsonProperty( "text" ) - private String text; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for TextContent. - */ - protected TextContent() - { - } - - /** - * Set the type of this {@link TextContent} instance and return the same instance. - * - * @param type - * The type of this {@link TextContent} - * @return The same instance of this {@link TextContent} class - */ - @Nonnull - public TextContent type( @Nonnull final TypeEnum type ) - { - this.type = type; - return this; - } - - /** - * Get type - * - * @return type The type of this {@link TextContent} instance. - */ - @Nonnull - public TypeEnum getType() - { - return type; - } - - /** - * Set the type of this {@link TextContent} instance. - * - * @param type - * The type of this {@link TextContent} - */ - public void setType( @Nonnull final TypeEnum type ) - { - this.type = type; - } - - /** - * Set the text of this {@link TextContent} instance and return the same instance. - * - * @param text - * The text of this {@link TextContent} - * @return The same instance of this {@link TextContent} class - */ - @Nonnull - public TextContent text( @Nonnull final String text ) - { - this.text = text; - return this; - } - - /** - * Get text - * - * @return text The text of this {@link TextContent} instance. - */ - @Nonnull - public String getText() - { - return text; - } - - /** - * Set the text of this {@link TextContent} instance. - * - * @param text - * The text of this {@link TextContent} - */ - public void setText( @Nonnull final String text ) - { - this.text = text; - } - - /** - * Get the names of the unrecognizable properties of the {@link TextContent}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link TextContent} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("TextContent has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link TextContent} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( type != null ) - declaredFields.put("type", type); - if( text != null ) - declaredFields.put("text", text); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link TextContent} instance. If the map previously contained a mapping - * for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final TextContent textContent = (TextContent) o; - return Objects.equals(this.cloudSdkCustomFields, textContent.cloudSdkCustomFields) - && Objects.equals(this.type, textContent.type) - && Objects.equals(this.text, textContent.text); - } - - @Override - public int hashCode() - { - return Objects.hash(type, text, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class TextContent {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" text: ").append(toIndentedString(text)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ToolChatMessage.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ToolChatMessage.java deleted file mode 100644 index 585e72ad4..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ToolChatMessage.java +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * ToolChatMessage - */ - -@Beta // CHECKSTYLE:OFF -public class ToolChatMessage implements ChatMessage -// CHECKSTYLE:ON -{ - /** - * Gets or Sets role - */ - public enum RoleEnum - { - /** - * The TOOL option of this ToolChatMessage - */ - TOOL("tool"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this ToolChatMessage - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - RoleEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type ToolChatMessage - */ - @JsonCreator - @Nonnull - public static RoleEnum fromValue( @Nonnull final String value ) - { - for( RoleEnum b : RoleEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "role" ) - private RoleEnum role; - - @JsonProperty( "tool_call_id" ) - private String toolCallId; - - @JsonProperty( "content" ) - private ChatMessageContent content; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for ToolChatMessage. - */ - protected ToolChatMessage() - { - } - - /** - * Set the role of this {@link ToolChatMessage} instance and return the same instance. - * - * @param role - * The role of this {@link ToolChatMessage} - * @return The same instance of this {@link ToolChatMessage} class - */ - @Nonnull - public ToolChatMessage role( @Nonnull final RoleEnum role ) - { - this.role = role; - return this; - } - - /** - * Get role - * - * @return role The role of this {@link ToolChatMessage} instance. - */ - @Nonnull - public RoleEnum getRole() - { - return role; - } - - /** - * Set the role of this {@link ToolChatMessage} instance. - * - * @param role - * The role of this {@link ToolChatMessage} - */ - public void setRole( @Nonnull final RoleEnum role ) - { - this.role = role; - } - - /** - * Set the toolCallId of this {@link ToolChatMessage} instance and return the same instance. - * - * @param toolCallId - * The toolCallId of this {@link ToolChatMessage} - * @return The same instance of this {@link ToolChatMessage} class - */ - @Nonnull - public ToolChatMessage toolCallId( @Nonnull final String toolCallId ) - { - this.toolCallId = toolCallId; - return this; - } - - /** - * Get toolCallId - * - * @return toolCallId The toolCallId of this {@link ToolChatMessage} instance. - */ - @Nonnull - public String getToolCallId() - { - return toolCallId; - } - - /** - * Set the toolCallId of this {@link ToolChatMessage} instance. - * - * @param toolCallId - * The toolCallId of this {@link ToolChatMessage} - */ - public void setToolCallId( @Nonnull final String toolCallId ) - { - this.toolCallId = toolCallId; - } - - /** - * Set the content of this {@link ToolChatMessage} instance and return the same instance. - * - * @param content - * The content of this {@link ToolChatMessage} - * @return The same instance of this {@link ToolChatMessage} class - */ - @Nonnull - public ToolChatMessage content( @Nonnull final ChatMessageContent content ) - { - this.content = content; - return this; - } - - /** - * Get content - * - * @return content The content of this {@link ToolChatMessage} instance. - */ - @Nonnull - public ChatMessageContent getContent() - { - return content; - } - - /** - * Set the content of this {@link ToolChatMessage} instance. - * - * @param content - * The content of this {@link ToolChatMessage} - */ - public void setContent( @Nonnull final ChatMessageContent content ) - { - this.content = content; - } - - /** - * Get the names of the unrecognizable properties of the {@link ToolChatMessage}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link ToolChatMessage} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("ToolChatMessage has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link ToolChatMessage} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( role != null ) - declaredFields.put("role", role); - if( toolCallId != null ) - declaredFields.put("toolCallId", toolCallId); - if( content != null ) - declaredFields.put("content", content); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link ToolChatMessage} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final ToolChatMessage toolChatMessage = (ToolChatMessage) o; - return Objects.equals(this.cloudSdkCustomFields, toolChatMessage.cloudSdkCustomFields) - && Objects.equals(this.role, toolChatMessage.role) - && Objects.equals(this.toolCallId, toolChatMessage.toolCallId) - && Objects.equals(this.content, toolChatMessage.content); - } - - @Override - public int hashCode() - { - return Objects.hash(role, toolCallId, content, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class ToolChatMessage {\n"); - sb.append(" role: ").append(toIndentedString(role)).append("\n"); - sb.append(" toolCallId: ").append(toIndentedString(toolCallId)).append("\n"); - sb.append(" content: ").append(toIndentedString(content)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TranslationModuleConfig.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TranslationModuleConfig.java deleted file mode 100644 index 4c0723b27..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/TranslationModuleConfig.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; - -/** - * Configuration for translation module - */ - -@Beta // CHECKSTYLE:OFF -public class TranslationModuleConfig -// CHECKSTYLE:ON -{ - @JsonProperty( "input" ) - private SAPDocumentTranslationInput input; - - @JsonProperty( "output" ) - private SAPDocumentTranslationOutput output; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for TranslationModuleConfig. - */ - protected TranslationModuleConfig() - { - } - - /** - * Set the input of this {@link TranslationModuleConfig} instance and return the same instance. - * - * @param input - * The input of this {@link TranslationModuleConfig} - * @return The same instance of this {@link TranslationModuleConfig} class - */ - @Nonnull - public TranslationModuleConfig input( @Nullable final SAPDocumentTranslationInput input ) - { - this.input = input; - return this; - } - - /** - * Get input - * - * @return input The input of this {@link TranslationModuleConfig} instance. - */ - @Nonnull - public SAPDocumentTranslationInput getInput() - { - return input; - } - - /** - * Set the input of this {@link TranslationModuleConfig} instance. - * - * @param input - * The input of this {@link TranslationModuleConfig} - */ - public void setInput( @Nullable final SAPDocumentTranslationInput input ) - { - this.input = input; - } - - /** - * Set the output of this {@link TranslationModuleConfig} instance and return the same instance. - * - * @param output - * The output of this {@link TranslationModuleConfig} - * @return The same instance of this {@link TranslationModuleConfig} class - */ - @Nonnull - public TranslationModuleConfig output( @Nullable final SAPDocumentTranslationOutput output ) - { - this.output = output; - return this; - } - - /** - * Get output - * - * @return output The output of this {@link TranslationModuleConfig} instance. - */ - @Nonnull - public SAPDocumentTranslationOutput getOutput() - { - return output; - } - - /** - * Set the output of this {@link TranslationModuleConfig} instance. - * - * @param output - * The output of this {@link TranslationModuleConfig} - */ - public void setOutput( @Nullable final SAPDocumentTranslationOutput output ) - { - this.output = output; - } - - /** - * Get the names of the unrecognizable properties of the {@link TranslationModuleConfig}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link TranslationModuleConfig} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("TranslationModuleConfig has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link TranslationModuleConfig} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( input != null ) - declaredFields.put("input", input); - if( output != null ) - declaredFields.put("output", output); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link TranslationModuleConfig} instance. If the map previously contained - * a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final TranslationModuleConfig translationModuleConfig = (TranslationModuleConfig) o; - return Objects.equals(this.cloudSdkCustomFields, translationModuleConfig.cloudSdkCustomFields) - && Objects.equals(this.input, translationModuleConfig.input) - && Objects.equals(this.output, translationModuleConfig.output); - } - - @Override - public int hashCode() - { - return Objects.hash(input, output, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class TranslationModuleConfig {\n"); - sb.append(" input: ").append(toIndentedString(input)).append("\n"); - sb.append(" output: ").append(toIndentedString(output)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessage.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessage.java deleted file mode 100644 index 3d99d01a6..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessage.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * UserChatMessage - */ - -@Beta // CHECKSTYLE:OFF -public class UserChatMessage implements ChatMessage -// CHECKSTYLE:ON -{ - @JsonProperty( "content" ) - private UserChatMessageContent content; - - /** - * Gets or Sets role - */ - public enum RoleEnum - { - /** - * The USER option of this UserChatMessage - */ - USER("user"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this UserChatMessage - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - RoleEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type UserChatMessage - */ - @JsonCreator - @Nonnull - public static RoleEnum fromValue( @Nonnull final String value ) - { - for( RoleEnum b : RoleEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "role" ) - private RoleEnum role; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for UserChatMessage. - */ - protected UserChatMessage() - { - } - - /** - * Set the content of this {@link UserChatMessage} instance and return the same instance. - * - * @param content - * The content of this {@link UserChatMessage} - * @return The same instance of this {@link UserChatMessage} class - */ - @Nonnull - public UserChatMessage content( @Nonnull final UserChatMessageContent content ) - { - this.content = content; - return this; - } - - /** - * Get content - * - * @return content The content of this {@link UserChatMessage} instance. - */ - @Nonnull - public UserChatMessageContent getContent() - { - return content; - } - - /** - * Set the content of this {@link UserChatMessage} instance. - * - * @param content - * The content of this {@link UserChatMessage} - */ - public void setContent( @Nonnull final UserChatMessageContent content ) - { - this.content = content; - } - - /** - * Set the role of this {@link UserChatMessage} instance and return the same instance. - * - * @param role - * The role of this {@link UserChatMessage} - * @return The same instance of this {@link UserChatMessage} class - */ - @Nonnull - public UserChatMessage role( @Nonnull final RoleEnum role ) - { - this.role = role; - return this; - } - - /** - * Get role - * - * @return role The role of this {@link UserChatMessage} instance. - */ - @Nonnull - public RoleEnum getRole() - { - return role; - } - - /** - * Set the role of this {@link UserChatMessage} instance. - * - * @param role - * The role of this {@link UserChatMessage} - */ - public void setRole( @Nonnull final RoleEnum role ) - { - this.role = role; - } - - /** - * Get the names of the unrecognizable properties of the {@link UserChatMessage}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link UserChatMessage} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("UserChatMessage has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link UserChatMessage} instance including unrecognized properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( content != null ) - declaredFields.put("content", content); - if( role != null ) - declaredFields.put("role", role); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link UserChatMessage} instance. If the map previously contained a - * mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final UserChatMessage userChatMessage = (UserChatMessage) o; - return Objects.equals(this.cloudSdkCustomFields, userChatMessage.cloudSdkCustomFields) - && Objects.equals(this.content, userChatMessage.content) - && Objects.equals(this.role, userChatMessage.role); - } - - @Override - public int hashCode() - { - return Objects.hash(content, role, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class UserChatMessage {\n"); - sb.append(" content: ").append(toIndentedString(content)).append("\n"); - sb.append(" role: ").append(toIndentedString(role)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessageContentItem.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessageContentItem.java deleted file mode 100644 index d9730e468..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/UserChatMessageContentItem.java +++ /dev/null @@ -1,358 +0,0 @@ -/* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. - */ - -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; - -/** - * UserChatMessageContentItem - */ - -@Beta // CHECKSTYLE:OFF -public class UserChatMessageContentItem -// CHECKSTYLE:ON -{ - /** - * Gets or Sets type - */ - public enum TypeEnum - { - /** - * The TEXT option of this UserChatMessageContentItem - */ - TEXT("text"), - - /** - * The IMAGE_URL option of this UserChatMessageContentItem - */ - IMAGE_URL("image_url"), - - /** - * The UNKNOWN_DEFAULT_OPEN_API option of this UserChatMessageContentItem - */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - TypeEnum( String value ) - { - this.value = value; - } - - /** - * Get the value of the enum - * - * @return The enum value - */ - @JsonValue - @Nonnull - public String getValue() - { - return value; - } - - /** - * Get the String value of the enum value. - * - * @return The enum value as String - */ - @Override - @Nonnull - public String toString() - { - return String.valueOf(value); - } - - /** - * Get the enum value from a String value - * - * @param value - * The String value - * @return The enum value of type UserChatMessageContentItem - */ - @JsonCreator - @Nonnull - public static TypeEnum fromValue( @Nonnull final String value ) - { - for( TypeEnum b : TypeEnum.values() ) { - if( b.value.equals(value) ) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - @JsonProperty( "type" ) - private TypeEnum type; - - @JsonProperty( "text" ) - private String text; - - @JsonProperty( "image_url" ) - private ImageContentUrl imageUrl; - - @JsonAnySetter - @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** - * Default constructor for UserChatMessageContentItem. - */ - protected UserChatMessageContentItem() - { - } - - /** - * Set the type of this {@link UserChatMessageContentItem} instance and return the same instance. - * - * @param type - * The type of this {@link UserChatMessageContentItem} - * @return The same instance of this {@link UserChatMessageContentItem} class - */ - @Nonnull - public UserChatMessageContentItem type( @Nonnull final TypeEnum type ) - { - this.type = type; - return this; - } - - /** - * Get type - * - * @return type The type of this {@link UserChatMessageContentItem} instance. - */ - @Nonnull - public TypeEnum getType() - { - return type; - } - - /** - * Set the type of this {@link UserChatMessageContentItem} instance. - * - * @param type - * The type of this {@link UserChatMessageContentItem} - */ - public void setType( @Nonnull final TypeEnum type ) - { - this.type = type; - } - - /** - * Set the text of this {@link UserChatMessageContentItem} instance and return the same instance. - * - * @param text - * The text of this {@link UserChatMessageContentItem} - * @return The same instance of this {@link UserChatMessageContentItem} class - */ - @Nonnull - public UserChatMessageContentItem text( @Nullable final String text ) - { - this.text = text; - return this; - } - - /** - * Get text - * - * @return text The text of this {@link UserChatMessageContentItem} instance. - */ - @Nonnull - public String getText() - { - return text; - } - - /** - * Set the text of this {@link UserChatMessageContentItem} instance. - * - * @param text - * The text of this {@link UserChatMessageContentItem} - */ - public void setText( @Nullable final String text ) - { - this.text = text; - } - - /** - * Set the imageUrl of this {@link UserChatMessageContentItem} instance and return the same instance. - * - * @param imageUrl - * The imageUrl of this {@link UserChatMessageContentItem} - * @return The same instance of this {@link UserChatMessageContentItem} class - */ - @Nonnull - public UserChatMessageContentItem imageUrl( @Nullable final ImageContentUrl imageUrl ) - { - this.imageUrl = imageUrl; - return this; - } - - /** - * Get imageUrl - * - * @return imageUrl The imageUrl of this {@link UserChatMessageContentItem} instance. - */ - @Nonnull - public ImageContentUrl getImageUrl() - { - return imageUrl; - } - - /** - * Set the imageUrl of this {@link UserChatMessageContentItem} instance. - * - * @param imageUrl - * The imageUrl of this {@link UserChatMessageContentItem} - */ - public void setImageUrl( @Nullable final ImageContentUrl imageUrl ) - { - this.imageUrl = imageUrl; - } - - /** - * Get the names of the unrecognizable properties of the {@link UserChatMessageContentItem}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() - { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link UserChatMessageContentItem} instance. - * - * @deprecated Use {@link #toMap()} instead. - * @param name - * The name of the property - * @return The value of the property - * @throws NoSuchElementException - * If no property with the given name could be found. - */ - @Nullable - @Deprecated - public Object getCustomField( @Nonnull final String name ) - throws NoSuchElementException - { - if( !cloudSdkCustomFields.containsKey(name) ) { - throw new NoSuchElementException("UserChatMessageContentItem has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link UserChatMessageContentItem} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() - { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if( type != null ) - declaredFields.put("type", type); - if( text != null ) - declaredFields.put("text", text); - if( imageUrl != null ) - declaredFields.put("imageUrl", imageUrl); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link UserChatMessageContentItem} instance. If the map previously - * contained a mapping for the key, the old value is replaced by the specified value. - * - * @param customFieldName - * The name of the property - * @param customFieldValue - * The value of the property - */ - @JsonIgnore - public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) - { - cloudSdkCustomFields.put(customFieldName, customFieldValue); - } - - @Override - public boolean equals( @Nullable final java.lang.Object o ) - { - if( this == o ) { - return true; - } - if( o == null || getClass() != o.getClass() ) { - return false; - } - final UserChatMessageContentItem userChatMessageContentItem = (UserChatMessageContentItem) o; - return Objects.equals(this.cloudSdkCustomFields, userChatMessageContentItem.cloudSdkCustomFields) - && Objects.equals(this.type, userChatMessageContentItem.type) - && Objects.equals(this.text, userChatMessageContentItem.text) - && Objects.equals(this.imageUrl, userChatMessageContentItem.imageUrl); - } - - @Override - public int hashCode() - { - return Objects.hash(type, text, imageUrl, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append("class UserChatMessageContentItem {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" text: ").append(toIndentedString(text)).append("\n"); - sb.append(" imageUrl: ").append(toIndentedString(imageUrl)).append("\n"); - cloudSdkCustomFields - .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString( final java.lang.Object o ) - { - if( o == null ) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/resources/prompt-registry.yaml b/datamodel/openapi/openapi-api-apache-sample/src/main/resources/prompt-registry.yaml deleted file mode 100644 index dc137966e..000000000 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/resources/prompt-registry.yaml +++ /dev/null @@ -1,2026 +0,0 @@ -openapi: 3.0.0 -info: - version: 0.0.1 - title: Prompt Registry API - description: Prompt Storage service for Design time & Runtime prompt templates. -tags: - - name: prompt templates - description: Tag for prompt templates operations - - name: orchestration configs - description: Tag for orchestration configs operations -paths: - /lm/promptTemplates: - post: - operationId: registry.controller.prompt_controller.create_update_prompt_template - x-sap-cloud-sdk-operation-name: createUpdatePromptTemplate - description: Create or update a prompt template - tags: - - prompt templates - parameters: - - $ref: '#/components/parameters/ai-resource-group' - - $ref: '#/components/parameters/ai-resource-group-scope' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/PromptTemplatePostRequest' - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/PromptTemplatePostResponse' - '400': - $ref: '#/components/responses/BadRequest' - '403': - $ref: '#/components/responses/ForbiddenError' - default: - $ref: '#/components/responses/CommonError' - get: - operationId: registry.controller.prompt_controller.list_prompt_templates - x-sap-cloud-sdk-operation-name: listPromptTemplates - description: List prompt templates - tags: - - prompt templates - parameters: - - $ref: '#/components/parameters/ai-resource-group' - - $ref: '#/components/parameters/ai-resource-group-scope' - - name: scenario - in: query - schema: - type: string - - name: name - in: query - schema: - type: string - - name: version - in: query - schema: - type: string - - name: retrieve - in: query - schema: - type: string - default: both - - name: includeSpec - in: query - schema: - type: boolean - default: false - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/PromptTemplateListResponse' - '400': - $ref: '#/components/responses/BadRequest' - '403': - $ref: '#/components/responses/ForbiddenError' - default: - $ref: '#/components/responses/CommonError' - /lm/scenarios/{scenario}/promptTemplates/{name}/versions/{version}/history: - get: - operationId: registry.controller.prompt_controller.list_prompt_template_history - x-sap-cloud-sdk-operation-name: listPromptTemplateHistory - description: List prompt template history - tags: - - prompt templates - parameters: - - $ref: '#/components/parameters/ai-resource-group' - - $ref: '#/components/parameters/ai-resource-group-scope' - - name: scenario - in: path - required: true - schema: - type: string - - name: version - in: path - required: true - schema: - type: string - - name: name - in: path - required: true - schema: - type: string - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/PromptTemplateListResponse' - '400': - $ref: '#/components/responses/BadRequest' - '403': - $ref: '#/components/responses/ForbiddenError' - default: - $ref: '#/components/responses/CommonError' - /lm/promptTemplates/{promptTemplateId}: - get: - operationId: registry.controller.prompt_controller.get_prompt_template_by_uuid - x-sap-cloud-sdk-operation-name: getPromptTemplateByUuid - description: Get prompt template by UUID - tags: - - prompt templates - parameters: - - $ref: '#/components/parameters/ai-resource-group' - - $ref: '#/components/parameters/ai-resource-group-scope' - - name: promptTemplateId - in: path - required: true - schema: - type: string - format: uuid - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/PromptTemplateGetResponse' - '400': - $ref: '#/components/responses/BadRequest' - '403': - $ref: '#/components/responses/ForbiddenError' - default: - $ref: '#/components/responses/CommonError' - delete: - operationId: registry.controller.prompt_controller.delete_prompt_template - x-sap-cloud-sdk-operation-name: deletePromptTemplate - description: Delete prompt template - tags: - - prompt templates - parameters: - - $ref: '#/components/parameters/ai-resource-group' - - $ref: '#/components/parameters/ai-resource-group-scope' - - name: promptTemplateId - in: path - required: true - schema: - type: string - format: uuid - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/PromptTemplateDeleteResponse' - '403': - $ref: '#/components/responses/ForbiddenError' - '404': - $ref: '#/components/responses/NotFound' - default: - $ref: '#/components/responses/CommonError' - /lm/promptTemplates/import: - post: - operationId: registry.controller.prompt_controller.import_prompt_template - x-sap-cloud-sdk-operation-name: importPromptTemplate - description: Import prompt template - tags: - - prompt templates - parameters: - - $ref: '#/components/parameters/ai-resource-group' - - $ref: '#/components/parameters/ai-resource-group-scope' - requestBody: - content: - multipart/form-data: - schema: - type: object - properties: - file: - type: string - format: binary - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/PromptTemplatePostResponse' - '400': - $ref: '#/components/responses/BadRequest' - default: - $ref: '#/components/responses/CommonError' - /lm/promptTemplates/{promptTemplateId}/export: - get: - operationId: registry.controller.prompt_controller.export_prompt_template - x-sap-cloud-sdk-operation-name: exportPromptTemplate - description: Export prompt template - tags: - - prompt templates - parameters: - - $ref: '#/components/parameters/ai-resource-group' - - $ref: '#/components/parameters/ai-resource-group-scope' - - name: promptTemplateId - in: path - required: true - schema: - type: string - format: uuid - responses: - '200': - description: Successful response - content: - application/octet-stream: - schema: - type: string - format: binary - '400': - $ref: '#/components/responses/BadRequest' - default: - $ref: '#/components/responses/CommonError' - /lm/promptTemplates/{promptTemplateId}/substitution: - post: - operationId: registry.controller.prompt_controller.parse_prompt_template_by_id - x-sap-cloud-sdk-operation-name: parsePromptTemplateById - description: Parse prompt template by ID - tags: - - prompt templates - parameters: - - $ref: '#/components/parameters/ai-resource-group' - - $ref: '#/components/parameters/ai-resource-group-scope' - - name: promptTemplateId - in: path - required: true - schema: - type: string - format: uuid - - name: metadata - in: query - schema: - type: boolean - default: false - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/PromptTemplateSubstitutionRequest' - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/PromptTemplateSubstitutionResponse' - '400': - $ref: '#/components/responses/BadRequest' - '403': - $ref: '#/components/responses/ForbiddenError' - default: - $ref: '#/components/responses/CommonError' - /lm/scenarios/{scenario}/promptTemplates/{name}/versions/{version}/substitution: - post: - operationId: registry.controller.prompt_controller.parse_prompt_template_by_name_version - x-sap-cloud-sdk-operation-name: parsePromptTemplateByNameVersion - description: Parse prompt template by name and version - tags: - - prompt templates - parameters: - - $ref: '#/components/parameters/ai-resource-group' - - $ref: '#/components/parameters/ai-resource-group-scope' - - name: scenario - in: path - required: true - schema: - type: string - - name: version - in: path - required: true - schema: - type: string - - name: name - in: path - required: true - schema: - type: string - - name: metadata - in: query - schema: - type: boolean - default: false - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/PromptTemplateSubstitutionRequest' - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/PromptTemplateSubstitutionResponse' - '400': - $ref: '#/components/responses/BadRequest' - '403': - $ref: '#/components/responses/ForbiddenError' - default: - $ref: '#/components/responses/CommonError' - /registry/v2/orchestrationConfigs: - post: - operationId: registry.controller.orchestration_config_controller.create_update_orchestration_config - x-sap-cloud-sdk-operation-name: createUpdateOrchestrationConfig - description: Create or update an orchestration config - tags: - - orchestration configs - parameters: - - $ref: '#/components/parameters/ai-resource-group' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/OrchestrationConfigPostRequest' - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/OrchestrationConfigPostResponse' - '400': - $ref: '#/components/responses/BadRequest' - '403': - $ref: '#/components/responses/ForbiddenError' - default: - $ref: '#/components/responses/CommonError' - get: - operationId: registry.controller.orchestration_config_controller.list_orchestration_configs - x-sap-cloud-sdk-operation-name: listOrchestrationConfigs - description: List orchestration configs - tags: - - orchestration configs - parameters: - - $ref: '#/components/parameters/ai-resource-group' - - name: scenario - in: query - schema: - type: string - - name: name - in: query - schema: - type: string - - name: version - in: query - schema: - type: string - - name: retrieve - in: query - schema: - type: string - default: both - enum: - - both - - imperative - - declarative - - name: include_spec - in: query - schema: - type: boolean - default: false - - name: resolve_template_ref - in: query - schema: - type: boolean - default: false - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/OrchestrationConfigListResponse' - '400': - $ref: '#/components/responses/BadRequest' - '403': - $ref: '#/components/responses/ForbiddenError' - default: - $ref: '#/components/responses/CommonError' - /registry/v2/scenarios/{scenario}/orchestrationConfigs/{name}/versions/{version}/history: - get: - operationId: registry.controller.orchestration_config_controller.list_orchestration_config_history - x-sap-cloud-sdk-operation-name: listOrchestrationConfigHistory - description: List orchestration config history - tags: - - orchestration configs - parameters: - - $ref: '#/components/parameters/ai-resource-group' - - name: scenario - in: path - required: true - schema: - type: string - - name: version - in: path - required: true - schema: - type: string - - name: name - in: path - required: true - schema: - type: string - - name: include_spec - in: query - schema: - type: boolean - default: false - - name: resolve_template_ref - in: query - schema: - type: boolean - default: false - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/OrchestrationConfigListResponse' - '400': - $ref: '#/components/responses/BadRequest' - '403': - $ref: '#/components/responses/ForbiddenError' - default: - $ref: '#/components/responses/CommonError' - /registry/v2/orchestrationConfigs/{orchestrationConfigId}: - get: - operationId: registry.controller.orchestration_config_controller.get_orchestration_config_by_uuid - x-sap-cloud-sdk-operation-name: getOrchestrationConfigByUuid - description: Get orchestration config by UUID - tags: - - orchestration configs - parameters: - - $ref: '#/components/parameters/ai-resource-group' - - name: orchestrationConfigId - in: path - required: true - schema: - type: string - format: uuid - - name: resolve_template_ref - in: query - schema: - type: boolean - default: false - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/OrchestrationConfigGetResponse' - '400': - $ref: '#/components/responses/BadRequest' - '403': - $ref: '#/components/responses/ForbiddenError' - default: - $ref: '#/components/responses/CommonError' - delete: - operationId: registry.controller.orchestration_config_controller.delete_orchestration_config - x-sap-cloud-sdk-operation-name: deleteOrchestrationConfig - description: Delete orchestration config - tags: - - orchestration configs - parameters: - - $ref: '#/components/parameters/ai-resource-group' - - name: orchestrationConfigId - in: path - required: true - schema: - type: string - format: uuid - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/OrchestrationConfigDeleteResponse' - '403': - $ref: '#/components/responses/ForbiddenError' - '404': - $ref: '#/components/responses/NotFound' - default: - $ref: '#/components/responses/CommonError' - /registry/v2/orchestrationConfigs/import: - post: - operationId: registry.controller.orchestration_config_controller.import_orchestration_config - x-sap-cloud-sdk-operation-name: importOrchestrationConfig - description: Import orchestration config - tags: - - orchestration configs - parameters: - - $ref: '#/components/parameters/ai-resource-group' - requestBody: - content: - multipart/form-data: - schema: - type: object - properties: - file: - type: string - format: binary - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/OrchestrationConfigPostResponse' - '400': - $ref: '#/components/responses/BadRequest' - default: - $ref: '#/components/responses/CommonError' - /registry/v2/orchestrationConfigs/{orchestrationConfigId}/export: - get: - operationId: registry.controller.orchestration_config_controller.export_orchestration_config - x-sap-cloud-sdk-operation-name: exportOrchestrationConfig - description: Export orchestration config - tags: - - orchestration configs - parameters: - - $ref: '#/components/parameters/ai-resource-group' - - name: orchestrationConfigId - in: path - required: true - schema: - type: string - format: uuid - responses: - '200': - description: Successful response - content: - application/octet-stream: - schema: - type: string - format: binary - '400': - $ref: '#/components/responses/BadRequest' - default: - $ref: '#/components/responses/CommonError' -components: - schemas: - PromptTemplate: - oneOf: - - $ref: '#/components/schemas/SingleChatTemplate' - - $ref: '#/components/schemas/MultiChatTemplate' - SingleChatTemplate: - type: object - required: - - role - - content - additionalProperties: false - properties: - role: - type: string - content: - type: string - MultiChatTemplate: - type: object - required: - - role - - content - additionalProperties: false - properties: - role: - type: string - content: - type: array - items: - $ref: '#/components/schemas/MultiChatContent' - MultiChatContent: - oneOf: - - $ref: '#/components/schemas/ImageContent' - - $ref: '#/components/schemas/TextContent' - TextContent: - type: object - required: - - type - - text - additionalProperties: false - properties: - type: - type: string - enum: - - text - text: - type: string - ImageContent: - type: object - required: - - type - - image_url - properties: - type: - type: string - enum: - - image_url - image_url: - type: object - required: - - url - additionalProperties: false - properties: - url: - type: string - detail: - type: string - default: auto - PromptTemplateSpec: - type: object - required: - - template - additionalProperties: - type: object - properties: - template: - type: array - items: - $ref: '#/components/schemas/PromptTemplate' - defaults: - type: object - additionalFields: - type: object - description: | - DEPRECATED. Please use additional_fields instead. - deprecated: true - response_format: - description: | - Response format that the model output should adhere to. This is the same as the OpenAI definition. - Compatible with GPT-4o, GPT-4o mini, GPT-4 (Turbo) and all GPT-3.5 Turbo models newer than gpt-3.5-turbo-1106. - oneOf: - - $ref: '#/components/schemas/ResponseFormatText' - - $ref: '#/components/schemas/ResponseFormatJsonObject' - - $ref: '#/components/schemas/ResponseFormatJsonSchema' - tools: - type: array - description: | - A list of tools the model may call. Used to provide a list of functions the model may generate JSON inputs for. This is the same as the OpenAI definition. - items: - $ref: '#/components/schemas/ChatCompletionTool' - ResponseFormatText: - type: object - additionalProperties: false - properties: - type: - type: string - description: 'The type of response format being defined: `text`' - enum: - - text - required: - - type - ResponseFormatJsonObject: - type: object - additionalProperties: false - properties: - type: - type: string - description: 'The type of response format being defined: `json_object`' - enum: - - json_object - required: - - type - ResponseFormatJsonSchema: - type: object - additionalProperties: false - properties: - type: - type: string - description: 'The type of response format being defined: `json_schema`' - enum: - - json_schema - json_schema: - type: object - additionalProperties: false - properties: - description: - type: string - description: A description of what the response format is for, used by the model to determine how to respond in the format. - name: - type: string - description: The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - pattern: ^[a-zA-Z0-9-_]+$ - maxLength: 64 - schema: - $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' - strict: - type: boolean - nullable: true - default: false - description: Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`. To learn more, read the [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). - required: - - name - required: - - type - - json_schema - ResponseFormatJsonSchemaSchema: - type: object - description: The schema for the response format, described as a JSON Schema object. - additionalProperties: true - ChatCompletionTool: - type: object - additionalProperties: false - properties: - type: - type: string - enum: - - function - description: The type of the tool. Currently, only `function` is supported. - function: - $ref: '#/components/schemas/FunctionObject' - required: - - type - - function - FunctionObject: - type: object - additionalProperties: false - properties: - description: - type: string - description: A description of what the function does, used by the model to choose when and how to call the function. - name: - type: string - description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - pattern: ^[a-zA-Z0-9-_]+$ - maxLength: 64 - parameters: - $ref: '#/components/schemas/FunctionParameters' - strict: - type: boolean - nullable: true - default: false - description: Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling). - required: - - name - FunctionParameters: - type: object - description: The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. Omitting `parameters` defines a function with an empty parameter list. - additionalProperties: true - PromptTemplatePostRequest: - type: object - required: - - name - - version - - scenario - - spec - properties: - name: - type: string - maxLength: 120 - pattern: ^[a-zA-Z0-9_-]+$ - version: - type: string - maxLength: 10 - pattern: ^[a-zA-Z0-9._-]+$ - scenario: - type: string - maxLength: 120 - pattern: ^[a-zA-Z0-9_-]+$ - spec: - $ref: '#/components/schemas/PromptTemplateSpec' - PromptTemplatePostResponse: - type: object - required: - - message - - id - - scenario - - name - - version - properties: - message: - type: string - id: - type: string - format: uuid - scenario: - type: string - name: - type: string - version: - type: string - PromptTemplateGetResponse: - type: object - properties: - id: - type: string - format: uuid - name: - type: string - version: - type: string - scenario: - type: string - creationTimestamp: - type: string - format: timestamp - managedBy: - type: string - isVersionHead: - type: boolean - resourceGroupId: - type: string - spec: - $ref: '#/components/schemas/PromptTemplateSpec' - PromptTemplateListResponse: - type: object - required: - - count - - resources - properties: - count: - type: integer - resources: - type: array - items: - $ref: '#/components/schemas/PromptTemplateGetResponse' - PromptTemplateDeleteResponse: - type: object - required: - - message - properties: - message: - type: string - RuntimePromptTemplateFile: - type: object - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - properties: - name: - type: string - version: - type: string - scenario: - type: string - spec: - $ref: '#/components/schemas/PromptTemplateSpec' - PromptTemplateSubstitutionRequest: - type: object - properties: - inputParams: - type: object - PromptTemplateSubstitutionResponse: - type: object - properties: - parsedPrompt: - type: array - items: - $ref: '#/components/schemas/PromptTemplate' - resource: - $ref: '#/components/schemas/PromptTemplateGetResponse' - ErrorResponse: - type: object - required: - - request_id - - message - properties: - request_id: - type: string - message: - type: string - OrchestrationConfigResource: - type: object - properties: - id: - type: string - format: uuid - name: - type: string - version: - type: string - scenario: - type: string - creation_timestamp: - type: string - format: timestamp - managed_by: - type: string - is_version_head: - type: boolean - resource_group_id: - type: string - spec: - $ref: '#/components/schemas/OrchestrationConfig' - OrchestrationConfigListResponse: - type: object - required: - - count - - resources - properties: - count: - type: integer - resources: - type: array - items: - $ref: '#/components/schemas/OrchestrationConfigGetResponse' - OrchestrationConfigPostRequest: - type: object - required: - - name - - version - - scenario - - spec - properties: - name: - type: string - maxLength: 120 - pattern: ^[a-zA-Z0-9_-]+$ - version: - type: string - maxLength: 10 - pattern: ^[a-zA-Z0-9._-]+$ - scenario: - type: string - maxLength: 120 - pattern: ^[a-zA-Z0-9_-]+$ - spec: - $ref: '#/components/schemas/OrchestrationConfig' - OrchestrationConfigPostResponse: - type: object - required: - - message - - id - - scenario - - name - - version - properties: - message: - type: string - id: - type: string - format: uuid - scenario: - type: string - name: - type: string - version: - type: string - OrchestrationConfigGetResponse: - type: object - properties: - id: - type: string - format: uuid - name: - type: string - version: - type: string - scenario: - type: string - creation_timestamp: - type: string - format: timestamp - managed_by: - type: string - is_version_head: - type: boolean - resource_group_id: - type: string - spec: - $ref: '#/components/schemas/OrchestrationConfig' - OrchestrationConfigDeleteResponse: - type: object - required: - - message - properties: - message: - type: string - RuntimeOrchestrationConfigFile: - type: object - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - properties: - name: - type: string - version: - type: string - scenario: - type: string - spec: - $ref: '#/components/schemas/OrchestrationConfig' - ChatMessageContent: - oneOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/TextContent' - minItems: 1 - SystemChatMessage: - type: object - additionalProperties: false - properties: - role: - type: string - enum: - - system - content: - $ref: '#/components/schemas/ChatMessageContent' - required: - - role - - content - ImageContentUrl: - type: object - required: - - url - additionalProperties: false - properties: - url: - type: string - detail: - type: string - default: auto - UserChatMessageContentItem: - type: object - additionalProperties: false - properties: - type: - type: string - enum: - - text - - image_url - text: - type: string - image_url: - $ref: '#/components/schemas/ImageContentUrl' - required: - - type - UserChatMessageContent: - oneOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/UserChatMessageContentItem' - minItems: 1 - UserChatMessage: - type: object - additionalProperties: false - properties: - content: - $ref: '#/components/schemas/UserChatMessageContent' - role: - type: string - enum: - - user - required: - - content - - role - MessageToolCall: - type: object - properties: - id: - type: string - description: The ID of the tool call. - type: - type: string - enum: - - function - description: The type of the tool. Currently, only `function` is supported. - function: - type: object - description: The function that the model called. - properties: - name: - type: string - description: The name of the function to call. - arguments: - type: string - description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. - required: - - name - - arguments - required: - - id - - type - - function - MessageToolCalls: - type: array - description: The tool calls generated by the model, such as function calls. - items: - $ref: '#/components/schemas/MessageToolCall' - AssistantChatMessage: - type: object - additionalProperties: false - properties: - role: - type: string - enum: - - assistant - content: - $ref: '#/components/schemas/ChatMessageContent' - refusal: - type: string - tool_calls: - $ref: '#/components/schemas/MessageToolCalls' - required: - - role - ToolChatMessage: - type: object - additionalProperties: false - properties: - role: - type: string - enum: - - tool - example: tool - tool_call_id: - type: string - content: - $ref: '#/components/schemas/ChatMessageContent' - required: - - role - - content - - tool_call_id - DeveloperChatMessage: - type: object - additionalProperties: false - properties: - role: - type: string - enum: - - developer - content: - $ref: '#/components/schemas/ChatMessageContent' - required: - - role - - content - ChatMessage: - oneOf: - - $ref: '#/components/schemas/SystemChatMessage' - - $ref: '#/components/schemas/UserChatMessage' - - $ref: '#/components/schemas/AssistantChatMessage' - - $ref: '#/components/schemas/ToolChatMessage' - - $ref: '#/components/schemas/DeveloperChatMessage' - TemplatingChatMessage: - type: array - minItems: 1 - items: - $ref: '#/components/schemas/ChatMessage' - Template: - type: object - required: - - template - additionalProperties: false - properties: - template: - allOf: - - $ref: '#/components/schemas/TemplatingChatMessage' - description: A chat message array to be formatted with values from placeholder_values. Both role and content can be templated. If messages_history is provided, the templated messages will be appended. - defaults: - description: Optional default values for the template. If a parameter has no default it is required. - type: object - additionalProperties: - type: string - response_format: - description: | - Response format that the model output should adhere to. This is the same as the OpenAI definition. - oneOf: - - $ref: '#/components/schemas/ResponseFormatText' - - $ref: '#/components/schemas/ResponseFormatJsonObject' - - $ref: '#/components/schemas/ResponseFormatJsonSchema' - tools: - type: array - description: | - A list of tools the model may call. Used to provide a list of functions the model may generate JSON inputs for. This is the same as the OpenAI definition. - items: - $ref: '#/components/schemas/ChatCompletionTool' - example: - template: - - role: user - content: How can the features of AI in SAP BTP specifically {{'{{?groundingOutput}}'}}, be applied to {{'{{?inputContext}}'}} - defaults: - inputContext: The default text that will be used in the template if inputContext is not set - TemplateRefByID: - type: object - required: - - id - additionalProperties: false - properties: - id: - type: string - description: ID of the template in prompt registry - example: template_id - scope: - type: string - description: | - Defines the scope that is searched for the referenced template. 'tenant' indicates the template is shared across all resource groups within the tenant, while 'resource_group' indicates the template is only accessible within the specific resource group. - enum: - - resource_group - - tenant - default: tenant - TemplateRefByScenarioNameVersion: - type: object - required: - - scenario - - name - - version - additionalProperties: false - properties: - scenario: - type: string - description: Scenario name - example: some-scenario - name: - type: string - description: Name of the template - example: some-template-name - version: - type: string - description: Version of the template - example: some version, can be `latest` - scope: - type: string - description: | - Defines the scope that is searched for the referenced template. 'tenant' indicates the template is shared across all resource groups within the tenant, while 'resource_group' indicates the template is only accessible within the specific resource group. - enum: - - resource_group - - tenant - default: tenant - TemplateRef: - type: object - required: - - template_ref - additionalProperties: false - properties: - template_ref: - description: Reference to a template in the prompt registry by ID or by scenario, name and version - oneOf: - - $ref: '#/components/schemas/TemplateRefByID' - - $ref: '#/components/schemas/TemplateRefByScenarioNameVersion' - LLMModelDetails: - type: object - description: | - The model and parameters to be used for the prompt templating. This is the model that will be used to generate the response. - required: - - name - additionalProperties: false - properties: - name: - type: string - description: Name of the model as in LLM Access configuration - example: gpt-4o-mini - version: - type: string - description: Version of the model to be used - default: latest - params: - type: object - description: Additional parameters for the model. Default values are used for mandatory parameters. - additionalProperties: true - example: - max_tokens: 300 - temperature: 0.1 - frequency_penalty: 0 - presence_penalty: 0 - 'n': 2 - stream_options: - include_usage: true - timeout: - description: Timeout for the LLM request in seconds. This parameter is currently ignored for Vertex AI models. - type: integer - default: 600 - minimum: 1 - maximum: 600 - max_retries: - description: Maximum number of retries for the LLM request. This parameter is currently ignored for Vertex AI models. - type: integer - default: 2 - minimum: 0 - maximum: 5 - PromptTemplatingModuleConfig: - type: object - required: - - prompt - - model - additionalProperties: false - properties: - prompt: - description: | - The prompt template to be used. Can be either a user defined template or a reference to a template in the prompt registry. - oneOf: - - $ref: '#/components/schemas/Template' - - $ref: '#/components/schemas/TemplateRef' - model: - $ref: '#/components/schemas/LLMModelDetails' - AzureThreshold: - type: integer - enum: - - 0 - - 2 - - 4 - - 6 - example: 0 - AzureContentSafetyInput: - description: Filter configuration for Azure Content Safety - type: object - additionalProperties: false - properties: - hate: - $ref: '#/components/schemas/AzureThreshold' - self_harm: - $ref: '#/components/schemas/AzureThreshold' - sexual: - $ref: '#/components/schemas/AzureThreshold' - violence: - $ref: '#/components/schemas/AzureThreshold' - prompt_shield: - type: boolean - description: Filter prompts for harmful content such as jailbreaks and prompt injections. - default: false - AzureContentSafetyInputFilterConfig: - type: object - required: - - type - additionalProperties: false - properties: - type: - description: Name of the filter provider type - type: string - enum: - - azure_content_safety - example: azure_content_safety - config: - $ref: '#/components/schemas/AzureContentSafetyInput' - LlamaGuard38b: - description: Filter configuration for Llama Guard 3 8B - type: object - additionalProperties: false - minProperties: 1 - properties: - violent_crimes: - type: boolean - non_violent_crimes: - type: boolean - sex_crimes: - type: boolean - child_exploitation: - type: boolean - defamation: - type: boolean - specialized_advice: - type: boolean - privacy: - type: boolean - intellectual_property: - type: boolean - indiscriminate_weapons: - type: boolean - hate: - type: boolean - self_harm: - type: boolean - sexual_content: - type: boolean - elections: - type: boolean - code_interpreter_abuse: - type: boolean - LlamaGuard38bFilterConfig: - type: object - required: - - type - - config - additionalProperties: false - properties: - type: - description: Name of the filter provider type - type: string - enum: - - llama_guard_3_8b - example: llama_guard_3_8b - config: - $ref: '#/components/schemas/LlamaGuard38b' - InputFilterConfig: - oneOf: - - $ref: '#/components/schemas/AzureContentSafetyInputFilterConfig' - - $ref: '#/components/schemas/LlamaGuard38bFilterConfig' - InputFilteringConfig: - type: object - required: - - filters - additionalProperties: false - properties: - filters: - description: Configuration for content filtering services that should be used for the given filtering step (input filtering). - type: array - minItems: 1 - items: - $ref: '#/components/schemas/InputFilterConfig' - AzureContentSafetyOutput: - description: Filter configuration for Azure Content Safety - type: object - additionalProperties: false - properties: - hate: - $ref: '#/components/schemas/AzureThreshold' - self_harm: - $ref: '#/components/schemas/AzureThreshold' - sexual: - $ref: '#/components/schemas/AzureThreshold' - violence: - $ref: '#/components/schemas/AzureThreshold' - protected_material_code: - type: boolean - description: Detect protected code content from known GitHub repositories. The scan includes software libraries, source code, algorithms, and other proprietary programming content. - default: false - AzureContentSafetyOutputFilterConfig: - type: object - required: - - type - additionalProperties: false - properties: - type: - description: Name of the filter provider type - type: string - enum: - - azure_content_safety - example: azure_content_safety - config: - $ref: '#/components/schemas/AzureContentSafetyOutput' - OutputFilterConfig: - oneOf: - - $ref: '#/components/schemas/AzureContentSafetyOutputFilterConfig' - - $ref: '#/components/schemas/LlamaGuard38bFilterConfig' - FilteringStreamOptions: - description: Stream options for output filtering. Will be ignored if stream is false. - type: object - additionalProperties: false - properties: - overlap: - type: integer - description: Number of characters that should be additionally sent to content filtering services from previous chunks as additional context. - default: 0 - minimum: 0 - maximum: 10000 - OutputFilteringConfig: - type: object - required: - - filters - additionalProperties: false - properties: - filters: - description: Configuration for content filtering services that should be used for the given filtering step (output filtering). - type: array - minItems: 1 - items: - $ref: '#/components/schemas/OutputFilterConfig' - stream_options: - $ref: '#/components/schemas/FilteringStreamOptions' - FilteringModuleConfig: - type: object - additionalProperties: false - properties: - input: - allOf: - - $ref: '#/components/schemas/InputFilteringConfig' - description: List of provider type and filters - output: - allOf: - - $ref: '#/components/schemas/OutputFilteringConfig' - description: List of provider type and filters - minProperties: 1 - DPIEntities: - description: Default entities supported by data privacy and integration service - type: string - enum: - - profile-person - - profile-org - - profile-university - - profile-location - - profile-email - - profile-phone - - profile-address - - profile-sapids-internal - - profile-sapids-public - - profile-url - - profile-username-password - - profile-nationalid - - profile-iban - - profile-ssn - - profile-credit-card-number - - profile-passport - - profile-driverlicense - - profile-nationality - - profile-religious-group - - profile-political-group - - profile-pronouns-gender - - profile-ethnicity - - profile-gender - - profile-sexual-orientation - - profile-trade-union - - profile-sensitive-data - DPIMethodConstant: - description: Replaces the entity with the specified value followed by an incrementing number - type: object - required: - - method - - value - additionalProperties: false - properties: - method: - type: string - enum: - - constant - value: - description: Value to be used for replacement - example: NAME_REDACTED - type: string - DPIMethodFabricatedData: - description: Replaces the entity with a randomly generated value appropriate to its type. - type: object - required: - - method - additionalProperties: false - properties: - method: - type: string - enum: - - fabricated_data - DPIStandardEntity: - type: object - required: - - type - additionalProperties: false - properties: - type: - $ref: '#/components/schemas/DPIEntities' - replacement_strategy: - description: Replacement strategy to be used for the entity - oneOf: - - $ref: '#/components/schemas/DPIMethodConstant' - - $ref: '#/components/schemas/DPIMethodFabricatedData' - DPICustomEntity: - type: object - required: - - regex - - replacement_strategy - additionalProperties: false - properties: - regex: - description: Regular expression to match the entity - type: string - replacement_strategy: - description: Replacement strategy to be used for the entity - oneOf: - - $ref: '#/components/schemas/DPIMethodConstant' - DPIEntityConfig: - oneOf: - - $ref: '#/components/schemas/DPIStandardEntity' - - $ref: '#/components/schemas/DPICustomEntity' - DPIConfig: - type: object - required: - - type - - method - - entities - additionalProperties: false - properties: - type: - description: Type of masking service provider - type: string - enum: - - sap_data_privacy_integration - method: - description: Type of masking method to be used - type: string - enum: - - anonymization - - pseudonymization - entities: - description: List of entities to be masked - type: array - minItems: 1 - items: - $ref: '#/components/schemas/DPIEntityConfig' - allowlist: - description: List of strings that should not be masked - type: array - example: - - SAP - - Joule - items: - type: string - mask_grounding_input: - type: object - additionalProperties: false - properties: - enabled: - type: boolean - default: false - description: controls whether the input to the grounding module will be masked with the configuration supplied in the masking module - MaskingProviderConfig: - oneOf: - - $ref: '#/components/schemas/DPIConfig' - MaskingModuleConfig: - oneOf: - - type: object - title: MaskingModuleConfigProviders - properties: - providers: - description: List of masking service providers - type: array - minItems: 1 - items: - $ref: '#/components/schemas/MaskingProviderConfig' - required: - - providers - additionalProperties: false - - type: object - title: MaskingModuleConfigMaskingProviders - properties: - masking_providers: - deprecated: true - description: 'List of masking service providers. **DEPRECATED**: will be removed Sept 15, 2026. Use `providers` property instead.' - type: array - minItems: 1 - items: - $ref: '#/components/schemas/MaskingProviderConfig' - required: - - masking_providers - additionalProperties: false - GroundingFilterId: - title: Id - description: Identifier of this SearchFilter - unique per request. - type: string - GroundingFilterSearchConfiguration: - additionalProperties: false - properties: - max_chunk_count: - type: integer - minimum: 0 - exclusiveMinimum: true - title: Maxchunkcount - description: Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. - max_document_count: - type: integer - minimum: 0 - exclusiveMinimum: true - title: Maxdocumentcount - description: '[Only supports ''vector'' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with ''maxChunkCount''. If maxDocumentCount is given, then only one chunk per document is returned.' - title: SearchConfiguration - minProperties: 0 - maxProperties: 1 - DataRepositoryType: - type: string - description: Only include DataRepositories with the given type. - enum: - - vector - - help.sap.com - title: DataRepositoryType - KeyValueListPair: - additionalProperties: false - properties: - key: - type: string - maxLength: 1024 - title: Key - value: - type: array - items: - type: string - maxLength: 1024 - title: Value - type: object - required: - - key - - value - title: KeyValueListPair - SearchSelectOptionEnum: - type: string - enum: - - ignoreIfKeyAbsent - title: SearchSelectOptionEnum - SearchDocumentKeyValueListPair: - additionalProperties: false - properties: - key: - type: string - maxLength: 1024 - title: Key - value: - type: array - items: - type: string - maxLength: 1024 - title: Value - select_mode: - type: array - items: - $ref: '#/components/schemas/SearchSelectOptionEnum' - title: Selectmode - description: Select mode for search filters - type: object - required: - - key - - value - title: SearchDocumentKeyValueListPair - DocumentGroundingFilter: - type: object - required: - - data_repository_type - additionalProperties: false - properties: - id: - $ref: '#/components/schemas/GroundingFilterId' - search_config: - $ref: '#/components/schemas/GroundingFilterSearchConfiguration' - data_repositories: - type: array - items: - type: string - title: DataRepositories - description: Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids. - default: - - '*' - data_repository_type: - $ref: '#/components/schemas/DataRepositoryType' - data_repository_metadata: - type: array - items: - $ref: '#/components/schemas/KeyValueListPair' - title: Datarepositorymetadata - description: Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*'] - document_metadata: - type: array - items: - $ref: '#/components/schemas/SearchDocumentKeyValueListPair' - title: Documentmetadata - description: Restrict documents considered during search to those annotated with the given metadata. - chunk_metadata: - type: array - items: - $ref: '#/components/schemas/KeyValueListPair' - title: Chunkmetadata - description: Restrict chunks considered during search to those with the given metadata. - minProperties: 1 - GroundingModuleConfig: - type: object - required: - - type - - config - additionalProperties: false - properties: - type: - type: string - anyOf: - - enum: - - document_grounding_service - - {} - example: document_grounding_service - config: - type: object - required: - - placeholders - additionalProperties: false - properties: - filters: - type: array - items: - oneOf: - - $ref: '#/components/schemas/DocumentGroundingFilter' - description: Document grounding service filters to be used - placeholders: - type: object - additionalProperties: false - required: - - input - - output - properties: - input: - type: array - minItems: 1 - items: - type: string - example: groundingInput - description: Contains the input parameters used for grounding input questions - output: - type: string - description: Placeholder name for grounding output - example: groundingOutput - description: Placeholders to be used for grounding input questions and output - metadata_params: - type: array - items: - type: string - description: Parameter name used for specifying metadata parameters - SAPDocumentTranslationApplyToSelector: - type: object - description: | - This selector allows you to define the scope of translation, such as specific placeholders or messages with specific roles. For example, `{"category": "placeholders", "items": ["user_input"], "source_language": "de-DE"}` targets the value of "user_input" in `placeholder_values` specified in the request payload; and considers the value to be in German. - required: - - category - - items - additionalProperties: false - properties: - category: - type: string - description: Category to apply translation to. - enum: - - placeholders - - template_roles - items: - type: array - description: List of placeholders or roles to apply translation to - items: - type: string - example: - - groundingInput - - inputContext - source_language: - type: string - description: Language of the text to be translated. - example: de-DE - SAPDocumentTranslationInput: - type: object - required: - - type - - config - additionalProperties: false - properties: - type: - description: Type of document translation provider - type: string - enum: - - sap_document_translation - example: sap_document_translation - translate_messages_history: - type: boolean - description: If true, the messages history will be translated as well. - default: true - config: - description: Configuration for `sap_document_translation` translation provider. - type: object - additionalProperties: false - required: - - target_language - properties: - source_language: - type: string - description: Language of the text to be translated. - example: de-DE - apply_to: - type: array - minItems: 1 - items: - $ref: '#/components/schemas/SAPDocumentTranslationApplyToSelector' - target_language: - type: string - description: Language to which the text should be translated. - example: en-US - SAPDocumentTranslationOutputTargetLanguage: - oneOf: - - type: string - description: Language to which the text should be translated. - example: en-US - - $ref: '#/components/schemas/SAPDocumentTranslationApplyToSelector' - SAPDocumentTranslationOutput: - type: object - required: - - type - - config - additionalProperties: false - properties: - type: - description: Configuration for `sap_document_translation` translation provider. - type: string - enum: - - sap_document_translation - example: sap_document_translation - config: - type: object - additionalProperties: false - required: - - target_language - properties: - source_language: - type: string - description: Language of the text to be translated. - example: de-DE - target_language: - $ref: '#/components/schemas/SAPDocumentTranslationOutputTargetLanguage' - TranslationModuleConfig: - type: object - description: Configuration for translation module - additionalProperties: false - properties: - input: - description: Configuration for input translation - oneOf: - - $ref: '#/components/schemas/SAPDocumentTranslationInput' - output: - description: Configuration for output translation - oneOf: - - $ref: '#/components/schemas/SAPDocumentTranslationOutput' - ModuleConfigs: - type: object - required: - - prompt_templating - additionalProperties: false - properties: - prompt_templating: - $ref: '#/components/schemas/PromptTemplatingModuleConfig' - filtering: - $ref: '#/components/schemas/FilteringModuleConfig' - masking: - $ref: '#/components/schemas/MaskingModuleConfig' - grounding: - $ref: '#/components/schemas/GroundingModuleConfig' - translation: - $ref: '#/components/schemas/TranslationModuleConfig' - GlobalStreamOptions: - description: Options for streaming. Will be ignored if enabled is false. - type: object - additionalProperties: false - properties: - enabled: - type: boolean - description: If true, the response will be streamed back to the client - default: false - chunk_size: - type: integer - description: Minimum number of characters per chunk that post-LLM modules operate on. - default: 100 - minimum: 1 - maximum: 10000 - delimiters: - type: array - minItems: 1 - description: List of delimiters to split the input text into chunks.Please note, this is a required parameter when `input_translation_module_config` or `output_translation_module_config` are configured. - items: - type: string - example: - - |+ - - - . - - '?' - - '!' - OrchestrationConfig: - type: object - required: - - modules - additionalProperties: false - properties: - modules: - $ref: '#/components/schemas/ModuleConfigs' - stream: - $ref: '#/components/schemas/GlobalStreamOptions' - responses: - BadRequest: - description: Bad Request - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - CommonError: - description: Common Error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - ForbiddenError: - description: Forbidden Error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - NotFound: - description: Bad Request - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - parameters: - ai-resource-group: - name: AI-Resource-Group - in: header - description: Specify a resource group id to use - required: false - schema: - type: string - ai-resource-group-scope: - name: AI-Resource-Group-Scope - in: header - description: Specify whether the resource group scope is to be used - required: false - schema: - type: string - enum: - - 'true' - - 'True' - - 'false' - - 'False' diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/resources/sodastore.yaml b/datamodel/openapi/openapi-api-apache-sample/src/main/resources/sodastore.yaml new file mode 100644 index 000000000..bf2b80a7f --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/resources/sodastore.yaml @@ -0,0 +1,307 @@ +openapi: 3.0.3 +info: + title: SodaStore API + version: 1.0.0 + description: API for managing soda products and orders in SodaStore. +tags: + - name: Sodas + description: Everything about our Sodas + - name: user + description: Operations about user + - name: Orders + description: Access to Sodastore orders +components: + securitySchemes: + apiKeyAuth: + type: apiKey + in: header + name: X-API-Key + bearerAuth: + type: http + scheme: bearer + schemas: + Soda: + type: object + required: + - name + - brand + - quantity + - price + properties: + name: + type: string + example: Cola + brand: + type: string + example: Coca-Cola + quantity: + type: integer + format: int32 + example: 100 + packaging: + type: string + enum: + - glass + - carton + - can + nullable: false + price: + type: number + format: float + example: 1.5 + SodaWithId: + allOf: + - $ref: '#/components/schemas/Soda' + - type: object + properties: + id: + type: integer + format: int64 + example: 123 + Order: + type: object + additionalProperties: true + required: + - productId + - quantity + properties: + productId: + type: integer + format: int64 + example: 1 + quantity: + type: integer + format: int32 + example: 2 + totalPrice: + type: number + format: float + example: 3 + typelessProperty: + description: >- + Some typeless property, interpreted by the generator as nullable by + default (because typeless) + nullableProperty: + type: string + description: Some typed property that is deliberately made nullable + nullable: true + OrderWithTimestamp: + allOf: + - $ref: '#/components/schemas/Order' + - type: object + properties: + timestamp: + type: string + format: date-time + OneOfWithDiscriminatorAndMapping: + oneOf: + - $ref: '#/components/schemas/Cola' + - $ref: '#/components/schemas/Fanta' + discriminator: + propertyName: sodaType + mapping: + cool_cola: '#/components/schemas/Cola' + fancy_fanta: '#/components/schemas/Fanta' + OneOfWithDiscriminator: + oneOf: + - $ref: '#/components/schemas/Cola' + - $ref: '#/components/schemas/Fanta' + discriminator: + propertyName: sodaType + OneOfWithEnumDiscriminator: + oneOf: + - $ref: '#/components/schemas/Foo' + - $ref: '#/components/schemas/Bar' + discriminator: + propertyName: disc + mapping: + disc_foo: '#/components/schemas/Foo' + disc_bar: '#/components/schemas/Bar' + Foo: + type: object + properties: + foo: + type: string + disc: + type: string + enum: + - disc_foo + Bar: + type: object + properties: + bar: + type: string + disc: + type: string + enum: + - disc_bar + OneOf: + oneOf: + - $ref: '#/components/schemas/Cola' + - $ref: '#/components/schemas/Fanta' + AnyOf: + anyOf: + - $ref: '#/components/schemas/Cola' + - $ref: '#/components/schemas/Fanta' + AllOf: + allOf: + - $ref: '#/components/schemas/Cola' + - $ref: '#/components/schemas/Fanta' + Cola: + type: object + properties: + sodaType: + type: string + caffeine: + type: boolean + logo: + oneOf: + - type: string + - type: array + items: + type: array + items: + type: integer + format: int32 + barCode: + oneOf: + - type: array + items: + type: number + - type: string + Fanta: + type: object + properties: + sodaType: + type: string + color: + type: string + flavor: + oneOf: + - type: string + - type: integer + - type: array + items: + $ref: '#/components/schemas/FlavorType' + - $ref: '#/components/schemas/FlavorType' + FlavorType: + type: object + properties: + intensity: + type: integer + description: The intensity of the flavor + nuance: + type: string + description: The nuance of the flavor +paths: + /sodas: + get: + summary: Get all soda products + tags: + - Sodas + security: + - apiKeyAuth: [ ] + responses: + '200': + description: A list of soda products + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/SodaWithId' + put: + summary: Update a specific soda product by ID + tags: + - Sodas + security: + - apiKeyAuth: [ ] + requestBody: + description: The updated soda product + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SodaWithId' + responses: + '200': + description: The updated soda product + content: + application/json: + schema: + $ref: '#/components/schemas/Soda' + '204': + description: Nothing has changed + '404': + description: Soda product not found + /sodas/{id}: + get: + summary: Get a specific soda product by ID + tags: + - Sodas + security: + - apiKeyAuth: [ ] + parameters: + - name: id + in: path + description: ID of the soda product to retrieve + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: The soda product + content: + application/json: + schema: + $ref: '#/components/schemas/SodaWithId' + '404': + description: Soda product not found + /sodas/download/{id}: + get: + summary: Download soda product data as binary + tags: + - Sodas + parameters: + - name: id + in: path + description: ID of the soda product to download + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: Successful response + content: + application/octet-stream: + schema: + type: string + format: binary + '404': + description: Soda product not found + /orders: + post: + summary: Create a new order + tags: + - Orders + security: + - apiKeyAuth: [ ] + requestBody: + description: The order details + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + responses: + '201': + description: The created order + content: + application/json: + schema: + $ref: '#/components/schemas/Order' +security: + - apiKeyAuth: [ ] + - bearerAuth: [ ] From 50a57bbbdf00969373df2a4a2f0308ee3aa9fb3a Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Mon, 29 Dec 2025 17:28:44 +0100 Subject: [PATCH 11/26] Fix version issue --- datamodel/openapi/openapi-api-apache-sample/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datamodel/openapi/openapi-api-apache-sample/pom.xml b/datamodel/openapi/openapi-api-apache-sample/pom.xml index 533a7be33..717b3f35f 100644 --- a/datamodel/openapi/openapi-api-apache-sample/pom.xml +++ b/datamodel/openapi/openapi-api-apache-sample/pom.xml @@ -6,7 +6,7 @@ com.sap.cloud.sdk.datamodel openapi-parent - 5.25.0-SNAPSHOT + 5.26.0-SNAPSHOT openapi-api-apache-sample From 6a33cf66e4a3bbd00b8f03ef2adfe22786eba25d Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Mon, 29 Dec 2025 17:39:20 +0100 Subject: [PATCH 12/26] Pom config and exclusions --- datamodel/openapi/pom.xml | 1 + module-inventory.json | 11 +++++++++++ pom.xml | 1 + 3 files changed, 13 insertions(+) diff --git a/datamodel/openapi/pom.xml b/datamodel/openapi/pom.xml index bdb913178..689e6a0c3 100644 --- a/datamodel/openapi/pom.xml +++ b/datamodel/openapi/pom.xml @@ -64,6 +64,7 @@ openapi-api-sample + openapi-api-apache-sample diff --git a/module-inventory.json b/module-inventory.json index e5cecad8f..03840ca6e 100644 --- a/module-inventory.json +++ b/module-inventory.json @@ -406,6 +406,17 @@ "parentArtifactId": "openapi-parent", "excludeFromBlackDuckScan": false }, + { + "groupId": "com.sap.cloud.sdk.datamodel", + "artifactId": "openapi-api-apache-sample", + "packaging": "jar", + "releaseAudience": "None", + "releaseMaturity": "Stable", + "pomFile": "datamodel/openapi/openapi-api-apache-sample/pom.xml", + "parentGroupId": "com.sap.cloud.sdk.datamodel", + "parentArtifactId": "openapi-parent", + "excludeFromBlackDuckScan": false + }, { "groupId": "com.sap.cloud.sdk.datamodel", "artifactId": "openapi-core", diff --git a/pom.xml b/pom.xml index d48c1fbe6..d70cc780a 100644 --- a/pom.xml +++ b/pom.xml @@ -703,6 +703,7 @@ com.sap.cloud.sdk.datamodel:odata-api-sample com.sap.cloud.sdk.datamodel:odata-v4-api-sample com.sap.cloud.sdk.datamodel:openapi-api-sample + com.sap.cloud.sdk.datamodel:openapi-api-apache-sample From cde369f90e4fdea583f1d4efc458bed2e3471221 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Tue, 30 Dec 2025 10:25:46 +0100 Subject: [PATCH 13/26] Set format skip false for sample module --- .../openapi/openapi-api-apache-sample/pom.xml | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/datamodel/openapi/openapi-api-apache-sample/pom.xml b/datamodel/openapi/openapi-api-apache-sample/pom.xml index 717b3f35f..0872d59c6 100644 --- a/datamodel/openapi/openapi-api-apache-sample/pom.xml +++ b/datamodel/openapi/openapi-api-apache-sample/pom.xml @@ -18,17 +18,17 @@ - - com.sap.cloud.sdk.datamodel - openapi-core - - com.google.guava - guava + com.sap.cloud.sdk.datamodel + openapi-core + + + com.google.guava + guava - com.fasterxml.jackson.core - jackson-core + com.fasterxml.jackson.core + jackson-core com.fasterxml.jackson.core @@ -88,6 +88,20 @@ false + + net.revelc.code + impsort-maven-plugin + + + + sort + + + + + false + +
From 1c0bef893418b682ae48b9fea69c157055834ea0 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal <36329474+rpanackal@users.noreply.github.com> Date: Mon, 12 Jan 2026 10:42:29 +0100 Subject: [PATCH 14/26] refactor: [OpenAPI] Part 1: Refactor Apache related files and templates (#1048) --- .../openapi/openapi-api-apache-sample/pom.xml | 63 +- .../openapi/apache/sample/api/OrdersApi.java | 142 ++- .../openapi/apache/sample/api/SodasApi.java | 332 +++----- .../openapi/apache/sample/model/AllOf.java | 4 +- .../openapi/apache/sample/model/AnyOf.java | 4 +- .../openapi/apache/sample/model/Bar.java | 4 +- .../openapi/apache/sample/model/Cola.java | 4 +- .../apache/sample/model/ColaBarCode.java | 3 - .../openapi/apache/sample/model/ColaLogo.java | 3 - .../openapi/apache/sample/model/Fanta.java | 4 +- .../apache/sample/model/FantaFlavor.java | 2 - .../apache/sample/model/FlavorType.java | 4 +- .../openapi/apache/sample/model/Foo.java | 4 +- .../openapi/apache/sample/model/OneOf.java | 2 - .../sample/model/OneOfWithDiscriminator.java | 2 - .../OneOfWithDiscriminatorAndMapping.java | 2 - .../model/OneOfWithEnumDiscriminator.java | 2 - .../openapi/apache/sample/model/Order.java | 4 +- .../sample/model/OrderWithTimestamp.java | 4 +- .../openapi/apache/sample/model/Soda.java | 4 +- .../apache/sample/model/SodaWithId.java | 4 +- datamodel/openapi/openapi-api-sample/pom.xml | 1 - datamodel/openapi/openapi-core/pom.xml | 4 + .../services/openapi/apache/ApiClient.java | 805 +++--------------- .../services/openapi/apache/ApiException.java | 129 --- .../sdk/services/openapi/apache/BaseApi.java | 160 +--- .../openapi/apache/Configuration.java | 67 -- .../apache/DefaultApiResponseHandler.java | 333 ++++++++ .../openapi/apache/OpenApiResponse.java | 30 + .../sdk/services/openapi/apache/Pair.java | 32 +- .../openapi/apache/RFC3339DateFormat.java | 61 -- .../apache/RFC3339InstantDeserializer.java | 108 --- .../openapi/apache/RFC3339JavaTimeModule.java | 40 - .../openapi/apache/ServerConfiguration.java | 80 -- .../openapi/apache/ServerVariable.java | 40 - .../services/openapi/apache/StringUtil.java | 91 -- .../openapi/apache/auth/ApiKeyAuth.java | 86 -- .../openapi/apache/auth/Authentication.java | 33 - .../openapi/apache/auth/HttpBasicAuth.java | 59 -- .../openapi/apache/auth/HttpBearerAuth.java | 80 -- .../openapi/core/OpenApiRequestException.java | 18 + .../libraries/apache-httpclient/api.mustache | 329 +++---- .../apache-httpclient/operationBody.mustache | 94 ++ .../nullable_var_annotations.mustache | 1 + 44 files changed, 960 insertions(+), 2318 deletions(-) delete mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiException.java delete mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Configuration.java create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/DefaultApiResponseHandler.java create mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/OpenApiResponse.java delete mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339DateFormat.java delete mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339InstantDeserializer.java delete mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339JavaTimeModule.java delete mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerConfiguration.java delete mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerVariable.java delete mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/StringUtil.java delete mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/ApiKeyAuth.java delete mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/Authentication.java delete mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBasicAuth.java delete mode 100644 datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBearerAuth.java create mode 100644 datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/operationBody.mustache create mode 100644 datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/nullable_var_annotations.mustache diff --git a/datamodel/openapi/openapi-api-apache-sample/pom.xml b/datamodel/openapi/openapi-api-apache-sample/pom.xml index 0872d59c6..595c907ce 100644 --- a/datamodel/openapi/openapi-api-apache-sample/pom.xml +++ b/datamodel/openapi/openapi-api-apache-sample/pom.xml @@ -8,23 +8,36 @@ openapi-parent 5.26.0-SNAPSHOT - openapi-api-apache-sample - - - 22 - 22 - UTF-8 - - + Data Model - OpenAPI Services - Sample API + Sample generated API classes of the OpenAPI VDM + https://sap.github.io/cloud-sdk/docs/java/getting-started + + SAP SE + https://www.sap.com + + + + The Apache Software License, Version 2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + + + + SAP + cloudsdk@sap.com + SAP SE + https://www.sap.com + + com.sap.cloud.sdk.datamodel openapi-core - com.google.guava - guava + com.sap.cloud.sdk.cloudplatform + cloudplatform-connectivity com.fasterxml.jackson.core @@ -41,13 +54,25 @@ com.sap.cloud.sdk.datamodel openapi-generator-maven-plugin + released ${project.basedir}/src/main/java - true true - sample-generation + sample-apache-swagger-v2 + generate-sources + + generate + + + ${project.basedir}/src/main/resources/petstore-swagger2.json + com.sap.cloud.sdk.datamodel.openapi.petstore.api + com.sap.cloud.sdk.datamodel.openapi.petstore.model + + + + sample-apache-openapi-v3 generate @@ -57,19 +82,17 @@ com.sap.cloud.sdk.datamodel.openapi.apache.sample.api com.sap.cloud.sdk.datamodel.openapi.apache.sample.model - true - com.sap.cloud.sdk.services.openapi.apache apache-httpclient false - true - true - true - \. - 3 - + create protected + true true + true + true + true + true diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java index a68fbf053..65602b693 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java @@ -1,102 +1,104 @@ /* - * SodaStore API - * API for managing soda products and orders in SodaStore. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ +* Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. +*/ package com.sap.cloud.sdk.datamodel.openapi.apache.sample.api; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringJoiner; +import javax.annotation.Nonnull; + import com.fasterxml.jackson.core.type.TypeReference; +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.Order; import com.sap.cloud.sdk.services.openapi.apache.ApiClient; -import com.sap.cloud.sdk.services.openapi.apache.ApiException; import com.sap.cloud.sdk.services.openapi.apache.BaseApi; -import com.sap.cloud.sdk.services.openapi.apache.Configuration; import com.sap.cloud.sdk.services.openapi.apache.Pair; +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +/** + * SodaStore API in version 1.0.0. + * + * API for managing soda products and orders in SodaStore. + */ public class OrdersApi extends BaseApi { + /** + * Instantiates this API class to invoke operations on the SodaStore API + */ public OrdersApi() { - super(Configuration.getDefaultApiClient()); } - public OrdersApi( ApiClient apiClient ) + /** + * Instantiates this API class to invoke operations on the SodaStore API. + * + * @param httpDestination + * The destination that API should be used with + */ + public OrdersApi( @Nonnull final Destination httpDestination ) { - super(apiClient); + super(httpDestination); } /** - * Create a new order + * Instantiates this API class to invoke operations on the SodaStore API based on a given {@link ApiClient}. * - * @param order - * The order details (required) - * @return Order - * @throws ApiException - * if fails to make API call + * @param apiClient + * ApiClient to invoke the API on */ - public Order ordersPost( @javax.annotation.Nonnull Order order ) - throws ApiException + public OrdersApi( @Nonnull final ApiClient apiClient ) { - return this.ordersPost(order, Collections.emptyMap()); + super(apiClient); } /** + *

* Create a new order + *

+ *

+ * 201 - The created order * * @param order - * The order details (required) - * @param additionalHeaders - * additionalHeaders for this call + * The order details * @return Order - * @throws ApiException - * if fails to make API call + * @throws OpenApiRequestException + * if an error occurs while attempting to invoke the API */ - public Order ordersPost( @javax.annotation.Nonnull Order order, Map additionalHeaders ) - throws ApiException + @Nonnull + public Order ordersPost( @Nonnull final Order order ) + throws OpenApiRequestException { - Object localVarPostBody = order; + final Object localVarPostBody = order; // verify the required parameter 'order' is set if( order == null ) { - throw new ApiException(400, "Missing the required parameter 'order' when calling ordersPost"); + throw new OpenApiRequestException("Missing the required parameter 'order' when calling ordersPost") + .statusCode(400); } // create path and map variables - String localVarPath = "/orders"; + final String localVarPath = "/orders"; - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarHeaderParams.putAll(additionalHeaders); + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "apiKeyAuth" }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); - TypeReference localVarReturnType = new TypeReference() + final TypeReference localVarReturnType = new TypeReference() { }; return apiClient @@ -108,55 +110,9 @@ public Order ordersPost( @javax.annotation.Nonnull Order order, Map T invokeAPI( - String url, - String method, - Object request, - TypeReference returnType, - Map additionalHeaders ) - throws ApiException - { - String localVarPath = url.replace(apiClient.getBaseURL(), ""); - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "apiKeyAuth" }; - - return apiClient - .invokeAPI( - localVarPath, - method, - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - request, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - returnType); - } } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java index 9a5265ac2..fbd776b6c 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java @@ -1,108 +1,113 @@ /* - * SodaStore API - * API for managing soda products and orders in SodaStore. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ +* Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. +*/ package com.sap.cloud.sdk.datamodel.openapi.apache.sample.api; import java.io.File; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringJoiner; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import com.fasterxml.jackson.core.type.TypeReference; +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.Soda; import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.SodaWithId; import com.sap.cloud.sdk.services.openapi.apache.ApiClient; -import com.sap.cloud.sdk.services.openapi.apache.ApiException; import com.sap.cloud.sdk.services.openapi.apache.BaseApi; -import com.sap.cloud.sdk.services.openapi.apache.Configuration; import com.sap.cloud.sdk.services.openapi.apache.Pair; +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +/** + * SodaStore API in version 1.0.0. + * + * API for managing soda products and orders in SodaStore. + */ public class SodasApi extends BaseApi { + /** + * Instantiates this API class to invoke operations on the SodaStore API + */ public SodasApi() { - super(Configuration.getDefaultApiClient()); } - public SodasApi( ApiClient apiClient ) + /** + * Instantiates this API class to invoke operations on the SodaStore API. + * + * @param httpDestination + * The destination that API should be used with + */ + public SodasApi( @Nonnull final Destination httpDestination ) { - super(apiClient); + super(httpDestination); } /** - * Download soda product data as binary + * Instantiates this API class to invoke operations on the SodaStore API based on a given {@link ApiClient}. * - * @param id - * ID of the soda product to download (required) - * @return File - * @throws ApiException - * if fails to make API call + * @param apiClient + * ApiClient to invoke the API on */ - public File sodasDownloadIdGet( @javax.annotation.Nonnull Long id ) - throws ApiException + public SodasApi( @Nonnull final ApiClient apiClient ) { - return this.sodasDownloadIdGet(id, Collections.emptyMap()); + super(apiClient); } /** + *

* Download soda product data as binary + *

+ *

+ * 200 - Successful response + *

+ * 404 - Soda product not found * * @param id - * ID of the soda product to download (required) - * @param additionalHeaders - * additionalHeaders for this call + * ID of the soda product to download * @return File - * @throws ApiException - * if fails to make API call + * @throws OpenApiRequestException + * if an error occurs while attempting to invoke the API */ - public File sodasDownloadIdGet( @javax.annotation.Nonnull Long id, Map additionalHeaders ) - throws ApiException + @Nonnull + public File sodasDownloadIdGet( @Nonnull final Long id ) + throws OpenApiRequestException { - Object localVarPostBody = null; + final Object localVarPostBody = null; // verify the required parameter 'id' is set if( id == null ) { - throw new ApiException(400, "Missing the required parameter 'id' when calling sodasDownloadIdGet"); + throw new OpenApiRequestException("Missing the required parameter 'id' when calling sodasDownloadIdGet") + .statusCode(400); } // create path and map variables - String localVarPath = + final String localVarPath = "/sodas/download/{id}" - .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(apiClient.parameterToString(id))); + .replaceAll("\\{" + "id" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(id))); - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarHeaderParams.putAll(additionalHeaders); + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/octet-stream" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "apiKeyAuth", "bearerAuth" }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); - TypeReference localVarReturnType = new TypeReference() + final TypeReference localVarReturnType = new TypeReference() { }; return apiClient @@ -114,65 +119,48 @@ public File sodasDownloadIdGet( @javax.annotation.Nonnull Long id, Map * Get all soda products + *

+ *

+ * 200 - A list of soda products * * @return List<SodaWithId> - * @throws ApiException - * if fails to make API call + * @throws OpenApiRequestException + * if an error occurs while attempting to invoke the API */ + @Nonnull public List sodasGet() - throws ApiException - { - return this.sodasGet(Collections.emptyMap()); - } - - /** - * Get all soda products - * - * @param additionalHeaders - * additionalHeaders for this call - * @return List<SodaWithId> - * @throws ApiException - * if fails to make API call - */ - public List sodasGet( Map additionalHeaders ) - throws ApiException + throws OpenApiRequestException { - Object localVarPostBody = null; + final Object localVarPostBody = null; // create path and map variables - String localVarPath = "/sodas"; + final String localVarPath = "/sodas"; - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarHeaderParams.putAll(additionalHeaders); + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "apiKeyAuth" }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); - TypeReference> localVarReturnType = new TypeReference>() + final TypeReference> localVarReturnType = new TypeReference>() { }; return apiClient @@ -184,75 +172,59 @@ public List sodasGet( Map additionalHeaders ) localVarQueryStringJoiner.toString(), localVarPostBody, localVarHeaderParams, - localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); } /** + *

* Get a specific soda product by ID + *

+ *

+ * 200 - The soda product + *

+ * 404 - Soda product not found * * @param id - * ID of the soda product to retrieve (required) + * ID of the soda product to retrieve * @return SodaWithId - * @throws ApiException - * if fails to make API call + * @throws OpenApiRequestException + * if an error occurs while attempting to invoke the API */ - public SodaWithId sodasIdGet( @javax.annotation.Nonnull Long id ) - throws ApiException + @Nonnull + public SodaWithId sodasIdGet( @Nonnull final Long id ) + throws OpenApiRequestException { - return this.sodasIdGet(id, Collections.emptyMap()); - } - - /** - * Get a specific soda product by ID - * - * @param id - * ID of the soda product to retrieve (required) - * @param additionalHeaders - * additionalHeaders for this call - * @return SodaWithId - * @throws ApiException - * if fails to make API call - */ - public SodaWithId sodasIdGet( @javax.annotation.Nonnull Long id, Map additionalHeaders ) - throws ApiException - { - Object localVarPostBody = null; + final Object localVarPostBody = null; // verify the required parameter 'id' is set if( id == null ) { - throw new ApiException(400, "Missing the required parameter 'id' when calling sodasIdGet"); + throw new OpenApiRequestException("Missing the required parameter 'id' when calling sodasIdGet") + .statusCode(400); } // create path and map variables - String localVarPath = - "/sodas/{id}".replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(apiClient.parameterToString(id))); + final String localVarPath = + "/sodas/{id}".replaceAll("\\{" + "id" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(id))); - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarHeaderParams.putAll(additionalHeaders); + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "apiKeyAuth" }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); - TypeReference localVarReturnType = new TypeReference() + final TypeReference localVarReturnType = new TypeReference() { }; return apiClient @@ -264,72 +236,58 @@ public SodaWithId sodasIdGet( @javax.annotation.Nonnull Long id, Map * Update a specific soda product by ID + *

+ *

+ * 200 - The updated soda product + *

+ * 204 - Nothing has changed + *

+ * 404 - Soda product not found * * @param sodaWithId - * The updated soda product (required) - * @return Soda - * @throws ApiException - * if fails to make API call - */ - public Soda sodasPut( @javax.annotation.Nonnull SodaWithId sodaWithId ) - throws ApiException - { - return this.sodasPut(sodaWithId, Collections.emptyMap()); - } - - /** - * Update a specific soda product by ID - * - * @param sodaWithId - * The updated soda product (required) - * @param additionalHeaders - * additionalHeaders for this call + * The updated soda product * @return Soda - * @throws ApiException - * if fails to make API call + * @throws OpenApiRequestException + * if an error occurs while attempting to invoke the API */ - public Soda sodasPut( @javax.annotation.Nonnull SodaWithId sodaWithId, Map additionalHeaders ) - throws ApiException + @Nullable + public Soda sodasPut( @Nonnull final SodaWithId sodaWithId ) + throws OpenApiRequestException { - Object localVarPostBody = sodaWithId; + final Object localVarPostBody = sodaWithId; // verify the required parameter 'sodaWithId' is set if( sodaWithId == null ) { - throw new ApiException(400, "Missing the required parameter 'sodaWithId' when calling sodasPut"); + throw new OpenApiRequestException("Missing the required parameter 'sodaWithId' when calling sodasPut") + .statusCode(400); } // create path and map variables - String localVarPath = "/sodas"; + final String localVarPath = "/sodas"; - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarHeaderParams.putAll(additionalHeaders); + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "apiKeyAuth" }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); - TypeReference localVarReturnType = new TypeReference() + final TypeReference localVarReturnType = new TypeReference() { }; return apiClient @@ -341,55 +299,9 @@ public Soda sodasPut( @javax.annotation.Nonnull SodaWithId sodaWithId, Map T invokeAPI( - String url, - String method, - Object request, - TypeReference returnType, - Map additionalHeaders ) - throws ApiException - { - String localVarPath = url.replace(apiClient.getBaseURL(), ""); - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "apiKeyAuth" }; - - return apiClient - .invokeAPI( - localVarPath, - method, - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - request, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - returnType); - } } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AllOf.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AllOf.java index d6462cc87..ced49cf22 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AllOf.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AllOf.java @@ -28,13 +28,11 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; /** * AllOf */ - -@Beta // CHECKSTYLE:OFF +// CHECKSTYLE:OFF public class AllOf // CHECKSTYLE:ON { diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AnyOf.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AnyOf.java index 97f8d677f..f1f51e2d1 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AnyOf.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AnyOf.java @@ -28,13 +28,11 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; /** * AnyOf */ - -@Beta // CHECKSTYLE:OFF +// CHECKSTYLE:OFF public class AnyOf // CHECKSTYLE:ON { diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Bar.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Bar.java index 55111820b..d7b296253 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Bar.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Bar.java @@ -30,13 +30,11 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; /** * Bar */ - -@Beta // CHECKSTYLE:OFF +// CHECKSTYLE:OFF public class Bar implements OneOfWithEnumDiscriminator // CHECKSTYLE:ON { diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Cola.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Cola.java index 7d5bb90be..4d89ee770 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Cola.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Cola.java @@ -28,13 +28,11 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; /** * Cola */ - -@Beta // CHECKSTYLE:OFF +// CHECKSTYLE:OFF public class Cola implements OneOf, OneOfWithDiscriminator, OneOfWithDiscriminatorAndMapping // CHECKSTYLE:ON { diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaBarCode.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaBarCode.java index 6ca5fa9dc..eb8bf12c2 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaBarCode.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaBarCode.java @@ -20,12 +20,9 @@ import javax.annotation.Nonnull; -import com.google.common.annotations.Beta; - /** * ColaBarCode */ -@Beta public interface ColaBarCode { /** diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaLogo.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaLogo.java index 84624d0e3..3191d9a4a 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaLogo.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaLogo.java @@ -19,12 +19,9 @@ import javax.annotation.Nonnull; -import com.google.common.annotations.Beta; - /** * ColaLogo */ -@Beta public interface ColaLogo { /** diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Fanta.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Fanta.java index 0215af3cb..aad7447f3 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Fanta.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Fanta.java @@ -28,13 +28,11 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; /** * Fanta */ - -@Beta // CHECKSTYLE:OFF +// CHECKSTYLE:OFF public class Fanta implements OneOf, OneOfWithDiscriminator, OneOfWithDiscriminatorAndMapping // CHECKSTYLE:ON { diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FantaFlavor.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FantaFlavor.java index 143119694..36883f283 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FantaFlavor.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FantaFlavor.java @@ -21,12 +21,10 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; /** * FantaFlavor */ -@Beta public interface FantaFlavor { /** diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FlavorType.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FlavorType.java index e95740c27..150bb8dc4 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FlavorType.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FlavorType.java @@ -28,13 +28,11 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; /** * FlavorType */ - -@Beta // CHECKSTYLE:OFF +// CHECKSTYLE:OFF public class FlavorType // CHECKSTYLE:ON { diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Foo.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Foo.java index 963d22d89..6c52ebe13 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Foo.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Foo.java @@ -30,13 +30,11 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; /** * Foo */ - -@Beta // CHECKSTYLE:OFF +// CHECKSTYLE:OFF public class Foo implements OneOfWithEnumDiscriminator // CHECKSTYLE:ON { diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOf.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOf.java index 491aeb64a..42b50cb7a 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOf.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOf.java @@ -17,12 +17,10 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.google.common.annotations.Beta; /** * OneOf */ -@Beta @JsonTypeInfo( use = JsonTypeInfo.Id.DEDUCTION ) @JsonSubTypes( { @JsonSubTypes.Type( value = Cola.class ), @JsonSubTypes.Type( value = Fanta.class ), } ) diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminator.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminator.java index f71818d41..eefc01778 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminator.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminator.java @@ -17,12 +17,10 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.google.common.annotations.Beta; /** * OneOfWithDiscriminator */ -@Beta @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, property = "sodaType", visible = true ) @JsonSubTypes( { @JsonSubTypes.Type( value = Cola.class, name = "Cola" ), diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminatorAndMapping.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminatorAndMapping.java index f9742cbd8..8a6ff0271 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminatorAndMapping.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminatorAndMapping.java @@ -17,12 +17,10 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.google.common.annotations.Beta; /** * OneOfWithDiscriminatorAndMapping */ -@Beta @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, property = "sodaType", visible = true ) @JsonSubTypes( { @JsonSubTypes.Type( value = Cola.class, name = "cool_cola" ), diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithEnumDiscriminator.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithEnumDiscriminator.java index c8657f4cb..4414cd99b 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithEnumDiscriminator.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithEnumDiscriminator.java @@ -17,12 +17,10 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.google.common.annotations.Beta; /** * OneOfWithEnumDiscriminator */ -@Beta @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, property = "disc", visible = true ) @JsonSubTypes( { @JsonSubTypes.Type( value = Bar.class, name = "disc_bar" ), diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Order.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Order.java index dfae11431..87df617d1 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Order.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Order.java @@ -28,13 +28,11 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; /** * Order */ - -@Beta // CHECKSTYLE:OFF +// CHECKSTYLE:OFF public class Order // CHECKSTYLE:ON { diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrderWithTimestamp.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrderWithTimestamp.java index 709b90bb9..a36dee610 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrderWithTimestamp.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrderWithTimestamp.java @@ -29,13 +29,11 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.Beta; /** * OrderWithTimestamp */ - -@Beta // CHECKSTYLE:OFF +// CHECKSTYLE:OFF public class OrderWithTimestamp // CHECKSTYLE:ON { diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Soda.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Soda.java index 3f334cdf3..8898b95c2 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Soda.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Soda.java @@ -30,13 +30,11 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; /** * Soda */ - -@Beta // CHECKSTYLE:OFF +// CHECKSTYLE:OFF public class Soda // CHECKSTYLE:ON { diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SodaWithId.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SodaWithId.java index efe0b425e..cb5b7a12f 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SodaWithId.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SodaWithId.java @@ -30,13 +30,11 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; -import com.google.common.annotations.Beta; /** * SodaWithId */ - -@Beta // CHECKSTYLE:OFF +// CHECKSTYLE:OFF public class SodaWithId // CHECKSTYLE:ON { diff --git a/datamodel/openapi/openapi-api-sample/pom.xml b/datamodel/openapi/openapi-api-sample/pom.xml index 1bff0e213..251db764b 100644 --- a/datamodel/openapi/openapi-api-sample/pom.xml +++ b/datamodel/openapi/openapi-api-sample/pom.xml @@ -126,7 +126,6 @@ File=byte[] create - protected true true diff --git a/datamodel/openapi/openapi-core/pom.xml b/datamodel/openapi/openapi-core/pom.xml index 46cacdeab..ce7787da4 100644 --- a/datamodel/openapi/openapi-core/pom.xml +++ b/datamodel/openapi/openapi-core/pom.xml @@ -70,6 +70,10 @@ com.fasterxml.jackson.core jackson-core + + com.google.guava + guava + org.projectlombok diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java index e8669d7bb..24682ece6 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java @@ -12,444 +12,122 @@ package com.sap.cloud.sdk.services.openapi.apache; +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; +import static com.fasterxml.jackson.annotation.PropertyAccessor.GETTER; +import static com.fasterxml.jackson.annotation.PropertyAccessor.SETTER; +import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES; +import static com.fasterxml.jackson.databind.MapperFeature.DEFAULT_VIEW_INCLUSION; +import static com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS; +import static com.sap.cloud.sdk.services.openapi.apache.DefaultApiResponseHandler.isJsonMime; +import static lombok.AccessLevel.PRIVATE; + import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; -import java.lang.reflect.Type; -import java.net.URI; import java.net.URLEncoder; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.charset.UnsupportedCharsetException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; -import java.text.DateFormat; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.Date; -import java.util.HashMap; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.Map.Entry; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; -import org.apache.hc.client5.http.cookie.BasicCookieStore; -import org.apache.hc.client5.http.cookie.Cookie; import org.apache.hc.client5.http.entity.UrlEncodedFormEntity; import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder; import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; -import org.apache.hc.client5.http.impl.classic.HttpClients; -import org.apache.hc.client5.http.impl.cookie.BasicClientCookie; import org.apache.hc.client5.http.protocol.HttpClientContext; -import org.apache.hc.core5.http.ClassicHttpResponse; import org.apache.hc.core5.http.ContentType; -import org.apache.hc.core5.http.Header; import org.apache.hc.core5.http.HttpEntity; -import org.apache.hc.core5.http.HttpResponse; -import org.apache.hc.core5.http.HttpStatus; import org.apache.hc.core5.http.NameValuePair; -import org.apache.hc.core5.http.ParseException; import org.apache.hc.core5.http.io.HttpClientResponseHandler; import org.apache.hc.core5.http.io.entity.ByteArrayEntity; -import org.apache.hc.core5.http.io.entity.EntityUtils; import org.apache.hc.core5.http.io.entity.FileEntity; import org.apache.hc.core5.http.io.entity.StringEntity; import org.apache.hc.core5.http.io.support.ClassicRequestBuilder; import org.apache.hc.core5.http.message.BasicNameValuePair; -import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import com.sap.cloud.sdk.services.openapi.apache.auth.Authentication; - +import com.google.common.annotations.Beta; +import com.sap.cloud.sdk.cloudplatform.connectivity.ApacheHttpClient5Accessor; +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; +import com.sap.cloud.sdk.services.openapi.apiclient.RFC3339DateFormat; +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; + +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.ToString; +import lombok.Value; +import lombok.With; + +@AllArgsConstructor( access = PRIVATE ) +@EqualsAndHashCode +@ToString public class ApiClient { - protected Map defaultHeaderMap = new HashMap(); - protected Map defaultCookieMap = new HashMap(); - protected String basePath = "http://localhost"; - protected List servers = - new ArrayList( - Arrays - .asList(new ServerConfiguration("", "No description provided", new HashMap()))); - protected Integer serverIndex = 0; - protected Map serverVariables = null; - protected boolean debugging = false; - protected int connectionTimeout = 0; + @Nonnull + private final CloseableHttpClient httpClient; - protected CloseableHttpClient httpClient; - protected ObjectMapper objectMapper; - protected String tempFolderPath = null; + @With + @Getter + @Nonnull + private final String basePath; - protected Map authentications; + @With( onMethod_ = @Beta ) + @Nonnull + private final ObjectMapper objectMapper; - protected ThreadLocal lastStatusCode = new ThreadLocal<>(); - protected ThreadLocal>> lastResponseHeaders = new ThreadLocal<>(); - - protected DateFormat dateFormat; + @With + @Nullable + private final String tempFolderPath; // Methods that can have a request body - protected static List bodyMethods = Arrays.asList("POST", "PUT", "DELETE", "PATCH"); - - public ApiClient( CloseableHttpClient httpClient ) - { - objectMapper = new ObjectMapper(); - objectMapper.setDefaultPropertyInclusion(JsonInclude.Include.NON_NULL); - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - objectMapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); - objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); - objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); - objectMapper.registerModule(new JavaTimeModule()); - objectMapper.registerModule(new RFC3339JavaTimeModule()); - objectMapper.setDateFormat(ApiClient.buildDefaultDateFormat()); - - dateFormat = ApiClient.buildDefaultDateFormat(); - - // Set default User-Agent. - setUserAgent("OpenAPI-Generator/0.0.1/java"); - - // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap(); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - - this.httpClient = httpClient; - } - - public ApiClient() - { - this(HttpClients.createDefault()); - } - - public static DateFormat buildDefaultDateFormat() - { - return new RFC3339DateFormat(); - } - - /** - * Returns the current object mapper used for JSON serialization/deserialization. - *

- * Note: If you make changes to the object mapper, remember to set it back via setObjectMapper in order - * to trigger HTTP client rebuilding. - *

- * - * @return Object mapper - */ - public ObjectMapper getObjectMapper() - { - return objectMapper; - } - - /** - * Sets the object mapper. - * - * @param objectMapper - * object mapper - * @return API client - */ - public ApiClient setObjectMapper( ObjectMapper objectMapper ) - { - this.objectMapper = objectMapper; - return this; - } - - public CloseableHttpClient getHttpClient() - { - return httpClient; - } - - /** - * Sets the HTTP client. - * - * @param httpClient - * HTTP client - * @return API client - */ - public ApiClient setHttpClient( CloseableHttpClient httpClient ) - { - this.httpClient = httpClient; - return this; - } - - public String getBasePath() - { - return basePath; - } - - /** - * Sets the base path. - * - * @param basePath - * base path - * @return API client - */ - public ApiClient setBasePath( String basePath ) - { - this.basePath = basePath; - this.serverIndex = null; - return this; - } - - public List getServers() - { - return servers; - } - - /** - * Sets the server. - * - * @param servers - * a list of server configuration - * @return API client - */ - public ApiClient setServers( List servers ) - { - this.servers = servers; - return this; - } - - public Integer getServerIndex() - { - return serverIndex; - } - - /** - * Sets the server index. - * - * @param serverIndex - * server index - * @return API client - */ - public ApiClient setServerIndex( Integer serverIndex ) - { - this.serverIndex = serverIndex; - return this; - } - - public Map getServerVariables() - { - return serverVariables; - } - - /** - * Sets the server variables. - * - * @param serverVariables - * server variables - * @return API client - */ - public ApiClient setServerVariables( Map serverVariables ) - { - this.serverVariables = serverVariables; - return this; - } - - /** - * Gets the status code of the previous request - * - * @return Status code - */ - @Deprecated - public int getStatusCode() - { - return lastStatusCode.get(); - } - - /** - * Gets the response headers of the previous request - * - * @return Response headers - */ - @Deprecated - public Map> getResponseHeaders() - { - return lastResponseHeaders.get(); - } - - /** - * Get authentications (key: authentication name, value: authentication). - * - * @return Map of authentication - */ - public Map getAuthentications() - { - return authentications; - } - - /** - * Get authentication for the given name. - * - * @param authName - * The authentication name - * @return The authentication, null if not found - */ - public Authentication getAuthentication( String authName ) - { - return authentications.get(authName); - } - - /** - * The path of temporary folder used to store downloaded files from endpoints with file response. The default value - * is null, i.e. using the system's default temporary folder. - * - * @return Temp folder path - */ - public String getTempFolderPath() - { - return tempFolderPath; - } - - /** - * Set the User-Agent header's value (by adding to the default header map). - * - * @param userAgent - * User agent - * @return API client - */ - public final ApiClient setUserAgent( String userAgent ) - { - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Set temp folder path - * - * @param tempFolderPath - * Temp folder path - * @return API client - */ - public ApiClient setTempFolderPath( String tempFolderPath ) - { - this.tempFolderPath = tempFolderPath; - return this; - } - - /** - * Add a default header. - * - * @param key - * The header's key - * @param value - * The header's value - * @return API client - */ - public final ApiClient addDefaultHeader( String key, String value ) - { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * Add a default cookie. - * - * @param key - * The cookie's key - * @param value - * The cookie's value - * @return API client - */ - public ApiClient addDefaultCookie( String key, String value ) - { - defaultCookieMap.put(key, value); - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - * - * @return True if debugging is on - */ - public boolean isDebugging() - { - return debugging; - } - - /** - * Enable/disable debugging for this API client. - * - * @param debugging - * To enable (true) or disable (false) debugging - * @return API client - */ - public ApiClient setDebugging( boolean debugging ) - { - // TODO: implement debugging mode - this.debugging = debugging; - return this; - } + private static final Set BODY_METHODS = Set.of("POST", "PUT", "DELETE", "PATCH"); + private static final String DEFAULT_BASE_PATH = "http://localhost"; - /** - * Connect timeout (in milliseconds). - * - * @return Connection timeout - */ - public int getConnectTimeout() + public static ApiClient fromHttpClient( @Nonnull final CloseableHttpClient httpClient ) { - return connectionTimeout; + return new ApiClient(httpClient, DEFAULT_BASE_PATH, createDefaultObjectMapper(), null); } - /** - * Set the connect timeout (in milliseconds). A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * - * @param connectionTimeout - * Connection timeout in milliseconds - * @return API client - */ - public ApiClient setConnectTimeout( int connectionTimeout ) + public static ApiClient create( @Nonnull final Destination destination ) { - this.connectionTimeout = connectionTimeout; - return this; - } + return fromHttpClient((CloseableHttpClient) ApacheHttpClient5Accessor.getHttpClient(destination)) + .withBasePath(destination.asHttp().getUri().toString()); - /** - * Get the date format used to parse/format date parameters. - * - * @return Date format - */ - public DateFormat getDateFormat() - { - return dateFormat; } - /** - * Set the date format used to parse/format date parameters. - * - * @param dateFormat - * Date format - * @return API client - */ - public ApiClient setDateFormat( DateFormat dateFormat ) + public static ApiClient create() { - this.dateFormat = dateFormat; - // Also set the date format for model (de)serialization with Date properties. - this.objectMapper.setDateFormat((DateFormat) dateFormat.clone()); - return this; + return fromHttpClient((CloseableHttpClient) ApacheHttpClient5Accessor.getHttpClient()); } - /** - * Parse the given string into Date object. - * - * @param str - * String - * @return Date - */ - public Date parseDate( String str ) + private static ObjectMapper createDefaultObjectMapper() { - try { - return dateFormat.parse(str); - } - catch( java.text.ParseException e ) { - throw new RuntimeException(e); - } + return JsonMapper + .builder() + .addModule(new JavaTimeModule()) + .defaultDateFormat(new RFC3339DateFormat()) + .visibility(GETTER, Visibility.NONE) + .visibility(SETTER, Visibility.NONE) + .defaultPropertyInclusion(JsonInclude.Value.construct(NON_NULL, NON_NULL)) + .disable(FAIL_ON_UNKNOWN_PROPERTIES) + .disable(DEFAULT_VIEW_INCLUSION) + .disable(WRITE_DATES_AS_TIMESTAMPS) + .build(); } /** @@ -459,9 +137,9 @@ public Date parseDate( String str ) * Date * @return Date in string format */ - public String formatDate( Date date ) + private static String formatDate( Date date ) { - return dateFormat.format(date); + return new RFC3339DateFormat().format(date); } /** @@ -471,7 +149,7 @@ public String formatDate( Date date ) * Object * @return Object in string format */ - public String parameterToString( Object param ) + public static String parameterToString( Object param ) { if( param == null ) { return ""; @@ -493,7 +171,7 @@ public String parameterToString( Object param ) /** * Formats the specified query parameter to a list containing a single {@code Pair} object. - * + *

* Note that {@code value} must not be a collection. * * @param name @@ -502,7 +180,7 @@ public String parameterToString( Object param ) * The value of the parameter. * @return A list containing a single {@code Pair} object. */ - public List parameterToPair( String name, Object value ) + public static List parameterToPair( String name, Object value ) { List params = new ArrayList(); @@ -517,7 +195,7 @@ public List parameterToPair( String name, Object value ) /** * Formats the specified collection query parameters to a list of {@code Pair} objects. - * + *

* Note that the values of each of the returned Pair objects are percent-encoded. * * @param collectionFormat @@ -528,7 +206,7 @@ public List parameterToPair( String name, Object value ) * The value of the parameter. * @return A list of {@code Pair} objects. */ - public List parameterToPairs( String collectionFormat, String name, Collection value ) + public static List parameterToPairs( String collectionFormat, String name, Collection value ) { List params = new ArrayList(); @@ -569,20 +247,6 @@ public List parameterToPairs( String collectionFormat, String name, Collec return params; } - /** - * Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; charset=UTF8 - * APPLICATION/JSON application/vnd.company+json - * - * @param mime - * MIME - * @return True if MIME type is boolean - */ - public boolean isJsonMime( String mime ) - { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); - } - /** * Select the Accept header's value from the given accepts array: if JSON exists in the given array, use it; * otherwise use all of them (joining into a string) @@ -592,7 +256,7 @@ public boolean isJsonMime( String mime ) * @return The Accept header to use. If the given array is empty, null will be returned (not to set the Accept * header explicitly). */ - public String selectHeaderAccept( String[] accepts ) + public static String selectHeaderAccept( String[] accepts ) { if( accepts.length == 0 ) { return null; @@ -602,7 +266,7 @@ public String selectHeaderAccept( String[] accepts ) return accept; } } - return StringUtil.join(accepts, ","); + return String.join(",", accepts); } /** @@ -613,7 +277,7 @@ public String selectHeaderAccept( String[] accepts ) * The Content-Type array to select from * @return The Content-Type header to use. If the given array is empty, or matches "any", JSON will be used. */ - public String selectHeaderContentType( String[] contentTypes ) + public static String selectHeaderContentType( String[] contentTypes ) { if( contentTypes.length == 0 || contentTypes[0].equals("*/*") ) { return "application/json"; @@ -633,7 +297,7 @@ public String selectHeaderContentType( String[] contentTypes ) * String * @return Escaped string */ - public String escapeString( String str ) + public static String escapeString( String str ) { try { return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); @@ -643,56 +307,20 @@ public String escapeString( String str ) } } - /** - * Transforms response headers into map. - * - * @param headers - * HTTP headers - * @return a map of string array - */ - protected Map> transformResponseHeaders( Header[] headers ) - { - Map> headersMap = new HashMap<>(); - for( Header header : headers ) { - List valuesList = headersMap.get(header.getName()); - if( valuesList != null ) { - valuesList.add(header.getValue()); - } else { - valuesList = new ArrayList<>(); - valuesList.add(header.getValue()); - headersMap.put(header.getName(), valuesList); - } - } - return headersMap; - } - /** * Parse content type object from header value */ - protected ContentType getContentType( String headerValue ) - throws ApiException + private ContentType getContentType( String headerValue ) + throws OpenApiRequestException { try { return ContentType.parse(headerValue); } catch( UnsupportedCharsetException e ) { - throw new ApiException("Could not parse content type " + headerValue); + throw new OpenApiRequestException("Could not parse content type " + headerValue); } } - /** - * Get content type of a response or null if one was not provided - */ - protected String getResponseMimeType( HttpResponse response ) - throws ApiException - { - Header contentTypeHeader = response.getFirstHeader("Content-Type"); - if( contentTypeHeader != null ) { - return getContentType(contentTypeHeader.getValue()).getMimeType(); - } - return null; - } - /** * Serialize the given Java object into string according the given Content-Type (only JSON is supported for now). * @@ -703,11 +331,11 @@ protected String getResponseMimeType( HttpResponse response ) * @param formParams * Form parameters * @return Object - * @throws ApiException + * @throws OpenApiRequestException * API exception */ - public HttpEntity serialize( Object obj, Map formParams, ContentType contentType ) - throws ApiException + private HttpEntity serialize( Object obj, Map formParams, ContentType contentType ) + throws OpenApiRequestException { String mimeType = contentType.getMimeType(); if( isJsonMime(mimeType) ) { @@ -717,7 +345,7 @@ public HttpEntity serialize( Object obj, Map formParams, Content contentType.withCharset(StandardCharsets.UTF_8)); } catch( JsonProcessingException e ) { - throw new ApiException(e); + throw new OpenApiRequestException(e); } } else if( mimeType.equals(ContentType.MULTIPART_FORM_DATA.getMimeType()) ) { MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create(); @@ -756,136 +384,10 @@ public HttpEntity serialize( Object obj, Map formParams, Content } else if( obj instanceof byte[] ) { return new ByteArrayEntity((byte[]) obj, contentType); } - throw new ApiException("Serialization for content type '" + contentType + "' not supported"); + throw new OpenApiRequestException("Serialization for content type '" + contentType + "' not supported"); } } - /** - * Deserialize response body to Java object according to the Content-Type. - * - * @param - * Type - * @param response - * Response - * @param valueType - * Return type - * @return Deserialized object - * @throws ApiException - * API exception - * @throws IOException - * IO exception - */ - @SuppressWarnings( "unchecked" ) - public T deserialize( ClassicHttpResponse response, TypeReference valueType ) - throws ApiException, - IOException, - ParseException - { - if( valueType == null ) { - return null; - } - HttpEntity entity = response.getEntity(); - Type valueRawType = valueType.getType(); - if( valueRawType.equals(byte[].class) ) { - return (T) EntityUtils.toByteArray(entity); - } else if( valueRawType.equals(File.class) ) { - return (T) downloadFileFromResponse(response); - } - String mimeType = getResponseMimeType(response); - if( mimeType == null || isJsonMime(mimeType) ) { - // Assume json if no mime type - // convert input stream to string - String content = EntityUtils.toString(entity); - - if( "".equals(content) ) { // returns null for empty body - return null; - } - - return objectMapper.readValue(content, valueType); - } else if( mimeType.toLowerCase().startsWith("text/") ) { - // convert input stream to string - return (T) EntityUtils.toString(entity); - } else { - Map> responseHeaders = transformResponseHeaders(response.getHeaders()); - throw new ApiException( - "Deserialization for content type '" + mimeType + "' not supported for type '" + valueType + "'", - response.getCode(), - responseHeaders, - EntityUtils.toString(entity)); - } - } - - protected File downloadFileFromResponse( ClassicHttpResponse response ) - throws IOException - { - Header contentDispositionHeader = response.getFirstHeader("Content-Disposition"); - String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue(); - File file = prepareDownloadFile(contentDisposition); - Files.copy(response.getEntity().getContent(), file.toPath(), StandardCopyOption.REPLACE_EXISTING); - return file; - } - - protected File prepareDownloadFile( String contentDisposition ) - throws IOException - { - String filename = null; - if( contentDisposition != null && !"".equals(contentDisposition) ) { - // Get filename from the Content-Disposition header. - Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); - Matcher matcher = pattern.matcher(contentDisposition); - if( matcher.find() ) - filename = matcher.group(1); - } - - String prefix; - String suffix = null; - if( filename == null ) { - prefix = "download-"; - suffix = ""; - } else { - int pos = filename.lastIndexOf('.'); - if( pos == -1 ) { - prefix = filename + "-"; - } else { - prefix = filename.substring(0, pos) + "-"; - suffix = filename.substring(pos); - } - // Files.createTempFile requires the prefix to be at least three characters long - if( prefix.length() < 3 ) - prefix = "download-"; - } - - if( tempFolderPath == null ) - return Files.createTempFile(prefix, suffix).toFile(); - else - return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); - } - - /** - * Returns the URL of the client as defined by the server (if exists) or the base path. - * - * @return The URL for the client. - */ - public String getBaseURL() - { - String baseURL; - if( serverIndex != null ) { - if( serverIndex < 0 || serverIndex >= servers.size() ) { - throw new ArrayIndexOutOfBoundsException( - String - .format( - Locale.ROOT, - "Invalid index %d when selecting the host settings. Must be less than %d", - serverIndex, - servers.size())); - } - baseURL = servers.get(serverIndex).URL(serverVariables); - } else { - baseURL = basePath; - } - return baseURL; - } - /** * Build full URL by concatenating base URL, the given sub path and query parameters. * @@ -899,14 +401,17 @@ public String getBaseURL() * URL query string of the deep object parameters * @return The full URL */ - protected + private String buildUrl( String path, List queryParams, List collectionQueryParams, String urlQueryDeepObject ) { - String baseURL = getBaseURL(); - final StringBuilder url = new StringBuilder(); - url.append(baseURL).append(path); + if( basePath.endsWith("/") && path != null && path.startsWith("/") ) { + url.append(basePath, 0, basePath.length() - 1); + } else { + url.append(basePath); + } + url.append(path); if( queryParams != null && !queryParams.isEmpty() ) { // support (constant) query string in `path`, e.g. "/posts?draft=1" @@ -951,67 +456,9 @@ public String getBaseURL() return url.toString(); } - protected boolean isSuccessfulStatus( int statusCode ) - { - return statusCode >= 200 && statusCode < 300; - } - - protected boolean isBodyAllowed( String method ) + private static boolean isBodyAllowed( String method ) { - return bodyMethods.contains(method); - } - - protected Cookie buildCookie( String key, String value, URI uri ) - { - BasicClientCookie cookie = new BasicClientCookie(key, value); - cookie.setDomain(uri.getHost()); - cookie.setPath("/"); - return cookie; - } - - /** - * Creates an HttpClientResponseHandler for processing HTTP responses. Wraps checked exceptions (ParseException, - * ApiException) as IOException since the handler interface only allows IOException to be thrown. - * - * @param - * Type - * @param returnType - * Return type - * @return HttpClientResponseHandler instance - */ - protected HttpClientResponseHandler createResponseHandler( TypeReference returnType ) - { - return response -> { - try { - return processResponse(response, returnType); - } - catch( ParseException | ApiException e ) { - // Wrap exceptions as IOException since handler can only throw IOException - throw new IOException("Failed to process response: " + e.getMessage(), e); - } - }; - } - - protected T processResponse( ClassicHttpResponse response, TypeReference returnType ) - throws ApiException, - IOException, - ParseException - { - int statusCode = response.getCode(); - lastStatusCode.set(statusCode); - if( statusCode == HttpStatus.SC_NO_CONTENT ) { - return null; - } - - Map> responseHeaders = transformResponseHeaders(response.getHeaders()); - lastResponseHeaders.set(responseHeaders); - - if( isSuccessfulStatus(statusCode) ) { - return this.deserialize(response, returnType); - } else { - String message = EntityUtils.toString(response.getEntity()); - throw new ApiException(message, statusCode, responseHeaders, message); - } + return BODY_METHODS.contains(method); } /** @@ -1033,22 +480,20 @@ protected T processResponse( ClassicHttpResponse response, TypeReference * The request body object - if it is not binary, otherwise null * @param headerParams * The header parameters - * @param cookieParams - * The cookie parameters * @param formParams * The form parameters * @param accept * The request's Accept header * @param contentType * The request's Content-Type header - * @param authNames - * The authentications to apply * @param returnType * Return type * @return The response body in type of string - * @throws ApiException + * @throws OpenApiRequestException * API exception */ + @Beta + @Nullable public T invokeAPI( String path, String method, @@ -1057,19 +502,16 @@ public T invokeAPI( String urlQueryDeepObject, Object body, Map headerParams, - Map cookieParams, Map formParams, String accept, String contentType, - String[] authNames, TypeReference returnType ) - throws ApiException + throws OpenApiRequestException { if( body != null && !formParams.isEmpty() ) { - throw new ApiException("Cannot have body and form params"); + throw new OpenApiRequestException("Cannot have body and form params"); } - updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); final String url = buildUrl(path, queryParams, collectionQueryParams, urlQueryDeepObject); ClassicRequestBuilder builder = ClassicRequestBuilder.create(method); @@ -1081,24 +523,8 @@ public T invokeAPI( for( Entry keyValue : headerParams.entrySet() ) { builder.addHeader(keyValue.getKey(), keyValue.getValue()); } - for( Map.Entry keyValue : defaultHeaderMap.entrySet() ) { - if( !headerParams.containsKey(keyValue.getKey()) ) { - builder.addHeader(keyValue.getKey(), keyValue.getValue()); - } - } - - BasicCookieStore store = new BasicCookieStore(); - for( Entry keyValue : cookieParams.entrySet() ) { - store.addCookie(buildCookie(keyValue.getKey(), keyValue.getValue(), builder.getUri())); - } - for( Entry keyValue : defaultCookieMap.entrySet() ) { - if( !cookieParams.containsKey(keyValue.getKey()) ) { - store.addCookie(buildCookie(keyValue.getKey(), keyValue.getValue(), builder.getUri())); - } - } HttpClientContext context = HttpClientContext.create(); - context.setCookieStore(store); ContentType contentTypeObj = getContentType(contentType); if( body != null || !formParams.isEmpty() ) { @@ -1106,7 +532,7 @@ public T invokeAPI( // Add entity if we have content and a valid method builder.setEntity(serialize(body, formParams, contentTypeObj)); } else { - throw new ApiException("method " + method + " does not support a request body"); + throw new OpenApiRequestException("method " + method + " does not support a request body"); } } else { // for empty body @@ -1114,37 +540,12 @@ public T invokeAPI( } try { - HttpClientResponseHandler responseHandler = createResponseHandler(returnType); + HttpClientResponseHandler responseHandler = + new DefaultApiResponseHandler<>(objectMapper, tempFolderPath, returnType); return httpClient.execute(builder.build(), context, responseHandler); } catch( IOException e ) { - throw new ApiException(e); - } - } - - /** - * Update query and header parameters based on authentication settings. - * - * @param authNames - * The authentications to apply - * @param queryParams - * Query parameters - * @param headerParams - * Header parameters - * @param cookieParams - * Cookie parameters - */ - protected void updateParamsForAuth( - String[] authNames, - List queryParams, - Map headerParams, - Map cookieParams ) - { - for( String authName : authNames ) { - Authentication auth = authentications.get(authName); - if( auth == null ) - throw new RuntimeException("Authentication undefined: " + authName); - auth.applyToParams(queryParams, headerParams, cookieParams); + throw new OpenApiRequestException(e); } } } diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiException.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiException.java deleted file mode 100644 index b8ab4534c..000000000 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiException.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * The version of the OpenAPI document: 0.0.1 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.services.openapi.apache; - -import java.util.List; -import java.util.Map; - -public class ApiException extends Exception -{ - private static final long serialVersionUID = 1L; - - private int code = 0; - private transient Map> responseHeaders = null; - private String responseBody = null; - - public ApiException() - { - } - - public ApiException( Throwable throwable ) - { - super(throwable); - } - - public ApiException( String message ) - { - super(message); - } - - public ApiException( - String message, - Throwable throwable, - int code, - Map> responseHeaders, - String responseBody ) - { - super(message, throwable); - this.code = code; - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - public ApiException( String message, int code, Map> responseHeaders, String responseBody ) - { - this(message, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException( String message, Throwable throwable, int code, Map> responseHeaders ) - { - this(message, throwable, code, responseHeaders, null); - } - - public ApiException( int code, Map> responseHeaders, String responseBody ) - { - this( - "Response Code: " + code + " Response Body: " + responseBody, - (Throwable) null, - code, - responseHeaders, - responseBody); - } - - public ApiException( int code, String message ) - { - super(message); - this.code = code; - } - - public ApiException( int code, String message, Map> responseHeaders, String responseBody ) - { - this(code, message); - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - /** - * Get the HTTP status code. - * - * @return HTTP status code - */ - public int getCode() - { - return code; - } - - /** - * Get the HTTP response headers. - * - * @return A map of list of string - */ - public Map> getResponseHeaders() - { - return responseHeaders; - } - - /** - * Get the HTTP response body. - * - * @return Response body in the form of string - */ - public String getResponseBody() - { - return responseBody; - } - - @Override - public String toString() - { - return "ApiException{" - + "code=" - + code - + ", responseHeaders=" - + responseHeaders - + ", responseBody='" - + responseBody - + '\'' - + '}'; - } -} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/BaseApi.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/BaseApi.java index 7203f9e7f..45a4cbb23 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/BaseApi.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/BaseApi.java @@ -12,170 +12,26 @@ package com.sap.cloud.sdk.services.openapi.apache; -import java.util.Collections; -import java.util.Map; +import javax.annotation.Nonnull; -import com.fasterxml.jackson.core.type.TypeReference; +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; public abstract class BaseApi { + protected final ApiClient apiClient; - protected ApiClient apiClient; - - public BaseApi() - { - this(Configuration.getDefaultApiClient()); - } - - public BaseApi( ApiClient apiClient ) + protected BaseApi() { - this.apiClient = apiClient; + this(ApiClient.create()); } - public ApiClient getApiClient() + protected BaseApi( @Nonnull final Destination destination ) { - return apiClient; + this(ApiClient.create(destination)); } - public void setApiClient( ApiClient apiClient ) + protected BaseApi( @Nonnull final ApiClient apiClient ) { this.apiClient = apiClient; } - - /** - * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. - * - * @param url - * The URL for the request, either full URL or only the path. - * @param method - * The HTTP method for the request. - * @throws ApiException - * if fails to make API call. - */ - public void invokeAPI( String url, String method ) - throws ApiException - { - invokeAPI(url, method, null, null, Collections.emptyMap()); - } - - /** - * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. - * - * @param url - * The URL for the request, either full URL or only the path. - * @param method - * The HTTP method for the request. - * @param additionalHeaders - * Additional headers for the request. - * @throws ApiException - * if fails to make API call. - */ - public void invokeAPI( String url, String method, Map additionalHeaders ) - throws ApiException - { - invokeAPI(url, method, null, null, additionalHeaders); - } - - /** - * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. - * - * @param url - * The URL for the request, either full URL or only the path. - * @param method - * The HTTP method for the request. - * @param request - * The request object. - * @throws ApiException - * if fails to make API call. - */ - public void invokeAPI( String url, String method, Object request ) - throws ApiException - { - invokeAPI(url, method, request, null, Collections.emptyMap()); - } - - /** - * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. - * - * @param url - * The URL for the request, either full URL or only the path. - * @param method - * The HTTP method for the request. - * @param request - * The request object. - * @param additionalHeaders - * Additional headers for the request. - * @throws ApiException - * if fails to make API call. - */ - public void invokeAPI( String url, String method, Object request, Map additionalHeaders ) - throws ApiException - { - invokeAPI(url, method, request, null, additionalHeaders); - } - - /** - * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. - * - * @param url - * The URL for the request, either full URL or only the path. - * @param method - * The HTTP method for the request. - * @param returnType - * The return type. - * @return The API response in the specified type. - * @throws ApiException - * if fails to make API call. - */ - public T invokeAPI( String url, String method, TypeReference returnType ) - throws ApiException - { - return invokeAPI(url, method, null, returnType, Collections.emptyMap()); - } - - /** - * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. - * - * @param url - * The URL for the request, either full URL or only the path. - * @param method - * The HTTP method for the request. - * @param request - * The request object. - * @param returnType - * The return type. - * @return The API response in the specified type. - * @throws ApiException - * if fails to make API call. - */ - public T invokeAPI( String url, String method, Object request, TypeReference returnType ) - throws ApiException - { - return invokeAPI(url, method, request, returnType, Collections.emptyMap()); - } - - /** - * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. - * - * @param url - * The URL for the request, either full URL or only the path. - * @param method - * The HTTP method for the request. - * @param request - * The request object. - * @param returnType - * The return type. - * @param additionalHeaders - * Additional headers for the request. - * @return The API response in the specified type. - * @throws ApiException - * if fails to make API call. - */ - public abstract T invokeAPI( - String url, - String method, - Object request, - TypeReference returnType, - Map additionalHeaders ) - throws ApiException; } diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Configuration.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Configuration.java deleted file mode 100644 index 8978044d7..000000000 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Configuration.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * The version of the OpenAPI document: 0.0.1 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.services.openapi.apache; - -import java.util.Objects; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Supplier; - -public class Configuration -{ - public static final String VERSION = "0.0.1"; - - private static final AtomicReference defaultApiClient = new AtomicReference<>(); - private static volatile Supplier apiClientFactory = ApiClient::new; - - /** - * Get the default API client, which would be used when creating API instances without providing an API client. - * - * @return Default API client - */ - public static ApiClient getDefaultApiClient() - { - ApiClient client = defaultApiClient.get(); - if( client == null ) { - client = defaultApiClient.updateAndGet(val -> { - if( val != null ) { // changed by another thread - return val; - } - return apiClientFactory.get(); - }); - } - return client; - } - - /** - * Set the default API client, which would be used when creating API instances without providing an API client. - * - * @param apiClient - * API client - */ - public static void setDefaultApiClient( ApiClient apiClient ) - { - defaultApiClient.set(apiClient); - } - - /** - * set the callback used to create new ApiClient objects - */ - public static void setApiClientFactory( Supplier factory ) - { - apiClientFactory = Objects.requireNonNull(factory); - } - - private Configuration() - { - } -} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/DefaultApiResponseHandler.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/DefaultApiResponseHandler.java new file mode 100644 index 000000000..fac2b4f61 --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/DefaultApiResponseHandler.java @@ -0,0 +1,333 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.openapi.apache; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.charset.UnsupportedCharsetException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.hc.core5.http.ClassicHttpResponse; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.Header; +import org.apache.hc.core5.http.HttpEntity; +import org.apache.hc.core5.http.HttpException; +import org.apache.hc.core5.http.HttpResponse; +import org.apache.hc.core5.http.HttpStatus; +import org.apache.hc.core5.http.ParseException; +import org.apache.hc.core5.http.io.HttpClientResponseHandler; +import org.apache.hc.core5.http.io.entity.EntityUtils; +import org.apache.hc.core5.http.message.StatusLine; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; + +/** + * Handles HTTP response processing for API client operations. This class encapsulates response deserialization, error + * handling, and file download functionality. + * + * @param + * The type of object to deserialize the response into + */ +class DefaultApiResponseHandler implements HttpClientResponseHandler +{ + private final ObjectMapper objectMapper; + private final String tempFolderPath; + private final TypeReference returnType; + + /** + * Creates a new response handler with the specified configuration. + * + * @param objectMapper + * The Jackson ObjectMapper for JSON deserialization + * @param tempFolderPath + * The temporary folder path for file downloads (null for system default) + * @param returnType + * The type reference for response deserialization + */ + DefaultApiResponseHandler( ObjectMapper objectMapper, String tempFolderPath, TypeReference returnType ) + { + this.objectMapper = objectMapper; + this.tempFolderPath = tempFolderPath; + this.returnType = returnType; + } + + @Override + public T handleResponse( ClassicHttpResponse response ) + throws HttpException, + IOException + { + try { + return processResponse(response); + } + catch( ParseException | OpenApiRequestException e ) { + // Wrap exceptions as IOException since handler can only throw IOException + throw new IOException("Failed to process response: " + e.getMessage(), e); + } + } + + /** + * Processes the HTTP response and returns the deserialized result. + * + * @param response + * The HTTP response to process + * @return The deserialized response object + * @throws OpenApiRequestException + * if the response indicates an error + * @throws IOException + * if an I/O error occurs + * @throws ParseException + * if response parsing fails + */ + @SuppressWarnings( "unchecked" ) + private T processResponse( ClassicHttpResponse response ) + throws OpenApiRequestException, + IOException, + ParseException + { + int statusCode = response.getCode(); + if( statusCode == HttpStatus.SC_NO_CONTENT ) { + if( returnType.getType().equals(OpenApiResponse.class) ) { + return (T) new OpenApiResponse(statusCode, transformResponseHeaders(response.getHeaders())); + } + return null; + } + + if( isSuccessfulStatus(statusCode) ) { + return deserialize(response); + } else { + Map> responseHeaders = transformResponseHeaders(response.getHeaders()); + String message = new StatusLine(response).toString(); + throw new OpenApiRequestException(message) + .statusCode(statusCode) + .responseHeaders(responseHeaders) + .responseBody(EntityUtils.toString(response.getEntity())); + } + } + + /** + * Deserializes the response body to a Java object according to the Content-Type. + * + * @param response + * The HTTP response to deserialize + * @return The deserialized object + * @throws OpenApiRequestException + * if deserialization fails + * @throws IOException + * if an I/O error occurs + * @throws ParseException + * if response parsing fails + */ + @SuppressWarnings( "unchecked" ) + private T deserialize( ClassicHttpResponse response ) + throws OpenApiRequestException, + IOException, + ParseException + { + if( returnType == null ) { + return null; + } + + final Type valueRawType = returnType.getType(); + if( valueRawType.equals(OpenApiResponse.class) ) { + final int statusCode = response.getCode(); + Map> headers = transformResponseHeaders(response.getHeaders()); + return (T) new OpenApiResponse(statusCode, headers); + } + + HttpEntity entity = response.getEntity(); + if( valueRawType.equals(byte[].class) ) { + return (T) EntityUtils.toByteArray(entity); + } else if( valueRawType.equals(File.class) ) { + return (T) downloadFileFromResponse(response); + } + String mimeType = getResponseMimeType(response); + if( mimeType == null || isJsonMime(mimeType) ) { + // Assume json if no mime type + // convert input stream to string + String content = EntityUtils.toString(entity); + + if( "".equals(content) ) { // returns null for empty body + return null; + } + + return objectMapper.readValue(content, returnType); + } else if( mimeType.toLowerCase().startsWith("text/") ) { + // convert input stream to string + return (T) EntityUtils.toString(entity); + } else { + Map> responseHeaders = transformResponseHeaders(response.getHeaders()); + throw new OpenApiRequestException( + "Deserialization for content type '" + mimeType + "' not supported for type '" + returnType + "'") + .statusCode(response.getCode()) + .responseHeaders(responseHeaders) + .responseBody(EntityUtils.toString(entity)); + } + } + + /** + * Downloads a file from the HTTP response. + * + * @param response + * The HTTP response containing the file + * @return The downloaded file + * @throws IOException + * if an I/O error occurs during download + */ + private File downloadFileFromResponse( ClassicHttpResponse response ) + throws IOException + { + Header contentDispositionHeader = response.getFirstHeader("Content-Disposition"); + String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue(); + File file = prepareDownloadFile(contentDisposition); + Files.copy(response.getEntity().getContent(), file.toPath(), StandardCopyOption.REPLACE_EXISTING); + return file; + } + + /** + * Prepares a temporary file for downloading response content. + * + * @param contentDisposition + * The Content-Disposition header value (may be null) + * @return A temporary file for storing the download + * @throws IOException + * if the temporary file cannot be created + */ + private File prepareDownloadFile( String contentDisposition ) + throws IOException + { + String filename = null; + if( contentDisposition != null && !"".equals(contentDisposition) ) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if( matcher.find() ) + filename = matcher.group(1); + } + + String prefix; + String suffix = null; + if( filename == null ) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf('.'); + if( pos == -1 ) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // Files.createTempFile requires the prefix to be at least three characters long + if( prefix.length() < 3 ) + prefix = "download-"; + } + + if( tempFolderPath == null ) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * Gets the MIME type from the response Content-Type header. + * + * @param response + * The HTTP response + * @return The MIME type, or null if not present + * @throws OpenApiRequestException + * if the content type cannot be parsed + */ + private String getResponseMimeType( HttpResponse response ) + throws OpenApiRequestException + { + Header contentTypeHeader = response.getFirstHeader("Content-Type"); + if( contentTypeHeader != null ) { + return parseContentType(contentTypeHeader.getValue()).getMimeType(); + } + return null; + } + + /** + * Parses a Content-Type header value into a ContentType object. + * + * @param headerValue + * The Content-Type header value + * @return The parsed ContentType object + * @throws OpenApiRequestException + * if the content type cannot be parsed + */ + private static ContentType parseContentType( String headerValue ) + throws OpenApiRequestException + { + try { + return ContentType.parse(headerValue); + } + catch( UnsupportedCharsetException e ) { + throw new OpenApiRequestException("Could not parse content type " + headerValue); + } + } + + /** + * Transforms response headers into map. + * + * @param headers + * HTTP headers + * @return a map of string array + */ + private static Map> transformResponseHeaders( Header[] headers ) + { + Map> headersMap = new HashMap<>(); + for( Header header : headers ) { + List valuesList = headersMap.get(header.getName()); + if( valuesList != null ) { + valuesList.add(header.getValue()); + } else { + valuesList = new ArrayList<>(); + valuesList.add(header.getValue()); + headersMap.put(header.getName(), valuesList); + } + } + return headersMap; + } + + private static boolean isSuccessfulStatus( int statusCode ) + { + return statusCode >= 200 && statusCode < 300; + } + + /** + * Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; charset=UTF8 + * APPLICATION/JSON application/vnd.company+json + * + * @param mime + * MIME + * @return True if MIME type is boolean + */ + static boolean isJsonMime( String mime ) + { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + +} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/OpenApiResponse.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/OpenApiResponse.java new file mode 100644 index 000000000..f4cc3c35d --- /dev/null +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/OpenApiResponse.java @@ -0,0 +1,30 @@ +package com.sap.cloud.sdk.services.openapi.apache; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Nonnull; + +import lombok.Getter; + +/** + * Response object for Apache HTTP client OpenAPI calls containing status code and headers + */ +@Getter +public class OpenApiResponse +{ + + private final int statusCode; + + @Nonnull + private final Map> headers; + + /** + * Create a new OpenApiResponse with status code and headers. + */ + OpenApiResponse( final int statusCode, @Nonnull final Map> headers ) + { + this.statusCode = statusCode; + this.headers = Map.copyOf(headers); + } +} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Pair.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Pair.java index c7e9a9711..1ab38e5f7 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Pair.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Pair.java @@ -12,29 +12,15 @@ package com.sap.cloud.sdk.services.openapi.apache; -public class Pair -{ - private final String name; - private final String value; - - public Pair( String name, String value ) - { - this.name = isValidString(name) ? name : ""; - this.value = isValidString(value) ? value : ""; - } +import javax.annotation.Nonnull; - public String getName() - { - return this.name; - } +import lombok.Value; - public String getValue() - { - return this.value; - } - - private static boolean isValidString( String arg ) - { - return arg != null; - } +@Value +public class Pair +{ + @Nonnull + String name; + @Nonnull + String value; } diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339DateFormat.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339DateFormat.java deleted file mode 100644 index 8d841d0bd..000000000 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339DateFormat.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * The version of the OpenAPI document: 0.0.1 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.services.openapi.apache; - -import java.text.DateFormat; -import java.text.DecimalFormat; -import java.text.FieldPosition; -import java.text.ParsePosition; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.TimeZone; - -import com.fasterxml.jackson.databind.util.StdDateFormat; - -public class RFC3339DateFormat extends DateFormat -{ - private static final long serialVersionUID = 1L; - private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - - private final StdDateFormat fmt = new StdDateFormat().withTimeZone(TIMEZONE_Z).withColonInTimeZone(true); - - public RFC3339DateFormat() - { - this.calendar = new GregorianCalendar(); - this.numberFormat = new DecimalFormat(); - } - - @Override - public Date parse( String source ) - { - return parse(source, new ParsePosition(0)); - } - - @Override - public Date parse( String source, ParsePosition pos ) - { - return fmt.parse(source, pos); - } - - @Override - public StringBuffer format( Date date, StringBuffer toAppendTo, FieldPosition fieldPosition ) - { - return fmt.format(date, toAppendTo, fieldPosition); - } - - @Override - public Object clone() - { - return super.clone(); - } -} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339InstantDeserializer.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339InstantDeserializer.java deleted file mode 100644 index ae5560a88..000000000 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339InstantDeserializer.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * The version of the OpenAPI document: 0.0.1 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.services.openapi.apache; - -import java.io.IOException; -import java.time.Instant; -import java.time.OffsetDateTime; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.time.temporal.Temporal; -import java.time.temporal.TemporalAccessor; -import java.util.function.BiFunction; -import java.util.function.Function; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; -import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; - -public class RFC3339InstantDeserializer extends InstantDeserializer -{ - private static final long serialVersionUID = 1L; - private final static boolean DEFAULT_NORMALIZE_ZONE_ID = - JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); - private final static boolean DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS = - JavaTimeFeature.ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS.enabledByDefault(); - - public static final RFC3339InstantDeserializer INSTANT = - new RFC3339InstantDeserializer<>( - Instant.class, - DateTimeFormatter.ISO_INSTANT, - Instant::from, - a -> Instant.ofEpochMilli(a.value), - a -> Instant.ofEpochSecond(a.integer, a.fraction), - null, - true, // yes, replace zero offset with Z - DEFAULT_NORMALIZE_ZONE_ID, - DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS); - - public static final RFC3339InstantDeserializer OFFSET_DATE_TIME = - new RFC3339InstantDeserializer<>( - OffsetDateTime.class, - DateTimeFormatter.ISO_OFFSET_DATE_TIME, - OffsetDateTime::from, - a -> OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId), - a -> OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId), - ( - d, - z ) -> (d.isEqual(OffsetDateTime.MIN) || d.isEqual(OffsetDateTime.MAX) - ? d - : d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime()))), - true, // yes, replace zero offset with Z - DEFAULT_NORMALIZE_ZONE_ID, - DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS); - - public static final RFC3339InstantDeserializer ZONED_DATE_TIME = - new RFC3339InstantDeserializer<>( - ZonedDateTime.class, - DateTimeFormatter.ISO_ZONED_DATE_TIME, - ZonedDateTime::from, - a -> ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId), - a -> ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId), - ZonedDateTime::withZoneSameInstant, - false, // keep zero offset and Z separate since zones explicitly supported - DEFAULT_NORMALIZE_ZONE_ID, - DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS); - - protected RFC3339InstantDeserializer( - Class supportedType, - DateTimeFormatter formatter, - Function parsedToValue, - Function fromMilliseconds, - Function fromNanoseconds, - BiFunction adjust, - boolean replaceZeroOffsetAsZ, - boolean normalizeZoneId, - boolean readNumericStringsAsTimestamp ) - { - super( - supportedType, - formatter, - parsedToValue, - fromMilliseconds, - fromNanoseconds, - adjust, - replaceZeroOffsetAsZ, - normalizeZoneId, - readNumericStringsAsTimestamp); - } - - @Override - protected T _fromString( JsonParser p, DeserializationContext ctxt, String string0 ) - throws IOException - { - return super._fromString(p, ctxt, string0.replace(' ', 'T')); - } -} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339JavaTimeModule.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339JavaTimeModule.java deleted file mode 100644 index ce882de8c..000000000 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/RFC3339JavaTimeModule.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * The version of the OpenAPI document: 0.0.1 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.services.openapi.apache; - -import java.time.Instant; -import java.time.OffsetDateTime; -import java.time.ZonedDateTime; - -import com.fasterxml.jackson.databind.module.SimpleModule; - -public class RFC3339JavaTimeModule extends SimpleModule -{ - private static final long serialVersionUID = 1L; - - public RFC3339JavaTimeModule() - { - super("RFC3339JavaTimeModule"); - } - - @Override - public void setupModule( SetupContext context ) - { - super.setupModule(context); - - addDeserializer(Instant.class, RFC3339InstantDeserializer.INSTANT); - addDeserializer(OffsetDateTime.class, RFC3339InstantDeserializer.OFFSET_DATE_TIME); - addDeserializer(ZonedDateTime.class, RFC3339InstantDeserializer.ZONED_DATE_TIME); - } - -} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerConfiguration.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerConfiguration.java deleted file mode 100644 index 3c91ed3b8..000000000 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerConfiguration.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * The version of the OpenAPI document: 0.0.1 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.services.openapi.apache; - -import java.util.Map; - -/** - * Representing a Server configuration. - */ -public class ServerConfiguration -{ - public String URL; - public String description; - public Map variables; - - /** - * @param URL - * A URL to the target host. - * @param description - * A description of the host designated by the URL. - * @param variables - * A map between a variable name and its value. The value is used for substitution in the server's URL - * template. - */ - public ServerConfiguration( String URL, String description, Map variables ) - { - this.URL = URL; - this.description = description; - this.variables = variables; - } - - /** - * Format URL template using given variables. - * - * @param variables - * A map between a variable name and its value. - * @return Formatted URL. - */ - public String URL( Map variables ) - { - String url = this.URL; - - // go through variables and replace placeholders - for( Map.Entry variable : this.variables.entrySet() ) { - String name = variable.getKey(); - ServerVariable serverVariable = variable.getValue(); - String value = serverVariable.defaultValue; - - if( variables != null && variables.containsKey(name) ) { - value = variables.get(name); - if( serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value) ) { - throw new IllegalArgumentException( - "The variable " + name + " in the server URL has invalid value " + value + "."); - } - } - url = url.replace("{" + name + "}", value); - } - return url; - } - - /** - * Format URL template using default server variables. - * - * @return Formatted URL. - */ - public String URL() - { - return URL(null); - } -} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerVariable.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerVariable.java deleted file mode 100644 index e2e4a3d06..000000000 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ServerVariable.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * The version of the OpenAPI document: 0.0.1 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.services.openapi.apache; - -import java.util.HashSet; - -/** - * Representing a Server Variable for server URL template substitution. - */ -public class ServerVariable -{ - public String description; - public String defaultValue; - public HashSet enumValues = null; - - /** - * @param description - * A description for the server variable. - * @param defaultValue - * The default value to use for substitution. - * @param enumValues - * An enumeration of string values to be used if the substitution options are from a limited set. - */ - public ServerVariable( String description, String defaultValue, HashSet enumValues ) - { - this.description = description; - this.defaultValue = defaultValue; - this.enumValues = enumValues; - } -} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/StringUtil.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/StringUtil.java deleted file mode 100644 index 8fe49ac89..000000000 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/StringUtil.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * The version of the OpenAPI document: 0.0.1 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.services.openapi.apache; - -import java.util.Collection; -import java.util.Iterator; - -public class StringUtil -{ - /** - * Check if the given array contains the given value (with case-insensitive comparison). - * - * @param array - * The array - * @param value - * The value to search - * @return true if the array contains the value - */ - public static boolean containsIgnoreCase( String[] array, String value ) - { - for( String str : array ) { - if( value == null && str == null ) { - return true; - } - if( value != null && value.equalsIgnoreCase(str) ) { - return true; - } - } - return false; - } - - /** - * Join an array of strings with the given separator. - *

- * Note: This might be replaced by utility method from commons-lang or guava someday if one of those libraries is - * added as dependency. - *

- * - * @param array - * The array of strings - * @param separator - * The separator - * @return the resulting string - */ - public static String join( String[] array, String separator ) - { - int len = array.length; - if( len == 0 ) { - return ""; - } - - StringBuilder out = new StringBuilder(); - out.append(array[0]); - for( int i = 1; i < len; i++ ) { - out.append(separator).append(array[i]); - } - return out.toString(); - } - - /** - * Join a list of strings with the given separator. - * - * @param list - * The list of strings - * @param separator - * The separator - * @return the resulting string - */ - public static String join( Collection list, String separator ) - { - Iterator iterator = list.iterator(); - StringBuilder out = new StringBuilder(); - if( iterator.hasNext() ) { - out.append(iterator.next()); - } - while( iterator.hasNext() ) { - out.append(separator).append(iterator.next()); - } - return out.toString(); - } -} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/ApiKeyAuth.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/ApiKeyAuth.java deleted file mode 100644 index 87f4fe832..000000000 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/ApiKeyAuth.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * The version of the OpenAPI document: 0.0.1 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.services.openapi.apache.auth; - -import java.util.List; -import java.util.Map; - -import com.sap.cloud.sdk.services.openapi.apache.Pair; - -public class ApiKeyAuth implements Authentication -{ - private final String location; - private final String paramName; - - private String apiKey; - private String apiKeyPrefix; - - public ApiKeyAuth( String location, String paramName ) - { - this.location = location; - this.paramName = paramName; - } - - public String getLocation() - { - return location; - } - - public String getParamName() - { - return paramName; - } - - public String getApiKey() - { - return apiKey; - } - - public void setApiKey( String apiKey ) - { - this.apiKey = apiKey; - } - - public String getApiKeyPrefix() - { - return apiKeyPrefix; - } - - public void setApiKeyPrefix( String apiKeyPrefix ) - { - this.apiKeyPrefix = apiKeyPrefix; - } - - @Override - public - void - applyToParams( List queryParams, Map headerParams, Map cookieParams ) - { - if( apiKey == null ) { - return; - } - String value; - if( apiKeyPrefix != null ) { - value = apiKeyPrefix + " " + apiKey; - } else { - value = apiKey; - } - if( "query".equals(location) ) { - queryParams.add(new Pair(paramName, value)); - } else if( "header".equals(location) ) { - headerParams.put(paramName, value); - } else if( "cookie".equals(location) ) { - cookieParams.put(paramName, value); - } - } -} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/Authentication.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/Authentication.java deleted file mode 100644 index 92d1e48b2..000000000 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/Authentication.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * The version of the OpenAPI document: 0.0.1 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.services.openapi.apache.auth; - -import java.util.List; -import java.util.Map; - -import com.sap.cloud.sdk.services.openapi.apache.Pair; - -public interface Authentication -{ - /** - * Apply authentication settings to header and query params. - * - * @param queryParams - * List of query parameters - * @param headerParams - * Map of header parameters - * @param cookieParams - * Map of cookie parameters - */ - void applyToParams( List queryParams, Map headerParams, Map cookieParams ); -} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBasicAuth.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBasicAuth.java deleted file mode 100644 index fc48507f6..000000000 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBasicAuth.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * The version of the OpenAPI document: 0.0.1 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.services.openapi.apache.auth; - -import java.nio.charset.StandardCharsets; -import java.util.Base64; -import java.util.List; -import java.util.Map; - -import com.sap.cloud.sdk.services.openapi.apache.Pair; - -public class HttpBasicAuth implements Authentication -{ - private String username; - private String password; - - public String getUsername() - { - return username; - } - - public void setUsername( String username ) - { - this.username = username; - } - - public String getPassword() - { - return password; - } - - public void setPassword( String password ) - { - this.password = password; - } - - @Override - public - void - applyToParams( List queryParams, Map headerParams, Map cookieParams ) - { - if( username == null && password == null ) { - return; - } - String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); - headerParams - .put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); - } -} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBearerAuth.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBearerAuth.java deleted file mode 100644 index 886915d6e..000000000 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/auth/HttpBearerAuth.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Prompt Registry API - * Prompt Storage service for Design time & Runtime prompt templates. - * - * The version of the OpenAPI document: 0.0.1 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.sap.cloud.sdk.services.openapi.apache.auth; - -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; - -import com.sap.cloud.sdk.services.openapi.apache.Pair; - -public class HttpBearerAuth implements Authentication -{ - private final String scheme; - private Supplier tokenSupplier; - - public HttpBearerAuth( String scheme ) - { - this.scheme = upperCaseBearer(scheme); - } - - /** - * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. - * - * @return The bearer token - */ - public String getBearerToken() - { - return tokenSupplier.get(); - } - - /** - * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. - * - * @param bearerToken - * The bearer token to send in the Authorization header - */ - public void setBearerToken( String bearerToken ) - { - this.tokenSupplier = () -> bearerToken; - } - - /** - * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization - * header. - * - * @param tokenSupplier - * The supplier of bearer tokens to send in the Authorization header - */ - public void setBearerToken( Supplier tokenSupplier ) - { - this.tokenSupplier = tokenSupplier; - } - - @Override - public - void - applyToParams( List queryParams, Map headerParams, Map cookieParams ) - { - String bearerToken = tokenSupplier != null ? tokenSupplier.get() : null; - if( bearerToken == null ) { - return; - } - headerParams.put("Authorization", (scheme != null ? scheme + " " : "") + bearerToken); - } - - private static String upperCaseBearer( String scheme ) - { - return "bearer".equalsIgnoreCase(scheme) ? "Bearer" : scheme; - } -} diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/core/OpenApiRequestException.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/core/OpenApiRequestException.java index c22e6a505..6237641e1 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/core/OpenApiRequestException.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/core/OpenApiRequestException.java @@ -1,14 +1,32 @@ package com.sap.cloud.sdk.services.openapi.core; +import java.util.List; +import java.util.Map; + import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; /** * Thrown if an error occurs during the invocation of a OpenAPI service. */ +@Accessors( fluent = true ) +@Getter +@Setter public class OpenApiRequestException extends RuntimeException { private static final long serialVersionUID = -8248392392632616674L; + @Nullable + private Integer statusCode; + @Nullable + private transient Map> responseHeaders; + @Nullable + private transient String responseBody; + /** * Thrown if an error occurs during the invocation of a OpenAPI service. * diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache index becb08a14..e6a5a6b92 100644 --- a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache +++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache @@ -1,21 +1,26 @@ -{{>licenseInfo}} +{{#copyrightHeader}} +/* +* {{copyrightHeader}} +*/ +{{/copyrightHeader}} + package {{package}}; import com.fasterxml.jackson.core.type.TypeReference; -import {{invokerPackage}}.ApiException; -import {{invokerPackage}}.ApiClient; -import {{invokerPackage}}.BaseApi; -import {{invokerPackage}}.Configuration; +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import com.sap.cloud.sdk.services.openapi.apache.OpenApiResponse; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + {{#models.0}} import {{modelPackage}}.*; {{/models.0}} -import {{invokerPackage}}.Pair; {{#imports}}import {{import}}; {{/imports}} - import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -24,222 +29,158 @@ import java.util.Locale; import java.util.Map; import java.util.StringJoiner; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +{{^aiSdkConstructor}}import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; +{{/aiSdkConstructor}} +{{#aiSdkConstructor}}import com.sap.ai.sdk.core.AiCoreService; +{{/aiSdkConstructor}} + {{#useBeanValidation}} import {{javaxPackage}}.validation.constraints.*; import {{javaxPackage}}.validation.Valid; {{/useBeanValidation}} -{{!>generatedAnnotation}} +/** +* {{appName}} in version {{version}}. +* +* {{#appDescription}}{{{appDescription}}}{{/appDescription}}{{^appDescription}}No description provided.{{/appDescription}} +*/ +{{!>generatedAnnotation}} {{#operations}} - public class {{classname}} extends BaseApi { - - public {{classname}}() { - super(Configuration.getDefaultApiClient()); +public class {{classname}} extends BaseApi { + + {{^aiSdkConstructor}} + /** + * Instantiates this API class to invoke operations on the {{appName}} + */ + public {{classname}}() {} + + /** + * Instantiates this API class to invoke operations on the {{appName}}. + * + * @param httpDestination The destination that API should be used with + */ + public {{classname}}( @Nonnull final Destination httpDestination ) + { + super(httpDestination); } - public {{classname}}(ApiClient apiClient) { + /** + * Instantiates this API class to invoke operations on the {{appName}} based on a given {@link ApiClient}. + * + * @param apiClient + * ApiClient to invoke the API on + */ + public {{classname}}(@Nonnull final ApiClient apiClient) { super(apiClient); } + {{/aiSdkConstructor}} + {{#aiSdkConstructor}} + /** + * Instantiates this API class to invoke operations on the {{appName}} + */ + public {{classname}}() + { + super(new AiCoreService().getApiClient()); + } + + /** + * Instantiates this API class to invoke operations on the {{appName}} + * + * @param aiCoreService The configured connectivity instance to AI Core + */ + public {{classname}}( @Nonnull final AiCoreService aiCoreService ) + { + super(aiCoreService.getApiClient()); + } + {{/aiSdkConstructor}} {{#operation}} - /** - * {{summary}} - * {{notes}} - {{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} - {{/allParams}} - {{#returnType}} + {{#hasOptionalParams}} + /** + *

{{summary}} + *

{{notes}} + {{#responses}} + *

{{code}}{{#message}} - {{message}}{{/message}} + {{/responses}} + {{#allParams}} + * @param {{paramName}} {{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} + {{#description}} + * {{description}} + {{/description}} + {{^description}} + * The value for the parameter {{paramName}} + {{/description}} + {{/allParams}} + {{#returnType}} * @return {{returnType}} - {{/returnType}} - * @throws ApiException if fails to make API call - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - {{#externalDocs}} + {{/returnType}} + {{^returnType}} + * @return An OpenApiResponse containing the status code of the HttpResponse. + {{/returnType}} + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + {{#externalDocs}} * {{description}} * @see {{summary}} Documentation - {{/externalDocs}} - */ - {{#isDeprecated}} + {{/externalDocs}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} @Deprecated - {{/isDeprecated}} - public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { - {{#returnType}}return {{/returnType}}this.{{operationId}}({{#allParams}}{{paramName}}, {{/allParams}}Collections.emptyMap()); - } - + {{/isDeprecated}} + {{#vendorExtensions.x-return-nullable}}@Nullable{{/vendorExtensions.x-return-nullable}}{{^vendorExtensions.x-return-nullable}}@Nonnull{{/vendorExtensions.x-return-nullable}} + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}OpenApiResponse {{/returnType}}{{#vendorExtensions.x-sap-cloud-sdk-operation-name}}{{vendorExtensions.x-sap-cloud-sdk-operation-name}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}{{^vendorExtensions.x-sap-cloud-sdk-operation-name}}{{operationId}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}({{#allParams}}{{>nullable_var_annotations}} final {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws OpenApiRequestException { + {{>operationBody}} + } + {{/hasOptionalParams}} /** - * {{summary}} - * {{notes}} - {{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} - {{/allParams}} - * @param additionalHeaders additionalHeaders for this call + *

{{summary}} + *

{{notes}} + {{#responses}} + *

{{code}}{{#message}} - {{message}}{{/message}} + {{/responses}} + {{#requiredParams}} + * @param {{paramName}} + {{#description}} + * {{description}} + {{/description}} + {{^description}} + * The value for the parameter {{paramName}} + {{/description}} + {{/requiredParams}} {{#returnType}} - * @return {{returnType}} + * @return {{returnType}} {{/returnType}} - * @throws ApiException if fails to make API call - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} + {{^returnType}} + * @return An OpenApiResponse containing the status code of the HttpResponse. + {{/returnType}} + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API {{#externalDocs}} * {{description}} * @see {{summary}} Documentation {{/externalDocs}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} */ {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}, {{/allParams}}Map additionalHeaders) throws ApiException { - Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; - {{#allParams}}{{#required}} - // verify the required parameter '{{paramName}}' is set - if ({{paramName}} == null) { - throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}"); - } - {{/required}}{{/allParams}} - // create path and map variables - String localVarPath = "{{{path}}}"{{#pathParams}} - .replaceAll("\\{" + "{{baseName}}" + "\\}", apiClient.escapeString(apiClient.parameterToString({{{paramName}}}))){{/pathParams}}; - - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - {{#queryParams}} - {{#isDeepObject}} - localVarQueryParameterBaseName = "{{{baseName}}}"; - {{#isArray}} - for (int i=0; i < {{paramName}}.size(); i++) { - localVarQueryStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format(Locale.ROOT, "{{baseName}}[%d]", i))); - } - {{/isArray}} - {{^isArray}} - localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString("{{baseName}}")); - {{/isArray}} - {{/isDeepObject}} - {{^isDeepObject}} - {{#isExplode}} - {{#hasVars}} - {{#vars}} - {{#isArray}} - localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "{{baseName}}", {{paramName}}.{{getter}}())); - {{/isArray}} - {{^isArray}} - localVarQueryParams.addAll(apiClient.parameterToPair("{{baseName}}", {{paramName}}.{{getter}}())); - {{/isArray}} - {{/vars}} - {{/hasVars}} - {{^hasVars}} - {{#isModel}} - localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString()); - {{/isModel}} - {{^isModel}} - {{#collectionFormat}}localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(apiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); - {{/isModel}} - {{/hasVars}} - {{/isExplode}} - {{^isExplode}} - {{#collectionFormat}}localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(apiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); - {{/isExplode}} - {{/isDeepObject}} - {{/queryParams}} - {{#headerParams}}if ({{paramName}} != null) - localVarHeaderParams.put("{{baseName}}", apiClient.parameterToString({{paramName}})); - {{/headerParams}} - - localVarHeaderParams.putAll(additionalHeaders); - - {{#cookieParams}}if ({{paramName}} != null) - localVarCookieParams.put("{{baseName}}", apiClient.parameterToString({{paramName}})); - {{/cookieParams}} - - {{#formParams}}if ({{paramName}} != null) - localVarFormParams.put("{{baseName}}", {{paramName}}); - {{/formParams}} - - final String[] localVarAccepts = { - {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; - - {{#returnType}} - TypeReference<{{{returnType}}}> localVarReturnType = new TypeReference<{{{returnType}}}>() {}; - return apiClient.invokeAPI( - {{/returnType}} - {{^returnType}} - apiClient.invokeAPI( - {{/returnType}} - localVarPath, - "{{httpMethod}}", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}} - ); - } - - {{#-last}} - @Override - public T invokeAPI(String url, String method, Object request, TypeReference returnType, Map additionalHeaders) throws ApiException { - String localVarPath = url.replace(apiClient.getBaseURL(), ""); - StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarHeaderParams.putAll(additionalHeaders); - - final String[] localVarAccepts = { - {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; - - return apiClient.invokeAPI( - localVarPath, - method, - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - request, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - returnType - ); - } - {{/-last}} + {{#vendorExtensions.x-return-nullable}}@Nullable{{/vendorExtensions.x-return-nullable}}{{^vendorExtensions.x-return-nullable}}@Nonnull{{/vendorExtensions.x-return-nullable}} + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}OpenApiResponse {{/returnType}}{{#vendorExtensions.x-sap-cloud-sdk-operation-name}}{{vendorExtensions.x-sap-cloud-sdk-operation-name}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}{{^vendorExtensions.x-sap-cloud-sdk-operation-name}}{{operationId}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}({{#requiredParams}}{{>nullable_var_annotations}} final {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) throws OpenApiRequestException { + {{#hasOptionalParams}} + {{#returnType}}return {{/returnType}}{{#vendorExtensions.x-sap-cloud-sdk-operation-name}}{{vendorExtensions.x-sap-cloud-sdk-operation-name}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}{{^vendorExtensions.x-sap-cloud-sdk-operation-name}}{{operationId}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}({{#hasRequiredParams}}{{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}, {{/hasRequiredParams}}{{#optionalParams}}null{{^-last}}, {{/-last}}{{/optionalParams}}); + {{/hasOptionalParams}} + {{^hasOptionalParams}} + {{>operationBody}} + {{/hasOptionalParams}} + } {{/operation}} } {{/operations}} \ No newline at end of file diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/operationBody.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/operationBody.mustache new file mode 100644 index 000000000..7f9138e97 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/operationBody.mustache @@ -0,0 +1,94 @@ +final Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; +{{#allParams}}{{#required}} + // verify the required parameter '{{paramName}}' is set + if ({{paramName}} == null) { + throw new OpenApiRequestException("Missing the required parameter '{{paramName}}' when calling {{#vendorExtensions.x-sap-cloud-sdk-operation-name}}{{vendorExtensions.x-sap-cloud-sdk-operation-name}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}{{^vendorExtensions.x-sap-cloud-sdk-operation-name}}{{operationId}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}") + .statusCode(400); + } +{{/required}}{{/allParams}} +// create path and map variables +final String localVarPath = "{{{path}}}"{{#pathParams}} + .replaceAll("\\{" + "{{baseName}}" + "\\}", ApiClient.escapeString(ApiClient.parameterToString({{{paramName}}}))){{/pathParams}}; + +final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); +String localVarQueryParameterBaseName; +final List localVarQueryParams = new ArrayList(); +final List localVarCollectionQueryParams = new ArrayList(); +final Map localVarHeaderParams = new HashMap(); +final Map localVarFormParams = new HashMap(); + + {{#queryParams}} + {{#isDeepObject}} + localVarQueryParameterBaseName = "{{{baseName}}}"; + {{#isArray}} + for (int i=0; i < {{paramName}}.size(); i++) { + localVarQueryStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format(Locale.ROOT, "{{baseName}}[%d]", i))); + } + {{/isArray}} + {{^isArray}} + localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString("{{baseName}}")); + {{/isArray}} + {{/isDeepObject}} + {{^isDeepObject}} + {{#isExplode}} + {{#hasVars}} + {{#vars}} + {{#isArray}} + localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "{{baseName}}", {{paramName}}.{{getter}}())); + {{/isArray}} + {{^isArray}} + localVarQueryParams.addAll(ApiClient.parameterToPair("{{baseName}}", {{paramName}}.{{getter}}())); + {{/isArray}} + {{/vars}} + {{/hasVars}} + {{^hasVars}} + {{#isModel}} + localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString()); + {{/isModel}} + {{^isModel}} + {{#collectionFormat}}localVarCollectionQueryParams.addAll(ApiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(ApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); + {{/isModel}} + {{/hasVars}} + {{/isExplode}} + {{^isExplode}} + {{#collectionFormat}}localVarCollectionQueryParams.addAll(ApiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(ApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); + {{/isExplode}} + {{/isDeepObject}} + {{/queryParams}} + {{#headerParams}}if ({{paramName}} != null) + localVarHeaderParams.put("{{baseName}}", ApiClient.parameterToString({{paramName}})); + {{/headerParams}} + + {{#formParams}}if ({{paramName}} != null) + localVarFormParams.put("{{baseName}}", {{paramName}}); + {{/formParams}} + + final String[] localVarAccepts = { + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + {{#returnType}} + final TypeReference<{{{returnType}}}> localVarReturnType = new TypeReference<{{{returnType}}}>() {}; + {{/returnType}} + {{^returnType}} + final TypeReference localVarReturnType = new TypeReference() {}; + {{/returnType}} + return apiClient.invokeAPI( + localVarPath, + "{{httpMethod}}", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/nullable_var_annotations.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/nullable_var_annotations.mustache new file mode 100644 index 000000000..54ee8cac6 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/nullable_var_annotations.mustache @@ -0,0 +1 @@ +{{#required}}{{#isNullable}}@Nullable{{/isNullable}}{{^isNullable}}@Nonnull{{/isNullable}}{{/required}}{{^required}}@Nullable{{/required}} \ No newline at end of file From f02fd1d0cdeddc81823fc2dc71ed4e95ccee1113 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Mon, 12 Jan 2026 10:58:22 +0100 Subject: [PATCH 15/26] Fix CI/CD --- .../openapi/openapi-api-apache-sample/pom.xml | 7 +- .../apache/petstore/api/DefaultApi.java | 333 ++++++++++++++++ .../apache/petstore/model/ErrorModel.java | 309 +++++++++++++++ .../openapi/apache/petstore/model/Pet.java | 370 ++++++++++++++++++ .../apache/petstore/model/PetInput.java | 370 ++++++++++++++++++ .../openapi/apache/sample/api/OrdersApi.java | 2 +- .../openapi/apache/sample/api/SodasApi.java | 2 +- .../openapi/apache/sample/model/AllOf.java | 10 +- .../openapi/apache/sample/model/AnyOf.java | 10 +- .../openapi/apache/sample/model/Bar.java | 10 +- .../openapi/apache/sample/model/Cola.java | 10 +- .../apache/sample/model/ColaBarCode.java | 17 +- .../openapi/apache/sample/model/ColaLogo.java | 2 +- .../openapi/apache/sample/model/Fanta.java | 10 +- .../apache/sample/model/FantaFlavor.java | 2 +- .../apache/sample/model/FlavorType.java | 10 +- .../openapi/apache/sample/model/Foo.java | 10 +- .../openapi/apache/sample/model/OneOf.java | 2 +- .../sample/model/OneOfWithDiscriminator.java | 2 +- .../OneOfWithDiscriminatorAndMapping.java | 2 +- .../model/OneOfWithEnumDiscriminator.java | 2 +- .../openapi/apache/sample/model/Order.java | 41 +- .../sample/model/OrderWithTimestamp.java | 41 +- .../openapi/apache/sample/model/Soda.java | 72 +++- .../apache/sample/model/SodaWithId.java | 72 +++- .../src/main/resources/petstore-swagger2.json | 227 +++++++++++ 26 files changed, 1914 insertions(+), 31 deletions(-) create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/ErrorModel.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/Pet.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/PetInput.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/main/resources/petstore-swagger2.json diff --git a/datamodel/openapi/openapi-api-apache-sample/pom.xml b/datamodel/openapi/openapi-api-apache-sample/pom.xml index 595c907ce..f41716a88 100644 --- a/datamodel/openapi/openapi-api-apache-sample/pom.xml +++ b/datamodel/openapi/openapi-api-apache-sample/pom.xml @@ -67,8 +67,11 @@ ${project.basedir}/src/main/resources/petstore-swagger2.json - com.sap.cloud.sdk.datamodel.openapi.petstore.api - com.sap.cloud.sdk.datamodel.openapi.petstore.model + com.sap.cloud.sdk.datamodel.openapi.apache.petstore.api + com.sap.cloud.sdk.datamodel.openapi.apache.petstore.model + + apache-httpclient + diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java new file mode 100644 index 000000000..af9d5c541 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java @@ -0,0 +1,333 @@ +/* +* Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. +*/ + +package com.sap.cloud.sdk.datamodel.openapi.apache.petstore.api; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.StringJoiner; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; +import com.sap.cloud.sdk.datamodel.openapi.apache.petstore.model.Pet; +import com.sap.cloud.sdk.datamodel.openapi.apache.petstore.model.PetInput; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.OpenApiResponse; +import com.sap.cloud.sdk.services.openapi.apache.Pair; +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; + +/** + * Swagger Petstore in version 1.0.0. + * + * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification + */ +public class DefaultApi extends BaseApi +{ + + /** + * Instantiates this API class to invoke operations on the Swagger Petstore + */ + public DefaultApi() + { + } + + /** + * Instantiates this API class to invoke operations on the Swagger Petstore. + * + * @param httpDestination + * The destination that API should be used with + */ + public DefaultApi( @Nonnull final Destination httpDestination ) + { + super(httpDestination); + } + + /** + * Instantiates this API class to invoke operations on the Swagger Petstore based on a given {@link ApiClient}. + * + * @param apiClient + * ApiClient to invoke the API on + */ + public DefaultApi( @Nonnull final ApiClient apiClient ) + { + super(apiClient); + } + + /** + *

+ *

+ * Creates a new pet in the store. Duplicates are allowed + *

+ * 200 - pet response + *

+ * 0 - unexpected error + * + * @param pet + * Pet to add to the store + * @return Pet + * @throws OpenApiRequestException + * if an error occurs while attempting to invoke the API + */ + @Nonnull + public Pet addPet( @Nonnull final PetInput pet ) + throws OpenApiRequestException + { + final Object localVarPostBody = pet; + + // verify the required parameter 'pet' is set + if( pet == null ) { + throw new OpenApiRequestException("Missing the required parameter 'pet' when calling addPet") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/pets"; + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType); + } + + /** + *

+ *

+ * deletes a single pet based on the ID supplied + *

+ * 204 - pet deleted + *

+ * 0 - unexpected error + * + * @param id + * ID of pet to delete + * @return An OpenApiResponse containing the status code of the HttpResponse. + * @throws OpenApiRequestException + * if an error occurs while attempting to invoke the API + */ + @Nonnull + public OpenApiResponse deletePet( @Nonnull final Long id ) + throws OpenApiRequestException + { + final Object localVarPostBody = null; + + // verify the required parameter 'id' is set + if( id == null ) { + throw new OpenApiRequestException("Missing the required parameter 'id' when calling deletePet") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = + "/pets/{id}".replaceAll("\\{" + "id" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(id))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType); + } + + /** + *

+ *

+ * Returns a user based on a single ID, if the user does not have access to the pet + *

+ * 200 - pet response + *

+ * 0 - unexpected error + * + * @param id + * ID of pet to fetch + * @return Pet + * @throws OpenApiRequestException + * if an error occurs while attempting to invoke the API + */ + @Nonnull + public Pet findPetById( @Nonnull final Long id ) + throws OpenApiRequestException + { + final Object localVarPostBody = null; + + // verify the required parameter 'id' is set + if( id == null ) { + throw new OpenApiRequestException("Missing the required parameter 'id' when calling findPetById") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = + "/pets/{id}".replaceAll("\\{" + "id" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(id))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json", "application/xml", "text/xml", "text/html" }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType); + } + + /** + *

+ *

+ * Returns all pets from the system that the user has access to + *

+ * 200 - pet response + *

+ * 0 - unexpected error + * + * @param tags + * (optional) tags to filter by + * @param limit + * (optional) maximum number of results to return + * @return List<Pet> + * @throws OpenApiRequestException + * if an error occurs while attempting to invoke the API + */ + @Nonnull + public List findPets( @Nullable final List tags, @Nullable final Integer limit ) + throws OpenApiRequestException + { + final Object localVarPostBody = null; + + // create path and map variables + final String localVarPath = "/pets"; + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + localVarCollectionQueryParams.addAll(ApiClient.parameterToPairs("csv", "tags", tags)); + localVarQueryParams.addAll(ApiClient.parameterToPair("limit", limit)); + + final String[] localVarAccepts = { "application/json", "application/xml", "text/xml", "text/html" }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference> localVarReturnType = new TypeReference>() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType); + } + + /** + *

+ *

+ * Returns all pets from the system that the user has access to + *

+ * 200 - pet response + *

+ * 0 - unexpected error + * + * @return List<Pet> + * @throws OpenApiRequestException + * if an error occurs while attempting to invoke the API + */ + @Nonnull + public List findPets() + throws OpenApiRequestException + { + return findPets(null, null); + } +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/ErrorModel.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/ErrorModel.java new file mode 100644 index 000000000..c9739e71d --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/ErrorModel.java @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Swagger Petstore + * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.petstore.model; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import java.util.StringJoiner; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * ErrorModel + */ +// CHECKSTYLE:OFF +public class ErrorModel +// CHECKSTYLE:ON +{ + @JsonProperty( "code" ) + private Integer code; + + @JsonProperty( "message" ) + private String message; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the code of this {@link ErrorModel} instance and return the same instance. + * + * @param code + * The code of this {@link ErrorModel} + * @return The same instance of this {@link ErrorModel} class + */ + @Nonnull + public ErrorModel code( @Nonnull final Integer code ) + { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code The code of this {@link ErrorModel} instance. + */ + @Nonnull + public Integer getCode() + { + return code; + } + + /** + * Set the code of this {@link ErrorModel} instance. + * + * @param code + * The code of this {@link ErrorModel} + */ + public void setCode( @Nonnull final Integer code ) + { + this.code = code; + } + + /** + * Set the message of this {@link ErrorModel} instance and return the same instance. + * + * @param message + * The message of this {@link ErrorModel} + * @return The same instance of this {@link ErrorModel} class + */ + @Nonnull + public ErrorModel message( @Nonnull final String message ) + { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link ErrorModel} instance. + */ + @Nonnull + public String getMessage() + { + return message; + } + + /** + * Set the message of this {@link ErrorModel} instance. + * + * @param message + * The message of this {@link ErrorModel} + */ + public void setMessage( @Nonnull final String message ) + { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link ErrorModel}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ErrorModel} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("ErrorModel has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ErrorModel} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( code != null ) + declaredFields.put("code", code); + if( message != null ) + declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ErrorModel} instance. If the map previously contained a mapping for + * the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final ErrorModel errorModel = (ErrorModel) o; + return Objects.equals(this.cloudSdkCustomFields, errorModel.cloudSdkCustomFields) + && Objects.equals(this.code, errorModel.code) + && Objects.equals(this.message, errorModel.message); + } + + @Override + public int hashCode() + { + return Objects.hash(code, message, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class ErrorModel {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() + { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix + * prefix of the query string + * @return URL query string + */ + public String toUrlQueryString( String prefix ) + { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if( prefix == null ) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `code` to the URL query string + if( getCode() != null ) { + try { + joiner + .add( + String + .format( + "%scode%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getCode()), "UTF-8").replaceAll("\\+", "%20"))); + } + catch( UnsupportedEncodingException e ) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + // add `message` to the URL query string + if( getMessage() != null ) { + try { + joiner + .add( + String + .format( + "%smessage%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getMessage()), "UTF-8").replaceAll("\\+", "%20"))); + } + catch( UnsupportedEncodingException e ) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + return joiner.toString(); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/Pet.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/Pet.java new file mode 100644 index 000000000..1a6d2654a --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/Pet.java @@ -0,0 +1,370 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Swagger Petstore + * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.petstore.model; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import java.util.StringJoiner; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Pet + */ +// CHECKSTYLE:OFF +public class Pet +// CHECKSTYLE:ON +{ + @JsonProperty( "id" ) + private Long id; + + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "tag" ) + private String tag; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the id of this {@link Pet} instance and return the same instance. + * + * @param id + * The id of this {@link Pet} + * @return The same instance of this {@link Pet} class + */ + @Nonnull + public Pet id( @Nonnull final Long id ) + { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link Pet} instance. + */ + @Nonnull + public Long getId() + { + return id; + } + + /** + * Set the id of this {@link Pet} instance. + * + * @param id + * The id of this {@link Pet} + */ + public void setId( @Nonnull final Long id ) + { + this.id = id; + } + + /** + * Set the name of this {@link Pet} instance and return the same instance. + * + * @param name + * The name of this {@link Pet} + * @return The same instance of this {@link Pet} class + */ + @Nonnull + public Pet name( @Nonnull final String name ) + { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name The name of this {@link Pet} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link Pet} instance. + * + * @param name + * The name of this {@link Pet} + */ + public void setName( @Nonnull final String name ) + { + this.name = name; + } + + /** + * Set the tag of this {@link Pet} instance and return the same instance. + * + * @param tag + * The tag of this {@link Pet} + * @return The same instance of this {@link Pet} class + */ + @Nonnull + public Pet tag( @Nullable final String tag ) + { + this.tag = tag; + return this; + } + + /** + * Get tag + * + * @return tag The tag of this {@link Pet} instance. + */ + @Nonnull + public String getTag() + { + return tag; + } + + /** + * Set the tag of this {@link Pet} instance. + * + * @param tag + * The tag of this {@link Pet} + */ + public void setTag( @Nullable final String tag ) + { + this.tag = tag; + } + + /** + * Get the names of the unrecognizable properties of the {@link Pet}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Pet} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("Pet has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Pet} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( id != null ) + declaredFields.put("id", id); + if( name != null ) + declaredFields.put("name", name); + if( tag != null ) + declaredFields.put("tag", tag); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Pet} instance. If the map previously contained a mapping for the + * key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final Pet pet = (Pet) o; + return Objects.equals(this.cloudSdkCustomFields, pet.cloudSdkCustomFields) + && Objects.equals(this.id, pet.id) + && Objects.equals(this.name, pet.name) + && Objects.equals(this.tag, pet.tag); + } + + @Override + public int hashCode() + { + return Objects.hash(id, name, tag, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() + { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix + * prefix of the query string + * @return URL query string + */ + public String toUrlQueryString( String prefix ) + { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if( prefix == null ) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if( getId() != null ) { + try { + joiner + .add( + String + .format( + "%sid%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20"))); + } + catch( UnsupportedEncodingException e ) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + // add `name` to the URL query string + if( getName() != null ) { + try { + joiner + .add( + String + .format( + "%sname%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20"))); + } + catch( UnsupportedEncodingException e ) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + // add `tag` to the URL query string + if( getTag() != null ) { + try { + joiner + .add( + String + .format( + "%stag%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getTag()), "UTF-8").replaceAll("\\+", "%20"))); + } + catch( UnsupportedEncodingException e ) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + return joiner.toString(); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/PetInput.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/PetInput.java new file mode 100644 index 000000000..7f6ea7be2 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/PetInput.java @@ -0,0 +1,370 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Swagger Petstore + * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.datamodel.openapi.apache.petstore.model; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import java.util.StringJoiner; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * PetInput + */ +// CHECKSTYLE:OFF +public class PetInput +// CHECKSTYLE:ON +{ + @JsonProperty( "id" ) + private Long id; + + @JsonProperty( "name" ) + private String name; + + @JsonProperty( "tag" ) + private String tag; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the id of this {@link PetInput} instance and return the same instance. + * + * @param id + * The id of this {@link PetInput} + * @return The same instance of this {@link PetInput} class + */ + @Nonnull + public PetInput id( @Nonnull final Long id ) + { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link PetInput} instance. + */ + @Nonnull + public Long getId() + { + return id; + } + + /** + * Set the id of this {@link PetInput} instance. + * + * @param id + * The id of this {@link PetInput} + */ + public void setId( @Nonnull final Long id ) + { + this.id = id; + } + + /** + * Set the name of this {@link PetInput} instance and return the same instance. + * + * @param name + * The name of this {@link PetInput} + * @return The same instance of this {@link PetInput} class + */ + @Nonnull + public PetInput name( @Nonnull final String name ) + { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name The name of this {@link PetInput} instance. + */ + @Nonnull + public String getName() + { + return name; + } + + /** + * Set the name of this {@link PetInput} instance. + * + * @param name + * The name of this {@link PetInput} + */ + public void setName( @Nonnull final String name ) + { + this.name = name; + } + + /** + * Set the tag of this {@link PetInput} instance and return the same instance. + * + * @param tag + * The tag of this {@link PetInput} + * @return The same instance of this {@link PetInput} class + */ + @Nonnull + public PetInput tag( @Nullable final String tag ) + { + this.tag = tag; + return this; + } + + /** + * Get tag + * + * @return tag The tag of this {@link PetInput} instance. + */ + @Nonnull + public String getTag() + { + return tag; + } + + /** + * Set the tag of this {@link PetInput} instance. + * + * @param tag + * The tag of this {@link PetInput} + */ + public void setTag( @Nullable final String tag ) + { + this.tag = tag; + } + + /** + * Get the names of the unrecognizable properties of the {@link PetInput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() + { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PetInput} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name + * The name of the property + * @return The value of the property + * @throws NoSuchElementException + * If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) + throws NoSuchElementException + { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("PetInput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PetInput} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( id != null ) + declaredFields.put("id", id); + if( name != null ) + declaredFields.put("name", name); + if( tag != null ) + declaredFields.put("tag", tag); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PetInput} instance. If the map previously contained a mapping for + * the key, the old value is replaced by the specified value. + * + * @param customFieldName + * The name of the property + * @param customFieldValue + * The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals( @Nullable final java.lang.Object o ) + { + if( this == o ) { + return true; + } + if( o == null || getClass() != o.getClass() ) { + return false; + } + final PetInput petInput = (PetInput) o; + return Objects.equals(this.cloudSdkCustomFields, petInput.cloudSdkCustomFields) + && Objects.equals(this.id, petInput.id) + && Objects.equals(this.name, petInput.name) + && Objects.equals(this.tag, petInput.tag); + } + + @Override + public int hashCode() + { + return Objects.hash(id, name, tag, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append("class PetInput {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + cloudSdkCustomFields + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString( final java.lang.Object o ) + { + if( o == null ) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() + { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix + * prefix of the query string + * @return URL query string + */ + public String toUrlQueryString( String prefix ) + { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if( prefix == null ) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if( getId() != null ) { + try { + joiner + .add( + String + .format( + "%sid%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20"))); + } + catch( UnsupportedEncodingException e ) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + // add `name` to the URL query string + if( getName() != null ) { + try { + joiner + .add( + String + .format( + "%sname%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20"))); + } + catch( UnsupportedEncodingException e ) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + // add `tag` to the URL query string + if( getTag() != null ) { + try { + joiner + .add( + String + .format( + "%stag%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getTag()), "UTF-8").replaceAll("\\+", "%20"))); + } + catch( UnsupportedEncodingException e ) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + return joiner.toString(); + } + +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java index 65602b693..d3f5d7f00 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. +* Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ package com.sap.cloud.sdk.datamodel.openapi.apache.sample.api; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java index fbd776b6c..80d852f1c 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. +* Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ package com.sap.cloud.sdk.datamodel.openapi.apache.sample.api; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AllOf.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AllOf.java index ced49cf22..234145720 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AllOf.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AllOf.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* @@ -408,4 +408,12 @@ private String toIndentedString( final java.lang.Object o ) return o.toString().replace("\n", "\n "); } + /** + * Create a new {@link AllOf} instance. No arguments are required. + */ + public static AllOf create() + { + return new AllOf(); + } + } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AnyOf.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AnyOf.java index f1f51e2d1..797cdcfc5 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AnyOf.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AnyOf.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* @@ -408,4 +408,12 @@ private String toIndentedString( final java.lang.Object o ) return o.toString().replace("\n", "\n "); } + /** + * Create a new {@link AnyOf} instance. No arguments are required. + */ + public static AnyOf create() + { + return new AnyOf(); + } + } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Bar.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Bar.java index d7b296253..33bbf6e19 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Bar.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Bar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* @@ -304,4 +304,12 @@ private String toIndentedString( final java.lang.Object o ) return o.toString().replace("\n", "\n "); } + /** + * Create a new {@link Bar} instance. No arguments are required. + */ + public static Bar create() + { + return new Bar(); + } + } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Cola.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Cola.java index 4d89ee770..5f4f95861 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Cola.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Cola.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* @@ -322,4 +322,12 @@ private String toIndentedString( final java.lang.Object o ) return o.toString().replace("\n", "\n "); } + /** + * Create a new {@link Cola} instance. No arguments are required. + */ + public static Cola create() + { + return new Cola(); + } + } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaBarCode.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaBarCode.java index eb8bf12c2..967a74c58 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaBarCode.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaBarCode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* @@ -15,9 +15,6 @@ package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; -import java.math.BigDecimal; -import java.util.List; - import javax.annotation.Nonnull; /** @@ -26,22 +23,22 @@ public interface ColaBarCode { /** - * Helper class to create {@code List } that implements {@link ColaBarCode}. + * Helper class to create {@code float[] } that implements {@link ColaBarCode}. */ - record ListOfBigDecimals(@com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) implements ColaBarCode {} + record ArrayOfFloats(@com.fasterxml.jackson.annotation.JsonValue @Nonnull float[] values) implements ColaBarCode {} /** - * Creator to enable deserialization of {@code List }. + * Creator to enable deserialization of {@code float[] }. * * @param val * the value to use - * @return a new instance of {@link ListOfBigDecimals}. + * @return a new instance of {@link ArrayOfFloats}. */ @com.fasterxml.jackson.annotation.JsonCreator @Nonnull - static ListOfBigDecimals createListOfBigDecimals( @Nonnull final List val ) + static ArrayOfFloats createArrayOfFloats( @Nonnull final float[] val ) { - return new ListOfBigDecimals(val); + return new ArrayOfFloats(val); } /** diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaLogo.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaLogo.java index 3191d9a4a..72ea29bbd 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaLogo.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaLogo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Fanta.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Fanta.java index aad7447f3..27d1ac103 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Fanta.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Fanta.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* @@ -279,4 +279,12 @@ private String toIndentedString( final java.lang.Object o ) return o.toString().replace("\n", "\n "); } + /** + * Create a new {@link Fanta} instance. No arguments are required. + */ + public static Fanta create() + { + return new Fanta(); + } + } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FantaFlavor.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FantaFlavor.java index 36883f283..d295a9cca 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FantaFlavor.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FantaFlavor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FlavorType.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FlavorType.java index 150bb8dc4..67e1ab5d7 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FlavorType.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FlavorType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* @@ -236,4 +236,12 @@ private String toIndentedString( final java.lang.Object o ) return o.toString().replace("\n", "\n "); } + /** + * Create a new {@link FlavorType} instance. No arguments are required. + */ + public static FlavorType create() + { + return new FlavorType(); + } + } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Foo.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Foo.java index 6c52ebe13..68a350cf7 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Foo.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Foo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* @@ -304,4 +304,12 @@ private String toIndentedString( final java.lang.Object o ) return o.toString().replace("\n", "\n "); } + /** + * Create a new {@link Foo} instance. No arguments are required. + */ + public static Foo create() + { + return new Foo(); + } + } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOf.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOf.java index 42b50cb7a..177f45b3d 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOf.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOf.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminator.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminator.java index eefc01778..781c5501f 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminator.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminatorAndMapping.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminatorAndMapping.java index 8a6ff0271..459ac2c5c 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminatorAndMapping.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminatorAndMapping.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithEnumDiscriminator.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithEnumDiscriminator.java index 4414cd99b..0152e120e 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithEnumDiscriminator.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithEnumDiscriminator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Order.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Order.java index 87df617d1..cc37812ee 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Order.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Order.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* @@ -365,4 +365,43 @@ private String toIndentedString( final java.lang.Object o ) return o.toString().replace("\n", "\n "); } + /** + * Create a type-safe, fluent-api builder object to construct a new {@link Order} instance with all required + * arguments. + */ + public static Builder create() + { + return ( productId ) -> ( quantity ) -> new Order().productId(productId).quantity(quantity); + } + + /** + * Builder helper class. + */ + public interface Builder + { + /** + * Set the productId of this {@link Order} instance. + * + * @param productId + * The productId of this {@link Order} + * @return The Order builder. + */ + Builder1 productId( @Nonnull final Long productId ); + } + + /** + * Builder helper class. + */ + public interface Builder1 + { + /** + * Set the quantity of this {@link Order} instance. + * + * @param quantity + * The quantity of this {@link Order} + * @return The Order instance. + */ + Order quantity( @Nonnull final Integer quantity ); + } + } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrderWithTimestamp.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrderWithTimestamp.java index a36dee610..9a24b5710 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrderWithTimestamp.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrderWithTimestamp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* @@ -410,4 +410,43 @@ private String toIndentedString( final java.lang.Object o ) return o.toString().replace("\n", "\n "); } + /** + * Create a type-safe, fluent-api builder object to construct a new {@link OrderWithTimestamp} instance with all + * required arguments. + */ + public static Builder create() + { + return ( productId ) -> ( quantity ) -> new OrderWithTimestamp().productId(productId).quantity(quantity); + } + + /** + * Builder helper class. + */ + public interface Builder + { + /** + * Set the productId of this {@link OrderWithTimestamp} instance. + * + * @param productId + * The productId of this {@link OrderWithTimestamp} + * @return The OrderWithTimestamp builder. + */ + Builder1 productId( @Nonnull final Long productId ); + } + + /** + * Builder helper class. + */ + public interface Builder1 + { + /** + * Set the quantity of this {@link OrderWithTimestamp} instance. + * + * @param quantity + * The quantity of this {@link OrderWithTimestamp} + * @return The OrderWithTimestamp instance. + */ + OrderWithTimestamp quantity( @Nonnull final Integer quantity ); + } + } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Soda.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Soda.java index 8898b95c2..dfaa4d01d 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Soda.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Soda.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* @@ -443,4 +443,74 @@ private String toIndentedString( final java.lang.Object o ) return o.toString().replace("\n", "\n "); } + /** + * Create a type-safe, fluent-api builder object to construct a new {@link Soda} instance with all required + * arguments. + */ + public static Builder create() + { + return ( name ) -> ( + brand ) -> ( quantity ) -> ( price ) -> new Soda().name(name).brand(brand).quantity(quantity).price(price); + } + + /** + * Builder helper class. + */ + public interface Builder + { + /** + * Set the name of this {@link Soda} instance. + * + * @param name + * The name of this {@link Soda} + * @return The Soda builder. + */ + Builder1 name( @Nonnull final String name ); + } + + /** + * Builder helper class. + */ + public interface Builder1 + { + /** + * Set the brand of this {@link Soda} instance. + * + * @param brand + * The brand of this {@link Soda} + * @return The Soda builder. + */ + Builder2 brand( @Nonnull final String brand ); + } + + /** + * Builder helper class. + */ + public interface Builder2 + { + /** + * Set the quantity of this {@link Soda} instance. + * + * @param quantity + * The quantity of this {@link Soda} + * @return The Soda builder. + */ + Builder3 quantity( @Nonnull final Integer quantity ); + } + + /** + * Builder helper class. + */ + public interface Builder3 + { + /** + * Set the price of this {@link Soda} instance. + * + * @param price + * The price of this {@link Soda} + * @return The Soda instance. + */ + Soda price( @Nonnull final Float price ); + } + } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SodaWithId.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SodaWithId.java index cb5b7a12f..c7763d4a9 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SodaWithId.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SodaWithId.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ /* @@ -486,4 +486,74 @@ private String toIndentedString( final java.lang.Object o ) return o.toString().replace("\n", "\n "); } + /** + * Create a type-safe, fluent-api builder object to construct a new {@link SodaWithId} instance with all required + * arguments. + */ + public static Builder create() + { + return ( name ) -> ( brand ) -> ( + quantity ) -> ( price ) -> new SodaWithId().name(name).brand(brand).quantity(quantity).price(price); + } + + /** + * Builder helper class. + */ + public interface Builder + { + /** + * Set the name of this {@link SodaWithId} instance. + * + * @param name + * The name of this {@link SodaWithId} + * @return The SodaWithId builder. + */ + Builder1 name( @Nonnull final String name ); + } + + /** + * Builder helper class. + */ + public interface Builder1 + { + /** + * Set the brand of this {@link SodaWithId} instance. + * + * @param brand + * The brand of this {@link SodaWithId} + * @return The SodaWithId builder. + */ + Builder2 brand( @Nonnull final String brand ); + } + + /** + * Builder helper class. + */ + public interface Builder2 + { + /** + * Set the quantity of this {@link SodaWithId} instance. + * + * @param quantity + * The quantity of this {@link SodaWithId} + * @return The SodaWithId builder. + */ + Builder3 quantity( @Nonnull final Integer quantity ); + } + + /** + * Builder helper class. + */ + public interface Builder3 + { + /** + * Set the price of this {@link SodaWithId} instance. + * + * @param price + * The price of this {@link SodaWithId} + * @return The SodaWithId instance. + */ + SodaWithId price( @Nonnull final Float price ); + } + } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/resources/petstore-swagger2.json b/datamodel/openapi/openapi-api-apache-sample/src/main/resources/petstore-swagger2.json new file mode 100644 index 000000000..a088d1a1b --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/resources/petstore-swagger2.json @@ -0,0 +1,227 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "Swagger Petstore", + "description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification", + "termsOfService": "http://swagger.io/terms/", + "contact": { + "name": "Swagger API Team" + }, + "license": { + "name": "MIT" + } + }, + "host": "petstore.swagger.io", + "basePath": "/api", + "schemes": [ + "http" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/pets": { + "get": { + "description": "Returns all pets from the system that the user has access to", + "operationId": "findPets", + "produces": [ + "application/json", + "application/xml", + "text/xml", + "text/html" + ], + "parameters": [ + { + "name": "tags", + "in": "query", + "description": "tags to filter by", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv" + }, + { + "name": "limit", + "in": "query", + "description": "maximum number of results to return", + "required": false, + "type": "integer", + "format": "int32" + } + ], + "responses": { + "200": { + "description": "pet response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Pet" + } + } + }, + "default": { + "description": "unexpected error", + "schema": { + "$ref": "#/definitions/ErrorModel" + } + } + } + }, + "post": { + "description": "Creates a new pet in the store. Duplicates are allowed", + "operationId": "addPet", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "pet", + "in": "body", + "description": "Pet to add to the store", + "required": true, + "schema": { + "$ref": "#/definitions/PetInput" + } + } + ], + "responses": { + "200": { + "description": "pet response", + "schema": { + "$ref": "#/definitions/Pet" + } + }, + "default": { + "description": "unexpected error", + "schema": { + "$ref": "#/definitions/ErrorModel" + } + } + } + } + }, + "/pets/{id}": { + "get": { + "description": "Returns a user based on a single ID, if the user does not have access to the pet", + "operationId": "findPetById", + "produces": [ + "application/json", + "application/xml", + "text/xml", + "text/html" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of pet to fetch", + "required": true, + "type": "integer", + "format": "int64" + } + ], + "responses": { + "200": { + "description": "pet response", + "schema": { + "$ref": "#/definitions/Pet" + } + }, + "default": { + "description": "unexpected error", + "schema": { + "$ref": "#/definitions/ErrorModel" + } + } + } + }, + "delete": { + "description": "deletes a single pet based on the ID supplied", + "operationId": "deletePet", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of pet to delete", + "required": true, + "type": "integer", + "format": "int64" + } + ], + "responses": { + "204": { + "description": "pet deleted" + }, + "default": { + "description": "unexpected error", + "schema": { + "$ref": "#/definitions/ErrorModel" + } + } + } + } + } + }, + "definitions": { + "Pet": { + "type": "object", + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + }, + "PetInput": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Pet" + }, + { + "required": [ + "name" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + } + } + } + ] + }, + "ErrorModel": { + "type": "object", + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } + } + } + } +} \ No newline at end of file From cefb24479af6d1e9d55195d63afb7fa9f7198b70 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Mon, 12 Jan 2026 11:37:29 +0100 Subject: [PATCH 16/26] checkstyle --- .../openapi/openapi-api-apache-sample/pom.xml | 53 +++++++++++++++++++ .../services/openapi/apache/ApiClient.java | 22 ++++++++ .../sdk/services/openapi/apache/BaseApi.java | 21 ++++++++ .../sdk/services/openapi/apache/Pair.java | 3 ++ 4 files changed, 99 insertions(+) diff --git a/datamodel/openapi/openapi-api-apache-sample/pom.xml b/datamodel/openapi/openapi-api-apache-sample/pom.xml index f41716a88..4e08b5835 100644 --- a/datamodel/openapi/openapi-api-apache-sample/pom.xml +++ b/datamodel/openapi/openapi-api-apache-sample/pom.xml @@ -128,6 +128,59 @@ false + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + + + + org.apache.maven.plugins + maven-pmd-plugin + + true + + + + org.apache.maven.plugins + maven-javadoc-plugin + + true + + + + org.jacoco + jacoco-maven-plugin + + true + + + + + release + + + release + + + + + + + org.sonatype.central + central-publishing-maven-plugin + + + injected-central-publishing + + + + + + + + diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java index 24682ece6..e3af38b06 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java @@ -73,6 +73,9 @@ import lombok.Value; import lombok.With; +/** + * API client for executing HTTP requests using Apache HttpClient 5. + */ @AllArgsConstructor( access = PRIVATE ) @EqualsAndHashCode @ToString @@ -98,11 +101,25 @@ public class ApiClient private static final Set BODY_METHODS = Set.of("POST", "PUT", "DELETE", "PATCH"); private static final String DEFAULT_BASE_PATH = "http://localhost"; + /** + * Creates an ApiClient instance from an existing HttpClient. + * + * @param httpClient + * The HttpClient to use for requests + * @return A new ApiClient instance + */ public static ApiClient fromHttpClient( @Nonnull final CloseableHttpClient httpClient ) { return new ApiClient(httpClient, DEFAULT_BASE_PATH, createDefaultObjectMapper(), null); } + /** + * Creates an ApiClient instance configured for the given destination. + * + * @param destination + * The destination to use for requests + * @return A new ApiClient instance configured with the destination + */ public static ApiClient create( @Nonnull final Destination destination ) { return fromHttpClient((CloseableHttpClient) ApacheHttpClient5Accessor.getHttpClient(destination)) @@ -110,6 +127,11 @@ public static ApiClient create( @Nonnull final Destination destination ) } + /** + * Creates an ApiClient instance with default configuration. + * + * @return A new ApiClient instance + */ public static ApiClient create() { return fromHttpClient((CloseableHttpClient) ApacheHttpClient5Accessor.getHttpClient()); diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/BaseApi.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/BaseApi.java index 45a4cbb23..c189867e6 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/BaseApi.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/BaseApi.java @@ -16,20 +16,41 @@ import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; +/** + * Base class for generated API classes, providing common functionality for API client management. + */ public abstract class BaseApi { + /** + * The API client used to execute HTTP requests. + */ protected final ApiClient apiClient; + /** + * Creates a new BaseApi instance with default configuration. + */ protected BaseApi() { this(ApiClient.create()); } + /** + * Creates a new BaseApi instance configured for the given destination. + * + * @param destination + * The destination to use for API requests + */ protected BaseApi( @Nonnull final Destination destination ) { this(ApiClient.create(destination)); } + /** + * Creates a new BaseApi instance with the given API client. + * + * @param apiClient + * The API client to use for requests + */ protected BaseApi( @Nonnull final ApiClient apiClient ) { this.apiClient = apiClient; diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Pair.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Pair.java index 1ab38e5f7..c0acc45b3 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Pair.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/Pair.java @@ -16,6 +16,9 @@ import lombok.Value; +/** + * Represents a name-value pair used for query parameters and form data. + */ @Value public class Pair { From 1632d2c39ae5e4b0631d417903cd330067cfd0d9 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Mon, 12 Jan 2026 12:48:36 +0100 Subject: [PATCH 17/26] pmd --- .../services/openapi/apache/ApiClient.java | 214 +++++++++--------- .../apache/DefaultApiResponseHandler.java | 79 ++++--- 2 files changed, 154 insertions(+), 139 deletions(-) diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java index e3af38b06..8276181c7 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java @@ -12,18 +12,11 @@ package com.sap.cloud.sdk.services.openapi.apache; -import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; -import static com.fasterxml.jackson.annotation.PropertyAccessor.GETTER; -import static com.fasterxml.jackson.annotation.PropertyAccessor.SETTER; -import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES; -import static com.fasterxml.jackson.databind.MapperFeature.DEFAULT_VIEW_INCLUSION; -import static com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS; import static com.sap.cloud.sdk.services.openapi.apache.DefaultApiResponseHandler.isJsonMime; import static lombok.AccessLevel.PRIVATE; import java.io.File; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; @@ -55,9 +48,13 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.google.common.annotations.Beta; @@ -70,7 +67,6 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; -import lombok.Value; import lombok.With; /** @@ -108,6 +104,7 @@ public class ApiClient * The HttpClient to use for requests * @return A new ApiClient instance */ + @Nonnull public static ApiClient fromHttpClient( @Nonnull final CloseableHttpClient httpClient ) { return new ApiClient(httpClient, DEFAULT_BASE_PATH, createDefaultObjectMapper(), null); @@ -120,6 +117,7 @@ public static ApiClient fromHttpClient( @Nonnull final CloseableHttpClient httpC * The destination to use for requests * @return A new ApiClient instance configured with the destination */ + @Nonnull public static ApiClient create( @Nonnull final Destination destination ) { return fromHttpClient((CloseableHttpClient) ApacheHttpClient5Accessor.getHttpClient(destination)) @@ -132,23 +130,26 @@ public static ApiClient create( @Nonnull final Destination destination ) * * @return A new ApiClient instance */ + @Nonnull public static ApiClient create() { return fromHttpClient((CloseableHttpClient) ApacheHttpClient5Accessor.getHttpClient()); } + @Nonnull private static ObjectMapper createDefaultObjectMapper() { return JsonMapper .builder() .addModule(new JavaTimeModule()) .defaultDateFormat(new RFC3339DateFormat()) - .visibility(GETTER, Visibility.NONE) - .visibility(SETTER, Visibility.NONE) - .defaultPropertyInclusion(JsonInclude.Value.construct(NON_NULL, NON_NULL)) - .disable(FAIL_ON_UNKNOWN_PROPERTIES) - .disable(DEFAULT_VIEW_INCLUSION) - .disable(WRITE_DATES_AS_TIMESTAMPS) + .visibility(PropertyAccessor.GETTER, Visibility.NONE) + .visibility(PropertyAccessor.SETTER, Visibility.NONE) + .defaultPropertyInclusion( + JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL)) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(MapperFeature.DEFAULT_VIEW_INCLUSION) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .build(); } @@ -159,7 +160,8 @@ private static ObjectMapper createDefaultObjectMapper() * Date * @return Date in string format */ - private static String formatDate( Date date ) + @Nonnull + private static String formatDate( @Nonnull final Date date ) { return new RFC3339DateFormat().format(date); } @@ -171,19 +173,20 @@ private static String formatDate( Date date ) * Object * @return Object in string format */ - public static String parameterToString( Object param ) + @Nonnull + public static String parameterToString( @Nullable final Object param ) { if( param == null ) { return ""; - } else if( param instanceof Date ) { - return formatDate((Date) param); + } else if( param instanceof Date date ) { + return formatDate(date); } else if( param instanceof Collection ) { - StringBuilder b = new StringBuilder(); + final StringBuilder b = new StringBuilder(); for( Object o : (Collection) param ) { - if( b.length() > 0 ) { + if( !b.isEmpty() ) { b.append(','); } - b.append(String.valueOf(o)); + b.append(o); } return b.toString(); } else { @@ -202,9 +205,10 @@ public static String parameterToString( Object param ) * The value of the parameter. * @return A list containing a single {@code Pair} object. */ - public static List parameterToPair( String name, Object value ) + @Nonnull + public static List parameterToPair( @Nullable final String name, @Nullable final Object value ) { - List params = new ArrayList(); + final List params = new ArrayList<>(); // preconditions if( name == null || name.isEmpty() || value == null || value instanceof Collection ) { @@ -228,9 +232,13 @@ public static List parameterToPair( String name, Object value ) * The value of the parameter. * @return A list of {@code Pair} objects. */ - public static List parameterToPairs( String collectionFormat, String name, Collection value ) + @Nonnull + public static List parameterToPairs( + @Nonnull final String collectionFormat, + @Nullable final String name, + @Nullable final Collection value ) { - List params = new ArrayList(); + final List params = new ArrayList<>(); // preconditions if( name == null || name.isEmpty() || value == null || value.isEmpty() ) { @@ -246,19 +254,15 @@ public static List parameterToPairs( String collectionFormat, String name, } // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - // escape all delimiters except commas, which are URI reserved - // characters - if( "ssv".equals(collectionFormat) ) { - delimiter = escapeString(" "); - } else if( "tsv".equals(collectionFormat) ) { - delimiter = escapeString("\t"); - } else if( "pipes".equals(collectionFormat) ) { - delimiter = escapeString("|"); - } - - StringBuilder sb = new StringBuilder(); + final String delimiter = switch( collectionFormat ) { + case "ssv" -> escapeString(" "); + case "tsv" -> escapeString("\t"); + case "pipes" -> escapeString("|"); + default -> ","; + // escape all delimiters except commas, which are URI reserved characters + }; + + final StringBuilder sb = new StringBuilder(); for( Object item : value ) { sb.append(delimiter); sb.append(escapeString(parameterToString(item))); @@ -278,7 +282,8 @@ public static List parameterToPairs( String collectionFormat, String name, * @return The Accept header to use. If the given array is empty, null will be returned (not to set the Accept * header explicitly). */ - public static String selectHeaderAccept( String[] accepts ) + @Nullable + public static String selectHeaderAccept( @Nonnull final String[] accepts ) { if( accepts.length == 0 ) { return null; @@ -299,7 +304,8 @@ public static String selectHeaderAccept( String[] accepts ) * The Content-Type array to select from * @return The Content-Type header to use. If the given array is empty, or matches "any", JSON will be used. */ - public static String selectHeaderContentType( String[] contentTypes ) + @Nonnull + public static String selectHeaderContentType( @Nonnull final String[] contentTypes ) { if( contentTypes.length == 0 || contentTypes[0].equals("*/*") ) { return "application/json"; @@ -319,20 +325,17 @@ public static String selectHeaderContentType( String[] contentTypes ) * String * @return Escaped string */ - public static String escapeString( String str ) + @Nonnull + public static String escapeString( @Nonnull final String str ) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } - catch( UnsupportedEncodingException e ) { - return str; - } + return URLEncoder.encode(str, StandardCharsets.UTF_8).replaceAll("\\+", "%20"); } /** * Parse content type object from header value */ - private ContentType getContentType( String headerValue ) + @Nonnull + private ContentType getContentType( @Nonnull final String headerValue ) throws OpenApiRequestException { try { @@ -356,10 +359,14 @@ private ContentType getContentType( String headerValue ) * @throws OpenApiRequestException * API exception */ - private HttpEntity serialize( Object obj, Map formParams, ContentType contentType ) + @Nonnull + private HttpEntity serialize( + @Nullable final Object obj, + @Nonnull final Map formParams, + @Nonnull final ContentType contentType ) throws OpenApiRequestException { - String mimeType = contentType.getMimeType(); + final String mimeType = contentType.getMimeType(); if( isJsonMime(mimeType) ) { try { return new StringEntity( @@ -370,17 +377,17 @@ private HttpEntity serialize( Object obj, Map formParams, Conten throw new OpenApiRequestException(e); } } else if( mimeType.equals(ContentType.MULTIPART_FORM_DATA.getMimeType()) ) { - MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create(); + final MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create(); for( Entry paramEntry : formParams.entrySet() ) { - Object value = paramEntry.getValue(); - if( value instanceof File ) { - multiPartBuilder.addBinaryBody(paramEntry.getKey(), (File) value); - } else if( value instanceof byte[] ) { - multiPartBuilder.addBinaryBody(paramEntry.getKey(), (byte[]) value); + final Object value = paramEntry.getValue(); + if( value instanceof File file ) { + multiPartBuilder.addBinaryBody(paramEntry.getKey(), file); + } else if( value instanceof byte[] byteArray ) { + multiPartBuilder.addBinaryBody(paramEntry.getKey(), byteArray); } else { - Charset charset = contentType.getCharset(); + final Charset charset = contentType.getCharset(); if( charset != null ) { - ContentType customContentType = + final ContentType customContentType = ContentType.create(ContentType.TEXT_PLAIN.getMimeType(), charset); multiPartBuilder .addTextBody( @@ -394,17 +401,17 @@ private HttpEntity serialize( Object obj, Map formParams, Conten } return multiPartBuilder.build(); } else if( mimeType.equals(ContentType.APPLICATION_FORM_URLENCODED.getMimeType()) ) { - List formValues = new ArrayList<>(); - for( Entry paramEntry : formParams.entrySet() ) { + final List formValues = new ArrayList<>(); + for( final Entry paramEntry : formParams.entrySet() ) { formValues.add(new BasicNameValuePair(paramEntry.getKey(), parameterToString(paramEntry.getValue()))); } return new UrlEncodedFormEntity(formValues, contentType.getCharset()); } else { // Handle files with unknown content type - if( obj instanceof File ) { - return new FileEntity((File) obj, contentType); - } else if( obj instanceof byte[] ) { - return new ByteArrayEntity((byte[]) obj, contentType); + if( obj instanceof File file ) { + return new FileEntity(file, contentType); + } else if( obj instanceof byte[] byteArray ) { + return new ByteArrayEntity(byteArray, contentType); } throw new OpenApiRequestException("Serialization for content type '" + contentType + "' not supported"); } @@ -423,9 +430,12 @@ private HttpEntity serialize( Object obj, Map formParams, Conten * URL query string of the deep object parameters * @return The full URL */ - private - String - buildUrl( String path, List queryParams, List collectionQueryParams, String urlQueryDeepObject ) + @Nonnull + private String buildUrl( + @Nullable final String path, + @Nullable final List queryParams, + @Nullable final List collectionQueryParams, + @Nullable final String urlQueryDeepObject ) { final StringBuilder url = new StringBuilder(); if( basePath.endsWith("/") && path != null && path.startsWith("/") ) { @@ -439,38 +449,34 @@ private HttpEntity serialize( Object obj, Map formParams, Conten // support (constant) query string in `path`, e.g. "/posts?draft=1" String prefix = path.contains("?") ? "&" : "?"; for( Pair param : queryParams ) { - if( param.getValue() != null ) { - if( prefix != null ) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - // query parameter value already escaped as part of parameterToPair - url.append(escapeString(param.getName())).append("=").append(value); + if( prefix != null ) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); } + final String value = parameterToString(param.getValue()); + // query parameter value already escaped as part of parameterToPair + url.append(escapeString(param.getName())).append("=").append(value); } } if( collectionQueryParams != null && !collectionQueryParams.isEmpty() ) { String prefix = url.toString().contains("?") ? "&" : "?"; for( Pair param : collectionQueryParams ) { - if( param.getValue() != null ) { - if( prefix != null ) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - // collection query parameter value already escaped as part of parameterToPairs - url.append(escapeString(param.getName())).append("=").append(value); + if( prefix != null ) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); } + final String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); } } - if( urlQueryDeepObject != null && urlQueryDeepObject.length() > 0 ) { + if( urlQueryDeepObject != null && !urlQueryDeepObject.isEmpty() ) { url.append(url.toString().contains("?") ? "&" : "?"); url.append(urlQueryDeepObject); } @@ -478,7 +484,7 @@ private HttpEntity serialize( Object obj, Map formParams, Conten return url.toString(); } - private static boolean isBodyAllowed( String method ) + private static boolean isBodyAllowed( @Nonnull final String method ) { return BODY_METHODS.contains(method); } @@ -517,17 +523,17 @@ private static boolean isBodyAllowed( String method ) @Beta @Nullable public T invokeAPI( - String path, - String method, - List queryParams, - List collectionQueryParams, - String urlQueryDeepObject, - Object body, - Map headerParams, - Map formParams, - String accept, - String contentType, - TypeReference returnType ) + @Nonnull final String path, + @Nonnull final String method, + @Nonnull final List queryParams, + @Nonnull final List collectionQueryParams, + @Nonnull final String urlQueryDeepObject, + @Nullable final Object body, + @Nonnull final Map headerParams, + @Nonnull final Map formParams, + @Nullable final String accept, + @Nonnull final String contentType, + @Nonnull final TypeReference returnType ) throws OpenApiRequestException { if( body != null && !formParams.isEmpty() ) { @@ -536,7 +542,7 @@ public T invokeAPI( final String url = buildUrl(path, queryParams, collectionQueryParams, urlQueryDeepObject); - ClassicRequestBuilder builder = ClassicRequestBuilder.create(method); + final ClassicRequestBuilder builder = ClassicRequestBuilder.create(method); builder.setUri(url); if( accept != null ) { @@ -546,9 +552,9 @@ public T invokeAPI( builder.addHeader(keyValue.getKey(), keyValue.getValue()); } - HttpClientContext context = HttpClientContext.create(); + final HttpClientContext context = HttpClientContext.create(); - ContentType contentTypeObj = getContentType(contentType); + final ContentType contentTypeObj = getContentType(contentType); if( body != null || !formParams.isEmpty() ) { if( isBodyAllowed(method) ) { // Add entity if we have content and a valid method @@ -562,7 +568,7 @@ public T invokeAPI( } try { - HttpClientResponseHandler responseHandler = + final HttpClientResponseHandler responseHandler = new DefaultApiResponseHandler<>(objectMapper, tempFolderPath, returnType); return httpClient.execute(builder.build(), context, responseHandler); } diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/DefaultApiResponseHandler.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/DefaultApiResponseHandler.java index fac2b4f61..0947b078a 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/DefaultApiResponseHandler.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/DefaultApiResponseHandler.java @@ -26,11 +26,13 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import org.apache.hc.core5.http.ClassicHttpResponse; import org.apache.hc.core5.http.ContentType; import org.apache.hc.core5.http.Header; import org.apache.hc.core5.http.HttpEntity; -import org.apache.hc.core5.http.HttpException; import org.apache.hc.core5.http.HttpResponse; import org.apache.hc.core5.http.HttpStatus; import org.apache.hc.core5.http.ParseException; @@ -65,17 +67,20 @@ class DefaultApiResponseHandler implements HttpClientResponseHandler * @param returnType * The type reference for response deserialization */ - DefaultApiResponseHandler( ObjectMapper objectMapper, String tempFolderPath, TypeReference returnType ) + DefaultApiResponseHandler( + @Nonnull final ObjectMapper objectMapper, + @Nullable final String tempFolderPath, + @Nonnull final TypeReference returnType ) { this.objectMapper = objectMapper; this.tempFolderPath = tempFolderPath; this.returnType = returnType; } + @Nullable @Override - public T handleResponse( ClassicHttpResponse response ) - throws HttpException, - IOException + public T handleResponse( @Nonnull final ClassicHttpResponse response ) + throws IOException { try { return processResponse(response); @@ -100,12 +105,13 @@ public T handleResponse( ClassicHttpResponse response ) * if response parsing fails */ @SuppressWarnings( "unchecked" ) - private T processResponse( ClassicHttpResponse response ) + @Nullable + private T processResponse( @Nonnull final ClassicHttpResponse response ) throws OpenApiRequestException, IOException, ParseException { - int statusCode = response.getCode(); + final int statusCode = response.getCode(); if( statusCode == HttpStatus.SC_NO_CONTENT ) { if( returnType.getType().equals(OpenApiResponse.class) ) { return (T) new OpenApiResponse(statusCode, transformResponseHeaders(response.getHeaders())); @@ -116,8 +122,8 @@ private T processResponse( ClassicHttpResponse response ) if( isSuccessfulStatus(statusCode) ) { return deserialize(response); } else { - Map> responseHeaders = transformResponseHeaders(response.getHeaders()); - String message = new StatusLine(response).toString(); + final Map> responseHeaders = transformResponseHeaders(response.getHeaders()); + final String message = new StatusLine(response).toString(); throw new OpenApiRequestException(message) .statusCode(statusCode) .responseHeaders(responseHeaders) @@ -138,34 +144,32 @@ private T processResponse( ClassicHttpResponse response ) * @throws ParseException * if response parsing fails */ + @Nullable @SuppressWarnings( "unchecked" ) - private T deserialize( ClassicHttpResponse response ) + private T deserialize( @Nonnull final ClassicHttpResponse response ) throws OpenApiRequestException, IOException, ParseException { - if( returnType == null ) { - return null; - } final Type valueRawType = returnType.getType(); if( valueRawType.equals(OpenApiResponse.class) ) { final int statusCode = response.getCode(); - Map> headers = transformResponseHeaders(response.getHeaders()); + final Map> headers = transformResponseHeaders(response.getHeaders()); return (T) new OpenApiResponse(statusCode, headers); } - HttpEntity entity = response.getEntity(); + final HttpEntity entity = response.getEntity(); if( valueRawType.equals(byte[].class) ) { return (T) EntityUtils.toByteArray(entity); } else if( valueRawType.equals(File.class) ) { return (T) downloadFileFromResponse(response); } - String mimeType = getResponseMimeType(response); + final String mimeType = getResponseMimeType(response); if( mimeType == null || isJsonMime(mimeType) ) { // Assume json if no mime type // convert input stream to string - String content = EntityUtils.toString(entity); + final String content = EntityUtils.toString(entity); if( "".equals(content) ) { // returns null for empty body return null; @@ -176,7 +180,7 @@ private T deserialize( ClassicHttpResponse response ) // convert input stream to string return (T) EntityUtils.toString(entity); } else { - Map> responseHeaders = transformResponseHeaders(response.getHeaders()); + final Map> responseHeaders = transformResponseHeaders(response.getHeaders()); throw new OpenApiRequestException( "Deserialization for content type '" + mimeType + "' not supported for type '" + returnType + "'") .statusCode(response.getCode()) @@ -194,12 +198,13 @@ private T deserialize( ClassicHttpResponse response ) * @throws IOException * if an I/O error occurs during download */ - private File downloadFileFromResponse( ClassicHttpResponse response ) + @Nonnull + private File downloadFileFromResponse( @Nonnull final ClassicHttpResponse response ) throws IOException { - Header contentDispositionHeader = response.getFirstHeader("Content-Disposition"); - String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue(); - File file = prepareDownloadFile(contentDisposition); + final Header contentDispositionHeader = response.getFirstHeader("Content-Disposition"); + final String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue(); + final File file = prepareDownloadFile(contentDisposition); Files.copy(response.getEntity().getContent(), file.toPath(), StandardCopyOption.REPLACE_EXISTING); return file; } @@ -213,14 +218,15 @@ private File downloadFileFromResponse( ClassicHttpResponse response ) * @throws IOException * if the temporary file cannot be created */ - private File prepareDownloadFile( String contentDisposition ) + @Nonnull + private File prepareDownloadFile( @Nullable final String contentDisposition ) throws IOException { String filename = null; - if( contentDisposition != null && !"".equals(contentDisposition) ) { + if( contentDisposition != null && !contentDisposition.isEmpty() ) { // Get filename from the Content-Disposition header. - Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); - Matcher matcher = pattern.matcher(contentDisposition); + final Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + final Matcher matcher = pattern.matcher(contentDisposition); if( matcher.find() ) filename = matcher.group(1); } @@ -231,7 +237,7 @@ private File prepareDownloadFile( String contentDisposition ) prefix = "download-"; suffix = ""; } else { - int pos = filename.lastIndexOf('.'); + final int pos = filename.lastIndexOf('.'); if( pos == -1 ) { prefix = filename + "-"; } else { @@ -258,10 +264,11 @@ private File prepareDownloadFile( String contentDisposition ) * @throws OpenApiRequestException * if the content type cannot be parsed */ - private String getResponseMimeType( HttpResponse response ) + @Nullable + private String getResponseMimeType( @Nonnull final HttpResponse response ) throws OpenApiRequestException { - Header contentTypeHeader = response.getFirstHeader("Content-Type"); + final Header contentTypeHeader = response.getFirstHeader("Content-Type"); if( contentTypeHeader != null ) { return parseContentType(contentTypeHeader.getValue()).getMimeType(); } @@ -277,7 +284,8 @@ private String getResponseMimeType( HttpResponse response ) * @throws OpenApiRequestException * if the content type cannot be parsed */ - private static ContentType parseContentType( String headerValue ) + @Nonnull + private static ContentType parseContentType( @Nonnull final String headerValue ) throws OpenApiRequestException { try { @@ -295,9 +303,10 @@ private static ContentType parseContentType( String headerValue ) * HTTP headers * @return a map of string array */ - private static Map> transformResponseHeaders( Header[] headers ) + @Nonnull + private static Map> transformResponseHeaders( @Nonnull final Header[] headers ) { - Map> headersMap = new HashMap<>(); + final Map> headersMap = new HashMap<>(); for( Header header : headers ) { List valuesList = headersMap.get(header.getName()); if( valuesList != null ) { @@ -311,7 +320,7 @@ private static Map> transformResponseHeaders( Header[] head return headersMap; } - private static boolean isSuccessfulStatus( int statusCode ) + private static boolean isSuccessfulStatus( final int statusCode ) { return statusCode >= 200 && statusCode < 300; } @@ -324,9 +333,9 @@ private static boolean isSuccessfulStatus( int statusCode ) * MIME * @return True if MIME type is boolean */ - static boolean isJsonMime( String mime ) + static boolean isJsonMime( @Nullable final String mime ) { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + final String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); } From 1e0060480632b9201c276f87cd66e217f5484816 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Mon, 12 Jan 2026 13:01:31 +0100 Subject: [PATCH 18/26] pmd --- .../services/openapi/apache/ApiClient.java | 24 +++++++++---------- .../apache/DefaultApiResponseHandler.java | 16 +++++++------ 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java index 8276181c7..c4f1506f1 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java @@ -182,7 +182,7 @@ public static String parameterToString( @Nullable final Object param ) return formatDate(date); } else if( param instanceof Collection ) { final StringBuilder b = new StringBuilder(); - for( Object o : (Collection) param ) { + for( final Object o : (Collection) param ) { if( !b.isEmpty() ) { b.append(','); } @@ -247,7 +247,7 @@ public static List parameterToPairs( // create the params based on the collection format if( "multi".equals(collectionFormat) ) { - for( Object item : value ) { + for( final Object item : value ) { params.add(new Pair(name, escapeString(parameterToString(item)))); } return params; @@ -263,7 +263,7 @@ public static List parameterToPairs( }; final StringBuilder sb = new StringBuilder(); - for( Object item : value ) { + for( final Object item : value ) { sb.append(delimiter); sb.append(escapeString(parameterToString(item))); } @@ -288,7 +288,7 @@ public static String selectHeaderAccept( @Nonnull final String[] accepts ) if( accepts.length == 0 ) { return null; } - for( String accept : accepts ) { + for( final String accept : accepts ) { if( isJsonMime(accept) ) { return accept; } @@ -310,7 +310,7 @@ public static String selectHeaderContentType( @Nonnull final String[] contentTyp if( contentTypes.length == 0 || contentTypes[0].equals("*/*") ) { return "application/json"; } - for( String contentType : contentTypes ) { + for( final String contentType : contentTypes ) { if( isJsonMime(contentType) ) { return contentType; } @@ -342,7 +342,7 @@ private ContentType getContentType( @Nonnull final String headerValue ) return ContentType.parse(headerValue); } catch( UnsupportedCharsetException e ) { - throw new OpenApiRequestException("Could not parse content type " + headerValue); + throw new OpenApiRequestException("Could not parse content type " + headerValue, e); } } @@ -378,7 +378,7 @@ private HttpEntity serialize( } } else if( mimeType.equals(ContentType.MULTIPART_FORM_DATA.getMimeType()) ) { final MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create(); - for( Entry paramEntry : formParams.entrySet() ) { + for( final Entry paramEntry : formParams.entrySet() ) { final Object value = paramEntry.getValue(); if( value instanceof File file ) { multiPartBuilder.addBinaryBody(paramEntry.getKey(), file); @@ -432,13 +432,13 @@ private HttpEntity serialize( */ @Nonnull private String buildUrl( - @Nullable final String path, + @Nonnull final String path, @Nullable final List queryParams, @Nullable final List collectionQueryParams, @Nullable final String urlQueryDeepObject ) { final StringBuilder url = new StringBuilder(); - if( basePath.endsWith("/") && path != null && path.startsWith("/") ) { + if( basePath.endsWith("/") && path.startsWith("/") ) { url.append(basePath, 0, basePath.length() - 1); } else { url.append(basePath); @@ -448,7 +448,7 @@ private String buildUrl( if( queryParams != null && !queryParams.isEmpty() ) { // support (constant) query string in `path`, e.g. "/posts?draft=1" String prefix = path.contains("?") ? "&" : "?"; - for( Pair param : queryParams ) { + for( final Pair param : queryParams ) { if( prefix != null ) { url.append(prefix); prefix = null; @@ -463,7 +463,7 @@ private String buildUrl( if( collectionQueryParams != null && !collectionQueryParams.isEmpty() ) { String prefix = url.toString().contains("?") ? "&" : "?"; - for( Pair param : collectionQueryParams ) { + for( final Pair param : collectionQueryParams ) { if( prefix != null ) { url.append(prefix); prefix = null; @@ -548,7 +548,7 @@ public T invokeAPI( if( accept != null ) { builder.addHeader("Accept", accept); } - for( Entry keyValue : headerParams.entrySet() ) { + for( final Entry keyValue : headerParams.entrySet() ) { builder.addHeader(keyValue.getKey(), keyValue.getValue()); } diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/DefaultApiResponseHandler.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/DefaultApiResponseHandler.java index 0947b078a..20c96f58f 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/DefaultApiResponseHandler.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/DefaultApiResponseHandler.java @@ -227,8 +227,9 @@ private File prepareDownloadFile( @Nullable final String contentDisposition ) // Get filename from the Content-Disposition header. final Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); final Matcher matcher = pattern.matcher(contentDisposition); - if( matcher.find() ) + if( matcher.find() ) { filename = matcher.group(1); + } } String prefix; @@ -245,14 +246,15 @@ private File prepareDownloadFile( @Nullable final String contentDisposition ) suffix = filename.substring(pos); } // Files.createTempFile requires the prefix to be at least three characters long - if( prefix.length() < 3 ) + if( prefix.length() < 3 ) { prefix = "download-"; + } } - if( tempFolderPath == null ) + if( tempFolderPath == null ) { return Files.createTempFile(prefix, suffix).toFile(); - else - return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); } /** @@ -292,7 +294,7 @@ private static ContentType parseContentType( @Nonnull final String headerValue ) return ContentType.parse(headerValue); } catch( UnsupportedCharsetException e ) { - throw new OpenApiRequestException("Could not parse content type " + headerValue); + throw new OpenApiRequestException("Could not parse content type " + headerValue, e); } } @@ -307,7 +309,7 @@ private static ContentType parseContentType( @Nonnull final String headerValue ) private static Map> transformResponseHeaders( @Nonnull final Header[] headers ) { final Map> headersMap = new HashMap<>(); - for( Header header : headers ) { + for( final Header header : headers ) { List valuesList = headersMap.get(header.getName()); if( valuesList != null ) { valuesList.add(header.getValue()); From 4835a34712d61564ab589c9a87f370f8bab60814 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal <36329474+rpanackal@users.noreply.github.com> Date: Tue, 13 Jan 2026 17:01:38 +0100 Subject: [PATCH 19/26] Update datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache Co-authored-by: Charles Dubois <103174266+CharlesDuboisSAP@users.noreply.github.com> --- .../libraries/apache-httpclient/api.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache index e6a5a6b92..01e80f3a7 100644 --- a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache +++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache @@ -1,7 +1,7 @@ {{#copyrightHeader}} /* -* {{copyrightHeader}} -*/ + * {{copyrightHeader}} + */ {{/copyrightHeader}} package {{package}}; From de76c720dd54d230c645e13dce96d3e197eea10e Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Tue, 13 Jan 2026 17:07:48 +0100 Subject: [PATCH 20/26] Review: Apache Method enum and ctor formatting --- .../services/openapi/apache/ApiClient.java | 7 +- .../libraries/apache-httpclient/api.mustache | 158 +++++++++--------- 2 files changed, 83 insertions(+), 82 deletions(-) diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java index c4f1506f1..efc0bd2cc 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java @@ -38,6 +38,7 @@ import org.apache.hc.client5.http.protocol.HttpClientContext; import org.apache.hc.core5.http.ContentType; import org.apache.hc.core5.http.HttpEntity; +import org.apache.hc.core5.http.Method; import org.apache.hc.core5.http.NameValuePair; import org.apache.hc.core5.http.io.HttpClientResponseHandler; import org.apache.hc.core5.http.io.entity.ByteArrayEntity; @@ -94,7 +95,7 @@ public class ApiClient private final String tempFolderPath; // Methods that can have a request body - private static final Set BODY_METHODS = Set.of("POST", "PUT", "DELETE", "PATCH"); + private static final Set BODY_METHODS = Set.of(Method.POST, Method.PUT, Method.PATCH, Method.DELETE); private static final String DEFAULT_BASE_PATH = "http://localhost"; /** @@ -484,7 +485,7 @@ private String buildUrl( return url.toString(); } - private static boolean isBodyAllowed( @Nonnull final String method ) + private static boolean isBodyAllowed( @Nonnull final Method method ) { return BODY_METHODS.contains(method); } @@ -556,7 +557,7 @@ public T invokeAPI( final ContentType contentTypeObj = getContentType(contentType); if( body != null || !formParams.isEmpty() ) { - if( isBodyAllowed(method) ) { + if( isBodyAllowed(Method.valueOf(method)) ) { // Add entity if we have content and a valid method builder.setEntity(serialize(body, formParams, contentTypeObj)); } else { diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache index e6a5a6b92..3ff133135 100644 --- a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache +++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache @@ -44,54 +44,54 @@ import javax.annotation.Nullable; {{/useBeanValidation}} /** -* {{appName}} in version {{version}}. -* -* {{#appDescription}}{{{appDescription}}}{{/appDescription}}{{^appDescription}}No description provided.{{/appDescription}} -*/ + * {{appName}} in version {{version}}. + * + * {{#appDescription}}{{{appDescription}}}{{/appDescription}}{{^appDescription}}No description provided.{{/appDescription}} + */ {{!>generatedAnnotation}} {{#operations}} public class {{classname}} extends BaseApi { {{^aiSdkConstructor}} /** - * Instantiates this API class to invoke operations on the {{appName}} - */ + * Instantiates this API class to invoke operations on the {{appName}} + */ public {{classname}}() {} /** - * Instantiates this API class to invoke operations on the {{appName}}. - * - * @param httpDestination The destination that API should be used with - */ + * Instantiates this API class to invoke operations on the {{appName}}. + * + * @param httpDestination The destination that API should be used with + */ public {{classname}}( @Nonnull final Destination httpDestination ) { super(httpDestination); } /** - * Instantiates this API class to invoke operations on the {{appName}} based on a given {@link ApiClient}. - * - * @param apiClient - * ApiClient to invoke the API on - */ + * Instantiates this API class to invoke operations on the {{appName}} based on a given {@link ApiClient}. + * + * @param apiClient + * ApiClient to invoke the API on + */ public {{classname}}(@Nonnull final ApiClient apiClient) { super(apiClient); } {{/aiSdkConstructor}} {{#aiSdkConstructor}} /** - * Instantiates this API class to invoke operations on the {{appName}} - */ + * Instantiates this API class to invoke operations on the {{appName}} + */ public {{classname}}() { super(new AiCoreService().getApiClient()); } /** - * Instantiates this API class to invoke operations on the {{appName}} - * - * @param aiCoreService The configured connectivity instance to AI Core - */ + * Instantiates this API class to invoke operations on the {{appName}} + * + * @param aiCoreService The configured connectivity instance to AI Core + */ public {{classname}}( @Nonnull final AiCoreService aiCoreService ) { super(aiCoreService.getApiClient()); @@ -101,35 +101,35 @@ public class {{classname}} extends BaseApi { {{#operation}} {{#hasOptionalParams}} /** - *

{{summary}} - *

{{notes}} - {{#responses}} - *

{{code}}{{#message}} - {{message}}{{/message}} - {{/responses}} - {{#allParams}} - * @param {{paramName}} {{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} - {{#description}} - * {{description}} - {{/description}} - {{^description}} - * The value for the parameter {{paramName}} - {{/description}} - {{/allParams}} - {{#returnType}} - * @return {{returnType}} - {{/returnType}} - {{^returnType}} - * @return An OpenApiResponse containing the status code of the HttpResponse. - {{/returnType}} - * @throws OpenApiRequestException if an error occurs while attempting to invoke the API - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ + *

{{summary}} + *

{{notes}} + {{#responses}} + *

{{code}}{{#message}} - {{message}}{{/message}} + {{/responses}} + {{#allParams}} + * @param {{paramName}} {{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} + {{#description}} + * {{description}} + {{/description}} + {{^description}} + * The value for the parameter {{paramName}} + {{/description}} + {{/allParams}} + {{#returnType}} + * @return {{returnType}} + {{/returnType}} + {{^returnType}} + * @return An OpenApiResponse containing the status code of the HttpResponse. + {{/returnType}} + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ {{#isDeprecated}} @Deprecated {{/isDeprecated}} @@ -140,35 +140,35 @@ public class {{classname}} extends BaseApi { {{/hasOptionalParams}} /** - *

{{summary}} - *

{{notes}} - {{#responses}} - *

{{code}}{{#message}} - {{message}}{{/message}} - {{/responses}} - {{#requiredParams}} - * @param {{paramName}} - {{#description}} - * {{description}} - {{/description}} - {{^description}} - * The value for the parameter {{paramName}} - {{/description}} - {{/requiredParams}} - {{#returnType}} - * @return {{returnType}} - {{/returnType}} - {{^returnType}} - * @return An OpenApiResponse containing the status code of the HttpResponse. - {{/returnType}} - * @throws OpenApiRequestException if an error occurs while attempting to invoke the API - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ + *

{{summary}} + *

{{notes}} + {{#responses}} + *

{{code}}{{#message}} - {{message}}{{/message}} + {{/responses}} + {{#requiredParams}} + * @param {{paramName}} + {{#description}} + * {{description}} + {{/description}} + {{^description}} + * The value for the parameter {{paramName}} + {{/description}} + {{/requiredParams}} + {{#returnType}} + * @return {{returnType}} + {{/returnType}} + {{^returnType}} + * @return An OpenApiResponse containing the status code of the HttpResponse. + {{/returnType}} + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ {{#isDeprecated}} @Deprecated {{/isDeprecated}} From de01665a6de7faa8a9af2309939fc20e80b73fc4 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal <36329474+rpanackal@users.noreply.github.com> Date: Tue, 13 Jan 2026 17:13:04 +0100 Subject: [PATCH 21/26] Update datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java Co-authored-by: Charles Dubois <103174266+CharlesDuboisSAP@users.noreply.github.com> --- .../sap/cloud/sdk/services/openapi/apache/ApiClient.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java index efc0bd2cc..20d0e1a9e 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java @@ -526,9 +526,9 @@ private static boolean isBodyAllowed( @Nonnull final Method method ) public T invokeAPI( @Nonnull final String path, @Nonnull final String method, - @Nonnull final List queryParams, - @Nonnull final List collectionQueryParams, - @Nonnull final String urlQueryDeepObject, + @Nullable final List queryParams, + @Nullable final List collectionQueryParams, + @Nullable final String urlQueryDeepObject, @Nullable final Object body, @Nonnull final Map headerParams, @Nonnull final Map formParams, From b7d623ea6157cfc7dbe9560bced89f440124878e Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Tue, 13 Jan 2026 17:17:12 +0100 Subject: [PATCH 22/26] Fix compliance issue and formatting --- .../sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java | 4 ++-- .../sdk/datamodel/openapi/apache/sample/api/OrdersApi.java | 4 ++-- .../sdk/datamodel/openapi/apache/sample/api/SodasApi.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java index af9d5c541..31e1b234a 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java @@ -1,6 +1,6 @@ /* -* Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. -*/ + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ package com.sap.cloud.sdk.datamodel.openapi.apache.petstore.api; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java index d3f5d7f00..bc8170370 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java @@ -1,6 +1,6 @@ /* -* Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. -*/ + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ package com.sap.cloud.sdk.datamodel.openapi.apache.sample.api; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java index 80d852f1c..171acea7f 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java @@ -1,6 +1,6 @@ /* -* Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. -*/ + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ package com.sap.cloud.sdk.datamodel.openapi.apache.sample.api; From 1226e6fa3081b04c2c359fce493077ca90f1cf01 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Wed, 14 Jan 2026 14:14:13 +0100 Subject: [PATCH 23/26] Make return statement always present --- .../mustache-templates/libraries/apache-httpclient/api.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache index ca13003bd..08b8899f7 100644 --- a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache +++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache @@ -175,7 +175,7 @@ public class {{classname}} extends BaseApi { {{#vendorExtensions.x-return-nullable}}@Nullable{{/vendorExtensions.x-return-nullable}}{{^vendorExtensions.x-return-nullable}}@Nonnull{{/vendorExtensions.x-return-nullable}} public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}OpenApiResponse {{/returnType}}{{#vendorExtensions.x-sap-cloud-sdk-operation-name}}{{vendorExtensions.x-sap-cloud-sdk-operation-name}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}{{^vendorExtensions.x-sap-cloud-sdk-operation-name}}{{operationId}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}({{#requiredParams}}{{>nullable_var_annotations}} final {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) throws OpenApiRequestException { {{#hasOptionalParams}} - {{#returnType}}return {{/returnType}}{{#vendorExtensions.x-sap-cloud-sdk-operation-name}}{{vendorExtensions.x-sap-cloud-sdk-operation-name}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}{{^vendorExtensions.x-sap-cloud-sdk-operation-name}}{{operationId}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}({{#hasRequiredParams}}{{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}, {{/hasRequiredParams}}{{#optionalParams}}null{{^-last}}, {{/-last}}{{/optionalParams}}); + return {{#vendorExtensions.x-sap-cloud-sdk-operation-name}}{{vendorExtensions.x-sap-cloud-sdk-operation-name}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}{{^vendorExtensions.x-sap-cloud-sdk-operation-name}}{{operationId}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}({{#hasRequiredParams}}{{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}, {{/hasRequiredParams}}{{#optionalParams}}null{{^-last}}, {{/-last}}{{/optionalParams}}); {{/hasOptionalParams}} {{^hasOptionalParams}} {{>operationBody}} From d8a945e868206cadcd6f613cb30bb12e59edd3b7 Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Thu, 15 Jan 2026 16:31:10 +0100 Subject: [PATCH 24/26] minor changes in mustache files --- .../openapi/apache/petstore/api/DefaultApi.java | 14 +++++--------- .../openapi/apache/sample/api/OrdersApi.java | 5 ++--- .../openapi/apache/sample/api/SodasApi.java | 14 +++++--------- .../libraries/apache-httpclient/api.mustache | 2 +- .../apache-httpclient/operationBody.mustache | 4 +--- 5 files changed, 14 insertions(+), 25 deletions(-) diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java index 31e1b234a..e640fa446 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java @@ -25,7 +25,7 @@ /** * Swagger Petstore in version 1.0.0. - * + *

* A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification */ public class DefaultApi extends BaseApi @@ -79,7 +79,6 @@ public DefaultApi( @Nonnull final ApiClient apiClient ) public Pet addPet( @Nonnull final PetInput pet ) throws OpenApiRequestException { - final Object localVarPostBody = pet; // verify the required parameter 'pet' is set if( pet == null ) { @@ -113,7 +112,7 @@ public Pet addPet( @Nonnull final PetInput pet ) localVarQueryParams, localVarCollectionQueryParams, localVarQueryStringJoiner.toString(), - localVarPostBody, + pet, localVarHeaderParams, localVarFormParams, localVarAccept, @@ -140,7 +139,6 @@ public Pet addPet( @Nonnull final PetInput pet ) public OpenApiResponse deletePet( @Nonnull final Long id ) throws OpenApiRequestException { - final Object localVarPostBody = null; // verify the required parameter 'id' is set if( id == null ) { @@ -177,7 +175,7 @@ public OpenApiResponse deletePet( @Nonnull final Long id ) localVarQueryParams, localVarCollectionQueryParams, localVarQueryStringJoiner.toString(), - localVarPostBody, + null, localVarHeaderParams, localVarFormParams, localVarAccept, @@ -204,7 +202,6 @@ public OpenApiResponse deletePet( @Nonnull final Long id ) public Pet findPetById( @Nonnull final Long id ) throws OpenApiRequestException { - final Object localVarPostBody = null; // verify the required parameter 'id' is set if( id == null ) { @@ -241,7 +238,7 @@ public Pet findPetById( @Nonnull final Long id ) localVarQueryParams, localVarCollectionQueryParams, localVarQueryStringJoiner.toString(), - localVarPostBody, + null, localVarHeaderParams, localVarFormParams, localVarAccept, @@ -270,7 +267,6 @@ public Pet findPetById( @Nonnull final Long id ) public List findPets( @Nullable final List tags, @Nullable final Integer limit ) throws OpenApiRequestException { - final Object localVarPostBody = null; // create path and map variables final String localVarPath = "/pets"; @@ -303,7 +299,7 @@ public List findPets( @Nullable final List tags, @Nullable final In localVarQueryParams, localVarCollectionQueryParams, localVarQueryStringJoiner.toString(), - localVarPostBody, + null, localVarHeaderParams, localVarFormParams, localVarAccept, diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java index bc8170370..3eec16bf4 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java @@ -22,7 +22,7 @@ /** * SodaStore API in version 1.0.0. - * + *

* API for managing soda products and orders in SodaStore. */ public class OrdersApi extends BaseApi @@ -74,7 +74,6 @@ public OrdersApi( @Nonnull final ApiClient apiClient ) public Order ordersPost( @Nonnull final Order order ) throws OpenApiRequestException { - final Object localVarPostBody = order; // verify the required parameter 'order' is set if( order == null ) { @@ -108,7 +107,7 @@ public Order ordersPost( @Nonnull final Order order ) localVarQueryParams, localVarCollectionQueryParams, localVarQueryStringJoiner.toString(), - localVarPostBody, + order, localVarHeaderParams, localVarFormParams, localVarAccept, diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java index 171acea7f..5c96f9a89 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java @@ -25,7 +25,7 @@ /** * SodaStore API in version 1.0.0. - * + *

* API for managing soda products and orders in SodaStore. */ public class SodasApi extends BaseApi @@ -79,7 +79,6 @@ public SodasApi( @Nonnull final ApiClient apiClient ) public File sodasDownloadIdGet( @Nonnull final Long id ) throws OpenApiRequestException { - final Object localVarPostBody = null; // verify the required parameter 'id' is set if( id == null ) { @@ -117,7 +116,7 @@ public File sodasDownloadIdGet( @Nonnull final Long id ) localVarQueryParams, localVarCollectionQueryParams, localVarQueryStringJoiner.toString(), - localVarPostBody, + null, localVarHeaderParams, localVarFormParams, localVarAccept, @@ -140,7 +139,6 @@ public File sodasDownloadIdGet( @Nonnull final Long id ) public List sodasGet() throws OpenApiRequestException { - final Object localVarPostBody = null; // create path and map variables final String localVarPath = "/sodas"; @@ -170,7 +168,7 @@ public List sodasGet() localVarQueryParams, localVarCollectionQueryParams, localVarQueryStringJoiner.toString(), - localVarPostBody, + null, localVarHeaderParams, localVarFormParams, localVarAccept, @@ -197,7 +195,6 @@ public List sodasGet() public SodaWithId sodasIdGet( @Nonnull final Long id ) throws OpenApiRequestException { - final Object localVarPostBody = null; // verify the required parameter 'id' is set if( id == null ) { @@ -234,7 +231,7 @@ public SodaWithId sodasIdGet( @Nonnull final Long id ) localVarQueryParams, localVarCollectionQueryParams, localVarQueryStringJoiner.toString(), - localVarPostBody, + null, localVarHeaderParams, localVarFormParams, localVarAccept, @@ -263,7 +260,6 @@ public SodaWithId sodasIdGet( @Nonnull final Long id ) public Soda sodasPut( @Nonnull final SodaWithId sodaWithId ) throws OpenApiRequestException { - final Object localVarPostBody = sodaWithId; // verify the required parameter 'sodaWithId' is set if( sodaWithId == null ) { @@ -297,7 +293,7 @@ public Soda sodasPut( @Nonnull final SodaWithId sodaWithId ) localVarQueryParams, localVarCollectionQueryParams, localVarQueryStringJoiner.toString(), - localVarPostBody, + sodaWithId, localVarHeaderParams, localVarFormParams, localVarAccept, diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache index 08b8899f7..b14178041 100644 --- a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache +++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/api.mustache @@ -45,7 +45,7 @@ import javax.annotation.Nullable; /** * {{appName}} in version {{version}}. - * + *

* {{#appDescription}}{{{appDescription}}}{{/appDescription}}{{^appDescription}}No description provided.{{/appDescription}} */ {{!>generatedAnnotation}} diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/operationBody.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/operationBody.mustache index 7f9138e97..776219542 100644 --- a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/operationBody.mustache +++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/operationBody.mustache @@ -1,4 +1,3 @@ -final Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { @@ -19,7 +18,6 @@ final Map localVarFormParams = new HashMap(); {{#queryParams}} {{#isDeepObject}} - localVarQueryParameterBaseName = "{{{baseName}}}"; {{#isArray}} for (int i=0; i < {{paramName}}.size(); i++) { localVarQueryStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format(Locale.ROOT, "{{baseName}}[%d]", i))); @@ -85,7 +83,7 @@ final Map localVarFormParams = new HashMap(); localVarQueryParams, localVarCollectionQueryParams, localVarQueryStringJoiner.toString(), - localVarPostBody, + {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}, localVarHeaderParams, localVarFormParams, localVarAccept, From 859a8f19e206d4270bd13bd7904ab18b4208013e Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal <36329474+rpanackal@users.noreply.github.com> Date: Thu, 15 Jan 2026 16:47:52 +0100 Subject: [PATCH 25/26] feat: [OpenAPI] Part 2: Testing Apache Client Support and some fixes. (#1062) Moving to single larger PR (sorry), because its getting difficult to sync changes across. Both PRs have been thoroughly review at this point. --- .../openapi/openapi-api-apache-sample/pom.xml | 36 +- .../apache/petstore/api/DefaultApi.java | 8 +- .../apache/petstore/model/ErrorModel.java | 77 --- .../openapi/apache/petstore/model/Pet.java | 95 ---- .../apache/petstore/model/PetInput.java | 95 ---- .../{sample => sodastore}/api/OrdersApi.java | 6 +- .../{sample => sodastore}/api/SodasApi.java | 21 +- .../{sample => sodastore}/model/AllOf.java | 2 +- .../{sample => sodastore}/model/AnyOf.java | 2 +- .../{sample => sodastore}/model/Bar.java | 2 +- .../{sample => sodastore}/model/Cola.java | 2 +- .../model/ColaBarCode.java | 2 +- .../{sample => sodastore}/model/ColaLogo.java | 2 +- .../{sample => sodastore}/model/Fanta.java | 2 +- .../model/FantaFlavor.java | 2 +- .../model/FlavorType.java | 2 +- .../{sample => sodastore}/model/Foo.java | 2 +- .../{sample => sodastore}/model/OneOf.java | 2 +- .../model/OneOfWithDiscriminator.java | 2 +- .../OneOfWithDiscriminatorAndMapping.java | 2 +- .../model/OneOfWithEnumDiscriminator.java | 2 +- .../{sample => sodastore}/model/Order.java | 2 +- .../model/OrderWithTimestamp.java | 2 +- .../{sample => sodastore}/model/Soda.java | 2 +- .../model/SodaWithId.java | 2 +- .../openapi/apache/DeserializationTest.java | 143 ++++++ .../apache/OneOfDeserializationTest.java | 318 ++++++++++++ .../openapi/apache/SerializationTest.java | 111 ++++ .../sample/api/OneOfDeserializationTest.java | 10 +- datamodel/openapi/openapi-core/pom.xml | 7 +- .../services/openapi/apache/ApiClient.java | 3 - .../ApacheApiClientViaConstructorTest.java | 190 +++++++ ...piClientExtensionsDeserializationTest.java | 153 ++++-- .../ApiClientFromDestinationTest.java | 49 +- ...=> SpringApiClientViaConstructorTest.java} | 2 +- .../GenericParameterTest.java | 108 +++- .../GenericReturnTypeTest.java | 50 +- .../genericreturntype/TestApacheApi.java | 65 +++ .../{TestApi.java => TestSpringApi.java} | 4 +- .../GenerationConfigurationConverter.java | 5 + .../apache-httpclient/operationBody.mustache | 149 +++--- ...taModelGeneratorApacheIntegrationTest.java | 112 ++++ .../DataModelGeneratorIntegrationTest.java | 15 +- .../api-class-for-ai-sdk/input/sodastore.json | 249 +++++++++ .../services/builder/api/AwesomeSodaApi.java | 113 ++++ .../services/builder/api/AwesomeSodasApi.java | 104 ++++ .../sdk/services/builder/api/DefaultApi.java | 237 +++++++++ .../sdk/services/builder/model/NewSoda.java | 349 +++++++++++++ .../sdk/services/builder/model/Soda.java | 481 ++++++++++++++++++ .../services/builder/model/UpdateSoda.java | 349 +++++++++++++ .../input/sodastore.json | 235 +++++++++ .../api/AwesomeSodaApi.java | 120 +++++ .../api/AwesomeSodasApi.java | 111 ++++ .../api/DefaultApi.java | 244 +++++++++ .../model/NewSoda.java | 349 +++++++++++++ .../apiclassvendorextension/model/Soda.java | 313 ++++++++++++ .../model/UpdateSoda.java | 349 +++++++++++++ .../input/sodastore.yaml | 157 ++++++ .../api/DefaultApi.java | 347 +++++++++++++ .../model/NewSoda.java | 278 ++++++++++ .../apiclassvendorextension/model/Soda.java | 313 ++++++++++++ .../model/UpdateSoda.java | 278 ++++++++++ .../input/sodastore.yaml | 81 +++ .../services/inlineobject/api/DefaultApi.java | 125 +++++ .../services/inlineobject/model/NotFound.java | 173 +++++++ .../ServiceUnavailableApplicationJson.java | 173 +++++++ .../ServiceUnavailableApplicationXml.java | 173 +++++++ .../sdk/services/inlineobject/model/Soda.java | 313 ++++++++++++ .../partial-generation/input/sodastore.json | 261 ++++++++++ .../sdk/services/builder/api/DefaultApi.java | 245 +++++++++ .../sdk/services/builder/model/Soda.java | 313 ++++++++++++ .../services/builder/model/SodaWithFoo.java | 313 ++++++++++++ .../services/builder/model/UpdateSoda.java | 314 ++++++++++++ .../input/sodastore.json | 292 +++++++++++ .../sdk/services/builder/api/OrdersApi.java | 119 +++++ .../sdk/services/builder/api/SodasApi.java | 226 ++++++++ .../sdk/services/builder/model/Order.java | 313 ++++++++++++ .../builder/model/OrderWithTimestamp.java | 349 +++++++++++++ .../sdk/services/builder/model/Soda.java | 372 ++++++++++++++ .../services/builder/model/SodaWithId.java | 407 +++++++++++++++ 80 files changed, 10927 insertions(+), 479 deletions(-) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/api/OrdersApi.java (96%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/api/SodasApi.java (96%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/AllOf.java (99%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/AnyOf.java (99%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/Bar.java (99%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/Cola.java (99%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/ColaBarCode.java (95%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/ColaLogo.java (96%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/Fanta.java (99%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/FantaFlavor.java (97%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/FlavorType.java (98%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/Foo.java (99%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/OneOf.java (90%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/OneOfWithDiscriminator.java (92%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/OneOfWithDiscriminatorAndMapping.java (92%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/OneOfWithEnumDiscriminator.java (92%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/Order.java (99%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/OrderWithTimestamp.java (99%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/Soda.java (99%) rename datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/{sample => sodastore}/model/SodaWithId.java (99%) create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/test/java/com/sap/cloud/sdk/services/openapi/apache/DeserializationTest.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/test/java/com/sap/cloud/sdk/services/openapi/apache/OneOfDeserializationTest.java create mode 100644 datamodel/openapi/openapi-api-apache-sample/src/test/java/com/sap/cloud/sdk/services/openapi/apache/SerializationTest.java create mode 100644 datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/ApacheApiClientViaConstructorTest.java rename datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/{ApiClientViaConstructorTest.java => SpringApiClientViaConstructorTest.java} (99%) create mode 100644 datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericreturntype/TestApacheApi.java rename datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericreturntype/{TestApi.java => TestSpringApi.java} (94%) create mode 100644 datamodel/openapi/openapi-generator/src/test/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorApacheIntegrationTest.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/input/sodastore.json create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/AwesomeSodaApi.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/AwesomeSodasApi.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/DefaultApi.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/NewSoda.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/Soda.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/UpdateSoda.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/input/sodastore.json create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/AwesomeSodaApi.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/AwesomeSodasApi.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/DefaultApi.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/NewSoda.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/Soda.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/UpdateSoda.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/input/sodastore.yaml create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/DefaultApi.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/NewSoda.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/Soda.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/UpdateSoda.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/input/sodastore.yaml create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/api/DefaultApi.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/model/NotFound.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/model/ServiceUnavailableApplicationJson.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/model/ServiceUnavailableApplicationXml.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/model/Soda.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/input/sodastore.json create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/api/DefaultApi.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/model/Soda.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/model/SodaWithFoo.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/model/UpdateSoda.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/input/sodastore.json create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/api/OrdersApi.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/api/SodasApi.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/Order.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/OrderWithTimestamp.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/Soda.java create mode 100644 datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/SodaWithId.java diff --git a/datamodel/openapi/openapi-api-apache-sample/pom.xml b/datamodel/openapi/openapi-api-apache-sample/pom.xml index 4e08b5835..75d7abe55 100644 --- a/datamodel/openapi/openapi-api-apache-sample/pom.xml +++ b/datamodel/openapi/openapi-api-apache-sample/pom.xml @@ -47,6 +47,36 @@ com.fasterxml.jackson.core jackson-annotations + + + org.junit.jupiter + junit-jupiter-api + test + + + org.wiremock + wiremock + test + + + org.assertj + assertj-core + test + + + org.junit.jupiter + junit-jupiter-params + + + com.fasterxml.jackson.core + jackson-databind + test + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + test + @@ -82,11 +112,11 @@ generate-sources ${project.basedir}/src/main/resources/sodastore.yaml - com.sap.cloud.sdk.datamodel.openapi.apache.sample.api - com.sap.cloud.sdk.datamodel.openapi.apache.sample.model + com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.api + com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model + File=byte[] apache-httpclient - false create protected true diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java index e640fa446..1d942ca83 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java @@ -98,13 +98,13 @@ public Pet addPet( @Nonnull final PetInput pet ) final String[] localVarAccepts = { "application/json" }; final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); final TypeReference localVarReturnType = new TypeReference() { }; + return apiClient .invokeAPI( localVarPath, @@ -159,7 +159,6 @@ public OpenApiResponse deletePet( @Nonnull final Long id ) final String[] localVarAccepts = { "application/json" }; final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; @@ -168,6 +167,7 @@ public OpenApiResponse deletePet( @Nonnull final Long id ) final TypeReference localVarReturnType = new TypeReference() { }; + return apiClient .invokeAPI( localVarPath, @@ -222,7 +222,6 @@ public Pet findPetById( @Nonnull final Long id ) final String[] localVarAccepts = { "application/json", "application/xml", "text/xml", "text/html" }; final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; @@ -231,6 +230,7 @@ public Pet findPetById( @Nonnull final Long id ) final TypeReference localVarReturnType = new TypeReference() { }; + return apiClient .invokeAPI( localVarPath, @@ -283,7 +283,6 @@ public List findPets( @Nullable final List tags, @Nullable final In final String[] localVarAccepts = { "application/json", "application/xml", "text/xml", "text/html" }; final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; @@ -292,6 +291,7 @@ public List findPets( @Nullable final List tags, @Nullable final In final TypeReference> localVarReturnType = new TypeReference>() { }; + return apiClient .invokeAPI( localVarPath, diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/ErrorModel.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/ErrorModel.java index c9739e71d..046e744f0 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/ErrorModel.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/ErrorModel.java @@ -15,14 +15,11 @@ package com.sap.cloud.sdk.datamodel.openapi.apache.petstore.model; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; import java.util.LinkedHashMap; import java.util.Map; import java.util.NoSuchElementException; import java.util.Objects; import java.util.Set; -import java.util.StringJoiner; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -232,78 +229,4 @@ private String toIndentedString( final java.lang.Object o ) return o.toString().replace("\n", "\n "); } - /** - * Convert the instance into URL query string. - * - * @return URL query string - */ - public String toUrlQueryString() - { - return toUrlQueryString(null); - } - - /** - * Convert the instance into URL query string. - * - * @param prefix - * prefix of the query string - * @return URL query string - */ - public String toUrlQueryString( String prefix ) - { - String suffix = ""; - String containerSuffix = ""; - String containerPrefix = ""; - if( prefix == null ) { - // style=form, explode=true, e.g. /pet?name=cat&type=manx - prefix = ""; - } else { - // deepObject style e.g. /pet?id[name]=cat&id[type]=manx - prefix = prefix + "["; - suffix = "]"; - containerSuffix = "]"; - containerPrefix = "["; - } - - StringJoiner joiner = new StringJoiner("&"); - - // add `code` to the URL query string - if( getCode() != null ) { - try { - joiner - .add( - String - .format( - "%scode%s=%s", - prefix, - suffix, - URLEncoder.encode(String.valueOf(getCode()), "UTF-8").replaceAll("\\+", "%20"))); - } - catch( UnsupportedEncodingException e ) { - // Should never happen, UTF-8 is always supported - throw new RuntimeException(e); - } - } - - // add `message` to the URL query string - if( getMessage() != null ) { - try { - joiner - .add( - String - .format( - "%smessage%s=%s", - prefix, - suffix, - URLEncoder.encode(String.valueOf(getMessage()), "UTF-8").replaceAll("\\+", "%20"))); - } - catch( UnsupportedEncodingException e ) { - // Should never happen, UTF-8 is always supported - throw new RuntimeException(e); - } - } - - return joiner.toString(); - } - } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/Pet.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/Pet.java index 1a6d2654a..d86916dfb 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/Pet.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/Pet.java @@ -15,14 +15,11 @@ package com.sap.cloud.sdk.datamodel.openapi.apache.petstore.model; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; import java.util.LinkedHashMap; import java.util.Map; import java.util.NoSuchElementException; import java.util.Objects; import java.util.Set; -import java.util.StringJoiner; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -275,96 +272,4 @@ private String toIndentedString( final java.lang.Object o ) return o.toString().replace("\n", "\n "); } - /** - * Convert the instance into URL query string. - * - * @return URL query string - */ - public String toUrlQueryString() - { - return toUrlQueryString(null); - } - - /** - * Convert the instance into URL query string. - * - * @param prefix - * prefix of the query string - * @return URL query string - */ - public String toUrlQueryString( String prefix ) - { - String suffix = ""; - String containerSuffix = ""; - String containerPrefix = ""; - if( prefix == null ) { - // style=form, explode=true, e.g. /pet?name=cat&type=manx - prefix = ""; - } else { - // deepObject style e.g. /pet?id[name]=cat&id[type]=manx - prefix = prefix + "["; - suffix = "]"; - containerSuffix = "]"; - containerPrefix = "["; - } - - StringJoiner joiner = new StringJoiner("&"); - - // add `id` to the URL query string - if( getId() != null ) { - try { - joiner - .add( - String - .format( - "%sid%s=%s", - prefix, - suffix, - URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20"))); - } - catch( UnsupportedEncodingException e ) { - // Should never happen, UTF-8 is always supported - throw new RuntimeException(e); - } - } - - // add `name` to the URL query string - if( getName() != null ) { - try { - joiner - .add( - String - .format( - "%sname%s=%s", - prefix, - suffix, - URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20"))); - } - catch( UnsupportedEncodingException e ) { - // Should never happen, UTF-8 is always supported - throw new RuntimeException(e); - } - } - - // add `tag` to the URL query string - if( getTag() != null ) { - try { - joiner - .add( - String - .format( - "%stag%s=%s", - prefix, - suffix, - URLEncoder.encode(String.valueOf(getTag()), "UTF-8").replaceAll("\\+", "%20"))); - } - catch( UnsupportedEncodingException e ) { - // Should never happen, UTF-8 is always supported - throw new RuntimeException(e); - } - } - - return joiner.toString(); - } - } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/PetInput.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/PetInput.java index 7f6ea7be2..3d458b782 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/PetInput.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/model/PetInput.java @@ -15,14 +15,11 @@ package com.sap.cloud.sdk.datamodel.openapi.apache.petstore.model; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; import java.util.LinkedHashMap; import java.util.Map; import java.util.NoSuchElementException; import java.util.Objects; import java.util.Set; -import java.util.StringJoiner; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -275,96 +272,4 @@ private String toIndentedString( final java.lang.Object o ) return o.toString().replace("\n", "\n "); } - /** - * Convert the instance into URL query string. - * - * @return URL query string - */ - public String toUrlQueryString() - { - return toUrlQueryString(null); - } - - /** - * Convert the instance into URL query string. - * - * @param prefix - * prefix of the query string - * @return URL query string - */ - public String toUrlQueryString( String prefix ) - { - String suffix = ""; - String containerSuffix = ""; - String containerPrefix = ""; - if( prefix == null ) { - // style=form, explode=true, e.g. /pet?name=cat&type=manx - prefix = ""; - } else { - // deepObject style e.g. /pet?id[name]=cat&id[type]=manx - prefix = prefix + "["; - suffix = "]"; - containerSuffix = "]"; - containerPrefix = "["; - } - - StringJoiner joiner = new StringJoiner("&"); - - // add `id` to the URL query string - if( getId() != null ) { - try { - joiner - .add( - String - .format( - "%sid%s=%s", - prefix, - suffix, - URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20"))); - } - catch( UnsupportedEncodingException e ) { - // Should never happen, UTF-8 is always supported - throw new RuntimeException(e); - } - } - - // add `name` to the URL query string - if( getName() != null ) { - try { - joiner - .add( - String - .format( - "%sname%s=%s", - prefix, - suffix, - URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20"))); - } - catch( UnsupportedEncodingException e ) { - // Should never happen, UTF-8 is always supported - throw new RuntimeException(e); - } - } - - // add `tag` to the URL query string - if( getTag() != null ) { - try { - joiner - .add( - String - .format( - "%stag%s=%s", - prefix, - suffix, - URLEncoder.encode(String.valueOf(getTag()), "UTF-8").replaceAll("\\+", "%20"))); - } - catch( UnsupportedEncodingException e ) { - // Should never happen, UTF-8 is always supported - throw new RuntimeException(e); - } - } - - return joiner.toString(); - } - } diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/api/OrdersApi.java similarity index 96% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/api/OrdersApi.java index 3eec16bf4..ef5f5a6a8 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/OrdersApi.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/api/OrdersApi.java @@ -2,7 +2,7 @@ * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.api; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.api; import java.util.ArrayList; import java.util.HashMap; @@ -14,7 +14,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; -import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.Order; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.Order; import com.sap.cloud.sdk.services.openapi.apache.ApiClient; import com.sap.cloud.sdk.services.openapi.apache.BaseApi; import com.sap.cloud.sdk.services.openapi.apache.Pair; @@ -93,13 +93,13 @@ public Order ordersPost( @Nonnull final Order order ) final String[] localVarAccepts = { "application/json" }; final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); final TypeReference localVarReturnType = new TypeReference() { }; + return apiClient .invokeAPI( localVarPath, diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/api/SodasApi.java similarity index 96% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/api/SodasApi.java index 5c96f9a89..1c20f24dc 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/api/SodasApi.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/api/SodasApi.java @@ -2,9 +2,8 @@ * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.api; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.api; -import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -16,8 +15,8 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; -import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.Soda; -import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.SodaWithId; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.Soda; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.SodaWithId; import com.sap.cloud.sdk.services.openapi.apache.ApiClient; import com.sap.cloud.sdk.services.openapi.apache.BaseApi; import com.sap.cloud.sdk.services.openapi.apache.Pair; @@ -71,12 +70,12 @@ public SodasApi( @Nonnull final ApiClient apiClient ) * * @param id * ID of the soda product to download - * @return File + * @return byte[] * @throws OpenApiRequestException * if an error occurs while attempting to invoke the API */ @Nonnull - public File sodasDownloadIdGet( @Nonnull final Long id ) + public byte[] sodasDownloadIdGet( @Nonnull final Long id ) throws OpenApiRequestException { @@ -100,15 +99,15 @@ public File sodasDownloadIdGet( @Nonnull final Long id ) final String[] localVarAccepts = { "application/octet-stream" }; final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); - final TypeReference localVarReturnType = new TypeReference() + final TypeReference localVarReturnType = new TypeReference() { }; + return apiClient .invokeAPI( localVarPath, @@ -152,7 +151,6 @@ public List sodasGet() final String[] localVarAccepts = { "application/json" }; final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; @@ -161,6 +159,7 @@ public List sodasGet() final TypeReference> localVarReturnType = new TypeReference>() { }; + return apiClient .invokeAPI( localVarPath, @@ -215,7 +214,6 @@ public SodaWithId sodasIdGet( @Nonnull final Long id ) final String[] localVarAccepts = { "application/json" }; final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; @@ -224,6 +222,7 @@ public SodaWithId sodasIdGet( @Nonnull final Long id ) final TypeReference localVarReturnType = new TypeReference() { }; + return apiClient .invokeAPI( localVarPath, @@ -279,13 +278,13 @@ public Soda sodasPut( @Nonnull final SodaWithId sodaWithId ) final String[] localVarAccepts = { "application/json" }; final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); final TypeReference localVarReturnType = new TypeReference() { }; + return apiClient .invokeAPI( localVarPath, diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AllOf.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/AllOf.java similarity index 99% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AllOf.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/AllOf.java index 234145720..4314271a4 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AllOf.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/AllOf.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import java.util.LinkedHashMap; import java.util.Map; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AnyOf.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/AnyOf.java similarity index 99% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AnyOf.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/AnyOf.java index 797cdcfc5..7a52c6b68 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/AnyOf.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/AnyOf.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import java.util.LinkedHashMap; import java.util.Map; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Bar.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Bar.java similarity index 99% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Bar.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Bar.java index 33bbf6e19..b08fd7d21 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Bar.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Bar.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import java.util.LinkedHashMap; import java.util.Map; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Cola.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Cola.java similarity index 99% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Cola.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Cola.java index 5f4f95861..e5065f83b 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Cola.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Cola.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import java.util.LinkedHashMap; import java.util.Map; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaBarCode.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/ColaBarCode.java similarity index 95% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaBarCode.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/ColaBarCode.java index 967a74c58..1643ab004 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaBarCode.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/ColaBarCode.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import javax.annotation.Nonnull; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaLogo.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/ColaLogo.java similarity index 96% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaLogo.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/ColaLogo.java index 72ea29bbd..c757ceca1 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/ColaLogo.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/ColaLogo.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import java.util.List; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Fanta.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Fanta.java similarity index 99% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Fanta.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Fanta.java index 27d1ac103..10ec15000 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Fanta.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Fanta.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import java.util.LinkedHashMap; import java.util.Map; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FantaFlavor.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/FantaFlavor.java similarity index 97% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FantaFlavor.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/FantaFlavor.java index d295a9cca..41738c868 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FantaFlavor.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/FantaFlavor.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import java.util.List; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FlavorType.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/FlavorType.java similarity index 98% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FlavorType.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/FlavorType.java index 67e1ab5d7..22c389044 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/FlavorType.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/FlavorType.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import java.util.LinkedHashMap; import java.util.Map; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Foo.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Foo.java similarity index 99% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Foo.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Foo.java index 68a350cf7..1b07e9411 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Foo.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Foo.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import java.util.LinkedHashMap; import java.util.Map; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOf.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/OneOf.java similarity index 90% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOf.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/OneOf.java index 177f45b3d..08460550c 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOf.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/OneOf.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminator.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/OneOfWithDiscriminator.java similarity index 92% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminator.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/OneOfWithDiscriminator.java index 781c5501f..c360e6957 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminator.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/OneOfWithDiscriminator.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminatorAndMapping.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/OneOfWithDiscriminatorAndMapping.java similarity index 92% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminatorAndMapping.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/OneOfWithDiscriminatorAndMapping.java index 459ac2c5c..b5bd9540f 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithDiscriminatorAndMapping.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/OneOfWithDiscriminatorAndMapping.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithEnumDiscriminator.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/OneOfWithEnumDiscriminator.java similarity index 92% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithEnumDiscriminator.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/OneOfWithEnumDiscriminator.java index 0152e120e..60c6bafc6 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OneOfWithEnumDiscriminator.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/OneOfWithEnumDiscriminator.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Order.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Order.java similarity index 99% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Order.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Order.java index cc37812ee..722bfd26a 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Order.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Order.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import java.util.LinkedHashMap; import java.util.Map; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrderWithTimestamp.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/OrderWithTimestamp.java similarity index 99% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrderWithTimestamp.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/OrderWithTimestamp.java index 9a24b5710..7a37e6995 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/OrderWithTimestamp.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/OrderWithTimestamp.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import java.time.OffsetDateTime; import java.util.LinkedHashMap; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Soda.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Soda.java similarity index 99% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Soda.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Soda.java index dfaa4d01d..d114bfac9 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/Soda.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/Soda.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import java.util.LinkedHashMap; import java.util.Map; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SodaWithId.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/SodaWithId.java similarity index 99% rename from datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SodaWithId.java rename to datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/SodaWithId.java index c7763d4a9..3bac8d0f2 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sample/model/SodaWithId.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/model/SodaWithId.java @@ -13,7 +13,7 @@ * Do not edit the class manually. */ -package com.sap.cloud.sdk.datamodel.openapi.apache.sample.model; +package com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model; import java.util.LinkedHashMap; import java.util.Map; diff --git a/datamodel/openapi/openapi-api-apache-sample/src/test/java/com/sap/cloud/sdk/services/openapi/apache/DeserializationTest.java b/datamodel/openapi/openapi-api-apache-sample/src/test/java/com/sap/cloud/sdk/services/openapi/apache/DeserializationTest.java new file mode 100644 index 000000000..384185717 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/test/java/com/sap/cloud/sdk/services/openapi/apache/DeserializationTest.java @@ -0,0 +1,143 @@ +package com.sap.cloud.sdk.services.openapi.apache; + +import static com.github.tomakehurst.wiremock.client.WireMock.okJson; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.List; +import java.util.Map; + +import org.assertj.core.api.InstanceOfAssertFactories; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import com.github.tomakehurst.wiremock.client.WireMock; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; +import com.github.tomakehurst.wiremock.junit5.WireMockTest; +import com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpDestination; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.api.SodasApi; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.SodaWithId; + +@WireMockTest +class DeserializationTest +{ + + private SodasApi sut; + private String responseBody; + + @BeforeEach + void setUp( WireMockRuntimeInfo wmRuntimeInfo ) + { + sut = new SodasApi(DefaultHttpDestination.builder(wmRuntimeInfo.getHttpBaseUrl()).build()); + } + + @Test + void testFullResponse() + { + responseBody = """ + { + "name": "Cola", + "brand": "Coca-Cola", + "quantity": 100, + "packaging" : "new-value", + "price": 1.5, + "id": 0 + } + """; + stub(responseBody); + + final SodaWithId expected = + SodaWithId + .create() + .name("Cola") + .brand("Coca-Cola") + .quantity(100) + .price(1.5f) + .id(0L) + .packaging(SodaWithId.PackagingEnum.UNKNOWN_DEFAULT_OPEN_API); + + final SodaWithId actual = sut.sodasIdGet(1L); + + assertThat(actual).isEqualTo(expected); + } + + @Test + void testUnexpectedFieldOrder() + { + responseBody = """ + { + "name": "Cola", + "price": 1.5, + "id": 0, + "brand": "Coca-Cola", + "quantity": 100 + } + """; + stub(responseBody); + + final SodaWithId expected = + SodaWithId.create().name("Cola").brand("Coca-Cola").quantity(100).price(1.5f).id(0L); + + final SodaWithId actual = sut.sodasIdGet(1L); + + assertThat(actual).isEqualTo(expected); + } + + @Test + void testPartialResponse() + { + responseBody = "{\"name\": \"Cola\"}"; + stub(responseBody); + + final SodaWithId expected = SodaWithId.create().name("Cola").brand(null).quantity(null).price(null); + + final SodaWithId actual = sut.sodasIdGet(1L); + + assertThat(actual).isEqualTo(expected); + } + + @Test + @SuppressWarnings( "deprecation" ) + void testUnexpectedAdditionalField() + { + responseBody = """ + { + "name": "Cola", + "unexpectedField": [] + } + """; + stub(responseBody); + + final SodaWithId actual = sut.sodasIdGet(1L); + + assertThat(actual.getName()).isEqualTo("Cola"); + assertThat(actual.toMap()) + .containsExactlyInAnyOrderEntriesOf(Map.of("name", "Cola", "unexpectedField", List.of())); + assertThat(actual.toMap().get("doesNotExist")).isNull(); + assertThat(actual.getCustomFieldNames()).containsExactly("unexpectedField"); + assertThat(actual.getCustomField("unexpectedField")).asInstanceOf(InstanceOfAssertFactories.LIST).isEmpty(); + } + + @Test + void testBinaryResponse() + { + final byte[] binaryData = "binary file content".getBytes(); + WireMock + .stubFor( + WireMock + .get(WireMock.urlMatching("/sodas/download/\\d+")) + .willReturn( + WireMock + .aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/octet-stream") + .withBody(binaryData))); + final byte[] result = sut.sodasDownloadIdGet(1L); + assertThat(result).isNotNull(); + assertThat(result).isEqualTo(binaryData); + } + + private void stub( String responseBody ) + { + WireMock.stubFor(WireMock.get(WireMock.anyUrl()).willReturn(okJson(responseBody))); + } +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/test/java/com/sap/cloud/sdk/services/openapi/apache/OneOfDeserializationTest.java b/datamodel/openapi/openapi-api-apache-sample/src/test/java/com/sap/cloud/sdk/services/openapi/apache/OneOfDeserializationTest.java new file mode 100644 index 000000000..ed7ea48f5 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/test/java/com/sap/cloud/sdk/services/openapi/apache/OneOfDeserializationTest.java @@ -0,0 +1,318 @@ +package com.sap.cloud.sdk.services.openapi.apache; + +import static com.fasterxml.jackson.annotation.PropertyAccessor.GETTER; +import static com.fasterxml.jackson.annotation.PropertyAccessor.SETTER; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import java.util.List; +import java.util.stream.Stream; + +import javax.annotation.Nonnull; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.AllOf; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.AnyOf; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.Bar; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.Cola; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.ColaBarCode; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.ColaLogo; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.Fanta; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.FantaFlavor; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.FlavorType; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.Foo; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.OneOf; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.OneOfWithDiscriminator; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.OneOfWithDiscriminatorAndMapping; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.OneOfWithEnumDiscriminator; + +class OneOfDeserializationTest +{ + private static final ObjectMapper objectMapper = newDefaultObjectMapper(); + + private static final Cola COLA_OBJECT = Cola.create().caffeine(true).sodaType("Cola"); + private static final Fanta FANTA_OBJECT = + Fanta + .create() + .color("orange") + .sodaType("Fanta") + .flavor(new FantaFlavor.InnerFlavorType(FlavorType.create().intensity(3).nuance("wood"))); + private static final String COLA_JSON = """ + { + "sodaType": "Cola", + "caffeine": true, + "logo":null, + "barCode":null + }"""; + private static final String FANTA_JSON = """ + { + "sodaType": "Fanta", + "color": "orange", + "flavor": {"intensity":3,"nuance":"wood"} + }"""; + private static final String FANTA_FLAVOR_ARRAY_JSON = """ + { + "sodaType": "Fanta", + "color": "orange", + "flavor": [ + {"intensity":3,"nuance":"wood"}, + {"intensity":5,"nuance":"citrus"} + ] + }"""; + private static final String COLA_LOGO_MATRIX_JSON = """ + { + "sodaType": "Cola", + "caffeine": true, + "logo": [[255, 0, 0], [0, 255, 0], [0, 0, 255]] + }"""; + private static final String UNKNOWN_JSON = """ + { + "sodaType": "Sprite", + "someProperty": "someValue" + }"""; + + private static final String COLA_BARCODE_FLOAT_ARRAY_JSON = """ + { + "sodaType": "Cola", + "caffeine": true, + "barCode": [1.1, 2.2, 3.3] + }"""; + + @Test + void oneOf() + throws JsonProcessingException + { + var actual = objectMapper.readValue(COLA_JSON, OneOf.class); + assertThat(actual) + .describedAs("Object should automatically be deserialized as Cola with JSON subtype deduction") + .isInstanceOf(Cola.class) + .isEqualTo(COLA_OBJECT); + + actual = objectMapper.readValue(FANTA_JSON, OneOf.class); + assertThat(actual) + .describedAs("Object should automatically be deserialized as Fanta with JSON subtype deduction") + .isInstanceOf(Fanta.class) + .isEqualTo(FANTA_OBJECT); + + assertThatThrownBy(() -> objectMapper.readValue(UNKNOWN_JSON, OneOf.class)) + .isInstanceOf(JsonProcessingException.class); + } + + @Test + void oneOfWithDiscriminator() + throws JsonProcessingException + { + var actual = objectMapper.readValue(COLA_JSON, OneOfWithDiscriminator.class); + assertThat(actual) + .describedAs( + "Object should automatically be deserialized as Cola using the class names as discriminator mapping values") + .isInstanceOf(Cola.class) + .isEqualTo(COLA_OBJECT); + + actual = objectMapper.readValue(FANTA_JSON, OneOfWithDiscriminator.class); + assertThat(actual) + .describedAs( + "Object should automatically be deserialized as Fanta using the class names as discriminator mapping values") + .isInstanceOf(Fanta.class) + .isEqualTo(FANTA_OBJECT); + + assertThatThrownBy(() -> objectMapper.readValue(UNKNOWN_JSON, OneOfWithDiscriminator.class)) + .isInstanceOf(JsonProcessingException.class); + } + + @Test + void oneOfWithDiscriminatorAndMapping() + throws JsonProcessingException + { + var jsonWithCustomMapping = """ + { + "sodaType": "cool_cola", + "caffeine": true + }"""; + var actual = objectMapper.readValue(jsonWithCustomMapping, OneOfWithDiscriminatorAndMapping.class); + assertThat(actual) + .describedAs( + "Object should automatically be deserialized as Cola using the explicit discriminator mapping values") + .isInstanceOf(Cola.class) + .isEqualTo(Cola.create().caffeine(true).sodaType("cool_cola")); + + jsonWithCustomMapping = """ + { + "sodaType": "fancy_fanta", + "color": "orange" + }"""; + actual = objectMapper.readValue(jsonWithCustomMapping, OneOfWithDiscriminatorAndMapping.class); + assertThat(actual) + .describedAs( + "Object should automatically be deserialized as Fanta using the explicit discriminator mapping values") + .isInstanceOf(Fanta.class) + .isEqualTo(Fanta.create().color("orange").sodaType("fancy_fanta")); + + assertThatThrownBy(() -> objectMapper.readValue(UNKNOWN_JSON, OneOfWithDiscriminatorAndMapping.class)) + .isInstanceOf(JsonProcessingException.class); + } + + static Stream> oneOfStrategiesProvider() + { + return Stream.of(OneOf.class, OneOfWithDiscriminator.class); + } + + @ParameterizedTest( name = "Deserialization with strategy: {0}" ) + @MethodSource( "oneOfStrategiesProvider" ) + void oneOfWithNestedArrayOfObjects( Class strategy ) + throws JsonProcessingException + { + var payload = FANTA_FLAVOR_ARRAY_JSON; + if( strategy == OneOfWithDiscriminatorAndMapping.class ) { + payload.replace("Fanta", "fancy_fanta").replace("Cola", "cool_cola"); + } + + Object actual = objectMapper.readValue(payload, strategy); + + assertThat(actual) + .describedAs("Object should automatically be deserialized as Fanta with JSON subtype deduction") + .isInstanceOf(Fanta.class); + var fanta = (Fanta) actual; + assertThat(fanta.getFlavor()) + .describedAs("Flavor should be deserialized as wrapper class for a list of FlavorType instances") + .isInstanceOf(FantaFlavor.ListOfFlavorTypes.class); + var flavorTypes = (FantaFlavor.ListOfFlavorTypes) fanta.getFlavor(); + assertThat(flavorTypes.values()) + .describedAs("Flavor should be deserialized as a list of FlavorType instances") + .isNotEmpty() + .allMatch(FlavorType.class::isInstance); + + actual = objectMapper.readValue(COLA_LOGO_MATRIX_JSON, strategy); + + assertThat(actual) + .describedAs("Object should automatically be deserialized as Cola with JSON subtype deduction") + .isInstanceOf(Cola.class); + var cola = (Cola) actual; + assertThat(cola.isCaffeine()).isTrue(); + assertThat(cola.getLogo()).isInstanceOf(ColaLogo.ListOfListOfIntegers.class); + var logo = (ColaLogo.ListOfListOfIntegers) cola.getLogo(); + assertThat(logo.values()) + .describedAs("Logo should be deserialized as a list of list of integers") + .isInstanceOf(List.class) + .containsExactly(List.of(255, 0, 0), List.of(0, 255, 0), List.of(0, 0, 255)); + + actual = objectMapper.readValue(COLA_BARCODE_FLOAT_ARRAY_JSON, strategy); + assertThat(actual) + .describedAs("Object should automatically be deserialized as Cola with JSON subtype deduction") + .isInstanceOf(Cola.class); + cola = (Cola) actual; + assertThat(cola.isCaffeine()).isTrue(); + assertThat(cola.getBarCode()).isInstanceOf(ColaBarCode.ArrayOfFloats.class); + var barCode = (ColaBarCode.ArrayOfFloats) cola.getBarCode(); + assertThat(barCode.values()) + .describedAs("BarCode should be deserialized as an array of floats") + .isInstanceOf(float[].class) + .containsExactly(1.1f, 2.2f, 3.3f); + } + + @Test + void anyOf() + throws JsonProcessingException + { + AnyOf anyOfCola = objectMapper.readValue(COLA_JSON, AnyOf.class); + assertThat(anyOfCola.getSodaType()).isEqualTo("Cola"); + assertThat(anyOfCola.isCaffeine()).isTrue(); + assertThat(anyOfCola.getColor()).isNull(); + + AnyOf anyOfFanta = objectMapper.readValue(FANTA_JSON, AnyOf.class); + assertThat(anyOfFanta.getSodaType()).isEqualTo("Fanta"); + assertThat(anyOfFanta.getColor()).isEqualTo("orange"); + assertThat(anyOfFanta.isCaffeine()).isNull(); + + AnyOf actual = objectMapper.readValue(FANTA_FLAVOR_ARRAY_JSON, AnyOf.class); + + assertThat(actual.getSodaType()).isEqualTo("Fanta"); + assertThat(actual.getColor()).isEqualTo("orange"); + assertThat(actual.getFlavor()).isInstanceOf(FantaFlavor.ListOfFlavorTypes.class); + assertThat(((FantaFlavor.ListOfFlavorTypes) actual.getFlavor()).values()) + .allMatch(FlavorType.class::isInstance); + } + + @Test + void allOf() + throws JsonProcessingException + { + AllOf allOfCola = objectMapper.readValue(COLA_JSON, AllOf.class); + assertThat(allOfCola.getSodaType()).isEqualTo("Cola"); + assertThat(allOfCola.isCaffeine()).isTrue(); + assertThat(allOfCola.getColor()).isNull(); + + AllOf allOfFanta = objectMapper.readValue(FANTA_JSON, AllOf.class); + assertThat(allOfFanta.getSodaType()).isEqualTo("Fanta"); + assertThat(allOfFanta.getColor()).isEqualTo("orange"); + assertThat(allOfFanta.isCaffeine()).isNull(); + } + + @Test + void testColaSerialization() + throws JsonProcessingException + { + var expected = objectMapper.readValue(COLA_JSON, JsonNode.class); + var actual = objectMapper.valueToTree(COLA_OBJECT); + + assertThat(actual).isEqualTo(expected); + } + + @Test + void testFantaSerialization() + throws JsonProcessingException + { + var expected = objectMapper.readValue(FANTA_JSON, JsonNode.class); + var actual = objectMapper.valueToTree(FANTA_OBJECT); + + assertThat(actual).isEqualTo(expected); + } + + @Test + void testDeserializationWithEnumDiscriminator() + throws JsonProcessingException + { + var json = """ + { + "foo": "asdf", + "disc": "disc_foo" + }"""; + assertThat(objectMapper.readValue(json, OneOfWithEnumDiscriminator.class)) + .isInstanceOf(Foo.class) + .isEqualTo(Foo.create().foo("asdf").disc(Foo.DiscEnum.DISC_FOO)); + json = """ + { + "bar": "asdf", + "disc": "disc_bar" + }"""; + assertThat(objectMapper.readValue(json, OneOfWithEnumDiscriminator.class)) + .isInstanceOf(Bar.class) + .isEqualTo(Bar.create().bar("asdf").disc(Bar.DiscEnum.DISC_BAR)); + + assertThatThrownBy(() -> objectMapper.readValue("{ \"type\": \"unknown\" }", OneOfWithEnumDiscriminator.class)) + .isInstanceOf(JsonProcessingException.class); + } + + /** + * Taken from {@link com.sap.cloud.sdk.services.openapi.apiclient.ApiClient} + */ + @Nonnull + private static ObjectMapper newDefaultObjectMapper() + { + return JsonMapper + .builder() + .addModule(new JavaTimeModule()) + .visibility(GETTER, JsonAutoDetect.Visibility.NONE) + .visibility(SETTER, JsonAutoDetect.Visibility.NONE) + .build(); + } +} diff --git a/datamodel/openapi/openapi-api-apache-sample/src/test/java/com/sap/cloud/sdk/services/openapi/apache/SerializationTest.java b/datamodel/openapi/openapi-api-apache-sample/src/test/java/com/sap/cloud/sdk/services/openapi/apache/SerializationTest.java new file mode 100644 index 000000000..5486d3f06 --- /dev/null +++ b/datamodel/openapi/openapi-api-apache-sample/src/test/java/com/sap/cloud/sdk/services/openapi/apache/SerializationTest.java @@ -0,0 +1,111 @@ +package com.sap.cloud.sdk.services.openapi.apache; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.tomakehurst.wiremock.client.WireMock; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; +import com.github.tomakehurst.wiremock.junit5.WireMockTest; +import com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpDestination; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.api.SodasApi; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.Order; +import com.sap.cloud.sdk.datamodel.openapi.apache.sodastore.model.SodaWithId; + +@WireMockTest +class SerializationTest +{ + + private SodasApi sut; + private String expected; + + @BeforeEach + void setUp( WireMockRuntimeInfo wmRuntimeInfo ) + { + sut = new SodasApi(DefaultHttpDestination.builder(wmRuntimeInfo.getHttpBaseUrl()).build()); + WireMock.stubFor(WireMock.put("/sodas").willReturn(WireMock.created())); + } + + @Test + void testPutPayload() + { + expected = """ + { + "name": "Cola", + "brand": "Coca-Cola", + "quantity": 100, + "packaging" : null, + "price": 1.5, + "id": 0 + } + """; + + final SodaWithId obj = SodaWithId.create().name("Cola").brand("Coca-Cola").quantity(100).price(1.5f).id(0L); + + sut.sodasPut(obj); + + verify(expected); + } + + @Test + void testJacksonSerializeSodaWithId() + throws JsonProcessingException + { + expected = """ + { + "name": "Cola", + "brand": "Coca-Cola", + "quantity": 100, + "packaging" : "can", + "price": 1.5, + "id": 0 + } + """; + + final SodaWithId obj = + SodaWithId + .create() + .name("Cola") + .brand("Coca-Cola") + .quantity(100) + .price(1.5f) + .id(0L) + .packaging(SodaWithId.PackagingEnum.CAN); + + assertThat(new ObjectMapper().writeValueAsString(obj)).isEqualToIgnoringWhitespace(expected); + } + + @Test + void testJacksonSerializeOrder() + throws JsonProcessingException + { + expected = """ + { + "productId": 100, + "quantity": 5, + "totalPrice": 6.0, + "typelessProperty":null, + "nullableProperty":null, + "shoesize": 44 + } + """; + final Order order = Order.create().productId(100L).quantity(5).totalPrice(6.0f); + order.setCustomField("shoesize", 44); + assertThat(new ObjectMapper().writeValueAsString(order)).isEqualToIgnoringWhitespace(expected); + assertThat(new ObjectMapper().readValue(expected, Order.class)).isEqualTo(order); + } + + private void verify( String requestBody ) + { + WireMock + .verify( + WireMock + .putRequestedFor(WireMock.urlEqualTo("/sodas")) + .withHeader("Content-Type", WireMock.equalTo("application/json; charset=UTF-8")) + .withRequestBody(WireMock.equalToJson(requestBody))); + } + +} diff --git a/datamodel/openapi/openapi-api-sample/src/test/java/com/sap/cloud/sdk/datamodel/openapi/sample/api/OneOfDeserializationTest.java b/datamodel/openapi/openapi-api-sample/src/test/java/com/sap/cloud/sdk/datamodel/openapi/sample/api/OneOfDeserializationTest.java index 5a0611253..b705bee84 100644 --- a/datamodel/openapi/openapi-api-sample/src/test/java/com/sap/cloud/sdk/datamodel/openapi/sample/api/OneOfDeserializationTest.java +++ b/datamodel/openapi/openapi-api-sample/src/test/java/com/sap/cloud/sdk/datamodel/openapi/sample/api/OneOfDeserializationTest.java @@ -48,7 +48,9 @@ class OneOfDeserializationTest private static final String COLA_JSON = """ { "sodaType": "Cola", - "caffeine": true + "caffeine": true, + "logo": null, + "barCode": null }"""; private static final String FANTA_JSON = """ { @@ -259,7 +261,7 @@ void testColaSerialization() throws JsonProcessingException { var expected = objectMapper.readValue(COLA_JSON, JsonNode.class); - var actual = objectMapper.valueToTree(expected); + var actual = objectMapper.valueToTree(COLA_OBJECT); assertThat(actual).isEqualTo(expected); } @@ -268,8 +270,8 @@ void testColaSerialization() void testFantaSerialization() throws JsonProcessingException { - var expected = objectMapper.readValue(FANTA_JSON, JsonNode.class); - var actual = objectMapper.valueToTree(expected); + JsonNode expected = objectMapper.readValue(FANTA_JSON, JsonNode.class); + JsonNode actual = objectMapper.valueToTree(FANTA_OBJECT); assertThat(actual).isEqualTo(expected); } diff --git a/datamodel/openapi/openapi-core/pom.xml b/datamodel/openapi/openapi-core/pom.xml index ce7787da4..5c43b2765 100644 --- a/datamodel/openapi/openapi-core/pom.xml +++ b/datamodel/openapi/openapi-core/pom.xml @@ -105,7 +105,12 @@ org.apache.httpcomponents.core5 httpcore5 - + + org.junit.jupiter + junit-jupiter-params + test + + diff --git a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java index 20d0e1a9e..f2262678f 100644 --- a/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java +++ b/datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java @@ -48,7 +48,6 @@ import org.apache.hc.core5.http.message.BasicNameValuePair; import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; -import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; @@ -146,8 +145,6 @@ private static ObjectMapper createDefaultObjectMapper() .defaultDateFormat(new RFC3339DateFormat()) .visibility(PropertyAccessor.GETTER, Visibility.NONE) .visibility(PropertyAccessor.SETTER, Visibility.NONE) - .defaultPropertyInclusion( - JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL)) .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .disable(MapperFeature.DEFAULT_VIEW_INCLUSION) .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) diff --git a/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/ApacheApiClientViaConstructorTest.java b/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/ApacheApiClientViaConstructorTest.java new file mode 100644 index 000000000..ae2912fd0 --- /dev/null +++ b/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/ApacheApiClientViaConstructorTest.java @@ -0,0 +1,190 @@ +package com.sap.cloud.sdk.services.openapi.apiclient; + +import static com.github.tomakehurst.wiremock.client.WireMock.anyUrl; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor; +import static com.github.tomakehurst.wiremock.client.WireMock.ok; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.verify; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Nullable; + +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.junit.jupiter.api.Test; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.github.tomakehurst.wiremock.client.WireMock; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; +import com.github.tomakehurst.wiremock.junit5.WireMockTest; +import com.sap.cloud.sdk.cloudplatform.connectivity.ApacheHttpClient5FactoryBuilder; +import com.sap.cloud.sdk.cloudplatform.connectivity.ApacheHttpClient5FactoryBuilder.TlsUpgrade; +import com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpDestination; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + +import jdk.jfr.Description; + +@WireMockTest +class ApacheApiClientViaConstructorTest +{ + + private static final String RELATIVE_PATH = "/apiEndpoint"; + private static final String SUCCESS_BODY = "success"; + + @Test + @Description( "Verify ApiClient's ObjectMapper ignores getters to avoid duplicate JSON properties." ) + void testApiClientDefaultObjectMapperIgnoresGetters( WireMockRuntimeInfo wm ) + { + final String baseUrl = wm.getHttpBaseUrl(); + final String requestBody = "{\"Return\":\"Hello, World!\"}"; + WireMock + .stubFor( + post(urlEqualTo(RELATIVE_PATH)) + .withRequestBody(equalTo(requestBody)) + .willReturn(ok().withHeader("Content-Type", "text/plain").withBody(SUCCESS_BODY))); + + final MyDto myTestDto = new MyDto(); + myTestDto.setReturn("Hello, World!"); + + final var apiClient = ApiClient.create().withBasePath(baseUrl); + final var testApi = new MyTestApacheOpenApiService(apiClient, baseUrl); + testApi.invokeApiEndpoint(myTestDto); + + WireMock.verify(1, postRequestedFor(urlEqualTo(RELATIVE_PATH)).withRequestBody(equalTo(requestBody))); + } + + @Test + void testApiClientWithQueryParams( WireMockRuntimeInfo wm ) + { + final String baseUrl = wm.getHttpBaseUrl(); + final String filterQueryValue = "emails.value eq \"my.email@test.com\""; + final String filterQueryParam = "filter"; + + final List queryParams = ApiClient.parameterToPair(filterQueryParam, filterQueryValue); + + WireMock + .stubFor( + get(urlPathEqualTo(RELATIVE_PATH)) + .withQueryParam(filterQueryParam, equalTo(filterQueryValue)) + .willReturn(ok().withHeader("Content-Type", "text/plain").withBody(SUCCESS_BODY))); + + final var apiClient = ApiClient.create().withBasePath(baseUrl); + final var testApi = new MyTestApacheOpenApiService(apiClient, baseUrl); + testApi.invokeApiEndpoint("GET", null, queryParams); + + WireMock + .verify( + 1, + getRequestedFor(urlPathEqualTo(RELATIVE_PATH)) + .withQueryParam(filterQueryParam, equalTo(filterQueryValue))); + } + + @Test + @Description( "Verify that the TlsUpgrade configuration is transmitted in HTTP requests." ) + void testHttpRequestConfigIsTransmitted( WireMockRuntimeInfo wm ) + { + httpRequest(TlsUpgrade.DISABLED, wm.getHttpBaseUrl()); + verify(getRequestedFor(anyUrl()).withoutHeader("Upgrade")); + + httpRequest(TlsUpgrade.AUTOMATIC, wm.getHttpBaseUrl()); + verify(getRequestedFor(anyUrl()).withoutHeader("Upgrade")); + } + + private static void httpRequest( TlsUpgrade toggle, String url ) + { + final var httpClientFactory = new ApacheHttpClient5FactoryBuilder().tlsUpgrade(toggle).build(); + final var httpClient = httpClientFactory.createHttpClient(DefaultHttpDestination.builder(url).build()); + var apiClient = ApiClient.fromHttpClient((CloseableHttpClient) httpClient); + apiClient = apiClient.withBasePath(url); + + stubFor(get(anyUrl()).willReturn(ok().withHeader("Content-Type", "text/plain").withBody(SUCCESS_BODY))); + + assertThat( + apiClient + .invokeAPI( + RELATIVE_PATH, + "GET", + List.of(), + List.of(), + "", + null, + Map.of(), + Map.of(), + "text/plain", + "text/plain", + new TypeReference() + { + })) + .isEqualTo(SUCCESS_BODY); + } + + private static class MyDto + { + @JsonProperty( "Return" ) + private String _return; + + public String getReturn() + { + return _return; + } + + public void setReturn( String _return ) + { + this._return = _return; + } + } + + private static class MyTestApacheOpenApiService extends BaseApi + { + private final String expectedBasePath; + + MyTestApacheOpenApiService( ApiClient apiClient, String expectedBasePath ) + { + super(apiClient); + this.expectedBasePath = expectedBasePath; + } + + void invokeApiEndpoint( @Nullable Object body ) + { + invokeApiEndpoint("POST", body, List.of()); + } + + //make it apache reliant + void invokeApiEndpoint( String method, Object body, List queryParams ) + { + assertThat(apiClient.getBasePath()).isEqualTo(expectedBasePath); + + final TypeReference returnType = new TypeReference() + { + }; + + final String s = + apiClient + .invokeAPI( + RELATIVE_PATH, + method, + queryParams, + List.of(), + "", + body, + Map.of(), + Map.of(), + "application/json", + "application/json", + returnType); + + assertThat(s).isEqualTo(SUCCESS_BODY); + } + } +} diff --git a/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/ApiClientExtensionsDeserializationTest.java b/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/ApiClientExtensionsDeserializationTest.java index 599ce214c..e4e27e010 100644 --- a/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/ApiClientExtensionsDeserializationTest.java +++ b/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/ApiClientExtensionsDeserializationTest.java @@ -5,12 +5,14 @@ import static org.springframework.test.web.client.match.MockRestRequestMatchers.method; import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; +import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; +import java.util.StringJoiner; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -31,17 +33,57 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.github.tomakehurst.wiremock.client.WireMock; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; +import com.github.tomakehurst.wiremock.junit5.WireMockTest; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService; +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import jdk.jfr.Description; import lombok.Getter; import lombok.Setter; +@WireMockTest class ApiClientExtensionsDeserializationTest { @Nonnull private static final String BASE_PATH = "http://localhost:8080"; @Nonnull private static final String RELATIVE_PATH = "/outer"; + @Nonnull + private static final String RESPONSE = """ + { + "message": "Hello from the outer level.", + "code": 1337, + "inner": { + "message": "Hello from the inner level.", + "code": 7331, + "innerComplexExtension": { + "innerString": "inner", + "innerInteger": 24 + }, + "innerListExtension": [ + "oof", + "rab", + "zab" + ], + "innerPrimitiveExtension": "additionalInnerValue" + }, + "outerComplexExtension": { + "outerString": "outer", + "outerInteger": 42 + }, + "outerListExtension": [ + "foo", + "bar", + "baz" + ], + "outerPrimitiveExtension": "additionalOuterValue" + } + """; @Test void testDeserializeResponseWithNestedExtensions() @@ -53,42 +95,33 @@ void testDeserializeResponseWithNestedExtensions() server .expect(ExpectedCount.once(), requestTo(BASE_PATH + RELATIVE_PATH)) .andExpect(method(HttpMethod.GET)) - .andRespond(MockRestResponseCreators.withSuccess(""" - { - "message": "Hello from the outer level.", - "code": 1337, - "inner": { - "message": "Hello from the inner level.", - "code": 7331, - "innerComplexExtension": { - "innerString": "inner", - "innerInteger": 24 - }, - "innerListExtension": [ - "oof", - "rab", - "zab" - ], - "innerPrimitiveExtension": "additionalInnerValue" - }, - "outerComplexExtension": { - "outerString": "outer", - "outerInteger": 42 - }, - "outerListExtension": [ - "foo", - "bar", - "baz" - ], - "outerPrimitiveExtension": "additionalOuterValue" - } - """, MediaType.APPLICATION_JSON)); - - final TestApi api = new TestApi(apiClient); + .andRespond(MockRestResponseCreators.withSuccess(RESPONSE, MediaType.APPLICATION_JSON)); + + final TestSpringApi api = new TestSpringApi(apiClient); final Outer result = api.getOuter(); server.verify(); + assertResult(result); + } + + @Test + @Description( "Tests deserialization of responses with nested extensions using the Apache HTTP client based ApiClient." ) + void testDeserializeResponseWithNestedExtensionsApache( WireMockRuntimeInfo wmInfo ) + { + + WireMock.stubFor(WireMock.get(WireMock.urlEqualTo(RELATIVE_PATH)).willReturn(WireMock.okJson(RESPONSE))); + final var apiClient = + com.sap.cloud.sdk.services.openapi.apache.ApiClient.create().withBasePath(wmInfo.getHttpBaseUrl()); + + final TestApacheApi api = new TestApacheApi(apiClient); + final Outer result = api.getOuter(); + + WireMock.verify(1, WireMock.getRequestedFor(WireMock.urlEqualTo(RELATIVE_PATH))); + assertResult(result); + } + private static void assertResult( Outer result ) + { assertThat(result.getMessage()).isEqualTo("Hello from the outer level."); assertThat(result.getCode()).isEqualTo(1337); assertThat(result.getCustomFieldNames()) @@ -128,9 +161,61 @@ void testDeserializeResponseWithNestedExtensions() }); } - private static class TestApi extends AbstractOpenApiService + private static class TestApacheApi extends BaseApi + { + public TestApacheApi( final com.sap.cloud.sdk.services.openapi.apache.ApiClient apiClient ) + { + super(apiClient); + } + + @Nonnull + public Outer getOuter() + throws OpenApiRequestException + { + final Object localVarPostBody = null; + + // create path and map variables + final String localVarPath = RELATIVE_PATH; + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = + com.sap.cloud.sdk.services.openapi.apache.ApiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = + com.sap.cloud.sdk.services.openapi.apache.ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType); + } + } + + private static class TestSpringApi extends AbstractOpenApiService { - public TestApi( final ApiClient apiClient ) + public TestSpringApi( final ApiClient apiClient ) { super(apiClient); } diff --git a/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/ApiClientFromDestinationTest.java b/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/ApiClientFromDestinationTest.java index faa905633..8135e9c6e 100644 --- a/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/ApiClientFromDestinationTest.java +++ b/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/ApiClientFromDestinationTest.java @@ -11,6 +11,7 @@ import com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpDestination; import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; import com.sap.cloud.sdk.cloudplatform.connectivity.HttpDestination; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService; class ApiClientFromDestinationTest @@ -24,9 +25,12 @@ void testServiceInvocation() { final HttpDestination testDestination = DefaultHttpDestination.builder(SERVER.baseUrl()).build(); - final MyTestAbstractOpenApiService service = new MyTestAbstractOpenApiService(testDestination); + final MyTestAbstractOpenApiService springService = new MyTestAbstractOpenApiService(testDestination); + final MyTestAbstractApacheOpenApiService apacheService = + new MyTestAbstractApacheOpenApiService(testDestination); - service.foo(); + springService.foo(); + apacheService.foo(); } @Test @@ -34,12 +38,16 @@ void testExceptionIsThrown() { final HttpDestination testDestination = DefaultHttpDestination.builder(SERVER.baseUrl()).build(); - final MyExceptionThrowingServiceAbstract service = new MyExceptionThrowingServiceAbstract(testDestination); + final MyExceptionThrowingSpringServiceAbstract springService = + new MyExceptionThrowingSpringServiceAbstract(testDestination); + final MyExceptionThrowingApacheServiceAbstract apacheService = + new MyExceptionThrowingApacheServiceAbstract(testDestination); - assertThatExceptionOfType(IllegalAccessException.class).isThrownBy(service::foo); + assertThatExceptionOfType(IllegalAccessException.class).isThrownBy(springService::foo); + assertThatExceptionOfType(IllegalAccessException.class).isThrownBy(apacheService::foo); } - private class MyTestAbstractOpenApiService extends AbstractOpenApiService + private static class MyTestAbstractOpenApiService extends AbstractOpenApiService { public MyTestAbstractOpenApiService( final Destination destination ) { @@ -52,9 +60,36 @@ void foo() } } - private static class MyExceptionThrowingServiceAbstract extends AbstractOpenApiService + private static class MyExceptionThrowingSpringServiceAbstract extends AbstractOpenApiService { - public MyExceptionThrowingServiceAbstract( final Destination destination ) + public MyExceptionThrowingSpringServiceAbstract( final Destination destination ) + { + super(destination); + } + + void foo() + throws IllegalAccessException + { + throw new IllegalAccessException("Something went horribly wrong"); + } + } + + private static class MyTestAbstractApacheOpenApiService extends BaseApi + { + public MyTestAbstractApacheOpenApiService( final Destination destination ) + { + super(destination); + } + + void foo() + { + assertThat(apiClient.getBasePath()).isEqualTo(SERVER.baseUrl()); + } + } + + private static class MyExceptionThrowingApacheServiceAbstract extends BaseApi + { + public MyExceptionThrowingApacheServiceAbstract( final Destination destination ) { super(destination); } diff --git a/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/ApiClientViaConstructorTest.java b/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/SpringApiClientViaConstructorTest.java similarity index 99% rename from datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/ApiClientViaConstructorTest.java rename to datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/SpringApiClientViaConstructorTest.java index b7cda71d3..e0a169533 100644 --- a/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/ApiClientViaConstructorTest.java +++ b/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/SpringApiClientViaConstructorTest.java @@ -38,7 +38,7 @@ import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService; @WireMockTest -class ApiClientViaConstructorTest +class SpringApiClientViaConstructorTest { private static final String RELATIVE_PATH = "/apiEndpoint"; private static final String SUCCESS_BODY = "success"; diff --git a/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericparameter/GenericParameterTest.java b/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericparameter/GenericParameterTest.java index f50df180f..035effa39 100644 --- a/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericparameter/GenericParameterTest.java +++ b/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericparameter/GenericParameterTest.java @@ -7,7 +7,11 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static com.github.tomakehurst.wiremock.client.WireMock.verify; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.StringJoiner; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -25,6 +29,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRawValue; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.client.WireMock; @@ -32,6 +37,9 @@ import com.github.tomakehurst.wiremock.junit5.WireMockTest; import com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpDestination; import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService; import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; @@ -41,23 +49,24 @@ @WireMockTest class GenericParameterTest { + final static String EXPECTED_BODY = """ + {\ + "id":"foo",\ + "fieldPopulatedAsStringWithAnnotation":{"foo": "bar"},\ + "fieldPopulatedAsStringWithoutAnnotation":"{\\"foo\\": \\"bar\\"}",\ + "fieldPopulatedAsJacksonJsonNode":{"foo":"bar"}\ + }\ + """; + @Test void testInvocationWithGenericParameter( @Nonnull final WireMockRuntimeInfo wm ) throws JsonProcessingException { - final String expectedBody = """ - {\ - "id":"foo",\ - "fieldPopulatedAsStringWithAnnotation":{"foo": "bar"},\ - "fieldPopulatedAsStringWithoutAnnotation":"{\\"foo\\": \\"bar\\"}",\ - "fieldPopulatedAsJacksonJsonNode":{"foo":"bar"}\ - }\ - """; WireMock .stubFor( post(urlEqualTo("/api")) - .withRequestBody(equalTo(expectedBody)) + .withRequestBody(equalTo(EXPECTED_BODY)) .willReturn(aResponse().withStatus(HttpStatus.SC_OK))); final DefaultHttpDestination httpDestination = DefaultHttpDestination.builder(wm.getHttpBaseUrl()).build(); @@ -67,16 +76,18 @@ void testInvocationWithGenericParameter( @Nonnull final WireMockRuntimeInfo wm ) //this is how you pass a JSON representation into a parameter of type Object final JsonNode jacksonJsonNode = new ObjectMapper().readTree(jsonString); - new TestApi(httpDestination) - .testMethod( - TestModelPOST - .builder() - .id("foo") - .fieldPopulatedAsStringWithAnnotation(jsonString) - .fieldPopulatedAsStringWithoutAnnotation(jsonString) - .fieldPopulatedAsJacksonJsonNode(jacksonJsonNode) - .build()); - verify(postRequestedFor(urlEqualTo("/api")).withRequestBody(equalTo(expectedBody))); + final TestModelPOST testModelPOST = + TestModelPOST + .builder() + .id("foo") + .fieldPopulatedAsStringWithAnnotation(jsonString) + .fieldPopulatedAsStringWithoutAnnotation(jsonString) + .fieldPopulatedAsJacksonJsonNode(jacksonJsonNode) + .build(); + + new TestSpringApi(httpDestination).testMethod(testModelPOST); + new TestApacheApi(httpDestination).testMethod(testModelPOST); + verify(2, postRequestedFor(urlEqualTo("/api")).withRequestBody(equalTo(EXPECTED_BODY))); } @Value @@ -97,9 +108,64 @@ private static class TestModelPOST Object fieldPopulatedAsJacksonJsonNode; } - private static class TestApi extends AbstractOpenApiService + private static class TestApacheApi extends BaseApi + { + public TestApacheApi( @Nonnull final Destination destination ) + { + super(destination); + } + + @Nullable + public TestModel testMethod( @Nonnull final TestModelPOST body ) + throws OpenApiRequestException + { + final Object localVarPostBody = body; + + // verify the required parameter 'pet' is set + if( body == null ) { + throw new OpenApiRequestException("Missing the required parameter 'pet' when calling addPet") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/api"; + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType); + } + + } + + private static class TestSpringApi extends AbstractOpenApiService { - public TestApi( @Nonnull final Destination httpDestination ) + public TestSpringApi( @Nonnull final Destination httpDestination ) { super(httpDestination); } diff --git a/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericreturntype/GenericReturnTypeTest.java b/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericreturntype/GenericReturnTypeTest.java index 0a7b3f87d..4d909438b 100644 --- a/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericreturntype/GenericReturnTypeTest.java +++ b/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericreturntype/GenericReturnTypeTest.java @@ -8,10 +8,15 @@ import java.util.LinkedHashMap; import java.util.List; +import java.util.function.Function; +import java.util.stream.Stream; import javax.annotation.Nonnull; -import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import com.github.tomakehurst.wiremock.junit5.WireMockTest; @@ -42,16 +47,31 @@ @WireMockTest class GenericReturnTypeTest { - @Test - void testGenericAccessToNonNestedJsonObject( @Nonnull final WireMockRuntimeInfo wm ) + + HttpDestination httpDestination; + + @BeforeEach + void setUp( @Nonnull final WireMockRuntimeInfo wm ) { - final String responseBody = "{\"firstname\":\"John\",\"lastname\":\"Doe\"}"; + httpDestination = DefaultHttpDestination.builder(wm.getHttpBaseUrl()).build(); + } - final HttpDestination httpDestination = DefaultHttpDestination.builder(wm.getHttpBaseUrl()).build(); + static Stream provideContext() + { + return Stream + .of( + Arguments.of((Function) ( des ) -> new TestSpringApi(des).testMethod()), + Arguments.of((Function) ( des ) -> new TestApacheApi(des).testMethod())); + } + @MethodSource( "provideContext" ) + @ParameterizedTest + void testGenericAccessToNonNestedJsonObject( @Nonnull final Function contextFactory ) + { + final String responseBody = "{\"firstname\":\"John\",\"lastname\":\"Doe\"}"; stubFor(get(urlEqualTo("/endpoint")).willReturn(okJson(responseBody))); - final Object context = new TestApi(httpDestination).testMethod(); + final Object context = contextFactory.apply(httpDestination); @SuppressWarnings( "unchecked" ) final LinkedHashMap castedReturnObject = (LinkedHashMap) context; @@ -60,16 +80,15 @@ void testGenericAccessToNonNestedJsonObject( @Nonnull final WireMockRuntimeInfo assertThat(castedReturnObject.get("lastname")).isEqualTo("Doe"); } - @Test - void testGenericAccessToNestedJsonObject( @Nonnull final WireMockRuntimeInfo wm ) + @MethodSource( "provideContext" ) + @ParameterizedTest + void testGenericAccessToNestedJsonObject( @Nonnull final Function contextFactory ) { final String responseBody = "{" + "\"foo\": \"bar\"," + "\"bar\": {" + "\"foobar\": \"barfoo\"" + "}" + "}"; - final HttpDestination httpDestination = DefaultHttpDestination.builder(wm.getHttpBaseUrl()).build(); - stubFor(get(urlEqualTo("/endpoint")).willReturn(okJson(responseBody))); - final Object context = new TestApi(httpDestination).testMethod(); + final Object context = contextFactory.apply(httpDestination); @SuppressWarnings( "unchecked" ) final LinkedHashMap castedReturnObject = (LinkedHashMap) context; @@ -83,16 +102,15 @@ void testGenericAccessToNestedJsonObject( @Nonnull final WireMockRuntimeInfo wm assertThat(castedNestedReturnObject.get("foobar")).isEqualTo("barfoo"); } - @Test - void testGenericAccessToArray( @Nonnull final WireMockRuntimeInfo wm ) + @MethodSource( "provideContext" ) + @ParameterizedTest + void testGenericAccessToArray( @Nonnull final Function contextFactory ) { final String responseBody = "[\"foo\", \"bar\", \"foo\", \"bar\"]"; - final HttpDestination httpDestination = DefaultHttpDestination.builder(wm.getHttpBaseUrl()).build(); - stubFor(get(urlEqualTo("/endpoint")).willReturn(okJson(responseBody))); - final Object context = new TestApi(httpDestination).testMethod(); + final Object context = contextFactory.apply(httpDestination); @SuppressWarnings( "unchecked" ) final List castedReturnObject = (List) context; diff --git a/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericreturntype/TestApacheApi.java b/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericreturntype/TestApacheApi.java new file mode 100644 index 000000000..6e3f10aca --- /dev/null +++ b/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericreturntype/TestApacheApi.java @@ -0,0 +1,65 @@ +package com.sap.cloud.sdk.services.openapi.genericreturntype; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.StringJoiner; + +import javax.annotation.Nonnull; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + +class TestApacheApi extends BaseApi +{ + + TestApacheApi( @Nonnull final Destination destination ) + { + super(destination); + } + + Object testMethod() + { + final Object localVarPostBody = null; + + // create path and map variables + final String localVarPath = "/endpoint"; + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = + com.sap.cloud.sdk.services.openapi.apache.ApiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = + com.sap.cloud.sdk.services.openapi.apache.ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() + { + }; + return apiClient + .invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType); + } +} diff --git a/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericreturntype/TestApi.java b/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericreturntype/TestSpringApi.java similarity index 94% rename from datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericreturntype/TestApi.java rename to datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericreturntype/TestSpringApi.java index 900b83373..c670b1271 100644 --- a/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericreturntype/TestApi.java +++ b/datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericreturntype/TestSpringApi.java @@ -18,9 +18,9 @@ import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService; import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; -class TestApi extends AbstractOpenApiService +class TestSpringApi extends AbstractOpenApiService { - TestApi( @Nonnull final Destination httpDestination ) + TestSpringApi( @Nonnull final Destination httpDestination ) { super(httpDestination); } diff --git a/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java b/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java index 596d8545c..999398f32 100644 --- a/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java +++ b/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java @@ -49,6 +49,7 @@ class GenerationConfigurationConverter "Copyright (c) " + Year.now() + " SAP SE or an SAP affiliate company. All rights reserved."; static final String TEMPLATE_DIRECTORY = Paths.get("openapi-generator").resolve("mustache-templates").toString(); static final String LIBRARY_NAME = JavaClientCodegen.RESTTEMPLATE; + static final String SUPPORT_URL_QUERY = "supportUrlQuery"; @Nonnull static ClientOptInput convertGenerationConfiguration( @@ -190,6 +191,10 @@ private static Map getAdditionalProperties( @Nonnull final Gener } result.put(k, v); }); + + // Always disable supportUrlQuery as it's not compatible with interface generation + result.put(SUPPORT_URL_QUERY, "false"); + return result; } } diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/operationBody.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/operationBody.mustache index 776219542..f908859b2 100644 --- a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/operationBody.mustache +++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/operationBody.mustache @@ -1,9 +1,9 @@ {{#allParams}}{{#required}} - // verify the required parameter '{{paramName}}' is set - if ({{paramName}} == null) { - throw new OpenApiRequestException("Missing the required parameter '{{paramName}}' when calling {{#vendorExtensions.x-sap-cloud-sdk-operation-name}}{{vendorExtensions.x-sap-cloud-sdk-operation-name}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}{{^vendorExtensions.x-sap-cloud-sdk-operation-name}}{{operationId}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}") - .statusCode(400); - } +// verify the required parameter '{{paramName}}' is set +if ({{paramName}} == null) { +throw new OpenApiRequestException("Missing the required parameter '{{paramName}}' when calling {{#vendorExtensions.x-sap-cloud-sdk-operation-name}}{{vendorExtensions.x-sap-cloud-sdk-operation-name}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}{{^vendorExtensions.x-sap-cloud-sdk-operation-name}}{{operationId}}{{/vendorExtensions.x-sap-cloud-sdk-operation-name}}") +.statusCode(400); +} {{/required}}{{/allParams}} // create path and map variables final String localVarPath = "{{{path}}}"{{#pathParams}} @@ -16,77 +16,76 @@ final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); final Map localVarFormParams = new HashMap(); - {{#queryParams}} - {{#isDeepObject}} - {{#isArray}} - for (int i=0; i < {{paramName}}.size(); i++) { - localVarQueryStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format(Locale.ROOT, "{{baseName}}[%d]", i))); - } - {{/isArray}} - {{^isArray}} - localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString("{{baseName}}")); - {{/isArray}} - {{/isDeepObject}} - {{^isDeepObject}} - {{#isExplode}} - {{#hasVars}} - {{#vars}} - {{#isArray}} - localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "{{baseName}}", {{paramName}}.{{getter}}())); - {{/isArray}} - {{^isArray}} - localVarQueryParams.addAll(ApiClient.parameterToPair("{{baseName}}", {{paramName}}.{{getter}}())); - {{/isArray}} - {{/vars}} - {{/hasVars}} - {{^hasVars}} - {{#isModel}} - localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString()); - {{/isModel}} - {{^isModel}} - {{#collectionFormat}}localVarCollectionQueryParams.addAll(ApiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(ApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); - {{/isModel}} - {{/hasVars}} - {{/isExplode}} - {{^isExplode}} +{{#queryParams}} + {{#isDeepObject}} + {{#isArray}} + for (int i=0; i < {{paramName}}.size(); i++) { + localVarQueryStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format(Locale.ROOT, "{{baseName}}[%d]", i))); + } + {{/isArray}} + {{^isArray}} + localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString("{{baseName}}")); + {{/isArray}} + {{/isDeepObject}} + {{^isDeepObject}} + {{#isExplode}} + {{#hasVars}} + {{#vars}} + {{#isArray}} + localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "{{baseName}}", {{paramName}}.{{getter}}())); + {{/isArray}} + {{^isArray}} + localVarQueryParams.addAll(ApiClient.parameterToPair("{{baseName}}", {{paramName}}.{{getter}}())); + {{/isArray}} + {{/vars}} + {{/hasVars}} + {{^hasVars}} + {{#isModel}} + localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString()); + {{/isModel}} + {{^isModel}} {{#collectionFormat}}localVarCollectionQueryParams.addAll(ApiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(ApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); - {{/isExplode}} - {{/isDeepObject}} - {{/queryParams}} - {{#headerParams}}if ({{paramName}} != null) - localVarHeaderParams.put("{{baseName}}", ApiClient.parameterToString({{paramName}})); - {{/headerParams}} + {{/isModel}} + {{/hasVars}} + {{/isExplode}} + {{^isExplode}} + {{#collectionFormat}}localVarCollectionQueryParams.addAll(ApiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(ApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); + {{/isExplode}} + {{/isDeepObject}} +{{/queryParams}} +{{#headerParams}}if ({{paramName}} != null) + localVarHeaderParams.put("{{baseName}}", ApiClient.parameterToString({{paramName}})); +{{/headerParams}} +{{#formParams}}if ({{paramName}} != null) + localVarFormParams.put("{{baseName}}", {{paramName}}); +{{/formParams}} - {{#formParams}}if ({{paramName}} != null) - localVarFormParams.put("{{baseName}}", {{paramName}}); - {{/formParams}} +final String[] localVarAccepts = { +{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} +}; +final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); +final String[] localVarContentTypes = { +{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} +}; +final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); - final String[] localVarAccepts = { - {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} - }; - final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); +{{#returnType}} +final TypeReference<{{{returnType}}}> localVarReturnType = new TypeReference<{{{returnType}}}>() {}; +{{/returnType}} +{{^returnType}} +final TypeReference localVarReturnType = new TypeReference() {}; +{{/returnType}} - final String[] localVarContentTypes = { - {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} - }; - final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); - - {{#returnType}} - final TypeReference<{{{returnType}}}> localVarReturnType = new TypeReference<{{{returnType}}}>() {}; - {{/returnType}} - {{^returnType}} - final TypeReference localVarReturnType = new TypeReference() {}; - {{/returnType}} - return apiClient.invokeAPI( - localVarPath, - "{{httpMethod}}", - localVarQueryParams, - localVarCollectionQueryParams, - localVarQueryStringJoiner.toString(), - {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}, - localVarHeaderParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarReturnType - ); +return apiClient.invokeAPI( + localVarPath, + "{{httpMethod}}", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType +); diff --git a/datamodel/openapi/openapi-generator/src/test/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorApacheIntegrationTest.java b/datamodel/openapi/openapi-generator/src/test/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorApacheIntegrationTest.java new file mode 100644 index 000000000..cbd349e99 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorApacheIntegrationTest.java @@ -0,0 +1,112 @@ +package com.sap.cloud.sdk.datamodel.openapi.generator; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.nio.file.Files; +import java.nio.file.Path; + +import org.junit.jupiter.api.io.TempDir; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; + +import com.sap.cloud.sdk.datamodel.openapi.generator.model.GenerationConfiguration; +import com.sap.cloud.sdk.datamodel.openapi.generator.model.GenerationResult; + +import io.vavr.control.Try; + +// DataModelGeneratorApacheIntegrationTest.java +class DataModelGeneratorApacheIntegrationTest extends DataModelGeneratorIntegrationTest +{ + + static final String LIBRARY = "apache-httpclient"; + + @Override + @ParameterizedTest + @EnumSource( + value = TestCase.class, + mode = EnumSource.Mode.EXCLUDE, + names = { + "INPUT_SPEC_WITH_UPPERCASE_FILE_EXTENSION", + "ONE_OF_INTERFACES_DISABLED", + "ONE_OF_INTERFACES_ENABLED", + "INPUT_SPEC_WITH_BUILDER", + "GENERATE_APIS" } ) + void integrationTests( final TestCase testCase, @TempDir final Path path ) + throws Throwable + { + final Path inputDirectory = getInputDirectory(testCase); + final Path tempOutputDirectory = path.resolve("outputDirectory"); + final Path comparisonDirectory = getComparisonDirectory(testCase); + + Files.createDirectories(tempOutputDirectory); + + assertThat(inputDirectory).exists().isReadable().isDirectory(); + assertThat(tempOutputDirectory).exists().isReadable().isDirectory(); + assertThat(comparisonDirectory).exists().isReadable().isDirectory(); + + final var generationConfiguration = + GenerationConfiguration + .builder() + // .debugModels(true) enable this for better mustache file debugging + .apiPackage(testCase.apiPackageName) + .generateApis(testCase.generateApis) + .modelPackage(testCase.modelPackageName) + .inputSpec(inputDirectory.resolve(testCase.inputSpecFileName).toAbsolutePath().toString()) + .apiMaturity(testCase.apiMaturity) + .outputDirectory(tempOutputDirectory.toAbsolutePath().toString()) + .withSapCopyrightHeader(true) + .oneOfAnyOfGenerationEnabled(testCase.anyOfOneOfGenerationEnabled) + .additionalProperty("useAbstractionForFiles", "true") + .additionalProperty("library", LIBRARY); + + testCase.additionalProperties.forEach(generationConfiguration::additionalProperty); + + final Try maybeGenerationResult = + new DataModelGenerator().generateDataModel(generationConfiguration.build()); + + assertThat(maybeGenerationResult.get().getGeneratedFiles()).hasSize(testCase.expectedNumberOfGeneratedFiles); + + assertThatDirectoriesHaveSameContent(tempOutputDirectory, comparisonDirectory); + } + + // Add these annotations to regenerate all sources + // @ParameterizedTest + // use this to regenerate all relevant... + // @EnumSource( value=TestCase.class , mode = EnumSource.Mode.EXCLUDE, + // names = { + // "INPUT_SPEC_WITH_UPPERCASE_FILE_EXTENSION", + // "ONE_OF_INTERFACES_DISABLED", + // "ONE_OF_INTERFACES_ENABLED", + // "INPUT_SPEC_WITH_BUILDER", + // "GENERATE_APIS" + // }) + // @EnumSource( value = TestCase.class, names = { "API_CLASS_VENDOR_EXTENSION_YAML" } ) // ...and this one to only generate specific ones + @Override + void generateDataModelForComparison( final TestCase testCase ) + { + final Path inputDirectory = getInputDirectory(testCase); + final Path outputDirectory = getComparisonDirectory(testCase); + + assertThat(inputDirectory).exists().isReadable().isDirectory(); + assertThat(outputDirectory).exists().isReadable().isDirectory(); + + final var generationConfiguration = + GenerationConfiguration + .builder() + .apiPackage(testCase.apiPackageName) + .generateApis(testCase.generateApis) + .modelPackage(testCase.modelPackageName) + .inputSpec(inputDirectory.resolve(testCase.inputSpecFileName).toAbsolutePath().toString()) + .apiMaturity(testCase.apiMaturity) + .outputDirectory(outputDirectory.toAbsolutePath().toString()) + .deleteOutputDirectory(true) + .withSapCopyrightHeader(true) + .oneOfAnyOfGenerationEnabled(testCase.anyOfOneOfGenerationEnabled) + .additionalProperty("useAbstractionForFiles", "true") + .additionalProperty("library", LIBRARY); + testCase.additionalProperties.forEach(generationConfiguration::additionalProperty); + + GenerationConfiguration build = generationConfiguration.build(); + new DataModelGenerator().generateDataModel(build).onFailure(Throwable::printStackTrace); + } +} diff --git a/datamodel/openapi/openapi-generator/src/test/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorIntegrationTest.java b/datamodel/openapi/openapi-generator/src/test/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorIntegrationTest.java index 6d4084e57..3059cfee4 100644 --- a/datamodel/openapi/openapi-generator/src/test/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorIntegrationTest.java +++ b/datamodel/openapi/openapi-generator/src/test/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorIntegrationTest.java @@ -25,7 +25,7 @@ class DataModelGeneratorIntegrationTest { @RequiredArgsConstructor - private enum TestCase + enum TestCase { API_CLASS_FOR_AI_SDK( "api-class-for-ai-sdk", @@ -236,7 +236,7 @@ void generateDataModelForComparison( final TestCase testCase ) new DataModelGenerator().generateDataModel(build).onFailure(Throwable::printStackTrace); } - private static Path getInputDirectory( final TestCase testCase ) + Path getInputDirectory( final TestCase testCase ) { final Path testCaseDirectory = getTestCaseDirectory(testCase); final Path inputDirectory = testCaseDirectory.resolve("input"); @@ -246,20 +246,17 @@ private static Path getInputDirectory( final TestCase testCase ) return inputDirectory; } - private static Path getTestCaseDirectory( final TestCase testCase ) + private Path getTestCaseDirectory( final TestCase testCase ) { final Path testCaseDirectory = - Paths - .get( - "src/test/resources/" + DataModelGeneratorIntegrationTest.class.getSimpleName(), - testCase.testCaseName); + Paths.get("src/test/resources/" + this.getClass().getSimpleName(), testCase.testCaseName); assertThat(testCaseDirectory).exists().isDirectory().isReadable(); return testCaseDirectory; } - private static Path getComparisonDirectory( final TestCase testCase ) + Path getComparisonDirectory( final TestCase testCase ) { final Path testCaseDirectory = getTestCaseDirectory(testCase); final Path comparisonDirectory = testCaseDirectory.resolve("output"); @@ -271,7 +268,7 @@ private static Path getComparisonDirectory( final TestCase testCase ) @SuppressWarnings( "resource" ) @SneakyThrows - private static void assertThatDirectoriesHaveSameContent( final Path a, final Path b ) + static void assertThatDirectoriesHaveSameContent( final Path a, final Path b ) { final Predicate isFile = p -> p.toFile().isFile(); Files.walk(a).filter(isFile).forEach(p -> assertThat(p).hasSameTextualContentAs(b.resolve(a.relativize(p)))); diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/input/sodastore.json b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/input/sodastore.json new file mode 100644 index 000000000..fdacd7c85 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/input/sodastore.json @@ -0,0 +1,249 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Soda Store API", + "version": "1.0.0", + "description": "API for managing sodas in a soda store" + }, + "paths": { + "/sodas": { + "get": { + "summary": "Get a list of all sodas", + "x-sap-cloud-sdk-api-name": "AwesomeSodas", + "operationId": "getSodas", + "responses": { + "200": { + "description": "A list of sodas", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Soda" + } + } + } + } + } + } + }, + "post": { + "summary": "Add a new soda to the store", + "x-sap-cloud-sdk-api-name": "AwesomeSoda", + "operationId": "addSoda", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NewSoda" + } + } + } + }, + "responses": { + "201": { + "description": "The newly added soda", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Soda" + } + } + } + } + } + } + }, + "/sodas/{sodaId}": { + "get": { + "summary": "Get details of a specific soda", + "operationId": "getSodaById", + "parameters": [ + { + "name": "sodaId", + "in": "path", + "description": "ID of the soda to retrieve", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "The requested soda", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Soda" + } + } + } + }, + "404": { + "description": "Soda not found" + } + } + }, + "put": { + "summary": "Update details of a specific soda", + "operationId": "updateSodaById", + "parameters": [ + { + "name": "sodaId", + "in": "path", + "description": "ID of the soda to update", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateSoda" + } + } + } + }, + "responses": { + "200": { + "description": "The updated soda", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Soda" + } + } + } + }, + "404": { + "description": "Soda not found" + } + } + }, + "delete": { + "summary": "Delete a specific soda from the store", + "operationId": "deleteSodaById", + "parameters": [ + { + "name": "sodaId", + "in": "path", + "description": "ID of the soda to delete", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "Soda successfully deleted" + }, + "404": { + "description": "Soda not found" + } + } + } + } + }, + "components": { + "schemas": { + "Soda": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "brand": { + "type": "string" + }, + "isAvailable": { + "type": "boolean" + }, + "flavor": { + "type": "string" + }, + "price": { + "type": "number", + "format": "float" + }, + "diet": { + "type": "string", + "enum": ["sugar", "zero", "light"], + "nullable": true + }, + "embedding":{ + "type": "array", + "items": { + "type": "number" + } + } + }, + "required": ["name", "brand", "flavor", "price", "embedding"] + }, + "NewSoda": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "brand": { + "type": "string" + }, + "zero": { + "type": "boolean" + }, + "since": { + "type": "string", + "format": "date" + }, + "flavor": { + "type": "string" + }, + "price": { + "type": "number", + "format": "float" + } + }, + "required": ["name", "brand", "flavor", "price"] + }, + "UpdateSoda": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "zero": { + "type": "boolean" + }, + "since": { + "type": "string", + "format": "date" + }, + "brand": { + "type": "string" + }, + "flavor": { + "type": "string" + }, + "price": { + "type": "number", + "format": "float" + } + } + } + } + } +} diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/AwesomeSodaApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/AwesomeSodaApi.java new file mode 100644 index 000000000..64f28920a --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/AwesomeSodaApi.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +package com.sap.cloud.sdk.services.builder.api; + +import com.fasterxml.jackson.core.type.TypeReference; + +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import com.sap.cloud.sdk.services.openapi.apache.OpenApiResponse; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + + +import com.sap.cloud.sdk.services.builder.model.NewSoda; +import com.sap.cloud.sdk.services.builder.model.Soda; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.StringJoiner; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.sap.ai.sdk.core.AiCoreService; + + +/** + * Soda Store API in version 1.0.0. + *

+ * API for managing sodas in a soda store + */ +public class AwesomeSodaApi extends BaseApi { + + /** + * Instantiates this API class to invoke operations on the Soda Store API + */ + public AwesomeSodaApi() + { + super(new AiCoreService().getApiClient()); + } + + /** + * Instantiates this API class to invoke operations on the Soda Store API + * + * @param aiCoreService The configured connectivity instance to AI Core + */ + public AwesomeSodaApi( @Nonnull final AiCoreService aiCoreService ) + { + super(aiCoreService.getApiClient()); + } + + + /** + *

Add a new soda to the store + *

+ *

201 - The newly added soda + * @param newSoda + * The value for the parameter newSoda + * @return Soda + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Soda addSoda(@Nonnull final NewSoda newSoda) throws OpenApiRequestException { + + // verify the required parameter 'newSoda' is set + if (newSoda == null) { + throw new OpenApiRequestException("Missing the required parameter 'newSoda' when calling addSoda") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas"; + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + newSoda, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + } diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/AwesomeSodasApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/AwesomeSodasApi.java new file mode 100644 index 000000000..e31f7124b --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/AwesomeSodasApi.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +package com.sap.cloud.sdk.services.builder.api; + +import com.fasterxml.jackson.core.type.TypeReference; + +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import com.sap.cloud.sdk.services.openapi.apache.OpenApiResponse; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + + +import com.sap.cloud.sdk.services.builder.model.Soda; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.StringJoiner; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.sap.ai.sdk.core.AiCoreService; + + +/** + * Soda Store API in version 1.0.0. + *

+ * API for managing sodas in a soda store + */ +public class AwesomeSodasApi extends BaseApi { + + /** + * Instantiates this API class to invoke operations on the Soda Store API + */ + public AwesomeSodasApi() + { + super(new AiCoreService().getApiClient()); + } + + /** + * Instantiates this API class to invoke operations on the Soda Store API + * + * @param aiCoreService The configured connectivity instance to AI Core + */ + public AwesomeSodasApi( @Nonnull final AiCoreService aiCoreService ) + { + super(aiCoreService.getApiClient()); + } + + + /** + *

Get a list of all sodas + *

+ *

200 - A list of sodas + * @return List<Soda> + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public List getSodas() throws OpenApiRequestException { + + // create path and map variables + final String localVarPath = "/sodas"; + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference> localVarReturnType = new TypeReference>() {}; + + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + } diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/DefaultApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/DefaultApi.java new file mode 100644 index 000000000..6bb599e41 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/DefaultApi.java @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +package com.sap.cloud.sdk.services.builder.api; + +import com.fasterxml.jackson.core.type.TypeReference; + +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import com.sap.cloud.sdk.services.openapi.apache.OpenApiResponse; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + + +import com.sap.cloud.sdk.services.builder.model.Soda; +import com.sap.cloud.sdk.services.builder.model.UpdateSoda; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.StringJoiner; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.sap.ai.sdk.core.AiCoreService; + + +/** + * Soda Store API in version 1.0.0. + *

+ * API for managing sodas in a soda store + */ +public class DefaultApi extends BaseApi { + + /** + * Instantiates this API class to invoke operations on the Soda Store API + */ + public DefaultApi() + { + super(new AiCoreService().getApiClient()); + } + + /** + * Instantiates this API class to invoke operations on the Soda Store API + * + * @param aiCoreService The configured connectivity instance to AI Core + */ + public DefaultApi( @Nonnull final AiCoreService aiCoreService ) + { + super(aiCoreService.getApiClient()); + } + + + /** + *

Delete a specific soda from the store + *

+ *

204 - Soda successfully deleted + *

404 - Soda not found + * @param sodaId + * ID of the soda to delete + * @return An OpenApiResponse containing the status code of the HttpResponse. + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public OpenApiResponse deleteSodaById(@Nonnull final Long sodaId) throws OpenApiRequestException { + + // verify the required parameter 'sodaId' is set + if (sodaId == null) { + throw new OpenApiRequestException("Missing the required parameter 'sodaId' when calling deleteSodaById") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas/{sodaId}" + .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + + /** + *

Get details of a specific soda + *

+ *

200 - The requested soda + *

404 - Soda not found + * @param sodaId + * ID of the soda to retrieve + * @return Soda + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Soda getSodaById(@Nonnull final Long sodaId) throws OpenApiRequestException { + + // verify the required parameter 'sodaId' is set + if (sodaId == null) { + throw new OpenApiRequestException("Missing the required parameter 'sodaId' when calling getSodaById") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas/{sodaId}" + .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + + /** + *

Update details of a specific soda + *

+ *

200 - The updated soda + *

404 - Soda not found + * @param sodaId + * ID of the soda to update + * @param updateSoda + * The value for the parameter updateSoda + * @return Soda + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Soda updateSodaById(@Nonnull final Long sodaId, @Nonnull final UpdateSoda updateSoda) throws OpenApiRequestException { + + // verify the required parameter 'sodaId' is set + if (sodaId == null) { + throw new OpenApiRequestException("Missing the required parameter 'sodaId' when calling updateSodaById") + .statusCode(400); + } + + // verify the required parameter 'updateSoda' is set + if (updateSoda == null) { + throw new OpenApiRequestException("Missing the required parameter 'updateSoda' when calling updateSodaById") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas/{sodaId}" + .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + updateSoda, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + } diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/NewSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/NewSoda.java new file mode 100644 index 000000000..20ce285d8 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/NewSoda.java @@ -0,0 +1,349 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Soda Store API + * API for managing sodas in a soda store + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.builder.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.LocalDate; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * NewSoda + */ +// CHECKSTYLE:OFF +public class NewSoda +// CHECKSTYLE:ON +{ + @JsonProperty("name") + private String name; + + @JsonProperty("brand") + private String brand; + + @JsonProperty("zero") + private Boolean zero; + + @JsonProperty("since") + private LocalDate since; + + @JsonProperty("flavor") + private String flavor; + + @JsonProperty("price") + private Float price; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the name of this {@link NewSoda} instance and return the same instance. + * + * @param name The name of this {@link NewSoda} + * @return The same instance of this {@link NewSoda} class + */ + @Nonnull public NewSoda name( @Nonnull final String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name The name of this {@link NewSoda} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link NewSoda} instance. + * + * @param name The name of this {@link NewSoda} + */ + public void setName( @Nonnull final String name) { + this.name = name; + } + + /** + * Set the brand of this {@link NewSoda} instance and return the same instance. + * + * @param brand The brand of this {@link NewSoda} + * @return The same instance of this {@link NewSoda} class + */ + @Nonnull public NewSoda brand( @Nonnull final String brand) { + this.brand = brand; + return this; + } + + /** + * Get brand + * @return brand The brand of this {@link NewSoda} instance. + */ + @Nonnull + public String getBrand() { + return brand; + } + + /** + * Set the brand of this {@link NewSoda} instance. + * + * @param brand The brand of this {@link NewSoda} + */ + public void setBrand( @Nonnull final String brand) { + this.brand = brand; + } + + /** + * Set the zero of this {@link NewSoda} instance and return the same instance. + * + * @param zero The zero of this {@link NewSoda} + * @return The same instance of this {@link NewSoda} class + */ + @Nonnull public NewSoda zero( @Nullable final Boolean zero) { + this.zero = zero; + return this; + } + + /** + * Get zero + * @return zero The zero of this {@link NewSoda} instance. + */ + @Nonnull + public Boolean isZero() { + return zero; + } + + /** + * Set the zero of this {@link NewSoda} instance. + * + * @param zero The zero of this {@link NewSoda} + */ + public void setZero( @Nullable final Boolean zero) { + this.zero = zero; + } + + /** + * Set the since of this {@link NewSoda} instance and return the same instance. + * + * @param since The since of this {@link NewSoda} + * @return The same instance of this {@link NewSoda} class + */ + @Nonnull public NewSoda since( @Nullable final LocalDate since) { + this.since = since; + return this; + } + + /** + * Get since + * @return since The since of this {@link NewSoda} instance. + */ + @Nonnull + public LocalDate getSince() { + return since; + } + + /** + * Set the since of this {@link NewSoda} instance. + * + * @param since The since of this {@link NewSoda} + */ + public void setSince( @Nullable final LocalDate since) { + this.since = since; + } + + /** + * Set the flavor of this {@link NewSoda} instance and return the same instance. + * + * @param flavor The flavor of this {@link NewSoda} + * @return The same instance of this {@link NewSoda} class + */ + @Nonnull public NewSoda flavor( @Nonnull final String flavor) { + this.flavor = flavor; + return this; + } + + /** + * Get flavor + * @return flavor The flavor of this {@link NewSoda} instance. + */ + @Nonnull + public String getFlavor() { + return flavor; + } + + /** + * Set the flavor of this {@link NewSoda} instance. + * + * @param flavor The flavor of this {@link NewSoda} + */ + public void setFlavor( @Nonnull final String flavor) { + this.flavor = flavor; + } + + /** + * Set the price of this {@link NewSoda} instance and return the same instance. + * + * @param price The price of this {@link NewSoda} + * @return The same instance of this {@link NewSoda} class + */ + @Nonnull public NewSoda price( @Nonnull final Float price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price The price of this {@link NewSoda} instance. + */ + @Nonnull + public Float getPrice() { + return price; + } + + /** + * Set the price of this {@link NewSoda} instance. + * + * @param price The price of this {@link NewSoda} + */ + public void setPrice( @Nonnull final Float price) { + this.price = price; + } + + /** + * Get the names of the unrecognizable properties of the {@link NewSoda}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link NewSoda} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("NewSoda has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link NewSoda} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( name != null ) declaredFields.put("name", name); + if( brand != null ) declaredFields.put("brand", brand); + if( zero != null ) declaredFields.put("zero", zero); + if( since != null ) declaredFields.put("since", since); + if( flavor != null ) declaredFields.put("flavor", flavor); + if( price != null ) declaredFields.put("price", price); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link NewSoda} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final NewSoda newSoda = (NewSoda) o; + return Objects.equals(this.cloudSdkCustomFields, newSoda.cloudSdkCustomFields) && + Objects.equals(this.name, newSoda.name) && + Objects.equals(this.brand, newSoda.brand) && + Objects.equals(this.zero, newSoda.zero) && + Objects.equals(this.since, newSoda.since) && + Objects.equals(this.flavor, newSoda.flavor) && + Objects.equals(this.price, newSoda.price); + } + + @Override + public int hashCode() { + return Objects.hash(name, brand, zero, since, flavor, price, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class NewSoda {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" zero: ").append(toIndentedString(zero)).append("\n"); + sb.append(" since: ").append(toIndentedString(since)).append("\n"); + sb.append(" flavor: ").append(toIndentedString(flavor)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/Soda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/Soda.java new file mode 100644 index 000000000..b0cab12da --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/Soda.java @@ -0,0 +1,481 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Soda Store API + * API for managing sodas in a soda store + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.builder.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Soda + */ +// CHECKSTYLE:OFF +public class Soda +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private Long id; + + @JsonProperty("name") + private String name; + + @JsonProperty("brand") + private String brand; + + @JsonProperty("isAvailable") + private Boolean isAvailable; + + @JsonProperty("flavor") + private String flavor; + + @JsonProperty("price") + private Float price; + + /** + * Gets or Sets diet + */ + public enum DietEnum { + /** + * The SUGAR option of this Soda + */ + SUGAR("sugar"), + + /** + * The ZERO option of this Soda + */ + ZERO("zero"), + + /** + * The LIGHT option of this Soda + */ + LIGHT("light"); + + private String value; + + DietEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * @return The enum value + */ + @JsonValue + @Nonnull public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * @return The enum value as String + */ + @Override + @Nonnull public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * @param value The String value + * @return The enum value of type Soda + */ + @JsonCreator + @Nullable public static DietEnum fromValue(@Nonnull final String value) { + for (DietEnum b : DietEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + } + + @JsonProperty("diet") + private DietEnum diet; + + @JsonProperty("embedding") + private float[] embedding; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the id of this {@link Soda} instance and return the same instance. + * + * @param id The id of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda id( @Nullable final Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id The id of this {@link Soda} instance. + */ + @Nonnull + public Long getId() { + return id; + } + + /** + * Set the id of this {@link Soda} instance. + * + * @param id The id of this {@link Soda} + */ + public void setId( @Nullable final Long id) { + this.id = id; + } + + /** + * Set the name of this {@link Soda} instance and return the same instance. + * + * @param name The name of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda name( @Nonnull final String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name The name of this {@link Soda} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link Soda} instance. + * + * @param name The name of this {@link Soda} + */ + public void setName( @Nonnull final String name) { + this.name = name; + } + + /** + * Set the brand of this {@link Soda} instance and return the same instance. + * + * @param brand The brand of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda brand( @Nonnull final String brand) { + this.brand = brand; + return this; + } + + /** + * Get brand + * @return brand The brand of this {@link Soda} instance. + */ + @Nonnull + public String getBrand() { + return brand; + } + + /** + * Set the brand of this {@link Soda} instance. + * + * @param brand The brand of this {@link Soda} + */ + public void setBrand( @Nonnull final String brand) { + this.brand = brand; + } + + /** + * Set the isAvailable of this {@link Soda} instance and return the same instance. + * + * @param isAvailable The isAvailable of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda isAvailable( @Nullable final Boolean isAvailable) { + this.isAvailable = isAvailable; + return this; + } + + /** + * Get isAvailable + * @return isAvailable The isAvailable of this {@link Soda} instance. + */ + @Nonnull + public Boolean isAvailable() { + return isAvailable; + } + + /** + * Set the isAvailable of this {@link Soda} instance. + * + * @param isAvailable The isAvailable of this {@link Soda} + */ + public void setIsAvailable( @Nullable final Boolean isAvailable) { + this.isAvailable = isAvailable; + } + + /** + * Set the flavor of this {@link Soda} instance and return the same instance. + * + * @param flavor The flavor of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda flavor( @Nonnull final String flavor) { + this.flavor = flavor; + return this; + } + + /** + * Get flavor + * @return flavor The flavor of this {@link Soda} instance. + */ + @Nonnull + public String getFlavor() { + return flavor; + } + + /** + * Set the flavor of this {@link Soda} instance. + * + * @param flavor The flavor of this {@link Soda} + */ + public void setFlavor( @Nonnull final String flavor) { + this.flavor = flavor; + } + + /** + * Set the price of this {@link Soda} instance and return the same instance. + * + * @param price The price of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda price( @Nonnull final Float price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price The price of this {@link Soda} instance. + */ + @Nonnull + public Float getPrice() { + return price; + } + + /** + * Set the price of this {@link Soda} instance. + * + * @param price The price of this {@link Soda} + */ + public void setPrice( @Nonnull final Float price) { + this.price = price; + } + + /** + * Set the diet of this {@link Soda} instance and return the same instance. + * + * @param diet The diet of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda diet( @Nullable final DietEnum diet) { + this.diet = diet; + return this; + } + + /** + * Get diet + * @return diet The diet of this {@link Soda} instance. + */ + @Nullable + public DietEnum getDiet() { + return diet; + } + + /** + * Set the diet of this {@link Soda} instance. + * + * @param diet The diet of this {@link Soda} + */ + public void setDiet( @Nullable final DietEnum diet) { + this.diet = diet; + } + + /** + * Set the embedding of this {@link Soda} instance and return the same instance. + * + * @param embedding The embedding of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda embedding( @Nonnull final float[] embedding) { + this.embedding = embedding; + return this; + } + + /** + * Get embedding + * @return embedding The embedding of this {@link Soda} instance. + */ + @Nonnull + public float[] getEmbedding() { + return embedding; + } + + /** + * Set the embedding of this {@link Soda} instance. + * + * @param embedding The embedding of this {@link Soda} + */ + public void setEmbedding( @Nonnull final float[] embedding) { + this.embedding = embedding; + } + + /** + * Get the names of the unrecognizable properties of the {@link Soda}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Soda} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("Soda has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Soda} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( id != null ) declaredFields.put("id", id); + if( name != null ) declaredFields.put("name", name); + if( brand != null ) declaredFields.put("brand", brand); + if( isAvailable != null ) declaredFields.put("isAvailable", isAvailable); + if( flavor != null ) declaredFields.put("flavor", flavor); + if( price != null ) declaredFields.put("price", price); + if( diet != null ) declaredFields.put("diet", diet); + if( embedding != null ) declaredFields.put("embedding", embedding); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Soda} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final Soda soda = (Soda) o; + return Objects.equals(this.cloudSdkCustomFields, soda.cloudSdkCustomFields) && + Objects.equals(this.id, soda.id) && + Objects.equals(this.name, soda.name) && + Objects.equals(this.brand, soda.brand) && + Objects.equals(this.isAvailable, soda.isAvailable) && + Objects.equals(this.flavor, soda.flavor) && + Objects.equals(this.price, soda.price) && + Objects.equals(this.diet, soda.diet) && + Arrays.equals(this.embedding, soda.embedding); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, brand, isAvailable, flavor, price, diet, Arrays.hashCode(embedding), cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Soda {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" isAvailable: ").append(toIndentedString(isAvailable)).append("\n"); + sb.append(" flavor: ").append(toIndentedString(flavor)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" diet: ").append(toIndentedString(diet)).append("\n"); + sb.append(" embedding: ").append(toIndentedString(embedding)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/UpdateSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/UpdateSoda.java new file mode 100644 index 000000000..85f725e6a --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/UpdateSoda.java @@ -0,0 +1,349 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Soda Store API + * API for managing sodas in a soda store + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.builder.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.LocalDate; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * UpdateSoda + */ +// CHECKSTYLE:OFF +public class UpdateSoda +// CHECKSTYLE:ON +{ + @JsonProperty("name") + private String name; + + @JsonProperty("zero") + private Boolean zero; + + @JsonProperty("since") + private LocalDate since; + + @JsonProperty("brand") + private String brand; + + @JsonProperty("flavor") + private String flavor; + + @JsonProperty("price") + private Float price; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the name of this {@link UpdateSoda} instance and return the same instance. + * + * @param name The name of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda name( @Nullable final String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name The name of this {@link UpdateSoda} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link UpdateSoda} instance. + * + * @param name The name of this {@link UpdateSoda} + */ + public void setName( @Nullable final String name) { + this.name = name; + } + + /** + * Set the zero of this {@link UpdateSoda} instance and return the same instance. + * + * @param zero The zero of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda zero( @Nullable final Boolean zero) { + this.zero = zero; + return this; + } + + /** + * Get zero + * @return zero The zero of this {@link UpdateSoda} instance. + */ + @Nonnull + public Boolean isZero() { + return zero; + } + + /** + * Set the zero of this {@link UpdateSoda} instance. + * + * @param zero The zero of this {@link UpdateSoda} + */ + public void setZero( @Nullable final Boolean zero) { + this.zero = zero; + } + + /** + * Set the since of this {@link UpdateSoda} instance and return the same instance. + * + * @param since The since of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda since( @Nullable final LocalDate since) { + this.since = since; + return this; + } + + /** + * Get since + * @return since The since of this {@link UpdateSoda} instance. + */ + @Nonnull + public LocalDate getSince() { + return since; + } + + /** + * Set the since of this {@link UpdateSoda} instance. + * + * @param since The since of this {@link UpdateSoda} + */ + public void setSince( @Nullable final LocalDate since) { + this.since = since; + } + + /** + * Set the brand of this {@link UpdateSoda} instance and return the same instance. + * + * @param brand The brand of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda brand( @Nullable final String brand) { + this.brand = brand; + return this; + } + + /** + * Get brand + * @return brand The brand of this {@link UpdateSoda} instance. + */ + @Nonnull + public String getBrand() { + return brand; + } + + /** + * Set the brand of this {@link UpdateSoda} instance. + * + * @param brand The brand of this {@link UpdateSoda} + */ + public void setBrand( @Nullable final String brand) { + this.brand = brand; + } + + /** + * Set the flavor of this {@link UpdateSoda} instance and return the same instance. + * + * @param flavor The flavor of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda flavor( @Nullable final String flavor) { + this.flavor = flavor; + return this; + } + + /** + * Get flavor + * @return flavor The flavor of this {@link UpdateSoda} instance. + */ + @Nonnull + public String getFlavor() { + return flavor; + } + + /** + * Set the flavor of this {@link UpdateSoda} instance. + * + * @param flavor The flavor of this {@link UpdateSoda} + */ + public void setFlavor( @Nullable final String flavor) { + this.flavor = flavor; + } + + /** + * Set the price of this {@link UpdateSoda} instance and return the same instance. + * + * @param price The price of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda price( @Nullable final Float price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price The price of this {@link UpdateSoda} instance. + */ + @Nonnull + public Float getPrice() { + return price; + } + + /** + * Set the price of this {@link UpdateSoda} instance. + * + * @param price The price of this {@link UpdateSoda} + */ + public void setPrice( @Nullable final Float price) { + this.price = price; + } + + /** + * Get the names of the unrecognizable properties of the {@link UpdateSoda}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link UpdateSoda} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("UpdateSoda has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link UpdateSoda} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( name != null ) declaredFields.put("name", name); + if( zero != null ) declaredFields.put("zero", zero); + if( since != null ) declaredFields.put("since", since); + if( brand != null ) declaredFields.put("brand", brand); + if( flavor != null ) declaredFields.put("flavor", flavor); + if( price != null ) declaredFields.put("price", price); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link UpdateSoda} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final UpdateSoda updateSoda = (UpdateSoda) o; + return Objects.equals(this.cloudSdkCustomFields, updateSoda.cloudSdkCustomFields) && + Objects.equals(this.name, updateSoda.name) && + Objects.equals(this.zero, updateSoda.zero) && + Objects.equals(this.since, updateSoda.since) && + Objects.equals(this.brand, updateSoda.brand) && + Objects.equals(this.flavor, updateSoda.flavor) && + Objects.equals(this.price, updateSoda.price); + } + + @Override + public int hashCode() { + return Objects.hash(name, zero, since, brand, flavor, price, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSoda {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" zero: ").append(toIndentedString(zero)).append("\n"); + sb.append(" since: ").append(toIndentedString(since)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" flavor: ").append(toIndentedString(flavor)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/input/sodastore.json b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/input/sodastore.json new file mode 100644 index 000000000..f10d46994 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/input/sodastore.json @@ -0,0 +1,235 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Soda Store API", + "version": "1.0.0", + "description": "API for managing sodas in a soda store" + }, + "paths": { + "/sodas": { + "get": { + "summary": "Get a list of all sodas", + "x-sap-cloud-sdk-api-name": "AwesomeSodas", + "operationId": "getSodas", + "responses": { + "200": { + "description": "A list of sodas", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Soda" + } + } + } + } + } + } + }, + "post": { + "summary": "Add a new soda to the store", + "x-sap-cloud-sdk-api-name": "AwesomeSoda", + "operationId": "addSoda", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NewSoda" + } + } + } + }, + "responses": { + "201": { + "description": "The newly added soda", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Soda" + } + } + } + } + } + } + }, + "/sodas/{sodaId}": { + "get": { + "summary": "Get details of a specific soda", + "operationId": "getSodaById", + "parameters": [ + { + "name": "sodaId", + "in": "path", + "description": "ID of the soda to retrieve", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "The requested soda", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Soda" + } + } + } + }, + "404": { + "description": "Soda not found" + } + } + }, + "put": { + "summary": "Update details of a specific soda", + "operationId": "updateSodaById", + "parameters": [ + { + "name": "sodaId", + "in": "path", + "description": "ID of the soda to update", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateSoda" + } + } + } + }, + "responses": { + "200": { + "description": "The updated soda", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Soda" + } + } + } + }, + "404": { + "description": "Soda not found" + } + } + }, + "delete": { + "summary": "Delete a specific soda from the store", + "operationId": "deleteSodaById", + "parameters": [ + { + "name": "sodaId", + "in": "path", + "description": "ID of the soda to delete", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "Soda successfully deleted" + }, + "404": { + "description": "Soda not found" + } + } + } + } + }, + "components": { + "schemas": { + "Soda": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "brand": { + "type": "string" + }, + "flavor": { + "type": "string" + }, + "price": { + "type": "number", + "format": "float" + } + }, + "required": ["name", "brand", "flavor", "price"] + }, + "NewSoda": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "brand": { + "type": "string" + }, + "zero": { + "type": "boolean" + }, + "since": { + "type": "string", + "format": "date" + }, + "flavor": { + "type": "string" + }, + "price": { + "type": "number", + "format": "float" + } + }, + "required": ["name", "brand", "flavor", "price"] + }, + "UpdateSoda": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "zero": { + "type": "boolean" + }, + "since": { + "type": "string", + "format": "date" + }, + "brand": { + "type": "string" + }, + "flavor": { + "type": "string" + }, + "price": { + "type": "number", + "format": "float" + } + } + } + } + } +} diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/AwesomeSodaApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/AwesomeSodaApi.java new file mode 100644 index 000000000..3332b8fc8 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/AwesomeSodaApi.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +package com.sap.cloud.sdk.services.apiclassvendorextension.api; + +import com.fasterxml.jackson.core.type.TypeReference; + +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import com.sap.cloud.sdk.services.openapi.apache.OpenApiResponse; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + + +import com.sap.cloud.sdk.services.apiclassvendorextension.model.NewSoda; +import com.sap.cloud.sdk.services.apiclassvendorextension.model.Soda; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.StringJoiner; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; + + +/** + * Soda Store API in version 1.0.0. + *

+ * API for managing sodas in a soda store + */ +public class AwesomeSodaApi extends BaseApi { + + /** + * Instantiates this API class to invoke operations on the Soda Store API + */ + public AwesomeSodaApi() {} + + /** + * Instantiates this API class to invoke operations on the Soda Store API. + * + * @param httpDestination The destination that API should be used with + */ + public AwesomeSodaApi( @Nonnull final Destination httpDestination ) + { + super(httpDestination); + } + + /** + * Instantiates this API class to invoke operations on the Soda Store API based on a given {@link ApiClient}. + * + * @param apiClient + * ApiClient to invoke the API on + */ + public AwesomeSodaApi(@Nonnull final ApiClient apiClient) { + super(apiClient); + } + + + /** + *

Add a new soda to the store + *

+ *

201 - The newly added soda + * @param newSoda + * The value for the parameter newSoda + * @return Soda + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Soda addSoda(@Nonnull final NewSoda newSoda) throws OpenApiRequestException { + + // verify the required parameter 'newSoda' is set + if (newSoda == null) { + throw new OpenApiRequestException("Missing the required parameter 'newSoda' when calling addSoda") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas"; + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + newSoda, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + } diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/AwesomeSodasApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/AwesomeSodasApi.java new file mode 100644 index 000000000..832fe451f --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/AwesomeSodasApi.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +package com.sap.cloud.sdk.services.apiclassvendorextension.api; + +import com.fasterxml.jackson.core.type.TypeReference; + +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import com.sap.cloud.sdk.services.openapi.apache.OpenApiResponse; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + + +import com.sap.cloud.sdk.services.apiclassvendorextension.model.Soda; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.StringJoiner; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; + + +/** + * Soda Store API in version 1.0.0. + *

+ * API for managing sodas in a soda store + */ +public class AwesomeSodasApi extends BaseApi { + + /** + * Instantiates this API class to invoke operations on the Soda Store API + */ + public AwesomeSodasApi() {} + + /** + * Instantiates this API class to invoke operations on the Soda Store API. + * + * @param httpDestination The destination that API should be used with + */ + public AwesomeSodasApi( @Nonnull final Destination httpDestination ) + { + super(httpDestination); + } + + /** + * Instantiates this API class to invoke operations on the Soda Store API based on a given {@link ApiClient}. + * + * @param apiClient + * ApiClient to invoke the API on + */ + public AwesomeSodasApi(@Nonnull final ApiClient apiClient) { + super(apiClient); + } + + + /** + *

Get a list of all sodas + *

+ *

200 - A list of sodas + * @return List<Soda> + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public List getSodas() throws OpenApiRequestException { + + // create path and map variables + final String localVarPath = "/sodas"; + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference> localVarReturnType = new TypeReference>() {}; + + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + } diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/DefaultApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/DefaultApi.java new file mode 100644 index 000000000..689435cd8 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/DefaultApi.java @@ -0,0 +1,244 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +package com.sap.cloud.sdk.services.apiclassvendorextension.api; + +import com.fasterxml.jackson.core.type.TypeReference; + +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import com.sap.cloud.sdk.services.openapi.apache.OpenApiResponse; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + + +import com.sap.cloud.sdk.services.apiclassvendorextension.model.Soda; +import com.sap.cloud.sdk.services.apiclassvendorextension.model.UpdateSoda; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.StringJoiner; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; + + +/** + * Soda Store API in version 1.0.0. + *

+ * API for managing sodas in a soda store + */ +public class DefaultApi extends BaseApi { + + /** + * Instantiates this API class to invoke operations on the Soda Store API + */ + public DefaultApi() {} + + /** + * Instantiates this API class to invoke operations on the Soda Store API. + * + * @param httpDestination The destination that API should be used with + */ + public DefaultApi( @Nonnull final Destination httpDestination ) + { + super(httpDestination); + } + + /** + * Instantiates this API class to invoke operations on the Soda Store API based on a given {@link ApiClient}. + * + * @param apiClient + * ApiClient to invoke the API on + */ + public DefaultApi(@Nonnull final ApiClient apiClient) { + super(apiClient); + } + + + /** + *

Delete a specific soda from the store + *

+ *

204 - Soda successfully deleted + *

404 - Soda not found + * @param sodaId + * ID of the soda to delete + * @return An OpenApiResponse containing the status code of the HttpResponse. + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public OpenApiResponse deleteSodaById(@Nonnull final Long sodaId) throws OpenApiRequestException { + + // verify the required parameter 'sodaId' is set + if (sodaId == null) { + throw new OpenApiRequestException("Missing the required parameter 'sodaId' when calling deleteSodaById") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas/{sodaId}" + .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + + /** + *

Get details of a specific soda + *

+ *

200 - The requested soda + *

404 - Soda not found + * @param sodaId + * ID of the soda to retrieve + * @return Soda + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Soda getSodaById(@Nonnull final Long sodaId) throws OpenApiRequestException { + + // verify the required parameter 'sodaId' is set + if (sodaId == null) { + throw new OpenApiRequestException("Missing the required parameter 'sodaId' when calling getSodaById") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas/{sodaId}" + .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + + /** + *

Update details of a specific soda + *

+ *

200 - The updated soda + *

404 - Soda not found + * @param sodaId + * ID of the soda to update + * @param updateSoda + * The value for the parameter updateSoda + * @return Soda + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Soda updateSodaById(@Nonnull final Long sodaId, @Nonnull final UpdateSoda updateSoda) throws OpenApiRequestException { + + // verify the required parameter 'sodaId' is set + if (sodaId == null) { + throw new OpenApiRequestException("Missing the required parameter 'sodaId' when calling updateSodaById") + .statusCode(400); + } + + // verify the required parameter 'updateSoda' is set + if (updateSoda == null) { + throw new OpenApiRequestException("Missing the required parameter 'updateSoda' when calling updateSodaById") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas/{sodaId}" + .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + updateSoda, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + } diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/NewSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/NewSoda.java new file mode 100644 index 000000000..6bbd8468d --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/NewSoda.java @@ -0,0 +1,349 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Soda Store API + * API for managing sodas in a soda store + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.apiclassvendorextension.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.LocalDate; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * NewSoda + */ +// CHECKSTYLE:OFF +public class NewSoda +// CHECKSTYLE:ON +{ + @JsonProperty("name") + private String name; + + @JsonProperty("brand") + private String brand; + + @JsonProperty("zero") + private Boolean zero; + + @JsonProperty("since") + private LocalDate since; + + @JsonProperty("flavor") + private String flavor; + + @JsonProperty("price") + private Float price; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the name of this {@link NewSoda} instance and return the same instance. + * + * @param name The name of this {@link NewSoda} + * @return The same instance of this {@link NewSoda} class + */ + @Nonnull public NewSoda name( @Nonnull final String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name The name of this {@link NewSoda} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link NewSoda} instance. + * + * @param name The name of this {@link NewSoda} + */ + public void setName( @Nonnull final String name) { + this.name = name; + } + + /** + * Set the brand of this {@link NewSoda} instance and return the same instance. + * + * @param brand The brand of this {@link NewSoda} + * @return The same instance of this {@link NewSoda} class + */ + @Nonnull public NewSoda brand( @Nonnull final String brand) { + this.brand = brand; + return this; + } + + /** + * Get brand + * @return brand The brand of this {@link NewSoda} instance. + */ + @Nonnull + public String getBrand() { + return brand; + } + + /** + * Set the brand of this {@link NewSoda} instance. + * + * @param brand The brand of this {@link NewSoda} + */ + public void setBrand( @Nonnull final String brand) { + this.brand = brand; + } + + /** + * Set the zero of this {@link NewSoda} instance and return the same instance. + * + * @param zero The zero of this {@link NewSoda} + * @return The same instance of this {@link NewSoda} class + */ + @Nonnull public NewSoda zero( @Nullable final Boolean zero) { + this.zero = zero; + return this; + } + + /** + * Get zero + * @return zero The zero of this {@link NewSoda} instance. + */ + @Nonnull + public Boolean isZero() { + return zero; + } + + /** + * Set the zero of this {@link NewSoda} instance. + * + * @param zero The zero of this {@link NewSoda} + */ + public void setZero( @Nullable final Boolean zero) { + this.zero = zero; + } + + /** + * Set the since of this {@link NewSoda} instance and return the same instance. + * + * @param since The since of this {@link NewSoda} + * @return The same instance of this {@link NewSoda} class + */ + @Nonnull public NewSoda since( @Nullable final LocalDate since) { + this.since = since; + return this; + } + + /** + * Get since + * @return since The since of this {@link NewSoda} instance. + */ + @Nonnull + public LocalDate getSince() { + return since; + } + + /** + * Set the since of this {@link NewSoda} instance. + * + * @param since The since of this {@link NewSoda} + */ + public void setSince( @Nullable final LocalDate since) { + this.since = since; + } + + /** + * Set the flavor of this {@link NewSoda} instance and return the same instance. + * + * @param flavor The flavor of this {@link NewSoda} + * @return The same instance of this {@link NewSoda} class + */ + @Nonnull public NewSoda flavor( @Nonnull final String flavor) { + this.flavor = flavor; + return this; + } + + /** + * Get flavor + * @return flavor The flavor of this {@link NewSoda} instance. + */ + @Nonnull + public String getFlavor() { + return flavor; + } + + /** + * Set the flavor of this {@link NewSoda} instance. + * + * @param flavor The flavor of this {@link NewSoda} + */ + public void setFlavor( @Nonnull final String flavor) { + this.flavor = flavor; + } + + /** + * Set the price of this {@link NewSoda} instance and return the same instance. + * + * @param price The price of this {@link NewSoda} + * @return The same instance of this {@link NewSoda} class + */ + @Nonnull public NewSoda price( @Nonnull final Float price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price The price of this {@link NewSoda} instance. + */ + @Nonnull + public Float getPrice() { + return price; + } + + /** + * Set the price of this {@link NewSoda} instance. + * + * @param price The price of this {@link NewSoda} + */ + public void setPrice( @Nonnull final Float price) { + this.price = price; + } + + /** + * Get the names of the unrecognizable properties of the {@link NewSoda}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link NewSoda} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("NewSoda has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link NewSoda} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( name != null ) declaredFields.put("name", name); + if( brand != null ) declaredFields.put("brand", brand); + if( zero != null ) declaredFields.put("zero", zero); + if( since != null ) declaredFields.put("since", since); + if( flavor != null ) declaredFields.put("flavor", flavor); + if( price != null ) declaredFields.put("price", price); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link NewSoda} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final NewSoda newSoda = (NewSoda) o; + return Objects.equals(this.cloudSdkCustomFields, newSoda.cloudSdkCustomFields) && + Objects.equals(this.name, newSoda.name) && + Objects.equals(this.brand, newSoda.brand) && + Objects.equals(this.zero, newSoda.zero) && + Objects.equals(this.since, newSoda.since) && + Objects.equals(this.flavor, newSoda.flavor) && + Objects.equals(this.price, newSoda.price); + } + + @Override + public int hashCode() { + return Objects.hash(name, brand, zero, since, flavor, price, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class NewSoda {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" zero: ").append(toIndentedString(zero)).append("\n"); + sb.append(" since: ").append(toIndentedString(since)).append("\n"); + sb.append(" flavor: ").append(toIndentedString(flavor)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/Soda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/Soda.java new file mode 100644 index 000000000..b0159f9aa --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/Soda.java @@ -0,0 +1,313 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Soda Store API + * API for managing sodas in a soda store + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.apiclassvendorextension.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Soda + */ +// CHECKSTYLE:OFF +public class Soda +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private Long id; + + @JsonProperty("name") + private String name; + + @JsonProperty("brand") + private String brand; + + @JsonProperty("flavor") + private String flavor; + + @JsonProperty("price") + private Float price; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the id of this {@link Soda} instance and return the same instance. + * + * @param id The id of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda id( @Nullable final Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id The id of this {@link Soda} instance. + */ + @Nonnull + public Long getId() { + return id; + } + + /** + * Set the id of this {@link Soda} instance. + * + * @param id The id of this {@link Soda} + */ + public void setId( @Nullable final Long id) { + this.id = id; + } + + /** + * Set the name of this {@link Soda} instance and return the same instance. + * + * @param name The name of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda name( @Nonnull final String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name The name of this {@link Soda} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link Soda} instance. + * + * @param name The name of this {@link Soda} + */ + public void setName( @Nonnull final String name) { + this.name = name; + } + + /** + * Set the brand of this {@link Soda} instance and return the same instance. + * + * @param brand The brand of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda brand( @Nonnull final String brand) { + this.brand = brand; + return this; + } + + /** + * Get brand + * @return brand The brand of this {@link Soda} instance. + */ + @Nonnull + public String getBrand() { + return brand; + } + + /** + * Set the brand of this {@link Soda} instance. + * + * @param brand The brand of this {@link Soda} + */ + public void setBrand( @Nonnull final String brand) { + this.brand = brand; + } + + /** + * Set the flavor of this {@link Soda} instance and return the same instance. + * + * @param flavor The flavor of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda flavor( @Nonnull final String flavor) { + this.flavor = flavor; + return this; + } + + /** + * Get flavor + * @return flavor The flavor of this {@link Soda} instance. + */ + @Nonnull + public String getFlavor() { + return flavor; + } + + /** + * Set the flavor of this {@link Soda} instance. + * + * @param flavor The flavor of this {@link Soda} + */ + public void setFlavor( @Nonnull final String flavor) { + this.flavor = flavor; + } + + /** + * Set the price of this {@link Soda} instance and return the same instance. + * + * @param price The price of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda price( @Nonnull final Float price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price The price of this {@link Soda} instance. + */ + @Nonnull + public Float getPrice() { + return price; + } + + /** + * Set the price of this {@link Soda} instance. + * + * @param price The price of this {@link Soda} + */ + public void setPrice( @Nonnull final Float price) { + this.price = price; + } + + /** + * Get the names of the unrecognizable properties of the {@link Soda}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Soda} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("Soda has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Soda} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( id != null ) declaredFields.put("id", id); + if( name != null ) declaredFields.put("name", name); + if( brand != null ) declaredFields.put("brand", brand); + if( flavor != null ) declaredFields.put("flavor", flavor); + if( price != null ) declaredFields.put("price", price); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Soda} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final Soda soda = (Soda) o; + return Objects.equals(this.cloudSdkCustomFields, soda.cloudSdkCustomFields) && + Objects.equals(this.id, soda.id) && + Objects.equals(this.name, soda.name) && + Objects.equals(this.brand, soda.brand) && + Objects.equals(this.flavor, soda.flavor) && + Objects.equals(this.price, soda.price); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, brand, flavor, price, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Soda {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" flavor: ").append(toIndentedString(flavor)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/UpdateSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/UpdateSoda.java new file mode 100644 index 000000000..65139c68c --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/UpdateSoda.java @@ -0,0 +1,349 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Soda Store API + * API for managing sodas in a soda store + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.apiclassvendorextension.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.LocalDate; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * UpdateSoda + */ +// CHECKSTYLE:OFF +public class UpdateSoda +// CHECKSTYLE:ON +{ + @JsonProperty("name") + private String name; + + @JsonProperty("zero") + private Boolean zero; + + @JsonProperty("since") + private LocalDate since; + + @JsonProperty("brand") + private String brand; + + @JsonProperty("flavor") + private String flavor; + + @JsonProperty("price") + private Float price; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the name of this {@link UpdateSoda} instance and return the same instance. + * + * @param name The name of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda name( @Nullable final String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name The name of this {@link UpdateSoda} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link UpdateSoda} instance. + * + * @param name The name of this {@link UpdateSoda} + */ + public void setName( @Nullable final String name) { + this.name = name; + } + + /** + * Set the zero of this {@link UpdateSoda} instance and return the same instance. + * + * @param zero The zero of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda zero( @Nullable final Boolean zero) { + this.zero = zero; + return this; + } + + /** + * Get zero + * @return zero The zero of this {@link UpdateSoda} instance. + */ + @Nonnull + public Boolean isZero() { + return zero; + } + + /** + * Set the zero of this {@link UpdateSoda} instance. + * + * @param zero The zero of this {@link UpdateSoda} + */ + public void setZero( @Nullable final Boolean zero) { + this.zero = zero; + } + + /** + * Set the since of this {@link UpdateSoda} instance and return the same instance. + * + * @param since The since of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda since( @Nullable final LocalDate since) { + this.since = since; + return this; + } + + /** + * Get since + * @return since The since of this {@link UpdateSoda} instance. + */ + @Nonnull + public LocalDate getSince() { + return since; + } + + /** + * Set the since of this {@link UpdateSoda} instance. + * + * @param since The since of this {@link UpdateSoda} + */ + public void setSince( @Nullable final LocalDate since) { + this.since = since; + } + + /** + * Set the brand of this {@link UpdateSoda} instance and return the same instance. + * + * @param brand The brand of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda brand( @Nullable final String brand) { + this.brand = brand; + return this; + } + + /** + * Get brand + * @return brand The brand of this {@link UpdateSoda} instance. + */ + @Nonnull + public String getBrand() { + return brand; + } + + /** + * Set the brand of this {@link UpdateSoda} instance. + * + * @param brand The brand of this {@link UpdateSoda} + */ + public void setBrand( @Nullable final String brand) { + this.brand = brand; + } + + /** + * Set the flavor of this {@link UpdateSoda} instance and return the same instance. + * + * @param flavor The flavor of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda flavor( @Nullable final String flavor) { + this.flavor = flavor; + return this; + } + + /** + * Get flavor + * @return flavor The flavor of this {@link UpdateSoda} instance. + */ + @Nonnull + public String getFlavor() { + return flavor; + } + + /** + * Set the flavor of this {@link UpdateSoda} instance. + * + * @param flavor The flavor of this {@link UpdateSoda} + */ + public void setFlavor( @Nullable final String flavor) { + this.flavor = flavor; + } + + /** + * Set the price of this {@link UpdateSoda} instance and return the same instance. + * + * @param price The price of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda price( @Nullable final Float price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price The price of this {@link UpdateSoda} instance. + */ + @Nonnull + public Float getPrice() { + return price; + } + + /** + * Set the price of this {@link UpdateSoda} instance. + * + * @param price The price of this {@link UpdateSoda} + */ + public void setPrice( @Nullable final Float price) { + this.price = price; + } + + /** + * Get the names of the unrecognizable properties of the {@link UpdateSoda}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link UpdateSoda} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("UpdateSoda has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link UpdateSoda} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( name != null ) declaredFields.put("name", name); + if( zero != null ) declaredFields.put("zero", zero); + if( since != null ) declaredFields.put("since", since); + if( brand != null ) declaredFields.put("brand", brand); + if( flavor != null ) declaredFields.put("flavor", flavor); + if( price != null ) declaredFields.put("price", price); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link UpdateSoda} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final UpdateSoda updateSoda = (UpdateSoda) o; + return Objects.equals(this.cloudSdkCustomFields, updateSoda.cloudSdkCustomFields) && + Objects.equals(this.name, updateSoda.name) && + Objects.equals(this.zero, updateSoda.zero) && + Objects.equals(this.since, updateSoda.since) && + Objects.equals(this.brand, updateSoda.brand) && + Objects.equals(this.flavor, updateSoda.flavor) && + Objects.equals(this.price, updateSoda.price); + } + + @Override + public int hashCode() { + return Objects.hash(name, zero, since, brand, flavor, price, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSoda {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" zero: ").append(toIndentedString(zero)).append("\n"); + sb.append(" since: ").append(toIndentedString(since)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" flavor: ").append(toIndentedString(flavor)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/input/sodastore.yaml b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/input/sodastore.yaml new file mode 100644 index 000000000..0acd4ad2d --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/input/sodastore.yaml @@ -0,0 +1,157 @@ +openapi: 3.0.0 +info: + title: Soda Store API + version: 1.0.0 + description: API for managing sodas in a soda store + +paths: + /sodas: + get: + summary: Get a list of all sodas + operationId: getSodas + responses: + '200': + description: A list of sodas + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Soda' + + post: + summary: Add a new soda to the store + operationId: addSoda + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NewSoda' + responses: + '201': + description: The newly added soda + content: + application/json: + schema: + $ref: '#/components/schemas/Soda' + + /sodas/{sodaId}: + get: + summary: Get details of a specific soda + operationId: getSodaById + parameters: + - name: sodaId + in: path + description: ID of the soda to retrieve + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: The requested soda + content: + application/json: + schema: + $ref: '#/components/schemas/Soda' + '404': + description: Soda not found + + put: + summary: Update details of a specific soda + operationId: updateSodaById + parameters: + - name: sodaId + in: path + description: ID of the soda to update + required: true + schema: + type: integer + format: int64 + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateSoda' + responses: + '200': + description: The updated soda + content: + application/json: + schema: + $ref: '#/components/schemas/Soda' + '404': + description: Soda not found + + delete: + summary: Delete a specific soda from the store + operationId: deleteSodaById + parameters: + - name: sodaId + in: path + description: ID of the soda to delete + required: true + schema: + type: integer + format: int64 + responses: + '204': + description: Soda successfully deleted + '404': + description: Soda not found + +components: + schemas: + Soda: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + brand: + type: string + flavor: + type: string + price: + type: number + format: float + required: + - name + - brand + - flavor + - price + + NewSoda: + type: object + properties: + name: + type: string + brand: + type: string + flavor: + type: string + price: + type: number + format: float + required: + - name + - brand + - flavor + - price + + UpdateSoda: + type: object + properties: + name: + type: string + brand: + type: string + flavor: + type: string + price: + type: number + format: float diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/DefaultApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/DefaultApi.java new file mode 100644 index 000000000..1db6280c6 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/DefaultApi.java @@ -0,0 +1,347 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +package com.sap.cloud.sdk.services.apiclassvendorextension.api; + +import com.fasterxml.jackson.core.type.TypeReference; + +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import com.sap.cloud.sdk.services.openapi.apache.OpenApiResponse; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + + +import com.sap.cloud.sdk.services.apiclassvendorextension.model.NewSoda; +import com.sap.cloud.sdk.services.apiclassvendorextension.model.Soda; +import com.sap.cloud.sdk.services.apiclassvendorextension.model.UpdateSoda; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.StringJoiner; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; + + +/** + * Soda Store API in version 1.0.0. + *

+ * API for managing sodas in a soda store + */ +public class DefaultApi extends BaseApi { + + /** + * Instantiates this API class to invoke operations on the Soda Store API + */ + public DefaultApi() {} + + /** + * Instantiates this API class to invoke operations on the Soda Store API. + * + * @param httpDestination The destination that API should be used with + */ + public DefaultApi( @Nonnull final Destination httpDestination ) + { + super(httpDestination); + } + + /** + * Instantiates this API class to invoke operations on the Soda Store API based on a given {@link ApiClient}. + * + * @param apiClient + * ApiClient to invoke the API on + */ + public DefaultApi(@Nonnull final ApiClient apiClient) { + super(apiClient); + } + + + /** + *

Add a new soda to the store + *

+ *

201 - The newly added soda + * @param newSoda + * The value for the parameter newSoda + * @return Soda + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Soda addSoda(@Nonnull final NewSoda newSoda) throws OpenApiRequestException { + + // verify the required parameter 'newSoda' is set + if (newSoda == null) { + throw new OpenApiRequestException("Missing the required parameter 'newSoda' when calling addSoda") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas"; + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + newSoda, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + + /** + *

Delete a specific soda from the store + *

+ *

204 - Soda successfully deleted + *

404 - Soda not found + * @param sodaId + * ID of the soda to delete + * @return An OpenApiResponse containing the status code of the HttpResponse. + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public OpenApiResponse deleteSodaById(@Nonnull final Long sodaId) throws OpenApiRequestException { + + // verify the required parameter 'sodaId' is set + if (sodaId == null) { + throw new OpenApiRequestException("Missing the required parameter 'sodaId' when calling deleteSodaById") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas/{sodaId}" + .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + + /** + *

Get details of a specific soda + *

+ *

200 - The requested soda + *

404 - Soda not found + * @param sodaId + * ID of the soda to retrieve + * @return Soda + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Soda getSodaById(@Nonnull final Long sodaId) throws OpenApiRequestException { + + // verify the required parameter 'sodaId' is set + if (sodaId == null) { + throw new OpenApiRequestException("Missing the required parameter 'sodaId' when calling getSodaById") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas/{sodaId}" + .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + + /** + *

Get a list of all sodas + *

+ *

200 - A list of sodas + * @return List<Soda> + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public List getSodas() throws OpenApiRequestException { + + // create path and map variables + final String localVarPath = "/sodas"; + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference> localVarReturnType = new TypeReference>() {}; + + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + + /** + *

Update details of a specific soda + *

+ *

200 - The updated soda + *

404 - Soda not found + * @param sodaId + * ID of the soda to update + * @param updateSoda + * The value for the parameter updateSoda + * @return Soda + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Soda updateSodaById(@Nonnull final Long sodaId, @Nonnull final UpdateSoda updateSoda) throws OpenApiRequestException { + + // verify the required parameter 'sodaId' is set + if (sodaId == null) { + throw new OpenApiRequestException("Missing the required parameter 'sodaId' when calling updateSodaById") + .statusCode(400); + } + + // verify the required parameter 'updateSoda' is set + if (updateSoda == null) { + throw new OpenApiRequestException("Missing the required parameter 'updateSoda' when calling updateSodaById") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas/{sodaId}" + .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + updateSoda, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + } diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/NewSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/NewSoda.java new file mode 100644 index 000000000..bfbecfa18 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/NewSoda.java @@ -0,0 +1,278 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Soda Store API + * API for managing sodas in a soda store + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.apiclassvendorextension.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * NewSoda + */ +// CHECKSTYLE:OFF +public class NewSoda +// CHECKSTYLE:ON +{ + @JsonProperty("name") + private String name; + + @JsonProperty("brand") + private String brand; + + @JsonProperty("flavor") + private String flavor; + + @JsonProperty("price") + private Float price; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the name of this {@link NewSoda} instance and return the same instance. + * + * @param name The name of this {@link NewSoda} + * @return The same instance of this {@link NewSoda} class + */ + @Nonnull public NewSoda name( @Nonnull final String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name The name of this {@link NewSoda} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link NewSoda} instance. + * + * @param name The name of this {@link NewSoda} + */ + public void setName( @Nonnull final String name) { + this.name = name; + } + + /** + * Set the brand of this {@link NewSoda} instance and return the same instance. + * + * @param brand The brand of this {@link NewSoda} + * @return The same instance of this {@link NewSoda} class + */ + @Nonnull public NewSoda brand( @Nonnull final String brand) { + this.brand = brand; + return this; + } + + /** + * Get brand + * @return brand The brand of this {@link NewSoda} instance. + */ + @Nonnull + public String getBrand() { + return brand; + } + + /** + * Set the brand of this {@link NewSoda} instance. + * + * @param brand The brand of this {@link NewSoda} + */ + public void setBrand( @Nonnull final String brand) { + this.brand = brand; + } + + /** + * Set the flavor of this {@link NewSoda} instance and return the same instance. + * + * @param flavor The flavor of this {@link NewSoda} + * @return The same instance of this {@link NewSoda} class + */ + @Nonnull public NewSoda flavor( @Nonnull final String flavor) { + this.flavor = flavor; + return this; + } + + /** + * Get flavor + * @return flavor The flavor of this {@link NewSoda} instance. + */ + @Nonnull + public String getFlavor() { + return flavor; + } + + /** + * Set the flavor of this {@link NewSoda} instance. + * + * @param flavor The flavor of this {@link NewSoda} + */ + public void setFlavor( @Nonnull final String flavor) { + this.flavor = flavor; + } + + /** + * Set the price of this {@link NewSoda} instance and return the same instance. + * + * @param price The price of this {@link NewSoda} + * @return The same instance of this {@link NewSoda} class + */ + @Nonnull public NewSoda price( @Nonnull final Float price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price The price of this {@link NewSoda} instance. + */ + @Nonnull + public Float getPrice() { + return price; + } + + /** + * Set the price of this {@link NewSoda} instance. + * + * @param price The price of this {@link NewSoda} + */ + public void setPrice( @Nonnull final Float price) { + this.price = price; + } + + /** + * Get the names of the unrecognizable properties of the {@link NewSoda}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link NewSoda} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("NewSoda has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link NewSoda} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( name != null ) declaredFields.put("name", name); + if( brand != null ) declaredFields.put("brand", brand); + if( flavor != null ) declaredFields.put("flavor", flavor); + if( price != null ) declaredFields.put("price", price); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link NewSoda} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final NewSoda newSoda = (NewSoda) o; + return Objects.equals(this.cloudSdkCustomFields, newSoda.cloudSdkCustomFields) && + Objects.equals(this.name, newSoda.name) && + Objects.equals(this.brand, newSoda.brand) && + Objects.equals(this.flavor, newSoda.flavor) && + Objects.equals(this.price, newSoda.price); + } + + @Override + public int hashCode() { + return Objects.hash(name, brand, flavor, price, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class NewSoda {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" flavor: ").append(toIndentedString(flavor)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/Soda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/Soda.java new file mode 100644 index 000000000..b0159f9aa --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/Soda.java @@ -0,0 +1,313 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Soda Store API + * API for managing sodas in a soda store + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.apiclassvendorextension.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Soda + */ +// CHECKSTYLE:OFF +public class Soda +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private Long id; + + @JsonProperty("name") + private String name; + + @JsonProperty("brand") + private String brand; + + @JsonProperty("flavor") + private String flavor; + + @JsonProperty("price") + private Float price; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the id of this {@link Soda} instance and return the same instance. + * + * @param id The id of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda id( @Nullable final Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id The id of this {@link Soda} instance. + */ + @Nonnull + public Long getId() { + return id; + } + + /** + * Set the id of this {@link Soda} instance. + * + * @param id The id of this {@link Soda} + */ + public void setId( @Nullable final Long id) { + this.id = id; + } + + /** + * Set the name of this {@link Soda} instance and return the same instance. + * + * @param name The name of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda name( @Nonnull final String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name The name of this {@link Soda} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link Soda} instance. + * + * @param name The name of this {@link Soda} + */ + public void setName( @Nonnull final String name) { + this.name = name; + } + + /** + * Set the brand of this {@link Soda} instance and return the same instance. + * + * @param brand The brand of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda brand( @Nonnull final String brand) { + this.brand = brand; + return this; + } + + /** + * Get brand + * @return brand The brand of this {@link Soda} instance. + */ + @Nonnull + public String getBrand() { + return brand; + } + + /** + * Set the brand of this {@link Soda} instance. + * + * @param brand The brand of this {@link Soda} + */ + public void setBrand( @Nonnull final String brand) { + this.brand = brand; + } + + /** + * Set the flavor of this {@link Soda} instance and return the same instance. + * + * @param flavor The flavor of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda flavor( @Nonnull final String flavor) { + this.flavor = flavor; + return this; + } + + /** + * Get flavor + * @return flavor The flavor of this {@link Soda} instance. + */ + @Nonnull + public String getFlavor() { + return flavor; + } + + /** + * Set the flavor of this {@link Soda} instance. + * + * @param flavor The flavor of this {@link Soda} + */ + public void setFlavor( @Nonnull final String flavor) { + this.flavor = flavor; + } + + /** + * Set the price of this {@link Soda} instance and return the same instance. + * + * @param price The price of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda price( @Nonnull final Float price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price The price of this {@link Soda} instance. + */ + @Nonnull + public Float getPrice() { + return price; + } + + /** + * Set the price of this {@link Soda} instance. + * + * @param price The price of this {@link Soda} + */ + public void setPrice( @Nonnull final Float price) { + this.price = price; + } + + /** + * Get the names of the unrecognizable properties of the {@link Soda}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Soda} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("Soda has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Soda} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( id != null ) declaredFields.put("id", id); + if( name != null ) declaredFields.put("name", name); + if( brand != null ) declaredFields.put("brand", brand); + if( flavor != null ) declaredFields.put("flavor", flavor); + if( price != null ) declaredFields.put("price", price); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Soda} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final Soda soda = (Soda) o; + return Objects.equals(this.cloudSdkCustomFields, soda.cloudSdkCustomFields) && + Objects.equals(this.id, soda.id) && + Objects.equals(this.name, soda.name) && + Objects.equals(this.brand, soda.brand) && + Objects.equals(this.flavor, soda.flavor) && + Objects.equals(this.price, soda.price); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, brand, flavor, price, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Soda {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" flavor: ").append(toIndentedString(flavor)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/UpdateSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/UpdateSoda.java new file mode 100644 index 000000000..84b275fbb --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/UpdateSoda.java @@ -0,0 +1,278 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Soda Store API + * API for managing sodas in a soda store + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.apiclassvendorextension.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * UpdateSoda + */ +// CHECKSTYLE:OFF +public class UpdateSoda +// CHECKSTYLE:ON +{ + @JsonProperty("name") + private String name; + + @JsonProperty("brand") + private String brand; + + @JsonProperty("flavor") + private String flavor; + + @JsonProperty("price") + private Float price; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the name of this {@link UpdateSoda} instance and return the same instance. + * + * @param name The name of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda name( @Nullable final String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name The name of this {@link UpdateSoda} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link UpdateSoda} instance. + * + * @param name The name of this {@link UpdateSoda} + */ + public void setName( @Nullable final String name) { + this.name = name; + } + + /** + * Set the brand of this {@link UpdateSoda} instance and return the same instance. + * + * @param brand The brand of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda brand( @Nullable final String brand) { + this.brand = brand; + return this; + } + + /** + * Get brand + * @return brand The brand of this {@link UpdateSoda} instance. + */ + @Nonnull + public String getBrand() { + return brand; + } + + /** + * Set the brand of this {@link UpdateSoda} instance. + * + * @param brand The brand of this {@link UpdateSoda} + */ + public void setBrand( @Nullable final String brand) { + this.brand = brand; + } + + /** + * Set the flavor of this {@link UpdateSoda} instance and return the same instance. + * + * @param flavor The flavor of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda flavor( @Nullable final String flavor) { + this.flavor = flavor; + return this; + } + + /** + * Get flavor + * @return flavor The flavor of this {@link UpdateSoda} instance. + */ + @Nonnull + public String getFlavor() { + return flavor; + } + + /** + * Set the flavor of this {@link UpdateSoda} instance. + * + * @param flavor The flavor of this {@link UpdateSoda} + */ + public void setFlavor( @Nullable final String flavor) { + this.flavor = flavor; + } + + /** + * Set the price of this {@link UpdateSoda} instance and return the same instance. + * + * @param price The price of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda price( @Nullable final Float price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price The price of this {@link UpdateSoda} instance. + */ + @Nonnull + public Float getPrice() { + return price; + } + + /** + * Set the price of this {@link UpdateSoda} instance. + * + * @param price The price of this {@link UpdateSoda} + */ + public void setPrice( @Nullable final Float price) { + this.price = price; + } + + /** + * Get the names of the unrecognizable properties of the {@link UpdateSoda}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link UpdateSoda} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("UpdateSoda has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link UpdateSoda} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( name != null ) declaredFields.put("name", name); + if( brand != null ) declaredFields.put("brand", brand); + if( flavor != null ) declaredFields.put("flavor", flavor); + if( price != null ) declaredFields.put("price", price); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link UpdateSoda} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final UpdateSoda updateSoda = (UpdateSoda) o; + return Objects.equals(this.cloudSdkCustomFields, updateSoda.cloudSdkCustomFields) && + Objects.equals(this.name, updateSoda.name) && + Objects.equals(this.brand, updateSoda.brand) && + Objects.equals(this.flavor, updateSoda.flavor) && + Objects.equals(this.price, updateSoda.price); + } + + @Override + public int hashCode() { + return Objects.hash(name, brand, flavor, price, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSoda {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" flavor: ").append(toIndentedString(flavor)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/input/sodastore.yaml b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/input/sodastore.yaml new file mode 100644 index 000000000..ec38cf653 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/input/sodastore.yaml @@ -0,0 +1,81 @@ +openapi: 3.0.0 +info: + title: Soda Store API + version: 1.0.0 + description: API for managing sodas in a soda store + +paths: + /sodas/{sodaId}: + get: + summary: Get details of a specific soda + operationId: getSodaById + parameters: + - name: sodaId + in: path + description: ID of the soda to retrieve + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: The requested soda + content: + application/json: + schema: + $ref: '#/components/schemas/Soda' + '404': + $ref: '#/components/responses/NotFound' + '503': + $ref: '#/components/responses/ServiceUnavailable' + +components: + schemas: + Soda: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + brand: + type: string + flavor: + type: string + price: + type: number + format: float + required: + - name + - brand + - flavor + - price + responses: + NotFound: + description: The specified resource was not found + content: + application/json: + schema: + type: object + properties: + message: + type: string + example: Resource not found + ServiceUnavailable: + description: The service is currently unavailable + content: + application/json: + schema: + type: object + properties: + message: + type: string + example: Resource not found + application/xml: + schema: + type: object + properties: + message: + type: string + example: Resource not found \ No newline at end of file diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/api/DefaultApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/api/DefaultApi.java new file mode 100644 index 000000000..56db31293 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/api/DefaultApi.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +package com.sap.cloud.sdk.services.inlineobject.api; + +import com.fasterxml.jackson.core.type.TypeReference; + +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import com.sap.cloud.sdk.services.openapi.apache.OpenApiResponse; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + + +import com.sap.cloud.sdk.services.inlineobject.model.NotFound; +import com.sap.cloud.sdk.services.inlineobject.model.ServiceUnavailableApplicationJson; +import com.sap.cloud.sdk.services.inlineobject.model.ServiceUnavailableApplicationXml; +import com.sap.cloud.sdk.services.inlineobject.model.Soda; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.StringJoiner; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; + + +/** + * Soda Store API in version 1.0.0. + *

+ * API for managing sodas in a soda store + */ +public class DefaultApi extends BaseApi { + + /** + * Instantiates this API class to invoke operations on the Soda Store API + */ + public DefaultApi() {} + + /** + * Instantiates this API class to invoke operations on the Soda Store API. + * + * @param httpDestination The destination that API should be used with + */ + public DefaultApi( @Nonnull final Destination httpDestination ) + { + super(httpDestination); + } + + /** + * Instantiates this API class to invoke operations on the Soda Store API based on a given {@link ApiClient}. + * + * @param apiClient + * ApiClient to invoke the API on + */ + public DefaultApi(@Nonnull final ApiClient apiClient) { + super(apiClient); + } + + + /** + *

Get details of a specific soda + *

+ *

200 - The requested soda + *

404 - The specified resource was not found + *

503 - The service is currently unavailable + * @param sodaId + * ID of the soda to retrieve + * @return Soda + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Soda getSodaById(@Nonnull final Long sodaId) throws OpenApiRequestException { + + // verify the required parameter 'sodaId' is set + if (sodaId == null) { + throw new OpenApiRequestException("Missing the required parameter 'sodaId' when calling getSodaById") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas/{sodaId}" + .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + } diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/model/NotFound.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/model/NotFound.java new file mode 100644 index 000000000..d0893c9d6 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/model/NotFound.java @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Soda Store API + * API for managing sodas in a soda store + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.inlineobject.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * NotFound + */ +// CHECKSTYLE:OFF +public class NotFound +// CHECKSTYLE:ON +{ + @JsonProperty("message") + private String message; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the message of this {@link NotFound} instance and return the same instance. + * + * @param message The message of this {@link NotFound} + * @return The same instance of this {@link NotFound} class + */ + @Nonnull public NotFound message( @Nullable final String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message The message of this {@link NotFound} instance. + */ + @Nonnull + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link NotFound} instance. + * + * @param message The message of this {@link NotFound} + */ + public void setMessage( @Nullable final String message) { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link NotFound}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link NotFound} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("NotFound has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link NotFound} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( message != null ) declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link NotFound} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final NotFound notFound = (NotFound) o; + return Objects.equals(this.cloudSdkCustomFields, notFound.cloudSdkCustomFields) && + Objects.equals(this.message, notFound.message); + } + + @Override + public int hashCode() { + return Objects.hash(message, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class NotFound {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/model/ServiceUnavailableApplicationJson.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/model/ServiceUnavailableApplicationJson.java new file mode 100644 index 000000000..2945b681e --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/model/ServiceUnavailableApplicationJson.java @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Soda Store API + * API for managing sodas in a soda store + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.inlineobject.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * ServiceUnavailableApplicationJson + */ +// CHECKSTYLE:OFF +public class ServiceUnavailableApplicationJson +// CHECKSTYLE:ON +{ + @JsonProperty("message") + private String message; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the message of this {@link ServiceUnavailableApplicationJson} instance and return the same instance. + * + * @param message The message of this {@link ServiceUnavailableApplicationJson} + * @return The same instance of this {@link ServiceUnavailableApplicationJson} class + */ + @Nonnull public ServiceUnavailableApplicationJson message( @Nullable final String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message The message of this {@link ServiceUnavailableApplicationJson} instance. + */ + @Nonnull + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link ServiceUnavailableApplicationJson} instance. + * + * @param message The message of this {@link ServiceUnavailableApplicationJson} + */ + public void setMessage( @Nullable final String message) { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link ServiceUnavailableApplicationJson}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ServiceUnavailableApplicationJson} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("ServiceUnavailableApplicationJson has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ServiceUnavailableApplicationJson} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( message != null ) declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ServiceUnavailableApplicationJson} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final ServiceUnavailableApplicationJson serviceUnavailableApplicationJson = (ServiceUnavailableApplicationJson) o; + return Objects.equals(this.cloudSdkCustomFields, serviceUnavailableApplicationJson.cloudSdkCustomFields) && + Objects.equals(this.message, serviceUnavailableApplicationJson.message); + } + + @Override + public int hashCode() { + return Objects.hash(message, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ServiceUnavailableApplicationJson {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/model/ServiceUnavailableApplicationXml.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/model/ServiceUnavailableApplicationXml.java new file mode 100644 index 000000000..7afdf67a4 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/model/ServiceUnavailableApplicationXml.java @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Soda Store API + * API for managing sodas in a soda store + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.inlineobject.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * ServiceUnavailableApplicationXml + */ +// CHECKSTYLE:OFF +public class ServiceUnavailableApplicationXml +// CHECKSTYLE:ON +{ + @JsonProperty("message") + private String message; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the message of this {@link ServiceUnavailableApplicationXml} instance and return the same instance. + * + * @param message The message of this {@link ServiceUnavailableApplicationXml} + * @return The same instance of this {@link ServiceUnavailableApplicationXml} class + */ + @Nonnull public ServiceUnavailableApplicationXml message( @Nullable final String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message The message of this {@link ServiceUnavailableApplicationXml} instance. + */ + @Nonnull + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link ServiceUnavailableApplicationXml} instance. + * + * @param message The message of this {@link ServiceUnavailableApplicationXml} + */ + public void setMessage( @Nullable final String message) { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link ServiceUnavailableApplicationXml}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ServiceUnavailableApplicationXml} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("ServiceUnavailableApplicationXml has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ServiceUnavailableApplicationXml} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( message != null ) declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ServiceUnavailableApplicationXml} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final ServiceUnavailableApplicationXml serviceUnavailableApplicationXml = (ServiceUnavailableApplicationXml) o; + return Objects.equals(this.cloudSdkCustomFields, serviceUnavailableApplicationXml.cloudSdkCustomFields) && + Objects.equals(this.message, serviceUnavailableApplicationXml.message); + } + + @Override + public int hashCode() { + return Objects.hash(message, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ServiceUnavailableApplicationXml {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/model/Soda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/model/Soda.java new file mode 100644 index 000000000..542eb09b3 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/model/Soda.java @@ -0,0 +1,313 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Soda Store API + * API for managing sodas in a soda store + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.inlineobject.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Soda + */ +// CHECKSTYLE:OFF +public class Soda +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private Long id; + + @JsonProperty("name") + private String name; + + @JsonProperty("brand") + private String brand; + + @JsonProperty("flavor") + private String flavor; + + @JsonProperty("price") + private Float price; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the id of this {@link Soda} instance and return the same instance. + * + * @param id The id of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda id( @Nullable final Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id The id of this {@link Soda} instance. + */ + @Nonnull + public Long getId() { + return id; + } + + /** + * Set the id of this {@link Soda} instance. + * + * @param id The id of this {@link Soda} + */ + public void setId( @Nullable final Long id) { + this.id = id; + } + + /** + * Set the name of this {@link Soda} instance and return the same instance. + * + * @param name The name of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda name( @Nonnull final String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name The name of this {@link Soda} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link Soda} instance. + * + * @param name The name of this {@link Soda} + */ + public void setName( @Nonnull final String name) { + this.name = name; + } + + /** + * Set the brand of this {@link Soda} instance and return the same instance. + * + * @param brand The brand of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda brand( @Nonnull final String brand) { + this.brand = brand; + return this; + } + + /** + * Get brand + * @return brand The brand of this {@link Soda} instance. + */ + @Nonnull + public String getBrand() { + return brand; + } + + /** + * Set the brand of this {@link Soda} instance. + * + * @param brand The brand of this {@link Soda} + */ + public void setBrand( @Nonnull final String brand) { + this.brand = brand; + } + + /** + * Set the flavor of this {@link Soda} instance and return the same instance. + * + * @param flavor The flavor of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda flavor( @Nonnull final String flavor) { + this.flavor = flavor; + return this; + } + + /** + * Get flavor + * @return flavor The flavor of this {@link Soda} instance. + */ + @Nonnull + public String getFlavor() { + return flavor; + } + + /** + * Set the flavor of this {@link Soda} instance. + * + * @param flavor The flavor of this {@link Soda} + */ + public void setFlavor( @Nonnull final String flavor) { + this.flavor = flavor; + } + + /** + * Set the price of this {@link Soda} instance and return the same instance. + * + * @param price The price of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda price( @Nonnull final Float price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price The price of this {@link Soda} instance. + */ + @Nonnull + public Float getPrice() { + return price; + } + + /** + * Set the price of this {@link Soda} instance. + * + * @param price The price of this {@link Soda} + */ + public void setPrice( @Nonnull final Float price) { + this.price = price; + } + + /** + * Get the names of the unrecognizable properties of the {@link Soda}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Soda} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("Soda has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Soda} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( id != null ) declaredFields.put("id", id); + if( name != null ) declaredFields.put("name", name); + if( brand != null ) declaredFields.put("brand", brand); + if( flavor != null ) declaredFields.put("flavor", flavor); + if( price != null ) declaredFields.put("price", price); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Soda} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final Soda soda = (Soda) o; + return Objects.equals(this.cloudSdkCustomFields, soda.cloudSdkCustomFields) && + Objects.equals(this.id, soda.id) && + Objects.equals(this.name, soda.name) && + Objects.equals(this.brand, soda.brand) && + Objects.equals(this.flavor, soda.flavor) && + Objects.equals(this.price, soda.price); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, brand, flavor, price, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Soda {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" flavor: ").append(toIndentedString(flavor)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/input/sodastore.json b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/input/sodastore.json new file mode 100644 index 000000000..b629185c6 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/input/sodastore.json @@ -0,0 +1,261 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Soda Store API", + "version": "1.0.0", + "description": "API for managing sodas in a soda store" + }, + "paths": { + "/sodas": { + "get": { + "summary": "Get a list of all sodas", + "x-sap-cloud-sdk-api-name": "AwesomeSodas", + "operationId": "getSodas", + "responses": { + "200": { + "description": "A list of sodas", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Soda" + } + } + } + } + } + } + }, + "post": { + "summary": "Add a new soda to the store", + "x-sap-cloud-sdk-api-name": "AwesomeSoda", + "operationId": "addSoda", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NewSoda" + } + } + } + }, + "responses": { + "201": { + "description": "The newly added soda", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Soda" + } + } + } + } + } + } + }, + "/sodas/{sodaId}": { + "get": { + "summary": "Get details of a specific soda", + "operationId": "getSodaById", + "parameters": [ + { + "name": "sodaId", + "in": "path", + "description": "ID of the soda to retrieve", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "The requested soda", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SodaWithFoo" + } + } + } + }, + "404": { + "description": "Soda not found" + } + } + }, + "put": { + "summary": "Update details of a specific soda", + "operationId": "updateSodaById", + "parameters": [ + { + "name": "sodaId", + "in": "path", + "description": "ID of the soda to update", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateSoda" + } + } + } + }, + "responses": { + "200": { + "description": "The updated soda", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Soda" + } + } + } + }, + "404": { + "description": "Soda not found" + } + } + }, + "delete": { + "summary": "Delete a specific soda from the store", + "operationId": "deleteSodaById", + "parameters": [ + { + "name": "sodaId", + "in": "path", + "description": "ID of the soda to delete", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "Soda successfully deleted" + }, + "404": { + "description": "Soda not found" + } + } + } + } + }, + "components": { + "schemas": { + "Soda": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "brand": { + "type": "string" + }, + "isAvailable": { + "type": "boolean" + }, + "flavor": { + "type": "string" + }, + "price": { + "type": "number", + "format": "float" + }, + "embedding":{ + "type": "array", + "items": { + "type": "number" + } + } + }, + "required": ["name", "brand", "flavor", "price", "embedding"] + }, + "NewSoda": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "brand": { + "type": "string" + }, + "zero": { + "type": "boolean" + }, + "since": { + "type": "string", + "format": "date" + }, + "flavor": { + "type": "string" + }, + "price": { + "type": "number", + "format": "float" + } + }, + "required": ["name", "brand", "flavor", "price"] + }, + "SodaWithFoo": { + "allOf": [ + { + "$ref": "#/components/schemas/Soda" + }, + { + "type": "object", + "properties": { + "foo": { + "type": "integer", + "format": "int64", + "example": 123 + } + } + } + ] + }, + "UpdateSoda": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "zero": { + "type": "boolean" + }, + "since": { + "type": "string", + "format": "date" + }, + "brand": { + "type": "string" + }, + "flavor": { + "type": "string" + }, + "price": { + "type": "number", + "format": "float" + } + } + } + } + } +} diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/api/DefaultApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/api/DefaultApi.java new file mode 100644 index 000000000..1b0de94b7 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/api/DefaultApi.java @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +package com.sap.cloud.sdk.services.builder.api; + +import com.fasterxml.jackson.core.type.TypeReference; + +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import com.sap.cloud.sdk.services.openapi.apache.OpenApiResponse; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + + +import com.sap.cloud.sdk.services.builder.model.Soda; +import com.sap.cloud.sdk.services.builder.model.SodaWithFoo; +import com.sap.cloud.sdk.services.builder.model.UpdateSoda; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.StringJoiner; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; + + +/** + * Soda Store API in version 1.0.0. + *

+ * API for managing sodas in a soda store + */ +public class DefaultApi extends BaseApi { + + /** + * Instantiates this API class to invoke operations on the Soda Store API + */ + public DefaultApi() {} + + /** + * Instantiates this API class to invoke operations on the Soda Store API. + * + * @param httpDestination The destination that API should be used with + */ + public DefaultApi( @Nonnull final Destination httpDestination ) + { + super(httpDestination); + } + + /** + * Instantiates this API class to invoke operations on the Soda Store API based on a given {@link ApiClient}. + * + * @param apiClient + * ApiClient to invoke the API on + */ + public DefaultApi(@Nonnull final ApiClient apiClient) { + super(apiClient); + } + + + /** + *

Delete a specific soda from the store + *

+ *

204 - Soda successfully deleted + *

404 - Soda not found + * @param sodaId + * ID of the soda to delete + * @return An OpenApiResponse containing the status code of the HttpResponse. + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public OpenApiResponse deleteSodaById(@Nonnull final Long sodaId) throws OpenApiRequestException { + + // verify the required parameter 'sodaId' is set + if (sodaId == null) { + throw new OpenApiRequestException("Missing the required parameter 'sodaId' when calling deleteSodaById") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas/{sodaId}" + .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + + /** + *

Get details of a specific soda + *

+ *

200 - The requested soda + *

404 - Soda not found + * @param sodaId + * ID of the soda to retrieve + * @return SodaWithFoo + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public SodaWithFoo getSodaById(@Nonnull final Long sodaId) throws OpenApiRequestException { + + // verify the required parameter 'sodaId' is set + if (sodaId == null) { + throw new OpenApiRequestException("Missing the required parameter 'sodaId' when calling getSodaById") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas/{sodaId}" + .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + + /** + *

Update details of a specific soda + *

+ *

200 - The updated soda + *

404 - Soda not found + * @param sodaId + * ID of the soda to update + * @param updateSoda + * The value for the parameter updateSoda + * @return Soda + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Soda updateSodaById(@Nonnull final Long sodaId, @Nonnull final UpdateSoda updateSoda) throws OpenApiRequestException { + + // verify the required parameter 'sodaId' is set + if (sodaId == null) { + throw new OpenApiRequestException("Missing the required parameter 'sodaId' when calling updateSodaById") + .statusCode(400); + } + + // verify the required parameter 'updateSoda' is set + if (updateSoda == null) { + throw new OpenApiRequestException("Missing the required parameter 'updateSoda' when calling updateSodaById") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas/{sodaId}" + .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + updateSoda, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + } diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/model/Soda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/model/Soda.java new file mode 100644 index 000000000..45a204a0f --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/model/Soda.java @@ -0,0 +1,313 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Soda Store API + * API for managing sodas in a soda store + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.builder.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Soda + */ +// CHECKSTYLE:OFF +public class Soda +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private Long id; + + @JsonProperty("name") + private String name; + + @JsonProperty("brand") + private String brand; + + @JsonProperty("isAvailable") + private Boolean isAvailable; + + @JsonProperty("price") + private Float price; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the id of this {@link Soda} instance and return the same instance. + * + * @param id The id of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda id( @Nullable final Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id The id of this {@link Soda} instance. + */ + @Nonnull + public Long getId() { + return id; + } + + /** + * Set the id of this {@link Soda} instance. + * + * @param id The id of this {@link Soda} + */ + public void setId( @Nullable final Long id) { + this.id = id; + } + + /** + * Set the name of this {@link Soda} instance and return the same instance. + * + * @param name The name of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda name( @Nonnull final String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name The name of this {@link Soda} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link Soda} instance. + * + * @param name The name of this {@link Soda} + */ + public void setName( @Nonnull final String name) { + this.name = name; + } + + /** + * Set the brand of this {@link Soda} instance and return the same instance. + * + * @param brand The brand of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda brand( @Nonnull final String brand) { + this.brand = brand; + return this; + } + + /** + * Get brand + * @return brand The brand of this {@link Soda} instance. + */ + @Nonnull + public String getBrand() { + return brand; + } + + /** + * Set the brand of this {@link Soda} instance. + * + * @param brand The brand of this {@link Soda} + */ + public void setBrand( @Nonnull final String brand) { + this.brand = brand; + } + + /** + * Set the isAvailable of this {@link Soda} instance and return the same instance. + * + * @param isAvailable The isAvailable of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda isAvailable( @Nullable final Boolean isAvailable) { + this.isAvailable = isAvailable; + return this; + } + + /** + * Get isAvailable + * @return isAvailable The isAvailable of this {@link Soda} instance. + */ + @Nonnull + public Boolean isIsAvailable() { + return isAvailable; + } + + /** + * Set the isAvailable of this {@link Soda} instance. + * + * @param isAvailable The isAvailable of this {@link Soda} + */ + public void setIsAvailable( @Nullable final Boolean isAvailable) { + this.isAvailable = isAvailable; + } + + /** + * Set the price of this {@link Soda} instance and return the same instance. + * + * @param price The price of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda price( @Nonnull final Float price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price The price of this {@link Soda} instance. + */ + @Nonnull + public Float getPrice() { + return price; + } + + /** + * Set the price of this {@link Soda} instance. + * + * @param price The price of this {@link Soda} + */ + public void setPrice( @Nonnull final Float price) { + this.price = price; + } + + /** + * Get the names of the unrecognizable properties of the {@link Soda}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Soda} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("Soda has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Soda} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( id != null ) declaredFields.put("id", id); + if( name != null ) declaredFields.put("name", name); + if( brand != null ) declaredFields.put("brand", brand); + if( isAvailable != null ) declaredFields.put("isAvailable", isAvailable); + if( price != null ) declaredFields.put("price", price); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Soda} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final Soda soda = (Soda) o; + return Objects.equals(this.cloudSdkCustomFields, soda.cloudSdkCustomFields) && + Objects.equals(this.id, soda.id) && + Objects.equals(this.name, soda.name) && + Objects.equals(this.brand, soda.brand) && + Objects.equals(this.isAvailable, soda.isAvailable) && + Objects.equals(this.price, soda.price); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, brand, isAvailable, price, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Soda {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" isAvailable: ").append(toIndentedString(isAvailable)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/model/SodaWithFoo.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/model/SodaWithFoo.java new file mode 100644 index 000000000..edccab010 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/model/SodaWithFoo.java @@ -0,0 +1,313 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Soda Store API + * API for managing sodas in a soda store + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.builder.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * SodaWithFoo + */ +// CHECKSTYLE:OFF +public class SodaWithFoo +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private Long id; + + @JsonProperty("name") + private String name; + + @JsonProperty("brand") + private String brand; + + @JsonProperty("isAvailable") + private Boolean isAvailable; + + @JsonProperty("price") + private Float price; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the id of this {@link SodaWithFoo} instance and return the same instance. + * + * @param id The id of this {@link SodaWithFoo} + * @return The same instance of this {@link SodaWithFoo} class + */ + @Nonnull public SodaWithFoo id( @Nullable final Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id The id of this {@link SodaWithFoo} instance. + */ + @Nonnull + public Long getId() { + return id; + } + + /** + * Set the id of this {@link SodaWithFoo} instance. + * + * @param id The id of this {@link SodaWithFoo} + */ + public void setId( @Nullable final Long id) { + this.id = id; + } + + /** + * Set the name of this {@link SodaWithFoo} instance and return the same instance. + * + * @param name The name of this {@link SodaWithFoo} + * @return The same instance of this {@link SodaWithFoo} class + */ + @Nonnull public SodaWithFoo name( @Nonnull final String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name The name of this {@link SodaWithFoo} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link SodaWithFoo} instance. + * + * @param name The name of this {@link SodaWithFoo} + */ + public void setName( @Nonnull final String name) { + this.name = name; + } + + /** + * Set the brand of this {@link SodaWithFoo} instance and return the same instance. + * + * @param brand The brand of this {@link SodaWithFoo} + * @return The same instance of this {@link SodaWithFoo} class + */ + @Nonnull public SodaWithFoo brand( @Nonnull final String brand) { + this.brand = brand; + return this; + } + + /** + * Get brand + * @return brand The brand of this {@link SodaWithFoo} instance. + */ + @Nonnull + public String getBrand() { + return brand; + } + + /** + * Set the brand of this {@link SodaWithFoo} instance. + * + * @param brand The brand of this {@link SodaWithFoo} + */ + public void setBrand( @Nonnull final String brand) { + this.brand = brand; + } + + /** + * Set the isAvailable of this {@link SodaWithFoo} instance and return the same instance. + * + * @param isAvailable The isAvailable of this {@link SodaWithFoo} + * @return The same instance of this {@link SodaWithFoo} class + */ + @Nonnull public SodaWithFoo isAvailable( @Nullable final Boolean isAvailable) { + this.isAvailable = isAvailable; + return this; + } + + /** + * Get isAvailable + * @return isAvailable The isAvailable of this {@link SodaWithFoo} instance. + */ + @Nonnull + public Boolean isIsAvailable() { + return isAvailable; + } + + /** + * Set the isAvailable of this {@link SodaWithFoo} instance. + * + * @param isAvailable The isAvailable of this {@link SodaWithFoo} + */ + public void setIsAvailable( @Nullable final Boolean isAvailable) { + this.isAvailable = isAvailable; + } + + /** + * Set the price of this {@link SodaWithFoo} instance and return the same instance. + * + * @param price The price of this {@link SodaWithFoo} + * @return The same instance of this {@link SodaWithFoo} class + */ + @Nonnull public SodaWithFoo price( @Nonnull final Float price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price The price of this {@link SodaWithFoo} instance. + */ + @Nonnull + public Float getPrice() { + return price; + } + + /** + * Set the price of this {@link SodaWithFoo} instance. + * + * @param price The price of this {@link SodaWithFoo} + */ + public void setPrice( @Nonnull final Float price) { + this.price = price; + } + + /** + * Get the names of the unrecognizable properties of the {@link SodaWithFoo}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SodaWithFoo} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("SodaWithFoo has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SodaWithFoo} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( id != null ) declaredFields.put("id", id); + if( name != null ) declaredFields.put("name", name); + if( brand != null ) declaredFields.put("brand", brand); + if( isAvailable != null ) declaredFields.put("isAvailable", isAvailable); + if( price != null ) declaredFields.put("price", price); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SodaWithFoo} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final SodaWithFoo sodaWithFoo = (SodaWithFoo) o; + return Objects.equals(this.cloudSdkCustomFields, sodaWithFoo.cloudSdkCustomFields) && + Objects.equals(this.id, sodaWithFoo.id) && + Objects.equals(this.name, sodaWithFoo.name) && + Objects.equals(this.brand, sodaWithFoo.brand) && + Objects.equals(this.isAvailable, sodaWithFoo.isAvailable) && + Objects.equals(this.price, sodaWithFoo.price); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, brand, isAvailable, price, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class SodaWithFoo {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" isAvailable: ").append(toIndentedString(isAvailable)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/model/UpdateSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/model/UpdateSoda.java new file mode 100644 index 000000000..40d04555d --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/model/UpdateSoda.java @@ -0,0 +1,314 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * Soda Store API + * API for managing sodas in a soda store + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.builder.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.LocalDate; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * UpdateSoda + */ +// CHECKSTYLE:OFF +public class UpdateSoda +// CHECKSTYLE:ON +{ + @JsonProperty("name") + private String name; + + @JsonProperty("zero") + private Boolean zero; + + @JsonProperty("since") + private LocalDate since; + + @JsonProperty("brand") + private String brand; + + @JsonProperty("price") + private Float price; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the name of this {@link UpdateSoda} instance and return the same instance. + * + * @param name The name of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda name( @Nullable final String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name The name of this {@link UpdateSoda} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link UpdateSoda} instance. + * + * @param name The name of this {@link UpdateSoda} + */ + public void setName( @Nullable final String name) { + this.name = name; + } + + /** + * Set the zero of this {@link UpdateSoda} instance and return the same instance. + * + * @param zero The zero of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda zero( @Nullable final Boolean zero) { + this.zero = zero; + return this; + } + + /** + * Get zero + * @return zero The zero of this {@link UpdateSoda} instance. + */ + @Nonnull + public Boolean isZero() { + return zero; + } + + /** + * Set the zero of this {@link UpdateSoda} instance. + * + * @param zero The zero of this {@link UpdateSoda} + */ + public void setZero( @Nullable final Boolean zero) { + this.zero = zero; + } + + /** + * Set the since of this {@link UpdateSoda} instance and return the same instance. + * + * @param since The since of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda since( @Nullable final LocalDate since) { + this.since = since; + return this; + } + + /** + * Get since + * @return since The since of this {@link UpdateSoda} instance. + */ + @Nonnull + public LocalDate getSince() { + return since; + } + + /** + * Set the since of this {@link UpdateSoda} instance. + * + * @param since The since of this {@link UpdateSoda} + */ + public void setSince( @Nullable final LocalDate since) { + this.since = since; + } + + /** + * Set the brand of this {@link UpdateSoda} instance and return the same instance. + * + * @param brand The brand of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda brand( @Nullable final String brand) { + this.brand = brand; + return this; + } + + /** + * Get brand + * @return brand The brand of this {@link UpdateSoda} instance. + */ + @Nonnull + public String getBrand() { + return brand; + } + + /** + * Set the brand of this {@link UpdateSoda} instance. + * + * @param brand The brand of this {@link UpdateSoda} + */ + public void setBrand( @Nullable final String brand) { + this.brand = brand; + } + + /** + * Set the price of this {@link UpdateSoda} instance and return the same instance. + * + * @param price The price of this {@link UpdateSoda} + * @return The same instance of this {@link UpdateSoda} class + */ + @Nonnull public UpdateSoda price( @Nullable final Float price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price The price of this {@link UpdateSoda} instance. + */ + @Nonnull + public Float getPrice() { + return price; + } + + /** + * Set the price of this {@link UpdateSoda} instance. + * + * @param price The price of this {@link UpdateSoda} + */ + public void setPrice( @Nullable final Float price) { + this.price = price; + } + + /** + * Get the names of the unrecognizable properties of the {@link UpdateSoda}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link UpdateSoda} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("UpdateSoda has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link UpdateSoda} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( name != null ) declaredFields.put("name", name); + if( zero != null ) declaredFields.put("zero", zero); + if( since != null ) declaredFields.put("since", since); + if( brand != null ) declaredFields.put("brand", brand); + if( price != null ) declaredFields.put("price", price); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link UpdateSoda} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final UpdateSoda updateSoda = (UpdateSoda) o; + return Objects.equals(this.cloudSdkCustomFields, updateSoda.cloudSdkCustomFields) && + Objects.equals(this.name, updateSoda.name) && + Objects.equals(this.zero, updateSoda.zero) && + Objects.equals(this.since, updateSoda.since) && + Objects.equals(this.brand, updateSoda.brand) && + Objects.equals(this.price, updateSoda.price); + } + + @Override + public int hashCode() { + return Objects.hash(name, zero, since, brand, price, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSoda {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" zero: ").append(toIndentedString(zero)).append("\n"); + sb.append(" since: ").append(toIndentedString(since)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/input/sodastore.json b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/input/sodastore.json new file mode 100644 index 000000000..e9ca71a1d --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/input/sodastore.json @@ -0,0 +1,292 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "SodaStore API", + "version": "1.0.0", + "description": "API for managing soda products and orders in SodaStore." + }, + "tags": [ + { + "name": "Sodas", + "description": "Everything about our Sodas" + }, + { + "name": "user", + "description": "Operations about user" + }, + { + "name": "Orders", + "description": "Access to Sodastore orders" + } + ], + "components": { + "securitySchemes": { + "apiKeyAuth": { + "type": "apiKey", + "in": "header", + "name": "X-API-Key" + }, + "bearerAuth": { + "type": "http", + "scheme": "bearer" + } + }, + "schemas": { + "Soda": { + "type": "object", + "required": [ + "name", + "brand", + "quantity", + "price" + ], + "properties": { + "name": { + "type": "string", + "example": "Cola" + }, + "brand": { + "type": "string", + "example": "Coca-Cola" + }, + "quantity": { + "type": "integer", + "format": "int32", + "example": 100 + }, + "packaging": { + "type": "string", + "enum": ["glass", "carton", "can"], + "nullable": false + }, + "price": { + "type": "number", + "format": "float", + "example": 1.5 + } + } + }, + "SodaWithId": { + "allOf": [ + { + "$ref": "#/components/schemas/Soda" + }, + { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64", + "example": 123 + } + } + } + ] + }, + "Order": { + "type": "object", + "required": [ + "productId", + "quantity" + ], + "properties": { + "productId": { + "type": "integer", + "format": "int64", + "example": 1 + }, + "quantity": { + "type": "integer", + "format": "int32", + "example": 2 + }, + "totalPrice": { + "type": "number", + "format": "float", + "example": 3.0 + }, + "typelessProperty": { + "description": "Some typeless property, interpreted by the generator as nullable by default (because typeless)" + }, + "nullableProperty": { + "type": "string", + "description": "Some typed property that is deliberately made nullable", + "nullable": true + } + } + }, + "OrderWithTimestamp": { + "allOf": [ + { + "$ref": "#/components/schemas/Order" + }, + { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "date-time" + } + } + } + ] + } + } + }, + "paths": { + "/sodas": { + "get": { + "operationId": "foo.bar.get", + "summary": "Get all soda products", + "tags": [ + "Sodas" + ], + "security": [ + { + "apiKeyAuth": [ ] + } + ], + "responses": { + "200": { + "description": "A list of soda products", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SodaWithId" + } + } + } + } + } + } + }, + "put": { + "summary": "Update a specific soda product by ID", + "tags": [ + "Sodas" + ], + "security": [ + { + "apiKeyAuth": [ ] + } + ], + "requestBody": { + "description": "The updated soda product", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SodaWithId" + } + } + } + }, + "responses": { + "200": { + "description": "The updated soda product", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Soda" + } + } + } + }, + "404": { + "description": "Soda product not found" + }, + "204": { + "description": "Nothing has changed" + } + } + } + }, + "/sodas/{id}": { + "get": { + "summary": "Get a specific soda product by ID", + "tags": [ + "Sodas" + ], + "security": [ + { + "apiKeyAuth": [ ] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of the soda product to retrieve", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "The soda product", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SodaWithId" + } + } + } + }, + "404": { + "description": "Soda product not found" + } + } + } + }, + "/orders": { + "post": { + "operationId": "foo2.bar2.get", + "summary": "Create a new order", + "tags": [ + "Orders" + ], + "security": [ + { + "apiKeyAuth": [ ] + } + ], + "requestBody": { + "description": "The order details", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Order" + } + } + } + }, + "responses": { + "201": { + "description": "The created order", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Order" + } + } + } + } + } + } + } + }, + "security": [ + { + "apiKeyAuth": [ ] + }, + { + "bearerAuth": [ ] + } + ] +} diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/api/OrdersApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/api/OrdersApi.java new file mode 100644 index 000000000..bad9c8eef --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/api/OrdersApi.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +package com.sap.cloud.sdk.services.builder.api; + +import com.fasterxml.jackson.core.type.TypeReference; + +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import com.sap.cloud.sdk.services.openapi.apache.OpenApiResponse; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + + +import com.sap.cloud.sdk.services.builder.model.Order; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.StringJoiner; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; + + +/** + * SodaStore API in version 1.0.0. + *

+ * API for managing soda products and orders in SodaStore. + */ +public class OrdersApi extends BaseApi { + + /** + * Instantiates this API class to invoke operations on the SodaStore API + */ + public OrdersApi() {} + + /** + * Instantiates this API class to invoke operations on the SodaStore API. + * + * @param httpDestination The destination that API should be used with + */ + public OrdersApi( @Nonnull final Destination httpDestination ) + { + super(httpDestination); + } + + /** + * Instantiates this API class to invoke operations on the SodaStore API based on a given {@link ApiClient}. + * + * @param apiClient + * ApiClient to invoke the API on + */ + public OrdersApi(@Nonnull final ApiClient apiClient) { + super(apiClient); + } + + + /** + *

Create a new order + *

+ *

201 - The created order + * @param order + * The order details + * @return Order + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Order get(@Nonnull final Order order) throws OpenApiRequestException { + + // verify the required parameter 'order' is set + if (order == null) { + throw new OpenApiRequestException("Missing the required parameter 'order' when calling get") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/orders"; + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + order, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + } diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/api/SodasApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/api/SodasApi.java new file mode 100644 index 000000000..129b65f5c --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/api/SodasApi.java @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +package com.sap.cloud.sdk.services.builder.api; + +import com.fasterxml.jackson.core.type.TypeReference; + +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import com.sap.cloud.sdk.services.openapi.apache.OpenApiResponse; +import com.sap.cloud.sdk.services.openapi.apache.ApiClient; +import com.sap.cloud.sdk.services.openapi.apache.BaseApi; +import com.sap.cloud.sdk.services.openapi.apache.Pair; + + +import com.sap.cloud.sdk.services.builder.model.Soda; +import com.sap.cloud.sdk.services.builder.model.SodaWithId; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.StringJoiner; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; + + +/** + * SodaStore API in version 1.0.0. + *

+ * API for managing soda products and orders in SodaStore. + */ +public class SodasApi extends BaseApi { + + /** + * Instantiates this API class to invoke operations on the SodaStore API + */ + public SodasApi() {} + + /** + * Instantiates this API class to invoke operations on the SodaStore API. + * + * @param httpDestination The destination that API should be used with + */ + public SodasApi( @Nonnull final Destination httpDestination ) + { + super(httpDestination); + } + + /** + * Instantiates this API class to invoke operations on the SodaStore API based on a given {@link ApiClient}. + * + * @param apiClient + * ApiClient to invoke the API on + */ + public SodasApi(@Nonnull final ApiClient apiClient) { + super(apiClient); + } + + + /** + *

Get all soda products + *

+ *

200 - A list of soda products + * @return List<SodaWithId> + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public List get() throws OpenApiRequestException { + + // create path and map variables + final String localVarPath = "/sodas"; + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference> localVarReturnType = new TypeReference>() {}; + + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + + /** + *

Get a specific soda product by ID + *

+ *

200 - The soda product + *

404 - Soda product not found + * @param id + * ID of the soda product to retrieve + * @return SodaWithId + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public SodaWithId sodasIdGet(@Nonnull final Long id) throws OpenApiRequestException { + + // verify the required parameter 'id' is set + if (id == null) { + throw new OpenApiRequestException("Missing the required parameter 'id' when calling sodasIdGet") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas/{id}" + .replaceAll("\\{" + "id" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(id))); + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + null, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + + /** + *

Update a specific soda product by ID + *

+ *

200 - The updated soda product + *

404 - Soda product not found + *

204 - Nothing has changed + * @param sodaWithId + * The updated soda product + * @return Soda + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nullable + public Soda sodasPut(@Nonnull final SodaWithId sodaWithId) throws OpenApiRequestException { + + // verify the required parameter 'sodaWithId' is set + if (sodaWithId == null) { + throw new OpenApiRequestException("Missing the required parameter 'sodaWithId' when calling sodasPut") + .statusCode(400); + } + + // create path and map variables + final String localVarPath = "/sodas"; + + final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + final List localVarQueryParams = new ArrayList(); + final List localVarCollectionQueryParams = new ArrayList(); + final Map localVarHeaderParams = new HashMap(); + final Map localVarFormParams = new HashMap(); + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = ApiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = ApiClient.selectHeaderContentType(localVarContentTypes); + + final TypeReference localVarReturnType = new TypeReference() {}; + + return apiClient.invokeAPI( + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + sodaWithId, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarReturnType + ); + } + } diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/Order.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/Order.java new file mode 100644 index 000000000..30c807a7b --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/Order.java @@ -0,0 +1,313 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * SodaStore API + * API for managing soda products and orders in SodaStore. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.builder.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Order + */ +// CHECKSTYLE:OFF +public class Order +// CHECKSTYLE:ON +{ + @JsonProperty("productId") + private Long productId; + + @JsonProperty("quantity") + private Integer quantity; + + @JsonProperty("totalPrice") + private Float totalPrice; + + @JsonProperty("typelessProperty") + private Object typelessProperty = null; + + @JsonProperty("nullableProperty") + private String nullableProperty; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the productId of this {@link Order} instance and return the same instance. + * + * @param productId The productId of this {@link Order} + * @return The same instance of this {@link Order} class + */ + @Nonnull public Order productId( @Nonnull final Long productId) { + this.productId = productId; + return this; + } + + /** + * Get productId + * @return productId The productId of this {@link Order} instance. + */ + @Nonnull + public Long getProductId() { + return productId; + } + + /** + * Set the productId of this {@link Order} instance. + * + * @param productId The productId of this {@link Order} + */ + public void setProductId( @Nonnull final Long productId) { + this.productId = productId; + } + + /** + * Set the quantity of this {@link Order} instance and return the same instance. + * + * @param quantity The quantity of this {@link Order} + * @return The same instance of this {@link Order} class + */ + @Nonnull public Order quantity( @Nonnull final Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity The quantity of this {@link Order} instance. + */ + @Nonnull + public Integer getQuantity() { + return quantity; + } + + /** + * Set the quantity of this {@link Order} instance. + * + * @param quantity The quantity of this {@link Order} + */ + public void setQuantity( @Nonnull final Integer quantity) { + this.quantity = quantity; + } + + /** + * Set the totalPrice of this {@link Order} instance and return the same instance. + * + * @param totalPrice The totalPrice of this {@link Order} + * @return The same instance of this {@link Order} class + */ + @Nonnull public Order totalPrice( @Nullable final Float totalPrice) { + this.totalPrice = totalPrice; + return this; + } + + /** + * Get totalPrice + * @return totalPrice The totalPrice of this {@link Order} instance. + */ + @Nonnull + public Float getTotalPrice() { + return totalPrice; + } + + /** + * Set the totalPrice of this {@link Order} instance. + * + * @param totalPrice The totalPrice of this {@link Order} + */ + public void setTotalPrice( @Nullable final Float totalPrice) { + this.totalPrice = totalPrice; + } + + /** + * Set the typelessProperty of this {@link Order} instance and return the same instance. + * + * @param typelessProperty Some typeless property, interpreted by the generator as nullable by default (because typeless) + * @return The same instance of this {@link Order} class + */ + @Nonnull public Order typelessProperty( @Nullable final Object typelessProperty) { + this.typelessProperty = typelessProperty; + return this; + } + + /** + * Some typeless property, interpreted by the generator as nullable by default (because typeless) + * @return typelessProperty The typelessProperty of this {@link Order} instance. + */ + @Nullable + public Object getTypelessProperty() { + return typelessProperty; + } + + /** + * Set the typelessProperty of this {@link Order} instance. + * + * @param typelessProperty Some typeless property, interpreted by the generator as nullable by default (because typeless) + */ + public void setTypelessProperty( @Nullable final Object typelessProperty) { + this.typelessProperty = typelessProperty; + } + + /** + * Set the nullableProperty of this {@link Order} instance and return the same instance. + * + * @param nullableProperty Some typed property that is deliberately made nullable + * @return The same instance of this {@link Order} class + */ + @Nonnull public Order nullableProperty( @Nullable final String nullableProperty) { + this.nullableProperty = nullableProperty; + return this; + } + + /** + * Some typed property that is deliberately made nullable + * @return nullableProperty The nullableProperty of this {@link Order} instance. + */ + @Nullable + public String getNullableProperty() { + return nullableProperty; + } + + /** + * Set the nullableProperty of this {@link Order} instance. + * + * @param nullableProperty Some typed property that is deliberately made nullable + */ + public void setNullableProperty( @Nullable final String nullableProperty) { + this.nullableProperty = nullableProperty; + } + + /** + * Get the names of the unrecognizable properties of the {@link Order}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Order} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("Order has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Order} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( productId != null ) declaredFields.put("productId", productId); + if( quantity != null ) declaredFields.put("quantity", quantity); + if( totalPrice != null ) declaredFields.put("totalPrice", totalPrice); + if( typelessProperty != null ) declaredFields.put("typelessProperty", typelessProperty); + if( nullableProperty != null ) declaredFields.put("nullableProperty", nullableProperty); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Order} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final Order order = (Order) o; + return Objects.equals(this.cloudSdkCustomFields, order.cloudSdkCustomFields) && + Objects.equals(this.productId, order.productId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.totalPrice, order.totalPrice) && + Objects.equals(this.typelessProperty, order.typelessProperty) && + Objects.equals(this.nullableProperty, order.nullableProperty); + } + + @Override + public int hashCode() { + return Objects.hash(productId, quantity, totalPrice, typelessProperty, nullableProperty, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + sb.append(" productId: ").append(toIndentedString(productId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" totalPrice: ").append(toIndentedString(totalPrice)).append("\n"); + sb.append(" typelessProperty: ").append(toIndentedString(typelessProperty)).append("\n"); + sb.append(" nullableProperty: ").append(toIndentedString(nullableProperty)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/OrderWithTimestamp.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/OrderWithTimestamp.java new file mode 100644 index 000000000..b81a924cb --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/OrderWithTimestamp.java @@ -0,0 +1,349 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * SodaStore API + * API for managing soda products and orders in SodaStore. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.builder.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * OrderWithTimestamp + */ +// CHECKSTYLE:OFF +public class OrderWithTimestamp +// CHECKSTYLE:ON +{ + @JsonProperty("productId") + private Long productId; + + @JsonProperty("quantity") + private Integer quantity; + + @JsonProperty("totalPrice") + private Float totalPrice; + + @JsonProperty("typelessProperty") + private Object typelessProperty; + + @JsonProperty("nullableProperty") + private String nullableProperty; + + @JsonProperty("timestamp") + private OffsetDateTime timestamp; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the productId of this {@link OrderWithTimestamp} instance and return the same instance. + * + * @param productId The productId of this {@link OrderWithTimestamp} + * @return The same instance of this {@link OrderWithTimestamp} class + */ + @Nonnull public OrderWithTimestamp productId( @Nonnull final Long productId) { + this.productId = productId; + return this; + } + + /** + * Get productId + * @return productId The productId of this {@link OrderWithTimestamp} instance. + */ + @Nonnull + public Long getProductId() { + return productId; + } + + /** + * Set the productId of this {@link OrderWithTimestamp} instance. + * + * @param productId The productId of this {@link OrderWithTimestamp} + */ + public void setProductId( @Nonnull final Long productId) { + this.productId = productId; + } + + /** + * Set the quantity of this {@link OrderWithTimestamp} instance and return the same instance. + * + * @param quantity The quantity of this {@link OrderWithTimestamp} + * @return The same instance of this {@link OrderWithTimestamp} class + */ + @Nonnull public OrderWithTimestamp quantity( @Nonnull final Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity The quantity of this {@link OrderWithTimestamp} instance. + */ + @Nonnull + public Integer getQuantity() { + return quantity; + } + + /** + * Set the quantity of this {@link OrderWithTimestamp} instance. + * + * @param quantity The quantity of this {@link OrderWithTimestamp} + */ + public void setQuantity( @Nonnull final Integer quantity) { + this.quantity = quantity; + } + + /** + * Set the totalPrice of this {@link OrderWithTimestamp} instance and return the same instance. + * + * @param totalPrice The totalPrice of this {@link OrderWithTimestamp} + * @return The same instance of this {@link OrderWithTimestamp} class + */ + @Nonnull public OrderWithTimestamp totalPrice( @Nullable final Float totalPrice) { + this.totalPrice = totalPrice; + return this; + } + + /** + * Get totalPrice + * @return totalPrice The totalPrice of this {@link OrderWithTimestamp} instance. + */ + @Nonnull + public Float getTotalPrice() { + return totalPrice; + } + + /** + * Set the totalPrice of this {@link OrderWithTimestamp} instance. + * + * @param totalPrice The totalPrice of this {@link OrderWithTimestamp} + */ + public void setTotalPrice( @Nullable final Float totalPrice) { + this.totalPrice = totalPrice; + } + + /** + * Set the typelessProperty of this {@link OrderWithTimestamp} instance and return the same instance. + * + * @param typelessProperty Some typeless property, interpreted by the generator as nullable by default (because typeless) + * @return The same instance of this {@link OrderWithTimestamp} class + */ + @Nonnull public OrderWithTimestamp typelessProperty( @Nullable final Object typelessProperty) { + this.typelessProperty = typelessProperty; + return this; + } + + /** + * Some typeless property, interpreted by the generator as nullable by default (because typeless) + * @return typelessProperty The typelessProperty of this {@link OrderWithTimestamp} instance. + */ + @Nullable + public Object getTypelessProperty() { + return typelessProperty; + } + + /** + * Set the typelessProperty of this {@link OrderWithTimestamp} instance. + * + * @param typelessProperty Some typeless property, interpreted by the generator as nullable by default (because typeless) + */ + public void setTypelessProperty( @Nullable final Object typelessProperty) { + this.typelessProperty = typelessProperty; + } + + /** + * Set the nullableProperty of this {@link OrderWithTimestamp} instance and return the same instance. + * + * @param nullableProperty Some typed property that is deliberately made nullable + * @return The same instance of this {@link OrderWithTimestamp} class + */ + @Nonnull public OrderWithTimestamp nullableProperty( @Nullable final String nullableProperty) { + this.nullableProperty = nullableProperty; + return this; + } + + /** + * Some typed property that is deliberately made nullable + * @return nullableProperty The nullableProperty of this {@link OrderWithTimestamp} instance. + */ + @Nullable + public String getNullableProperty() { + return nullableProperty; + } + + /** + * Set the nullableProperty of this {@link OrderWithTimestamp} instance. + * + * @param nullableProperty Some typed property that is deliberately made nullable + */ + public void setNullableProperty( @Nullable final String nullableProperty) { + this.nullableProperty = nullableProperty; + } + + /** + * Set the timestamp of this {@link OrderWithTimestamp} instance and return the same instance. + * + * @param timestamp The timestamp of this {@link OrderWithTimestamp} + * @return The same instance of this {@link OrderWithTimestamp} class + */ + @Nonnull public OrderWithTimestamp timestamp( @Nullable final OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get timestamp + * @return timestamp The timestamp of this {@link OrderWithTimestamp} instance. + */ + @Nonnull + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * Set the timestamp of this {@link OrderWithTimestamp} instance. + * + * @param timestamp The timestamp of this {@link OrderWithTimestamp} + */ + public void setTimestamp( @Nullable final OffsetDateTime timestamp) { + this.timestamp = timestamp; + } + + /** + * Get the names of the unrecognizable properties of the {@link OrderWithTimestamp}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link OrderWithTimestamp} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("OrderWithTimestamp has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link OrderWithTimestamp} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( productId != null ) declaredFields.put("productId", productId); + if( quantity != null ) declaredFields.put("quantity", quantity); + if( totalPrice != null ) declaredFields.put("totalPrice", totalPrice); + if( typelessProperty != null ) declaredFields.put("typelessProperty", typelessProperty); + if( nullableProperty != null ) declaredFields.put("nullableProperty", nullableProperty); + if( timestamp != null ) declaredFields.put("timestamp", timestamp); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link OrderWithTimestamp} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final OrderWithTimestamp orderWithTimestamp = (OrderWithTimestamp) o; + return Objects.equals(this.cloudSdkCustomFields, orderWithTimestamp.cloudSdkCustomFields) && + Objects.equals(this.productId, orderWithTimestamp.productId) && + Objects.equals(this.quantity, orderWithTimestamp.quantity) && + Objects.equals(this.totalPrice, orderWithTimestamp.totalPrice) && + Objects.equals(this.typelessProperty, orderWithTimestamp.typelessProperty) && + Objects.equals(this.nullableProperty, orderWithTimestamp.nullableProperty) && + Objects.equals(this.timestamp, orderWithTimestamp.timestamp); + } + + @Override + public int hashCode() { + return Objects.hash(productId, quantity, totalPrice, typelessProperty, nullableProperty, timestamp, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class OrderWithTimestamp {\n"); + sb.append(" productId: ").append(toIndentedString(productId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" totalPrice: ").append(toIndentedString(totalPrice)).append("\n"); + sb.append(" typelessProperty: ").append(toIndentedString(typelessProperty)).append("\n"); + sb.append(" nullableProperty: ").append(toIndentedString(nullableProperty)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/Soda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/Soda.java new file mode 100644 index 000000000..862a33733 --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/Soda.java @@ -0,0 +1,372 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * SodaStore API + * API for managing soda products and orders in SodaStore. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.builder.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Soda + */ +// CHECKSTYLE:OFF +public class Soda +// CHECKSTYLE:ON +{ + @JsonProperty("name") + private String name; + + @JsonProperty("brand") + private String brand; + + @JsonProperty("quantity") + private Integer quantity; + + /** + * Gets or Sets packaging + */ + public enum PackagingEnum { + /** + * The GLASS option of this Soda + */ + GLASS("glass"), + + /** + * The CARTON option of this Soda + */ + CARTON("carton"), + + /** + * The CAN option of this Soda + */ + CAN("can"); + + private String value; + + PackagingEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * @return The enum value + */ + @JsonValue + @Nonnull public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * @return The enum value as String + */ + @Override + @Nonnull public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * @param value The String value + * @return The enum value of type Soda + */ + @JsonCreator + @Nonnull public static PackagingEnum fromValue(@Nonnull final String value) { + for (PackagingEnum b : PackagingEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("packaging") + private PackagingEnum packaging; + + @JsonProperty("price") + private Float price; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the name of this {@link Soda} instance and return the same instance. + * + * @param name The name of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda name( @Nonnull final String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name The name of this {@link Soda} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link Soda} instance. + * + * @param name The name of this {@link Soda} + */ + public void setName( @Nonnull final String name) { + this.name = name; + } + + /** + * Set the brand of this {@link Soda} instance and return the same instance. + * + * @param brand The brand of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda brand( @Nonnull final String brand) { + this.brand = brand; + return this; + } + + /** + * Get brand + * @return brand The brand of this {@link Soda} instance. + */ + @Nonnull + public String getBrand() { + return brand; + } + + /** + * Set the brand of this {@link Soda} instance. + * + * @param brand The brand of this {@link Soda} + */ + public void setBrand( @Nonnull final String brand) { + this.brand = brand; + } + + /** + * Set the quantity of this {@link Soda} instance and return the same instance. + * + * @param quantity The quantity of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda quantity( @Nonnull final Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity The quantity of this {@link Soda} instance. + */ + @Nonnull + public Integer getQuantity() { + return quantity; + } + + /** + * Set the quantity of this {@link Soda} instance. + * + * @param quantity The quantity of this {@link Soda} + */ + public void setQuantity( @Nonnull final Integer quantity) { + this.quantity = quantity; + } + + /** + * Set the packaging of this {@link Soda} instance and return the same instance. + * + * @param packaging The packaging of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda packaging( @Nullable final PackagingEnum packaging) { + this.packaging = packaging; + return this; + } + + /** + * Get packaging + * @return packaging The packaging of this {@link Soda} instance. + */ + @Nonnull + public PackagingEnum getPackaging() { + return packaging; + } + + /** + * Set the packaging of this {@link Soda} instance. + * + * @param packaging The packaging of this {@link Soda} + */ + public void setPackaging( @Nullable final PackagingEnum packaging) { + this.packaging = packaging; + } + + /** + * Set the price of this {@link Soda} instance and return the same instance. + * + * @param price The price of this {@link Soda} + * @return The same instance of this {@link Soda} class + */ + @Nonnull public Soda price( @Nonnull final Float price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price The price of this {@link Soda} instance. + */ + @Nonnull + public Float getPrice() { + return price; + } + + /** + * Set the price of this {@link Soda} instance. + * + * @param price The price of this {@link Soda} + */ + public void setPrice( @Nonnull final Float price) { + this.price = price; + } + + /** + * Get the names of the unrecognizable properties of the {@link Soda}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Soda} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("Soda has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Soda} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( name != null ) declaredFields.put("name", name); + if( brand != null ) declaredFields.put("brand", brand); + if( quantity != null ) declaredFields.put("quantity", quantity); + if( packaging != null ) declaredFields.put("packaging", packaging); + if( price != null ) declaredFields.put("price", price); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Soda} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final Soda soda = (Soda) o; + return Objects.equals(this.cloudSdkCustomFields, soda.cloudSdkCustomFields) && + Objects.equals(this.name, soda.name) && + Objects.equals(this.brand, soda.brand) && + Objects.equals(this.quantity, soda.quantity) && + Objects.equals(this.packaging, soda.packaging) && + Objects.equals(this.price, soda.price); + } + + @Override + public int hashCode() { + return Objects.hash(name, brand, quantity, packaging, price, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Soda {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" packaging: ").append(toIndentedString(packaging)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/SodaWithId.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/SodaWithId.java new file mode 100644 index 000000000..70553d4ca --- /dev/null +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/SodaWithId.java @@ -0,0 +1,407 @@ +/* + * Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. + */ + +/* + * SodaStore API + * API for managing soda products and orders in SodaStore. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.cloud.sdk.services.builder.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * SodaWithId + */ +// CHECKSTYLE:OFF +public class SodaWithId +// CHECKSTYLE:ON +{ + @JsonProperty("name") + private String name; + + @JsonProperty("brand") + private String brand; + + @JsonProperty("quantity") + private Integer quantity; + + /** + * Gets or Sets packaging + */ + public enum PackagingEnum { + /** + * The GLASS option of this SodaWithId + */ + GLASS("glass"), + + /** + * The CARTON option of this SodaWithId + */ + CARTON("carton"), + + /** + * The CAN option of this SodaWithId + */ + CAN("can"); + + private String value; + + PackagingEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * @return The enum value + */ + @JsonValue + @Nonnull public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * @return The enum value as String + */ + @Override + @Nonnull public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * @param value The String value + * @return The enum value of type SodaWithId + */ + @JsonCreator + @Nonnull public static PackagingEnum fromValue(@Nonnull final String value) { + for (PackagingEnum b : PackagingEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("packaging") + private PackagingEnum packaging; + + @JsonProperty("price") + private Float price; + + @JsonProperty("id") + private Long id; + + @JsonAnySetter + @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** + * Set the name of this {@link SodaWithId} instance and return the same instance. + * + * @param name The name of this {@link SodaWithId} + * @return The same instance of this {@link SodaWithId} class + */ + @Nonnull public SodaWithId name( @Nonnull final String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name The name of this {@link SodaWithId} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link SodaWithId} instance. + * + * @param name The name of this {@link SodaWithId} + */ + public void setName( @Nonnull final String name) { + this.name = name; + } + + /** + * Set the brand of this {@link SodaWithId} instance and return the same instance. + * + * @param brand The brand of this {@link SodaWithId} + * @return The same instance of this {@link SodaWithId} class + */ + @Nonnull public SodaWithId brand( @Nonnull final String brand) { + this.brand = brand; + return this; + } + + /** + * Get brand + * @return brand The brand of this {@link SodaWithId} instance. + */ + @Nonnull + public String getBrand() { + return brand; + } + + /** + * Set the brand of this {@link SodaWithId} instance. + * + * @param brand The brand of this {@link SodaWithId} + */ + public void setBrand( @Nonnull final String brand) { + this.brand = brand; + } + + /** + * Set the quantity of this {@link SodaWithId} instance and return the same instance. + * + * @param quantity The quantity of this {@link SodaWithId} + * @return The same instance of this {@link SodaWithId} class + */ + @Nonnull public SodaWithId quantity( @Nonnull final Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity The quantity of this {@link SodaWithId} instance. + */ + @Nonnull + public Integer getQuantity() { + return quantity; + } + + /** + * Set the quantity of this {@link SodaWithId} instance. + * + * @param quantity The quantity of this {@link SodaWithId} + */ + public void setQuantity( @Nonnull final Integer quantity) { + this.quantity = quantity; + } + + /** + * Set the packaging of this {@link SodaWithId} instance and return the same instance. + * + * @param packaging The packaging of this {@link SodaWithId} + * @return The same instance of this {@link SodaWithId} class + */ + @Nonnull public SodaWithId packaging( @Nullable final PackagingEnum packaging) { + this.packaging = packaging; + return this; + } + + /** + * Get packaging + * @return packaging The packaging of this {@link SodaWithId} instance. + */ + @Nonnull + public PackagingEnum getPackaging() { + return packaging; + } + + /** + * Set the packaging of this {@link SodaWithId} instance. + * + * @param packaging The packaging of this {@link SodaWithId} + */ + public void setPackaging( @Nullable final PackagingEnum packaging) { + this.packaging = packaging; + } + + /** + * Set the price of this {@link SodaWithId} instance and return the same instance. + * + * @param price The price of this {@link SodaWithId} + * @return The same instance of this {@link SodaWithId} class + */ + @Nonnull public SodaWithId price( @Nonnull final Float price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price The price of this {@link SodaWithId} instance. + */ + @Nonnull + public Float getPrice() { + return price; + } + + /** + * Set the price of this {@link SodaWithId} instance. + * + * @param price The price of this {@link SodaWithId} + */ + public void setPrice( @Nonnull final Float price) { + this.price = price; + } + + /** + * Set the id of this {@link SodaWithId} instance and return the same instance. + * + * @param id The id of this {@link SodaWithId} + * @return The same instance of this {@link SodaWithId} class + */ + @Nonnull public SodaWithId id( @Nullable final Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id The id of this {@link SodaWithId} instance. + */ + @Nonnull + public Long getId() { + return id; + } + + /** + * Set the id of this {@link SodaWithId} instance. + * + * @param id The id of this {@link SodaWithId} + */ + public void setId( @Nullable final Long id) { + this.id = id; + } + + /** + * Get the names of the unrecognizable properties of the {@link SodaWithId}. + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SodaWithId} instance. + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException { + if( !cloudSdkCustomFields.containsKey(name) ) { + throw new NoSuchElementException("SodaWithId has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SodaWithId} instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() + { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if( name != null ) declaredFields.put("name", name); + if( brand != null ) declaredFields.put("brand", brand); + if( quantity != null ) declaredFields.put("quantity", quantity); + if( packaging != null ) declaredFields.put("packaging", packaging); + if( price != null ) declaredFields.put("price", price); + if( id != null ) declaredFields.put("id", id); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SodaWithId} instance. If the map previously contained a mapping + * for the key, the old value is replaced by the specified value. + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) + { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final SodaWithId sodaWithId = (SodaWithId) o; + return Objects.equals(this.cloudSdkCustomFields, sodaWithId.cloudSdkCustomFields) && + Objects.equals(this.name, sodaWithId.name) && + Objects.equals(this.brand, sodaWithId.brand) && + Objects.equals(this.quantity, sodaWithId.quantity) && + Objects.equals(this.packaging, sodaWithId.packaging) && + Objects.equals(this.price, sodaWithId.price) && + Objects.equals(this.id, sodaWithId.id); + } + + @Override + public int hashCode() { + return Objects.hash(name, brand, quantity, packaging, price, id, cloudSdkCustomFields); + } + + @Override + @Nonnull public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class SodaWithId {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" packaging: ").append(toIndentedString(packaging)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + From f05242f5af869f96e52b623ed2eac48cce3ead2c Mon Sep 17 00:00:00 2001 From: Roshin Rajan Panackal Date: Thu, 15 Jan 2026 16:59:04 +0100 Subject: [PATCH 26/26] Fix missed line on merge --- .../datamodel/openapi/apache/petstore/api/DefaultApi.java | 4 ---- .../datamodel/openapi/apache/sodastore/api/OrdersApi.java | 1 - .../sdk/datamodel/openapi/apache/sodastore/api/SodasApi.java | 4 ---- .../libraries/apache-httpclient/operationBody.mustache | 1 - .../sap/cloud/sdk/services/builder/api/AwesomeSodaApi.java | 1 - .../sap/cloud/sdk/services/builder/api/AwesomeSodasApi.java | 1 - .../com/sap/cloud/sdk/services/builder/api/DefaultApi.java | 3 --- .../services/apiclassvendorextension/api/AwesomeSodaApi.java | 1 - .../apiclassvendorextension/api/AwesomeSodasApi.java | 1 - .../sdk/services/apiclassvendorextension/api/DefaultApi.java | 3 --- .../sdk/services/apiclassvendorextension/api/DefaultApi.java | 5 ----- .../sap/cloud/sdk/services/inlineobject/api/DefaultApi.java | 1 - .../com/sap/cloud/sdk/services/builder/api/DefaultApi.java | 3 --- .../com/sap/cloud/sdk/services/builder/api/OrdersApi.java | 1 - .../com/sap/cloud/sdk/services/builder/api/SodasApi.java | 3 --- 15 files changed, 33 deletions(-) diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java index 1d942ca83..b08117f8d 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/petstore/api/DefaultApi.java @@ -90,7 +90,6 @@ public Pet addPet( @Nonnull final PetInput pet ) final String localVarPath = "/pets"; final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -151,7 +150,6 @@ public OpenApiResponse deletePet( @Nonnull final Long id ) "/pets/{id}".replaceAll("\\{" + "id" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(id))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -214,7 +212,6 @@ public Pet findPetById( @Nonnull final Long id ) "/pets/{id}".replaceAll("\\{" + "id" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(id))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -272,7 +269,6 @@ public List findPets( @Nullable final List tags, @Nullable final In final String localVarPath = "/pets"; final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/api/OrdersApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/api/OrdersApi.java index ef5f5a6a8..c6d82a1d8 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/api/OrdersApi.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/api/OrdersApi.java @@ -85,7 +85,6 @@ public Order ordersPost( @Nonnull final Order order ) final String localVarPath = "/orders"; final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); diff --git a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/api/SodasApi.java b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/api/SodasApi.java index 1c20f24dc..8e3f539f4 100644 --- a/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/api/SodasApi.java +++ b/datamodel/openapi/openapi-api-apache-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/apache/sodastore/api/SodasApi.java @@ -91,7 +91,6 @@ public byte[] sodasDownloadIdGet( @Nonnull final Long id ) .replaceAll("\\{" + "id" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(id))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -143,7 +142,6 @@ public List sodasGet() final String localVarPath = "/sodas"; final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -206,7 +204,6 @@ public SodaWithId sodasIdGet( @Nonnull final Long id ) "/sodas/{id}".replaceAll("\\{" + "id" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(id))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -270,7 +267,6 @@ public Soda sodasPut( @Nonnull final SodaWithId sodaWithId ) final String localVarPath = "/sodas"; final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/operationBody.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/operationBody.mustache index f908859b2..dd83ac4c9 100644 --- a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/operationBody.mustache +++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/libraries/apache-httpclient/operationBody.mustache @@ -10,7 +10,6 @@ final String localVarPath = "{{{path}}}"{{#pathParams}} .replaceAll("\\{" + "{{baseName}}" + "\\}", ApiClient.escapeString(ApiClient.parameterToString({{{paramName}}}))){{/pathParams}}; final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); -String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/AwesomeSodaApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/AwesomeSodaApi.java index 64f28920a..81edc6ad9 100644 --- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/AwesomeSodaApi.java +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/AwesomeSodaApi.java @@ -78,7 +78,6 @@ public Soda addSoda(@Nonnull final NewSoda newSoda) throws OpenApiRequestExcepti final String localVarPath = "/sodas"; final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/AwesomeSodasApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/AwesomeSodasApi.java index e31f7124b..946607d7a 100644 --- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/AwesomeSodasApi.java +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/AwesomeSodasApi.java @@ -69,7 +69,6 @@ public List getSodas() throws OpenApiRequestException { final String localVarPath = "/sodas"; final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/DefaultApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/DefaultApi.java index 6bb599e41..d909f2d6c 100644 --- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/DefaultApi.java +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/api/DefaultApi.java @@ -80,7 +80,6 @@ public OpenApiResponse deleteSodaById(@Nonnull final Long sodaId) throws OpenApi .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -137,7 +136,6 @@ public Soda getSodaById(@Nonnull final Long sodaId) throws OpenApiRequestExcepti .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -202,7 +200,6 @@ public Soda updateSodaById(@Nonnull final Long sodaId, @Nonnull final UpdateSoda .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/AwesomeSodaApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/AwesomeSodaApi.java index 3332b8fc8..6a9d9bc0e 100644 --- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/AwesomeSodaApi.java +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/AwesomeSodaApi.java @@ -85,7 +85,6 @@ public Soda addSoda(@Nonnull final NewSoda newSoda) throws OpenApiRequestExcepti final String localVarPath = "/sodas"; final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/AwesomeSodasApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/AwesomeSodasApi.java index 832fe451f..e8bb7f6f6 100644 --- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/AwesomeSodasApi.java +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/AwesomeSodasApi.java @@ -76,7 +76,6 @@ public List getSodas() throws OpenApiRequestException { final String localVarPath = "/sodas"; final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/DefaultApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/DefaultApi.java index 689435cd8..b236fece8 100644 --- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/DefaultApi.java +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/DefaultApi.java @@ -87,7 +87,6 @@ public OpenApiResponse deleteSodaById(@Nonnull final Long sodaId) throws OpenApi .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -144,7 +143,6 @@ public Soda getSodaById(@Nonnull final Long sodaId) throws OpenApiRequestExcepti .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -209,7 +207,6 @@ public Soda updateSodaById(@Nonnull final Long sodaId, @Nonnull final UpdateSoda .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/DefaultApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/DefaultApi.java index 1db6280c6..97d57f4da 100644 --- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/DefaultApi.java +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/api/DefaultApi.java @@ -86,7 +86,6 @@ public Soda addSoda(@Nonnull final NewSoda newSoda) throws OpenApiRequestExcepti final String localVarPath = "/sodas"; final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -143,7 +142,6 @@ public OpenApiResponse deleteSodaById(@Nonnull final Long sodaId) throws OpenApi .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -200,7 +198,6 @@ public Soda getSodaById(@Nonnull final Long sodaId) throws OpenApiRequestExcepti .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -247,7 +244,6 @@ public List getSodas() throws OpenApiRequestException { final String localVarPath = "/sodas"; final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -312,7 +308,6 @@ public Soda updateSodaById(@Nonnull final Long sodaId, @Nonnull final UpdateSoda .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/api/DefaultApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/api/DefaultApi.java index 56db31293..5614166e3 100644 --- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/api/DefaultApi.java +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/inlineobject-schemas-enabled/output/com/sap/cloud/sdk/services/inlineobject/api/DefaultApi.java @@ -90,7 +90,6 @@ public Soda getSodaById(@Nonnull final Long sodaId) throws OpenApiRequestExcepti .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/api/DefaultApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/api/DefaultApi.java index 1b0de94b7..54305d7fe 100644 --- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/api/DefaultApi.java +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/partial-generation/output/com/sap/cloud/sdk/services/builder/api/DefaultApi.java @@ -88,7 +88,6 @@ public OpenApiResponse deleteSodaById(@Nonnull final Long sodaId) throws OpenApi .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -145,7 +144,6 @@ public SodaWithFoo getSodaById(@Nonnull final Long sodaId) throws OpenApiRequest .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -210,7 +208,6 @@ public Soda updateSodaById(@Nonnull final Long sodaId, @Nonnull final UpdateSoda .replaceAll("\\{" + "sodaId" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(sodaId))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/api/OrdersApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/api/OrdersApi.java index bad9c8eef..8e5c18589 100644 --- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/api/OrdersApi.java +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/api/OrdersApi.java @@ -84,7 +84,6 @@ public Order get(@Nonnull final Order order) throws OpenApiRequestException { final String localVarPath = "/orders"; final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/api/SodasApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/api/SodasApi.java index 129b65f5c..1b83674b8 100644 --- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/api/SodasApi.java +++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorApacheIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/api/SodasApi.java @@ -77,7 +77,6 @@ public List get() throws OpenApiRequestException { final String localVarPath = "/sodas"; final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -134,7 +133,6 @@ public SodaWithId sodasIdGet(@Nonnull final Long id) throws OpenApiRequestExcept .replaceAll("\\{" + "id" + "\\}", ApiClient.escapeString(ApiClient.parameterToString(id))); final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap(); @@ -191,7 +189,6 @@ public Soda sodasPut(@Nonnull final SodaWithId sodaWithId) throws OpenApiRequest final String localVarPath = "/sodas"; final StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); - String localVarQueryParameterBaseName; final List localVarQueryParams = new ArrayList(); final List localVarCollectionQueryParams = new ArrayList(); final Map localVarHeaderParams = new HashMap();