diff --git a/models/common/model.tsp b/models/common/model.tsp index 82878b8..6dd70aa 100644 --- a/models/common/model.tsp +++ b/models/common/model.tsp @@ -44,22 +44,7 @@ model ObjectReference2 { } /** - * Validation constraint types for field-level errors - */ -enum ValidationConstraint { - required: "required", - min: "min", - max: "max", - min_length: "min_length", - max_length: "max_length", - pattern_match: "pattern", - enum_value: "enum", - format_check: "format", - unique: "unique", -} - -/** - * Field-level validation error detail (RFC 9457 extension) + * Field-level validation error detail */ model ValidationError { /** JSON path to the field that failed validation */ @@ -70,7 +55,8 @@ model ValidationError { value?: unknown; /** The validation constraint that was violated */ - constraint?: ValidationConstraint; + @example("required") + constraint?: "required" | "min" | "max" | "min_length" | "max_length" | "pattern" | "enum" | "format" | "unique"; /** Human-readable error message for this field */ @example("Cluster name is required") @@ -94,7 +80,7 @@ model Error { /** HTTP status code */ @example(400) - status: int32; + status: integer; /** Human-readable explanation specific to this occurrence */ @example("The cluster name field is required") diff --git a/schemas/core/openapi.yaml b/schemas/core/openapi.yaml index 8e656c5..28168b6 100644 --- a/schemas/core/openapi.yaml +++ b/schemas/core/openapi.yaml @@ -932,7 +932,6 @@ components: example: Validation Failed status: type: integer - format: int32 description: HTTP status code example: 400 detail: @@ -1289,19 +1288,6 @@ components: - Ready - Failed description: Phase of a resource (Cluster or NodePool) - ValidationConstraint: - type: string - enum: - - required - - min - - max - - min_length - - max_length - - pattern - - enum - - format - - unique - description: Validation constraint types for field-level errors ValidationError: type: object required: @@ -1315,14 +1301,24 @@ components: value: description: The invalid value that was provided (if safe to include) constraint: - allOf: - - $ref: '#/components/schemas/ValidationConstraint' + type: string + enum: + - required + - min + - max + - min_length + - max_length + - pattern + - enum + - format + - unique description: The validation constraint that was violated + example: required message: type: string description: Human-readable error message for this field example: Cluster name is required - description: Field-level validation error detail (RFC 9457 extension) + description: Field-level validation error detail securitySchemes: BearerAuth: type: http diff --git a/schemas/gcp/openapi.yaml b/schemas/gcp/openapi.yaml index 7f7ca4e..478faff 100644 --- a/schemas/gcp/openapi.yaml +++ b/schemas/gcp/openapi.yaml @@ -878,7 +878,6 @@ components: example: Validation Failed status: type: integer - format: int32 description: HTTP status code example: 400 detail: @@ -1357,19 +1356,6 @@ components: - NoSchedule - PreferNoSchedule - NoExecute - ValidationConstraint: - type: string - enum: - - required - - min - - max - - min_length - - max_length - - pattern - - enum - - format - - unique - description: Validation constraint types for field-level errors ValidationError: type: object required: @@ -1383,14 +1369,24 @@ components: value: description: The invalid value that was provided (if safe to include) constraint: - allOf: - - $ref: '#/components/schemas/ValidationConstraint' + type: string + enum: + - required + - min + - max + - min_length + - max_length + - pattern + - enum + - format + - unique description: The validation constraint that was violated + example: required message: type: string description: Human-readable error message for this field example: Cluster name is required - description: Field-level validation error detail (RFC 9457 extension) + description: Field-level validation error detail securitySchemes: BearerAuth: type: http diff --git a/schemas/gcp/swagger.yaml b/schemas/gcp/swagger.yaml index c8854dd..0d44baa 100644 --- a/schemas/gcp/swagger.yaml +++ b/schemas/gcp/swagger.yaml @@ -1014,7 +1014,6 @@ definitions: status: description: HTTP status code example: 400 - format: int32 type: integer timestamp: description: RFC3339 timestamp of when the error occurred @@ -1509,26 +1508,23 @@ definitions: - key - effect type: object - ValidationConstraint: - description: Validation constraint types for field-level errors - enum: - - required - - min - - max - - min_length - - max_length - - pattern - - enum - - format - - unique - type: string ValidationError: - description: Field-level validation error detail (RFC 9457 extension) + description: Field-level validation error detail properties: constraint: - allOf: - - $ref: '#/definitions/ValidationConstraint' description: The validation constraint that was violated + enum: + - required + - min + - max + - min_length + - max_length + - pattern + - enum + - format + - unique + example: required + type: string field: description: JSON path to the field that failed validation example: spec.name