From ab2dcc297a86a1e55f86671adac90afb91843493 Mon Sep 17 00:00:00 2001 From: adnanhemani Date: Thu, 18 Sep 2025 00:55:47 -0700 Subject: [PATCH 1/4] [OpenAPI Modification] Return created objects; Change revokeGrantFromCatalogRole to return 204 (No Content) on success --- .../polaris/service/admin/PolarisServiceImpl.java | 6 +++--- spec/polaris-management-service.yml | 14 +++++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java b/runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java index 48ad7027e8..b703bae1c2 100644 --- a/runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java +++ b/runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java @@ -130,7 +130,7 @@ public Response createCatalog( validateExternalCatalog(catalog); Catalog newCatalog = CatalogEntity.of(adminService.createCatalog(request)).asCatalog(); LOGGER.info("Created new catalog {}", newCatalog); - return Response.status(Response.Status.CREATED).build(); + return Response.status(Response.Status.CREATED).entity(newCatalog).build(); } private void validateClientId(String clientId) { @@ -342,7 +342,7 @@ public Response createPrincipalRole( PrincipalRole newPrincipalRole = new PrincipalRoleEntity(adminService.createPrincipalRole(entity)).asPrincipalRole(); LOGGER.info("Created new principalRole {}", newPrincipalRole); - return Response.status(Response.Status.CREATED).build(); + return Response.status(Response.Status.CREATED).entity(newPrincipalRole).build(); } /** From PolarisPrincipalRolesApiService */ @@ -398,7 +398,7 @@ public Response createCatalogRole( CatalogRole newCatalogRole = new CatalogRoleEntity(adminService.createCatalogRole(catalogName, entity)).asCatalogRole(); LOGGER.info("Created new catalogRole {}", newCatalogRole); - return Response.status(Response.Status.CREATED).build(); + return Response.status(Response.Status.CREATED).entity(newCatalogRole).build(); } /** From PolarisCatalogsApiService */ diff --git a/spec/polaris-management-service.yml b/spec/polaris-management-service.yml index 322f1473b5..93873a2f87 100644 --- a/spec/polaris-management-service.yml +++ b/spec/polaris-management-service.yml @@ -63,6 +63,10 @@ paths: responses: 201: description: "Successful response" + content: + application/json: + schema: + $ref: "#/components/schemas/Catalog" 403: description: "The caller does not have permission to create a catalog" 404: @@ -400,6 +404,10 @@ paths: responses: 201: description: "Successful response" + content: + application/json: + schema: + $ref: "#/components/schemas/PrincipalRole" 403: description: "The caller does not have permission to add a principal role" @@ -613,6 +621,10 @@ paths: responses: 201: description: "Successful response" + content: + application/json: + schema: + $ref: "#/components/schemas/CatalogRole" 403: description: "The principal is not authorized to create roles" 404: @@ -787,7 +799,7 @@ paths: schema: $ref: "#/components/schemas/RevokeGrantRequest" responses: - 201: + 204: description: "Successful response" 403: description: "The principal is not authorized to create grants" From bcc4c6c2de750fcb2a428af844b48c69fd141e7a Mon Sep 17 00:00:00 2001 From: adnanhemani Date: Thu, 18 Sep 2025 16:16:05 -0700 Subject: [PATCH 2/4] Remove change for 204 -> 201 --- spec/polaris-management-service.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/polaris-management-service.yml b/spec/polaris-management-service.yml index 93873a2f87..7e93f01ab3 100644 --- a/spec/polaris-management-service.yml +++ b/spec/polaris-management-service.yml @@ -799,7 +799,7 @@ paths: schema: $ref: "#/components/schemas/RevokeGrantRequest" responses: - 204: + 201: description: "Successful response" 403: description: "The principal is not authorized to create grants" From f0b68968c1ea8f18377526a337d63240f1d14828 Mon Sep 17 00:00:00 2001 From: adnanhemani Date: Thu, 18 Sep 2025 18:05:19 -0700 Subject: [PATCH 3/4] adjust regtests --- regtests/t_catalog_federation/src/catalog_federation.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/regtests/t_catalog_federation/src/catalog_federation.sh b/regtests/t_catalog_federation/src/catalog_federation.sh index a307865031..fe430562d0 100755 --- a/regtests/t_catalog_federation/src/catalog_federation.sh +++ b/regtests/t_catalog_federation/src/catalog_federation.sh @@ -43,7 +43,7 @@ NEW_CLIENT_SECRET=$(echo "$PRINCIPAL_RESPONSE" | jq -r '.credentials.clientSecre # Step 2: Create local catalog echo "Creating local catalog..." -RESPONSE_CODE=$(curl -s -X POST -H "Authorization: Bearer ${SPARK_BEARER_TOKEN}" -H 'Content-Type: application/json' \ +RESPONSE_CODE=$(curl -s -o /dev/null -X POST -H "Authorization: Bearer ${SPARK_BEARER_TOKEN}" -H 'Content-Type: application/json' \ http://${POLARIS_HOST:-localhost}:8181/api/management/v1/catalogs \ -d '{ "type": "INTERNAL", @@ -87,7 +87,7 @@ echo "Assign service_admin to new-user response code: $RESPONSE_CODE" # Step 4: Create external catalog echo "Creating external catalog (passthrough facade)..." -RESPONSE_CODE=$(curl -s -X POST -H "Authorization: Bearer ${SPARK_BEARER_TOKEN}" -H 'Content-Type: application/json' \ +RESPONSE_CODE=$(curl -s -o /dev/null -X POST -H "Authorization: Bearer ${SPARK_BEARER_TOKEN}" -H 'Content-Type: application/json' \ http://${POLARIS_HOST:-localhost}:8181/api/management/v1/catalogs \ -d "{ \"type\": \"EXTERNAL\", From 5f27979df6550b6ab9f58146f814cefa61062545 Mon Sep 17 00:00:00 2001 From: adnanhemani Date: Fri, 19 Sep 2025 15:38:51 -0700 Subject: [PATCH 4/4] added changelog entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93fd0fc6de..c2d31a93ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,8 @@ request adding CHANGELOG notes for breaking (!) changes and possibly other secti ### Changes +* The following APIs will now return the newly-created objects as part of the successful 201 response: createCatalog, createPrincipalRole, createCatalogRole. + ### Deprecations * The property `polaris.active-roles-provider.type` is deprecated and has no effect anymore.