autorest icon indicating copy to clipboard operation
autorest copied to clipboard

[Potential Bug] Should camelCase apply to @odata.***

Open vishrutshah opened this issue 9 years ago • 5 comments

Linter Rule DefinitionsPropertiesNamesCamelCase

Reported by @brjohnstmsft Issue: M3016: "Property named: "@odata.type", for definition: "Analyzer" must follow camelCase style. Example: "@odata.type"." I don't understand why the example exactly matches the property name. In any case, the casing of this name is dictated by the OData protocol and we cannot change it. Same for "@odata.etag" PR: https://github.com/Azure/azure-rest-api-specs-pr/pull/47

@ravbhatnagar : Can you please verify wether this requirement is valid for odata type?

cc: @veronicagg

vishrutshah avatar Mar 25 '17 20:03 vishrutshah

This requirement is not valid for OData annotations. Here is the relevant part of the OData specification: http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata03/os/odata-json-format-v4.0-errata03-os-complete.html#_Toc453766627

bitsforthought avatar Mar 27 '17 18:03 bitsforthought

To minimize the scope of exceptional cases, I will modify the code to ignore cases where the property names start with @odata. Feel free to point out any edge cases we can run into.

dsgouda avatar Apr 21 '17 17:04 dsgouda

@dsgouda If you plan to run these rules on data plane specs, then please exclude all property names that start with @. Built-in annotations are covered by @odata, but services are free to define their own custom annotations, which can have any name as long as it starts with @.

bitsforthought avatar Apr 21 '17 21:04 bitsforthought

@brjohnstmsft Thanks, appreciate that!

dsgouda avatar Apr 21 '17 21:04 dsgouda

@dsgouda the rule may be looking for '@' and in this case, it doesn't look to have it, we may need to ignore starting with "odata" as well.

veronicagg avatar Jun 12 '17 22:06 veronicagg