Open maximpn opened 2 months ago
Pinging @elastic/security-detections-response (Team:Detections and Resp)
Pinging @elastic/security-solution (Team: SecuritySolution)
Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management)
Epic: https://github.com/elastic/security-team/issues/9723 (internal)
Summary
Support for local circular OpenAPi references was implemented in https://github.com/elastic/kibana/issues/186066. In general case we need to support multi files circular references in OpenAPI schemas.
kbn-openapi-generator
package generates Zod schemas and related TS types from OpenAPI specification. It fails to handle recursive schemas. Code generation finished successfully but TS can't infer a proper type. See a related Zod documentation section.We need to add support for recursive OpenAPI schemas.
Details
OpenAPI specification allows to use references to decompose and simplify schema declarations. References can also be used to declare a recursive schema with arbitrary recursive chain length across multiple files.
An example of external recursive schemas looks like
spec1.schema.yaml:
spec2.schema.yaml: