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

Python|Ruby - QueryParametersMapper not getting generated #2824

Closed
andreaTP opened this issue Jun 28, 2023 · 5 comments · Fixed by #2825
Closed

Python|Ruby - QueryParametersMapper not getting generated #2824

andreaTP opened this issue Jun 28, 2023 · 5 comments · Fixed by #2825
Assignees
Labels
Milestone

Comments

@andreaTP
Copy link
Contributor

I "think" this is the root cause of this issue:

Apicurio/apicurio-registry#3465

We have an OpenAPI spec file that defines a QueryParameter with a field named ifExists, the mangled name in the corresponding dataclass is therefore if_exists.

I found that, in theory, there should be a generated Mapper, but I cannot find it in the generated sources 😞 , nor I can find any evidence of the generation of the get_query_parameter (which, I believe, should return the mapping) that is in the abstractions library.

I'm looking for some hint on how this is supposed to work all together 🙂 and what should be fixed to have it working as expected.

cc. @baywet

@andreaTP
Copy link
Contributor Author

I'm looking closer at this issue, so far I found:

  • QueryParameters have been "excluded" from the name mangling in the first place, but the Python Writers are eagerly calling .ToSnakeCase() - I think that this approach might generate confusion and breaks the separation of concerns as all the other languages names mangling is performed in the Refiners - but it's not the "real" issue
  • I think that the generated method QueryParametersMapper is never written for all of the languages (at least the same issue is present in Ruby e.g.)

@andreaTP andreaTP changed the title Python - QueryParametersMapper not getting generated/used Python|Ruby - QueryParametersMapper not getting generated Jun 28, 2023
@baywet baywet added type:bug A broken experience Python Ruby labels Jun 28, 2023
@baywet baywet added this to the Kiota v1.4 milestone Jun 28, 2023
@baywet baywet added this to Kiota Jun 28, 2023
@baywet baywet moved this to In Progress in Kiota Jun 28, 2023
@baywet
Copy link
Member

baywet commented Jun 28, 2023

Thanks for reporting this bug and for already starting a PR about it by the time I got to this notification 😅

@github-project-automation github-project-automation bot moved this from In Progress to Done in Kiota Jun 28, 2023
@andreaTP
Copy link
Contributor Author

Quick follow-up, I was thinking twice about this:

the Python Writers are eagerly calling .ToSnakeCase() - I think that this approach might generate confusion and breaks the separation of concerns as all the other languages' names mangling is performed in the Refiners

and I believe that this is a design issue, some of the Refiners phases are taking into consideration the fact that a name is escaped or not but here we are breaking the assumption.
Applying the manipulation in the Writers results in logic to be executed that, I believe, should happen in the Refiner.

wdyt @baywet ?

@baywet
Copy link
Member

baywet commented Jul 1, 2023

I think you're right. Normalization should happen before the writers. We've had so many issues caused by the fact two writers were not normalizing the same way and references being broken.
The thing I'm a bit worried about is how this will play with the convention service and scalar types.
But yeah if you want to explore building a generic normalizing function in the common refiners and remove normalization from writers, I'd support it.

Long term will need to enable concurrency for the refiners as they have been the performance bottleneck for a while now. If we enabled that without causing race conditions we'd unblock significant performance gains...

@andreaTP
Copy link
Contributor Author

andreaTP commented Jul 3, 2023

Opened #2842 for tracking the normalization issue.

Regarding:

Long term will need to enable concurrency for the refiners as they have been the performance bottleneck for a while now. If we enabled that without causing race conditions we'd unblock significant performance gains...

at the moment I think that this is a long long shot, I would not even attempt to go there until #2442 is fixed.

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

Successfully merging a pull request may close this issue.

2 participants