Azure / typespec-azure

About TypeSpec Azure Libraries
https://azure.github.io/typespec-azure/
MIT License
8 stars 28 forks source link

[ARM]: Extend linting rule of arm-resource-key-invalid-chars to report invalid words #1085

Open raych1 opened 1 week ago

raych1 commented 1 week ago

Clear and concise description of the problem

Context Currently for any invalid words defined as model/parameter names in the typespec/swagger, we need to add suppressions in two places:

We propose extending the current lint rule arm-resource-key-invalid-chars or adding a new lint rule to validate these words. This would allow the suppression in typespec to be carried over and consumed by the downstream SDK emitters. With this, we can avoid the need for multiple suppressions for the same word.

Example Looking at the following oracle typespec, where the key is defined as adbscharsetname, an invalid word:

model AutonomousDatabaseCharacterSet
  is ProxyResource<AutonomousDatabaseCharacterSetProperties> {
  @doc("AutonomousDatabaseCharacterSet name")
  @key("adbscharsetname")
  @path
  @segment("autonomousDatabaseCharacterSets")
  @pattern(".*")
  name: string;
}

Currently, the suppression must be added to both the spec repo at custom-words.txt and the azure-sdk-for-net repo at cspell.json

With this feature, we can keep the consistency across repositories.

//CC: @ArthurMa1978

Checklist

raych1 commented 4 days ago

@allenjzhang @markcowl
do you think if the lint rule can be improved to cover this check?

allenjzhang commented 4 days ago

This is a bigger question around EngSys to ensure consistency between various SDK team owned repos. I am all for consistency though I suspect that they would be overlapping, or at best cases, rest-api spec repo being the common subset for each language repos.

@mikeharder, @weshaggard, your thoughts on this?

weshaggard commented 4 days ago

I tend to agree with @allenjzhang here that this is a larger issue and cannot easily be solved by adding a linting rule. We have long had an issue of duplication with our spelling dictionaries between the specs and language repos but have not yet found a great way to share a common dictionary. However, that said we currently only error on spelling issues if they are in the public APIs, if they are just in the text somewhere it is only a warning but ideally, we would also fix those warnings.

mikeharder commented 4 days ago

@raych1: In azure-rest-api-specs repo, please use file cSpell.json instead of custom-words.txt going forward.