lasdf1234 commented on code in PR #14520:
URL: https://github.com/apache/gravitino/pull/14520#discussion_r4462806625
##########
docs/open-api/policies.yaml:
##########
@@ -894,7 +894,10 @@ components:
nullable: true
policyType:
type: string
- description: The type of the policy
+ description: >-
+ The type of the policy. Known values are matched
case-insensitively; the server
Review Comment:
Thanks, addressed in 5d83d91c6 and bbc794b90.
**Schema**
- The request schemas now match `policyType` with case-insensitive patterns
instead of lowercase/uppercase enums. For example, compaction uses
`^[sS][yY][sS][tT][eE][mM]_[iI][cC][eE][bB][eE][rR][gG]_...$`, and custom uses
`^[cC][uU][sS][tT][oO][mM]$`, matching the server's `custom`-or-known-type rule.
- The request schemas no longer use the exact-case discriminators. The
patterns are mutually exclusive, so `oneOf` alone selects the content for any
casing.
- Response schemas are unchanged and keep the canonical lowercase enum plus
discriminator.
**Payload validation**
- I added lowercase, uppercase, and mixed-case (`System_Iceberg_Compaction`)
request examples with `{"maxPartitionNum":5}` for both create and update.
- `:docs:build` runs Redocly with `recommended-strict`, and its
`no-invalid-media-type-examples` rule validates request examples against the
schema. With these examples in the spec, the build now covers the behavior you
described:
- Previous schema plus the new examples: the build fails on the mixed-case
create and update examples (`value of tag "policyType" must be in oneOf or
anyOf`).
- New schema: the build passes.
- Negative check (run locally, since examples can only be positive):
`system_iceberg_bogus`, and `System_Iceberg_Compaction` with `maxPartitionNum:
0`, are both rejected, so content is validated against the selected branch.
- REST: `TestPolicyOperations` create and update now run with both
`SYSTEM_ICEBERG_COMPACTION` and `System_Iceberg_Compaction`. The DTO tests
already cover all three casings.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]