Azure / bicep

Bicep is a declarative language for describing and deploying Azure resources
MIT License
3.25k stars 753 forks source link

property name checking is case sensitive #785

Open bmoore-msft opened 4 years ago

bmoore-msft commented 4 years ago

Bicep version 0.1.223-alpha

Describe the bug property checking is case sensitive, ARM is not

To Reproduce See screenshot

Similar to #225 we throw a warning but if casing is the distinction you really need to squint to see the problem. Also, this casing could change across apiVersions so this could change via indirect edits.

image

alex-frankel commented 4 years ago

everything in bicep is case sensitive, so this is the same issue as #225. Should we create an uber issue like "should bicep remain case sensitive?" and we can link both of these.

w.r.t the apiVersion change, you are right that this could change with an indirect edit, but the whole shape of the api could change at that point right?

bmoore-msft commented 4 years ago

Yeah probably the same as #225 but fixing one vs. the other may have different consequences for bicep... case insensitive property names wouldn't ever affect bicep, where functions seems more possible (though I don't care if we dupe one or the other).

w.r.t. apiVersion change, yes properties can be added/drop and bicep flagging that would be a good thing. if bicep flags a property name due to casing, that's noise... we're making folks deal with things in bicep that they don't have to deal with in the platform itself.

takekazuomi commented 3 years ago

bicep is case sensitive, but ARM Template is ignore case. The same applies to variables and the like. I think this will cause decompiler compatibility issues.

anthony-c-martin commented 3 years ago

@takekazuomi - although Bicep is currently case-sensitive, just wanted to point out the following:

  1. Type validation issues are treated as warnings, which means we will allow you to compile your template regardless
  2. You should get a descriptive warning message explaining the problem - e.g.: image
  3. If using the VSCode extension, you should have a code action to automatically fix the casing discrepancy (click the blue lightbulb in the above screenshot, or use the code actions shortcut when your cursor is on the word with the warning).
bmoore-msft commented 3 years ago

@anthony-c-martin - could we change the error message to state that the problem is casing? Rather than leaving that as an exercise for the reader ;)

I'm also wonder, if we're going to be case sensitive, if we should just auto-correct?