test(firstleg): harden pallet option page contract

This commit is contained in:
2026-09-01 11:03:40 +08:00
parent 7ace1ded56
commit 4991536065
6 changed files with 57 additions and 8 deletions
@@ -78,7 +78,7 @@ components:
type: array
maxItems: 100
items: { $ref: '#/components/schemas/PalletSnapshot' }
page: { type: integer, format: int64, minimum: 1 }
size: { type: integer, format: int64, minimum: 1, maximum: 100 }
total: { type: integer, format: int64, minimum: 0 }
pages: { type: integer, format: int64, minimum: 0 }
page: { oneOf: [{ type: integer, format: int64, minimum: 1 }, { type: string, pattern: '^[1-9][0-9]*$' }] }
size: { oneOf: [{ type: integer, format: int64, minimum: 1, maximum: 100 }, { type: string, pattern: '^(?:[1-9]|[1-9][0-9]|100)$' }] }
total: { oneOf: [{ type: integer, format: int64, minimum: 0 }, { type: string, pattern: '^(?:0|[1-9][0-9]*)$' }] }
pages: { oneOf: [{ type: integer, format: int64, minimum: 0 }, { type: string, pattern: '^(?:0|[1-9][0-9]*)$' }] }
@@ -20,6 +20,10 @@ class PalletOpenApiContractTest {
.contains("maximum: 100")
.contains("maxItems: 100")
.contains("PalletSnapshotPageResponse:")
.contains("page: { oneOf:")
.contains("size: { oneOf:")
.contains("total: { oneOf:")
.contains("pages: { oneOf:")
.contains("required: [palletId, palletCode, palletType, capacityCbm, tareWeightKg]")
.contains("additionalProperties: false")
.doesNotContain("tenantId:")