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

Add unwrapping and inlining to expand-generics #2504

Merged
merged 6 commits into from
May 13, 2024

Conversation

swallez
Copy link
Member

@swallez swallez commented Apr 11, 2024

The addition of WithNullValue is causing issues in the generic expansion process as it creates new types for what is more a convenience notation than an actual type.

This PR enhances the "expand-generics" transformation with two configurations:

  • inlined generics: allows declarations like foo: WithNullValue<string> to be converted to foo: string | NullValue.
  • unwrapped generics: allows declarations like foo: Stringified<integer> to be converted to foo: integer.

This PR only inlines WithNullValue, as unwrapping Stringified would change what is currently being generated.

@swallez swallez requested a review from a team as a code owner April 11, 2024 15:24
@Anaethelion Anaethelion merged commit 2f1902b into main May 13, 2024
7 checks passed
@Anaethelion Anaethelion deleted the compiler-inline-generics branch May 13, 2024 14:00
github-actions bot pushed a commit that referenced this pull request May 13, 2024
* Add unwrapping and inlining to expand-generics

* Make linter happy

* Add unwrapping and inlining to expand-generics (Rust edition)

* Update OpenAPI spec with inlined WithNullValue

---------

Co-authored-by: Laurent Saint-Félix <[email protected]>
(cherry picked from commit 2f1902b)
Anaethelion pushed a commit that referenced this pull request May 13, 2024
* Add unwrapping and inlining to expand-generics

* Make linter happy

* Add unwrapping and inlining to expand-generics (Rust edition)

* Update OpenAPI spec with inlined WithNullValue

---------

Co-authored-by: Laurent Saint-Félix <[email protected]>
(cherry picked from commit 2f1902b)

Co-authored-by: Sylvain Wallez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants