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

pkg:path types that reference their own package types #3022

Merged

Conversation

lawrencejones
Copy link
Contributor

If you have a user type placed in a package, ie. common, and it has a
field of another type in package common, we codegen a type reference of
common.Thing which will fail, as that code is already in the common
package.

If you have a user type placed in a package, ie. common, and it has a
field of another type in package common, we codegen a type reference of
common.Thing which will fail, as that code is already in the common
package.
@lawrencejones
Copy link
Contributor Author

@raphael this is a failing test for what we were discussing in Slack!

with attributes that themselves use the custom package path.
@raphael raphael marked this pull request as ready for review March 5, 2022 02:09
@raphael raphael merged commit b8b38ee into goadesign:v3 Mar 5, 2022
@lawrencejones
Copy link
Contributor Author

Linking here for those that find it: https://gophers.slack.com/archives/C0FK8EV28/p1656434471212069?thread_ts=1655929395.006179&cid=C0FK8EV28

tl;dr, this PR did not achieve what it needs to, and you'll still get redundant package prefixes to types into an external package.

@lawrencejones lawrencejones deleted the lawrence-pkg-path-recursive-references branch June 28, 2022 16:41
ernesto-jimenez pushed a commit to ernesto-jimenez/goa that referenced this pull request Jun 28, 2022
…pkg:path`

What was the issue?

What was meant to be a check on the parentPkg to avoid recursive
definitions wasn't actually checking the parent package, but the package
of the field itself.

It was a bug that got introduced in goadesign#3022 and never worked as expected.

Solution:

Injecting the parent package for the initial definition seems to address
this.
raphael pushed a commit that referenced this pull request Jul 12, 2022
What was the issue?

What was meant to be a check on the parentPkg to avoid recursive
definitions wasn't actually checking the parent package, but the package
of the field itself.

It was a bug that got introduced in #3022 and never worked as expected.

Solution:

Injecting the parent package for the initial definition seems to address
this.
raphael added a commit that referenced this pull request Jul 12, 2022
…#3084)

* Fixes #3083: properly generate attributes with meta `struct:pkg:path`

What was the issue?

What was meant to be a check on the parentPkg to avoid recursive
definitions wasn't actually checking the parent package, but the package
of the field itself.

It was a bug that got introduced in #3022 and never worked as expected.

Solution:

Injecting the parent package for the initial definition seems to address
this.

* Update codegen/scope.go

* failing server encoding test

* Fix marshalling function argument type packages

When using "struct:pkg:path"

Co-authored-by: Raphael Simon <simon.raphael@gmail.com>
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 this pull request may close these issues.

None yet

2 participants