Conversation
gtema
commented
Aug 11, 2026
Owner
- feat(sdk): Add microversion-aware schema-variant selector
- feat(tui): Validate editor buffer against BODY_SCHEMA
- feat: Extend the ResourceBehavior trait
Generated code emits one request struct per microversion break (e.g. create_20, create_233, ...); a resource's BODY_SCHEMA is therefore not single-valued for these operations. select_schema() picks the variant whose [min_version, max_version] range covers a given negotiated version, reusing the same bound-checking negotiate_microversion() already does (factored out into version_range_compatible() so the two don't duplicate the floor/ceiling rules). Degrades to always selecting the one schema for single-variant operations (the common case today). Signed-off-by: Artem Goncharov <artem.goncharov@gmail.com>
Extends the create-via-external-editor retry loop (from the earlier crash-on-bad-YAML fix) with a second validation stage: once a buffer parses as YAML, check it against the resource's schema (new ResourceBehaviour::editor_schema, wired through Action::Edit) via jsonschema, collecting every violation -- required fields, enums, ranges -- not just the first, before it's ever sent as EditResult. Failures reopen the editor with the errors prepended as comments, same pattern as the existing parse-error path. Also drops the schema to a temp file and prepends a yaml-language-server modeline when one is available, so editors that understand it get completion/live validation for free. editor_schema defaults to None (no resource emits BODY_SCHEMA in this repo yet, only the codegenerator side does so far), so this is a no-op until a resource opts in. Signed-off-by: Artem Goncharov <artem.goncharov@gmail.com>
prepare further editor work Signed-off-by: Artem Goncharov <artem.goncharov@gmail.com>
Signed-off-by: Artem Goncharov <artem.goncharov@gmail.com>
Open
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.