Skip to content

MaD: update generator scripts to support writing JSON data extensions - #22798

Draft
nickrolfe wants to merge 2 commits into
mainfrom
nickrolfe/mad-generator-json
Draft

nickrolfe wants to merge 2 commits into
mainfrom
nickrolfe/mad-generator-json

Conversation

@nickrolfe

@nickrolfe nickrolfe commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

This is split into two commits:

  1. Updates the scripts so that they store and build models using an in-memory representation that is independent of the YAML format currently used. This means tuples are represented as Python lists, where previously they were created as YAML-formatted strings during the merging process. Scalar values inside those tuples are represented as Python strings and booleans. Only the DataExtensionFile.write_yaml function now has to deal with YAML formatting concerns.
  2. Adds support for writing JSON and choosing which format to use.

For now, YAML is still the default. We can change this when CLI support for JSON extensions is widely available and the existing models in this repo have been converted to JSON. (I will be making a separate PR with a conversion script).

I tested these changes by running both misc/scripts/models-as-data/generate_mad.py and java/ql/src/utils/modelconverter/ConvertExtensions.py and manually inspecting the output.

In preparation for adding support for JSON data extensions, this commit
updates the scripts so that they store and build models using an
in-memory representation that is independent of the YAML format
currently used. This means tuples are represented as Python lists, where
previously they were created as YAML-formatted strings in the merging
process. Scalar values inside those tuples are represented as Python
strings and booleans.

Only the DataExtensionFile.write_yaml function now has to deal with YAML
formatting concerns.
The `generate_mad.py` script accepts a flag that lets you choose between
YAML or JSON, but YAML is still the default. We can change the default
later, when CLI support for JSON is widely available.

`convert_extensions.py` also still hard-codes `.yml` as the output
extension/format.
@nickrolfe
nickrolfe force-pushed the nickrolfe/mad-generator-json branch from e478733 to 95c94ef Compare October 9, 2026 15:49

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant