api-guidelines icon indicating copy to clipboard operation
api-guidelines copied to clipboard

Add guidance on case folding on enum values

Open mikekistler opened this issue 2 years ago • 8 comments

We should update the Azure REST API guidelines to explicitly state that enum values should be treated as case sensitive.

mikekistler avatar Mar 31 '22 19:03 mikekistler

@JeffreyRichter recommends:

  • Enum casing MUST be camelCase
  • Enum matching MUST be case-sensitive

mikekistler avatar Apr 01 '22 17:04 mikekistler

Perhaps it goes without saying, but I think we should be explicit about guidance for acronyms like "LUIS", that they should be all lowercase like "luis".

heaths avatar May 05 '22 17:05 heaths

See: #332

markweitzel avatar Jun 07 '22 21:06 markweitzel

@JeffreyRichter recommends:

  • Enum casing MUST be camelCase
  • Enum matching MUST be case-sensitive

just to clear up some confusion I have here, when you say camelCase do you mean names like myCoolEnum or do you mean PascalCase, like MyCoolEnum? I think the majority of enum values today follow PascalCase

forteddyt avatar Sep 02 '22 21:09 forteddyt

I meant camelCase (like myCoolEnum) but it does seem that Azure is all across the board with this. @markweitzel : Let's have the API Stewardship board discuss this next week (should be brief) and settle on a casing.

JeffreyRichter avatar Sep 02 '22 22:09 JeffreyRichter

I'll see if I can find the notes, but I thought we already talked about this: that enum values should be PascalCase and case-insensitive matches. @markweitzel do you recall this? I can't seem to find any outcome in OneNote. I mean, I'm not opposed to discussing it (again?) and changing it, but figured we could at least have context of prior conversations.

heaths avatar Sep 06 '22 20:09 heaths

I'm sure we want case-sensitive matches otherwise all kinds of problems ensue. But I can't remember having a discussion on this.

JeffreyRichter avatar Sep 06 '22 20:09 JeffreyRichter

Despite the fact that I posted it on April 1, it was not a joke. I'm sure we discussed this and @JeffreyRichter (among others) recommended we go with camelCase (not PascalCase) and that matching is case-sensitive.

But we never actually hardened this into the actual guidelines, and if PascalCase is better for some reason I think we could change it.

But I don't think we should condone case-insensitive matching.

mikekistler avatar Sep 06 '22 21:09 mikekistler