azure-cli-extensions icon indicating copy to clipboard operation
azure-cli-extensions copied to clipboard

[confcom] Add a programmatic schema for acipolicygen input

Open DomAyre opened this issue 3 months ago • 4 comments

We currently have a great markdown document explaining the format, but a programmatic JSON schema would support docs creation, and in code validation from a single source of truth.

We could implement this by defining the json input as data classes in the code, and then generating json schemas and docs from it

DomAyre avatar Sep 22 '25 09:09 DomAyre

Thank you for opening this issue, we will look into it.

yonzhan avatar Sep 22 '25 09:09 yonzhan

The plan is to define data classes which outline the schema, which we can use in code but also generate JSON schemas/docs from.

I will also update the code that parses other types of input to first parse it into this format before all going to a single policygen function.

In order to have confidence this doesn't break acipolicygen, the first step to to add tests for this function which don't currently exist: https://github.com/Azure/azure-cli-extensions/pull/9199

DomAyre avatar Sep 22 '25 09:09 DomAyre

Adding these tests uncovered this bug:

  • https://github.com/Azure/azure-cli-extensions/issues/9198

DomAyre avatar Sep 22 '25 09:09 DomAyre

Changing how the ARM template is parsed can lead to variations in the template which aren't functional, for example environment variables can be defined in a different order. Since some tests rely on this order, we should standardise it to avoid breaking tests:

  • https://github.com/DomAyre/azure-cli-extensions/pull/5

DomAyre avatar Sep 22 '25 09:09 DomAyre