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

[typespec-python] Bug: Alias and Spread Capitalization Issue #2604

Closed
l0lawrence opened this issue May 29, 2024 · 0 comments · Fixed by #2608
Closed

[typespec-python] Bug: Alias and Spread Capitalization Issue #2604

l0lawrence opened this issue May 29, 2024 · 0 comments · Fixed by #2608

Comments

@l0lawrence
Copy link
Member

I have changed a model to be an alias that I spread in EventGrid, and I am running into an emitter issue where the parameter within that alias is being capitalized incorrectly causing the operation to fail:

Old Tsp:

  models RejectOptions {
    @doc("Array of lock tokens.")
    lockTokens: string[];
  }

op blah( @bodyroot RejectOptions)

Generated the _content correctly as:

{"lockTokens": ["tokens"]}

New typespec looks like this:

  alias RejectOptions = {
    @doc("Array of lock tokens.")
    lockTokens: string[];
  };

op blah( ...RejectOptions)

Generated the _content as:

{"locktokens": ["tokens"]}

which gives me a service error


The service is expecting lockTokens. with the 'T' capitalized

Code currently being generated from the alias/spread with all lowercase locktokens:

        if body is _Unset:
            if lock_tokens is _Unset:
                raise TypeError("missing required argument: lock_tokens")
            body = {"locktokens": lock_tokens}
            body = {k: v for k, v in body.items() if v is not None}
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 a pull request may close this issue.

1 participant