From cd82674046ec917c43f5808abc058ae98676f52d Mon Sep 17 00:00:00 2001 From: Honah J Date: Thu, 27 Mar 2025 13:55:21 -0500 Subject: [PATCH 1/6] Add applicablePolicy object --- api/polaris-catalog-service/build.gradle.kts | 1 + .../bundled-polaris-catalog-service.yaml | 20 ++++++++++++++++-- spec/polaris-catalog-apis/policy-apis.yaml | 21 +++++++++++++++++-- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/api/polaris-catalog-service/build.gradle.kts b/api/polaris-catalog-service/build.gradle.kts index 1e0778f05d..f16343441b 100644 --- a/api/polaris-catalog-service/build.gradle.kts +++ b/api/polaris-catalog-service/build.gradle.kts @@ -38,6 +38,7 @@ val policyManagementModels = "LoadPolicyResponse", "PolicyIdentifier", "Policy", + "ApplicablePolicy", "PolicyAttachmentTarget", "AttachPolicyRequest", "DetachPolicyRequest", diff --git a/spec/generated/bundled-polaris-catalog-service.yaml b/spec/generated/bundled-polaris-catalog-service.yaml index c0dd88cc48..d86440fc94 100644 --- a/spec/generated/bundled-polaris-catalog-service.yaml +++ b/spec/generated/bundled-polaris-catalog-service.yaml @@ -4005,6 +4005,22 @@ components: properties: target: $ref: '#/components/schemas/PolicyAttachmentTarget' + ApplicablePolicy: + type: object + required: + - inherited + - namespaces + - policy + properties: + inherited: + type: boolean + namespaces: + type: array + description: A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. + items: + type: string + policy: + $ref: '#/components/schemas/Policy' GetApplicablePoliciesResponse: type: object required: @@ -4012,11 +4028,11 @@ components: properties: next-page-token: $ref: '#/components/schemas/PageToken' - policies: + applicable-policies: type: array uniqueItems: true items: - $ref: '#/components/schemas/Policy' + $ref: '#/components/schemas/ApplicablePolicy' responses: BadRequestErrorResponse: description: Indicates a bad request error. It could be caused by an unexpected request body format or other forms of request validation failure, such as invalid json. Usually serves application/json content, although in some cases simple text/plain content might be returned by the server's middleware. diff --git a/spec/polaris-catalog-apis/policy-apis.yaml b/spec/polaris-catalog-apis/policy-apis.yaml index 947e991142..2fbf9fd8e7 100644 --- a/spec/polaris-catalog-apis/policy-apis.yaml +++ b/spec/polaris-catalog-apis/policy-apis.yaml @@ -529,6 +529,23 @@ components: version: type: integer + ApplicablePolicy: + type: object + required: + - inherited + - namespaces + - policy + properties: + inherited: + type: boolean + namespaces: + type: array + description: A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. + items: + type: string + policy: + $ref: '#/components/schemas/Policy' + CreatePolicyRequest: type: object required: @@ -637,11 +654,11 @@ components: properties: next-page-token: $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/PageToken' - policies: + applicable-policies: type: array uniqueItems: true items: - $ref: '#/components/schemas/Policy' + $ref: '#/components/schemas/ApplicablePolicy' responses: CreatePolicyResponse: From ab52c2bdda81b838fe53a81dfb44d7419df28830 Mon Sep 17 00:00:00 2001 From: Honah J Date: Thu, 27 Mar 2025 16:53:20 -0500 Subject: [PATCH 2/6] Update the spec --- .../bundled-polaris-catalog-service.yaml | 36 ++++++++++-------- spec/polaris-catalog-apis/policy-apis.yaml | 37 +++++++++++-------- 2 files changed, 41 insertions(+), 32 deletions(-) diff --git a/spec/generated/bundled-polaris-catalog-service.yaml b/spec/generated/bundled-polaris-catalog-service.yaml index d86440fc94..c67cebf477 100644 --- a/spec/generated/bundled-polaris-catalog-service.yaml +++ b/spec/generated/bundled-polaris-catalog-service.yaml @@ -4006,21 +4006,25 @@ components: target: $ref: '#/components/schemas/PolicyAttachmentTarget' ApplicablePolicy: - type: object - required: - - inherited - - namespaces - - policy - properties: - inherited: - type: boolean - namespaces: - type: array - description: A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. - items: - type: string - policy: - $ref: '#/components/schemas/Policy' + allOf: + - type: object + description: | + For policies returned by GetApplicablePolicies, there are 2 additional fields + + - **inherited:** A boolean flag indicating whether the policy is inherited from target's parents + - **namespaces:** A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. + required: + - inherited + - namespaces + properties: + inherited: + type: boolean + namespaces: + type: array + description: A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. + items: + type: string + - $ref: '#/components/schemas/Policy' GetApplicablePoliciesResponse: type: object required: @@ -4028,7 +4032,7 @@ components: properties: next-page-token: $ref: '#/components/schemas/PageToken' - applicable-policies: + policies: type: array uniqueItems: true items: diff --git a/spec/polaris-catalog-apis/policy-apis.yaml b/spec/polaris-catalog-apis/policy-apis.yaml index 2fbf9fd8e7..1859b176be 100644 --- a/spec/polaris-catalog-apis/policy-apis.yaml +++ b/spec/polaris-catalog-apis/policy-apis.yaml @@ -530,21 +530,26 @@ components: type: integer ApplicablePolicy: - type: object - required: - - inherited - - namespaces - - policy - properties: - inherited: - type: boolean - namespaces: - type: array - description: A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. - items: - type: string - policy: - $ref: '#/components/schemas/Policy' + allOf: + - type: object + description: | + For policies returned by GetApplicablePolicies, there are 2 additional fields + + - **inherited:** A boolean flag indicating whether the policy is inherited from target's parents + - **namespaces:** A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. + required: + - inherited + - namespaces + properties: + inherited: + type: boolean + namespaces: + type: array + description: A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. + items: + type: string + - $ref: '#/components/schemas/Policy' + CreatePolicyRequest: type: object @@ -654,7 +659,7 @@ components: properties: next-page-token: $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/PageToken' - applicable-policies: + policies: type: array uniqueItems: true items: From f4a2bb66d1292c348a2379031300155c760e9e6b Mon Sep 17 00:00:00 2001 From: Honah J Date: Fri, 4 Apr 2025 18:46:05 -0500 Subject: [PATCH 3/6] rename namespaces to namespace-path --- spec/generated/bundled-polaris-catalog-service.yaml | 2 +- spec/polaris-catalog-apis/policy-apis.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/generated/bundled-polaris-catalog-service.yaml b/spec/generated/bundled-polaris-catalog-service.yaml index c67cebf477..3f18042a24 100644 --- a/spec/generated/bundled-polaris-catalog-service.yaml +++ b/spec/generated/bundled-polaris-catalog-service.yaml @@ -4019,7 +4019,7 @@ components: properties: inherited: type: boolean - namespaces: + namespace-path: type: array description: A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. items: diff --git a/spec/polaris-catalog-apis/policy-apis.yaml b/spec/polaris-catalog-apis/policy-apis.yaml index 1859b176be..19a8e476a0 100644 --- a/spec/polaris-catalog-apis/policy-apis.yaml +++ b/spec/polaris-catalog-apis/policy-apis.yaml @@ -543,7 +543,7 @@ components: properties: inherited: type: boolean - namespaces: + namespace-path: type: array description: A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. items: From be86facd98560275c005a6cbd6446c8949459397 Mon Sep 17 00:00:00 2001 From: Honah J Date: Sat, 5 Apr 2025 20:06:13 -0500 Subject: [PATCH 4/6] rename to namespace --- spec/generated/bundled-polaris-catalog-service.yaml | 11 ++++------- spec/polaris-catalog-apis/policy-apis.yaml | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/spec/generated/bundled-polaris-catalog-service.yaml b/spec/generated/bundled-polaris-catalog-service.yaml index 3f18042a24..df5a297264 100644 --- a/spec/generated/bundled-polaris-catalog-service.yaml +++ b/spec/generated/bundled-polaris-catalog-service.yaml @@ -4012,18 +4012,15 @@ components: For policies returned by GetApplicablePolicies, there are 2 additional fields - **inherited:** A boolean flag indicating whether the policy is inherited from target's parents - - **namespaces:** A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. + - **namespace:** A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. required: - inherited - - namespaces + - namespace properties: inherited: type: boolean - namespace-path: - type: array - description: A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. - items: - type: string + namespace: + $ref: '#/components/schemas/Namespace' - $ref: '#/components/schemas/Policy' GetApplicablePoliciesResponse: type: object diff --git a/spec/polaris-catalog-apis/policy-apis.yaml b/spec/polaris-catalog-apis/policy-apis.yaml index 19a8e476a0..14d2fb63e1 100644 --- a/spec/polaris-catalog-apis/policy-apis.yaml +++ b/spec/polaris-catalog-apis/policy-apis.yaml @@ -536,18 +536,15 @@ components: For policies returned by GetApplicablePolicies, there are 2 additional fields - **inherited:** A boolean flag indicating whether the policy is inherited from target's parents - - **namespaces:** A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. + - **namespace:** A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. required: - inherited - - namespaces + - namespace properties: inherited: type: boolean - namespace-path: - type: array - description: A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. - items: - type: string + namespace: + $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/Namespace' - $ref: '#/components/schemas/Policy' From 49c59d8760bc3419b774f7bdf252f78f1e445562 Mon Sep 17 00:00:00 2001 From: Honah J Date: Mon, 7 Apr 2025 11:54:35 -0700 Subject: [PATCH 5/6] address comments --- spec/generated/bundled-polaris-catalog-service.yaml | 5 +++-- spec/polaris-catalog-apis/policy-apis.yaml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/spec/generated/bundled-polaris-catalog-service.yaml b/spec/generated/bundled-polaris-catalog-service.yaml index df5a297264..2a7973493a 100644 --- a/spec/generated/bundled-polaris-catalog-service.yaml +++ b/spec/generated/bundled-polaris-catalog-service.yaml @@ -4011,7 +4011,7 @@ components: description: | For policies returned by GetApplicablePolicies, there are 2 additional fields - - **inherited:** A boolean flag indicating whether the policy is inherited from target's parents + - **inherited:** A boolean flag indicating whether the policy is inherited from target's parents. For non-inheritable policy, it should always be `false`. - **namespace:** A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. required: - inherited @@ -4019,6 +4019,7 @@ components: properties: inherited: type: boolean + default: false namespace: $ref: '#/components/schemas/Namespace' - $ref: '#/components/schemas/Policy' @@ -4029,7 +4030,7 @@ components: properties: next-page-token: $ref: '#/components/schemas/PageToken' - policies: + applicable-policies: type: array uniqueItems: true items: diff --git a/spec/polaris-catalog-apis/policy-apis.yaml b/spec/polaris-catalog-apis/policy-apis.yaml index 14d2fb63e1..b27e344f5e 100644 --- a/spec/polaris-catalog-apis/policy-apis.yaml +++ b/spec/polaris-catalog-apis/policy-apis.yaml @@ -535,7 +535,7 @@ components: description: | For policies returned by GetApplicablePolicies, there are 2 additional fields - - **inherited:** A boolean flag indicating whether the policy is inherited from target's parents + - **inherited:** A boolean flag indicating whether the policy is inherited from target's parents. For non-inheritable policy, it should always be `false`. - **namespace:** A list representing the hierarchical parent path to the policy, ordered from higher level namespace to lower. required: - inherited @@ -543,6 +543,7 @@ components: properties: inherited: type: boolean + default: false namespace: $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/Namespace' - $ref: '#/components/schemas/Policy' @@ -656,7 +657,7 @@ components: properties: next-page-token: $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/PageToken' - policies: + applicable-policies: type: array uniqueItems: true items: From 2c826dd4908ade4c58113761ce0f0c01aabfd389 Mon Sep 17 00:00:00 2001 From: Honah J Date: Mon, 7 Apr 2025 15:05:10 -0700 Subject: [PATCH 6/6] fix required --- spec/generated/bundled-polaris-catalog-service.yaml | 2 +- spec/polaris-catalog-apis/policy-apis.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/generated/bundled-polaris-catalog-service.yaml b/spec/generated/bundled-polaris-catalog-service.yaml index 2a7973493a..2a817dd69f 100644 --- a/spec/generated/bundled-polaris-catalog-service.yaml +++ b/spec/generated/bundled-polaris-catalog-service.yaml @@ -4026,7 +4026,7 @@ components: GetApplicablePoliciesResponse: type: object required: - - policies + - applicable-policies properties: next-page-token: $ref: '#/components/schemas/PageToken' diff --git a/spec/polaris-catalog-apis/policy-apis.yaml b/spec/polaris-catalog-apis/policy-apis.yaml index b27e344f5e..9aa15620cf 100644 --- a/spec/polaris-catalog-apis/policy-apis.yaml +++ b/spec/polaris-catalog-apis/policy-apis.yaml @@ -653,7 +653,7 @@ components: GetApplicablePoliciesResponse: type: object required: - - policies + - applicable-policies properties: next-page-token: $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/PageToken'