Parameter name casing in emitted JSON¶
Context and Problem Statement¶
Authors declare parameters in PowerShell style (Parameter Effect, Parameter AllowedLocations). Built-in policies and EPAC guidance use camelCase (effect, allowedLocations), and EPAC recommends that the effect parameter is always called effect. How should DSL names map to JSON parameter names?
Decision Drivers¶
- The output should match built-in and EPAC conventions.
- The mapping must be predictable: no surprising transformations of acronyms.
- Existing definitions with fixed parameter names must be representable, for the decompiler and for migration.
Considered Options¶
- Lower-case the first character, with a
JsonNameoverride - Emit names exactly as written
- Full camelCase conversion with acronym handling
Decision Outcome¶
Chosen option: "Lower-case the first character, with a JsonName override".
Effectbecomeseffect,AllowedLocationsbecomesallowedLocations, andVMSkubecomesvMSku.- The hashtable form of
ParameteracceptsJsonNameto set the emitted name exactly, for example@{ Name = 'VmSku'; JsonName = 'vmSku' }. The decompiler setsJsonNamewhenever the original name doesn't round-trip through the rule. Param Effectrefers to parameters by their DSL name, ignoring case.- Two parameters whose emitted names collide, ignoring case, is a compile error.
Consequences¶
- Good, because the common case matches built-in conventions with no extra syntax.
- Bad, because names that start with an acronym come out awkwardly (
vMSku) unlessJsonNameis set. A compile-time warning could suggestJsonNamewhen a name starts with two capitals.
Pros and Cons of the Options¶
Lower-case the first character, with an override¶
- Good, because the rule is simple to explain, with an escape hatch.
- Bad, because of the acronym edge case.
Exactly as written¶
- Good, because there is no surprise at all.
- Bad, because the output looks unlike built-in policies, and
Effectwould go against EPAC's guidance unless authors writeParameter effect, which reads oddly in PowerShell.
Full camelCase with acronym handling¶
- Good, because it gives the nicest output.
- Bad, because the heuristics (
VMSkutovmSku, but what aboutIPv6Range?) are unpredictable.