-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Initial Draft] [One Workflow] json-schema based inputs #243384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
h88
wants to merge
15
commits into
elastic:main
Choose a base branch
from
h88:oneworkflow-mamba-json-schema
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
+5,042
−788
Conversation
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
… enable advanced validation features including: - Email, URI, and date-time format validation - Regex pattern validation for IP addresses, CVE IDs, etc. - Nested object structures with deep validation - Array constraints (minItems, maxItems, uniqueItems) - Number and string constraints (min/max, minLength/maxLength) - Additional properties control - Schema references and composition Changes: - Update WorkflowSchema to use WorkflowInputsJsonSchema (properties, required, additionalProperties) - Add normalizeInputsToJsonSchema() for backward compatibility with legacy array format - Enable format validation in JSON Schema validator (email, uri, date-time) - Update all input processing code to handle new JSON Schema structure - Convert JSON Schema to Zod schemas for runtime validation - Add comprehensive tests for JSON Schema features and backward compatibility Backward Compatibility: - Legacy array-based inputs are automatically converted to JSON Schema format - WorkflowSchemaForAutocomplete accepts both formats during parsing - All existing workflows continue to work without modification
…by ensuring the version field is removed from the required array inside allOf items (similar to the version fix). Legacy array inputs support: Fixed the "Expected '0'" error by ensuring allOf[1].inputs (from the .pipe() transformation) accepts both array and object formats. The issue was that allOf[1].inputs was a $ref pointing only to the object schema, so arrays failed validation. Now it's wrapped in an anyOf that includes both formats.
Contributor
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
…ntext - Type field: suggests JSON Schema types (string, number, boolean, object, array, null) - Format field: suggests format values (email, uri, date-time, uuid, etc.) - Enum values: suggests enum values from schema definitions - Property keys: suggests JSON Schema property keywords (type, format, enum, etc.) Suppress Ajv console errors during JSON Schema validation - Prevents noisy console errors from Ajv compilation of large/complex schemas - Errors are expected and don't affect functionality Add utility functions for inputs.properties context detection - isInInputsPropertiesContext: detects if cursor is in inputs.properties - getInputPropertyName: extracts property name from YAML path
Contributor
💔 Build Failed
Failed CI Stepscc @h88 |
in workflow inputs and fixes several issues related to default value application and backward compatibility. Key changes: - Add support for `definitions` and `$defs` in WorkflowInputsJsonSchema - Implement $ref resolution in applyInputDefaults to resolve references and apply defaults from referenced schemas - Fix validation to accept $ref objects without trying to compile them in isolation - Restore ensureVersionIsOptional function to make version field optional in Monaco schema (prevents "Missing property 'version'" errors) - Add fixInputsSchemaForMonaco to support both legacy array and new object formats for backward compatibility - Fix workflow execute modal to extract inputs from yamlString when definition.inputs is undefined (fixes modal not opening for new format) - Update getZodTypeName to handle ZodEnum types correctly - Add comprehensive test coverage for $ref resolution and default values Fixes: - Default values from $ref references are now correctly applied - Version field is optional in Monaco editor validation - Legacy array inputs format works correctly with new schema - Inputs modal opens correctly for workflows with JSON Schema inputs
properties were not being pre-filled in the manual execution modal,
causing the input editor to show empty object '{}' instead of defaults.
Key changes:
- Add hasDefaultsRecursive function to detect defaults at any nesting level
- Update createObjectWithDefaults to include properties with nested defaults
- Update applyInputDefaults to return undefined when no defaults applied
- Fix getDefaultWorkflowInput to use applyInputDefaults for consistency
- Update useEffect to handle '{}' case and pre-fill defaults
- Add comprehensive test for Threat Intelligence Enrichment workflow
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport:skip
This PR does not require backporting
beta
Required for a feature to move to beta
release_note:skip
Skip the PR/issue when compiling release notes
Team:One Workflow
Team label for One Workflow (Workflow automation)
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.
TBD