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

Kiota python generator produces incorrect code to retrieve original query parameter name #2000

Closed
mikekistler opened this issue Nov 25, 2022 · 2 comments · Fixed by #2005
Closed
Assignees
Labels
Python type:bug A broken experience

Comments

@mikekistler
Copy link
Member

Using the same REST API definition and generation command as in #1996, it appears that Kiota generates incorrect code to retrieve the original name of the "api-version" query parameter, which in the client library has been renamed to "api_version". The get_query_parameter method of the SortAndFilterRequestBuilderGetQueryParameters is supposed to return the original name for a given query parameter name, but the code it produces uses the wrong casing for "api-version":

        if original_name == "apiVersion":         # this should be "api_version"
            return "api%2Dversion"
        return original_name

The result is that the wrong query parameter name is used in the request and it results in a 400 response.

@baywet baywet self-assigned this Nov 28, 2022
@baywet baywet assigned samwelkanda and unassigned baywet Nov 28, 2022
@baywet baywet added type:bug A broken experience and removed question labels Nov 28, 2022
@baywet
Copy link
Member

baywet commented Nov 28, 2022

Hey @mikekistler
Thanks for reporting this.
Just to be clear, this is supposed to match the "property" name on the query parameters class. What's the property name?

@mikekistler
Copy link
Member Author

The property name in the query parameters class is "api_version".

    @dataclass
    class SortAndFilterRequestBuilderGetQueryParameters():
        """
        Get all load tests by the fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}.
        """
        # API version
        api_version: Optional[str] = None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Python type:bug A broken experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants