[One Workflow] fix: request bodies with oneof schemas (kibana.SetAlertsStatus, etc)#245344
Merged
Kiryous merged 18 commits intoelastic:mainfrom Dec 8, 2025
Merged
Conversation
kibana.SetAlertsStatus, etc))kibana.SetAlertsStatus, etc)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes handling of OpenAPI request bodies that use composition schemas (oneOf, allOf, anyOf) in the Kibana workflows package. The primary focus is on enabling proper schema generation and validation for connectors like kibana.SetAlertsStatus which have multiple possible request body formats.
Key Changes:
- Enhanced parameter extraction to recursively process
oneOf,allOf, andanyOfschemas - Added connector contract override system for custom handling of specific operations
- Improved Zod schema introspection to support intersection types
Reviewed changes
Copilot reviewed 18 out of 57 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
spec/schema.ts |
Added metadata to FetcherConfigSchema for better documentation |
spec/lib/samples/kibana_steps.ts |
Added comprehensive sample steps for alert triage and case management operations |
spec/lib/samples/index.ts |
Moved operation category comments to their respective files |
spec/lib/samples/es_steps.ts |
Added operation category comments from index file |
spec/lib/insert_fetcher_to_schema.ts |
New utility to recursively insert fetcher config into Zod schemas |
spec/lib/get_workflow_json_schema.kibana.test.ts |
Enhanced test descriptions to include step names |
spec/lib/generate_yaml_schema_from_connectors.kibana.test.ts |
Enhanced test descriptions to include step names |
spec/kibana/overrides/kibana.set_alerts_status.ts |
New override file for SetAlertsStatus operation with custom contract |
spec/kibana/overrides/index.ts |
Exports override mappings for Kibana connectors |
spec/kibana/index.ts |
Merges override contracts with generated connectors |
scripts/shared/types.ts |
Added ParameterTypes interface definition |
scripts/shared/oas_remove_discriminators_with_invalid_mapping.ts |
New preprocessor to remove invalid discriminator mappings |
scripts/shared/generate_parameter_types.ts |
Enhanced to recursively extract parameters from composition schemas |
scripts/shared/generate_parameter_types.test.ts |
Added test coverage for oneOf request bodies |
scripts/generate_kibana_connectors/openapi_ts.config.ts |
Added preprocessing pipeline for OpenAPI spec before generation |
common/utils/zod/get_shape_at.ts |
Updated to use getSchemaAtPath utility |
common/utils/zod/get_shape_at.test.ts |
Added tests for union and nested union handling |
common/utils/zod/get_shape.ts |
Added support for ZodIntersection schemas |
src/platform/packages/shared/kbn-workflows/spec/lib/insert_fetcher_to_schema.ts
Outdated
Show resolved
Hide resolved
...ckages/shared/kbn-workflows/scripts/shared/oas_remove_discriminators_with_invalid_mapping.ts
Outdated
Show resolved
Hide resolved
src/platform/packages/shared/kbn-workflows/scripts/shared/generate_parameter_types.ts
Outdated
Show resolved
Hide resolved
…49-bug-request-bodies-with-oneof-schemas
…49-bug-request-bodies-with-oneof-schemas
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Module Count
Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
cc @Kiryous |
mbondyra
added a commit
to mbondyra/kibana
that referenced
this pull request
Dec 8, 2025
* commit '6647f813c9fa03ac0378e3d4756246e8dc4b4c76': (33 commits) [Detection Engine] Extracts Rules/Alerts/Exceptions permission to new Rules feature privileges (elastic#239634) [Agent Builder] Add Intro Tour (elastic#245551) Add datastream lifecycle support to indices metadata (elastic#245548) [Serverless] Update preconfigured connectors (elastic#245445) [Metrics][Discover] Discover to prefer line chars for time series data (elastic#244595) Update dependency @elastic/ebt to ^1.4.1 (main) (elastic#241629) [One Workflow] fix: request bodies with oneof schemas (`kibana.SetAlertsStatus`, etc) (elastic#245344) Update dependency ai to v5 (elastic#244675) Fix Discover trace waterfall behavior with duplicate spans (elastic#244984) [FSH] Migrated fs usage to kbn/fs for sample ingest (elastic#244163) Streamlang: Unskip type coercion test (elastic#245519) [Response Ops][Reporting] Fixing error in calculating delay value between retries (elastic#245431) Add TopNavMenuBeta to navigation plugin (elastic#243578) [scout] support custom servers configuration (elastic#244306) [Fleet] Run agentless background sync without dry run (elastic#245286) Fix Change Password Flaky Test (elastic#245443) Add new gap fill status for rules (elastic#242595) [Kibana Search] Move SLOs higher up in search results (elastic#245518) feat(slo): introduce find SLO instances internal route (elastic#245333) [FSH] Dropped unnecessary `fs` persistence for synthetics project code (elastic#244338) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close https://github.com/elastic/security-team/issues/14949
Pull request overview
This PR fixes handling of OpenAPI request bodies that use composition schemas (
oneOf,allOf,anyOf) in the Kibana workflows package. The primary focus is on enabling proper schema generation and validation for connectors likekibana.SetAlertsStatuswhich have multiple possible request body formats.Key Changes:
oneOf,allOf, andanyOfschemasBefore
After