[Security Solution] OpenAPI stringifyZodError
generates verbose and confusing error message
#182935
Labels
bug
Fixes for quality problems that affect the customer experience
Team:Detection Rule Management
Security Detection Rule Management Team
Team: SecuritySolution
Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.
triage_needed
Describe the bug:
The function
stringifyZodError
which is used bybuildRouteValidationWithZod
returns verbose and confusing error messages for some OpenAPI schemas.Current behavior:
Given the schema defined here:
kibana/x-pack/plugins/security_solution/common/api/entity_analytics/common/common.schema.yaml
Line 251 in f2e6834
the following test:
kibana/x-pack/plugins/security_solution/common/api/entity_analytics/common/risk_weights.schema.test.ts
Line 57 in f2e6834
Produces the error meesgae:
'host: Required, user: Required, type: Invalid literal value, expected "risk_category", value: Invalid literal value, expected "category_1", host: Required, and 3 more'
Expected behavior:
The previous implementation (without OpenAPI) used to produce a more readable error message:
The text was updated successfully, but these errors were encountered: