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

[Bug]: Block clientName to be empty string #647

Closed
4 tasks done
lmazuel opened this issue Apr 9, 2024 · 2 comments · Fixed by #1066
Closed
4 tasks done

[Bug]: Block clientName to be empty string #647

lmazuel opened this issue Apr 9, 2024 · 2 comments · Fixed by #1066
Assignees
Labels
bug Something isn't working lib:tcgc Issues for @azure-tools/typespec-client-generator-core library

Comments

@lmazuel
Copy link
Member

lmazuel commented Apr 9, 2024

Describe the bug

Should raise a diagnostic that it's not allowed

Reproduction

import "@azure-tools/typespec-client-generator-core";

using Azure.ClientGenerator.Core;

@clientName("")
model Foo {}

Checklist

  • Follow our Code of Conduct
  • Check that this issue is about the Azure libraries for typespec. For bug in the typespec language or core libraries file it in the TypeSpec repo
  • Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@lmazuel lmazuel added bug Something isn't working DPG lib:tcgc Issues for @azure-tools/typespec-client-generator-core library labels Apr 9, 2024
@lmazuel
Copy link
Member Author

lmazuel commented Apr 9, 2024

@timotheeguerin suggested something like:

if(arg === "") {
  reportDiagnostic(program, {
    code: "client-name-blank",
    target: context.getArgumentAtIndex(0)
  })
}

@timotheeguerin
Copy link
Member

timotheeguerin commented Apr 9, 2024

I would also suggest checking for a whitespace string not just empty string

@clientName(" ") // error on this

github-merge-queue bot pushed a commit that referenced this issue Jun 24, 2024
fixes #647

---------

Co-authored-by: iscai-msft <[email protected]>
Co-authored-by: catalinaperalta <[email protected]>
@tadelesh tadelesh removed their assignment Jun 26, 2024
markcowl pushed a commit to markcowl/typespec-azure that referenced this issue Jun 26, 2024
fixes Azure#647

---------

Co-authored-by: iscai-msft <[email protected]>
Co-authored-by: catalinaperalta <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lib:tcgc Issues for @azure-tools/typespec-client-generator-core library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants