Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions models/common/model.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,7 @@ model ObjectReference2<Kind> {
}

/**
* 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 */
Expand All @@ -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")
Expand All @@ -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")
Expand Down
30 changes: 13 additions & 17 deletions schemas/core/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,6 @@ components:
example: Validation Failed
status:
type: integer
format: int32
description: HTTP status code
example: 400
detail:
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
30 changes: 13 additions & 17 deletions schemas/gcp/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,6 @@ components:
example: Validation Failed
status:
type: integer
format: int32
description: HTTP status code
example: 400
detail:
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
30 changes: 13 additions & 17 deletions schemas/gcp/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down