Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

And tspconfig-java-package-dir Rule for TypeSpec Validation #31951

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

wanlwanl
Copy link
Member

@wanlwanl wanlwanl commented Dec 23, 2024

Issue: Azure/azure-sdk-tools#9355
Limit tspconfig.options.["@azure-tools/typespec-java"].["package-dir"] matches /^azure(-\w+)+$/

Copy link

openapi-pipeline-app bot commented Dec 23, 2024

Next Steps to Merge

✅ All automated merging requirements have been met! To get your PR merged, see aka.ms/azsdk/specreview/merge.

Copy link

openapi-pipeline-app bot commented Dec 23, 2024

PR validation pipeline restarted successfully. If there is ApiView generated, it will be updated in this comment.

@wanlwanl wanlwanl marked this pull request as ready for review December 23, 2024 08:54
@wanlwanl wanlwanl changed the title And tspconfig-java-namespace Rule for TypeSpec Validation And tspconfig-java-package-dir Rule for TypeSpec Validation Dec 24, 2024
Copy link
Member

@weidongxu-microsoft weidongxu-microsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a place to validate part that common to all emitters?
e.g.

parameters:
  "service-dir":
    default: "sdk/<>"

Please also have approval from dev familiar with lint rule code.

readonly description =
`"options.@azure-tools/typespec-java.package-dir" must match ${this.pattern}.`;
readonly action =
`Please update "options.@azure-tools/typespec-java.package-dir" to start with "azure", followed by one or more "-<word>" segments. Each <word> should consist of letters, digits, or underscores. For example: "azure-test".`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there better way to say "should consist of letters, digits, or underscores"? Mostly Java only want letters, but "should consist of" feels we ask them to use all 3.

Copy link
Member Author

@wanlwanl wanlwanl Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about

Please update "options.@azure-tools/typespec-java.package-dir" to start with "azure", followed by one or more "-" segments. Each should consist of letters, digits, or underscores (any combination or subset). For example: "azure-test".

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "Each segment can contain letters, digits, ..."?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@wanlwanl
Copy link
Member Author

Do we have a place to validate part that common to all emitters? e.g.

parameters:
  "service-dir":
    default: "sdk/<>"

Please also have approval from dev familiar with lint rule code.

Yes, we will have it in the future. This PR is a start to add rules for tspconfig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants