Skip to content

Model editor: add support for JSON data extensions - #4576

Open
nickrolfe wants to merge 6 commits into
mainfrom
nickrolfe/model-editor-json
Open

nickrolfe wants to merge 6 commits into
mainfrom
nickrolfe/model-editor-json

Conversation

@nickrolfe

@nickrolfe nickrolfe commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

This PR adds support to the model editor for loading JSON-formatted data extensions, in addition to the existing YAML format. When saving and overwriting existing extensions, it will preserve the file's existing format.

For now, new files will still be saved as YAML. We can change the definition of DEFAULT_EXTENSION_FORMAT_FOR_NEW_FILES to switch to JSON when we're ready.

I have done some manual testing:

  • creating a new model in the editor (in YAML), converting and renaming it to JSON, reloading the editor, modelling a new method, then saving and checking that the file gets saved as JSON.
  • I also checked that the CodeQL CLI was able to load that JSON file.

@nickrolfe nickrolfe added the Complexity: Medium Requires a moderate level of detail in design or review. label Oct 2, 2026
@nickrolfe
nickrolfe force-pushed the nickrolfe/model-editor-json branch 2 times, most recently from c2e2ac2 to 8d067e1 Compare October 2, 2026 16:19
This will allow us, for example, to switch to JSON as the default format
while keeping existing YAML files as YAML.

JSON (de)serialization is currently stubbed out, and will be implemented
in a follow-up commit.
Update the `dataExtensions` entry that it adds when writing a pack
manifest to include `models/**/*.json`, in addition to the existing
`models/**/*.yml`.
@nickrolfe
nickrolfe force-pushed the nickrolfe/model-editor-json branch from 8d067e1 to 4afeaf8 Compare October 5, 2026 11:32
@nickrolfe
nickrolfe added this pull request to stack #4584 October 7, 2026 09:46
@nickrolfe
nickrolfe marked this pull request as ready for review October 7, 2026 09:48
@nickrolfe
nickrolfe requested a review from a team as a code owner October 7, 2026 09:48
Copilot AI balanced review requested due to automatic review settings October 7, 2026 09:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Filename grouping can leave stale models active or overwrite existing models.

Review effort: Balanced
Findings: None

What changed in this PR

Adds JSON data-extension support to the model editor while keeping YAML as the default for new files.

Changes:

  • Adds format-aware loading and saving that preserves existing file formats.
  • Updates new-pack metadata and generated-file handling for JSON.
  • Extends tests and release notes.
File Description
extensions/​ql-vscode/​test/​vscode-tests/​no-workspace/​model-editor/​extension-pack-picker.test.ts Updates expected pack globs.
extensions/​ql-vscode/​test/​vscode-tests/​cli-integration/​model-editor/​modeled-method-fs.test.ts Adds a generated JSON fixture.
extensions/​ql-vscode/​test/​unit-tests/​model-editor/​extension-serialization.test.ts Tests parsing, serialization, and format preservation.
extensions/​ql-vscode/​src/​model-editor/​modeled-method-fs.ts Uses format-aware persistence and filters generated JSON.
extensions/​ql-vscode/​src/​model-editor/​model-editor-view.ts Updates generated-model serialization.
extensions/​ql-vscode/​src/​model-editor/​languages/​models-as-data.ts Documents JSON generated-file naming.
extensions/​ql-vscode/​src/​model-editor/​extension-serialization.ts Implements JSON support and format-aware filename grouping.
extensions/​ql-vscode/​src/​model-editor/​extension-pack-picker.ts Includes JSON globs in new packs.
extensions/​ql-vscode/​CHANGELOG.md Announces JSON support.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complexity: Medium Requires a moderate level of detail in design or review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants