Skip to content

feat(tui): Further work for editor - #1936

Merged
gtema merged 4 commits into
mainfrom
tui-edit
Aug 11, 2026
Merged

feat(tui): Further work for editor#1936
gtema merged 4 commits into
mainfrom
tui-edit

Conversation

@gtema

@gtema gtema commented Aug 11, 2026

Copy link
Copy Markdown
Owner
  • feat(sdk): Add microversion-aware schema-variant selector
  • feat(tui): Validate editor buffer against BODY_SCHEMA
  • feat: Extend the ResourceBehavior trait

gtema added 4 commits August 11, 2026 15:20
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>
@gtema
gtema merged commit 500374d into main Aug 11, 2026
24 checks passed
@gtema-release-plz gtema-release-plz Bot mentioned this pull request Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant