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

Fully qualify stdlib types in generated code #719

Open
czechboy0 opened this issue Jan 24, 2025 · 2 comments
Open

Fully qualify stdlib types in generated code #719

czechboy0 opened this issue Jan 24, 2025 · 2 comments
Labels
good first issue Good for newcomers kind/enhancement Improvements to existing feature. size/S Small task. (A couple of hours of work.)
Milestone

Comments

@czechboy0
Copy link
Contributor

For example, "any Error" should be "any Swift.Error", and so on.

Some user modules already have conflicting types, and it's difficult to work around this.

@czechboy0 czechboy0 added kind/enhancement Improvements to existing feature. size/S Small task. (A couple of hours of work.) good first issue Good for newcomers labels Jan 24, 2025
@czechboy0 czechboy0 added this to the Post-1.0 milestone Jan 24, 2025
@MahdiBM
Copy link
Contributor

MahdiBM commented Jan 25, 2025

@czechboy0 I find it weird that the openapi-generator policy is something in between just use SwiftPM features to solve your problem and the generator should work at all times so we need to fully qualify type names.

I'd be fine with either. Just pointing out that I can't tell when you as the maintainer of the package think the generator should keep things simpler and users should use SwiftPM features, and when you think that the generator should put some effort into fixing something although SwiftPM features (creating a dedicated target in this case) would solve the problem. The distinction isn't clear to me.

@czechboy0
Copy link
Contributor Author

czechboy0 commented Jan 25, 2025

It's a good question, it's certainly somewhat nuanced and requires making judgement calls.

In this case the generator has aimed to generate fully qualified type names in its implementation from the start. So not doing so for Error is more of an oversight, not by design, and now that an adopter has hit it, we'd accept a PR fixing the bug.

That's different to feature requests like adding an extra namespace around generated types - that's an example of something we chose not to implement, because the solution is right in SwiftPM, as you point out, as modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers kind/enhancement Improvements to existing feature. size/S Small task. (A couple of hours of work.)
Projects
None yet
Development

No branches or pull requests

2 participants