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

Fix: Refer to external refs correctly in strict interfaces #1387

Merged
merged 3 commits into from
Jan 25, 2024

Conversation

jamietanna
Copy link
Member

@jamietanna jamietanna commented Dec 18, 2023

The current approach doesn't often work when generating types that are
in external packages, unless that package is also a strict server's
definition, which isn't always the case.


Noticed while working on #1378

The current approach doesn't often work when generating types that are
in external packages, unless that package is also a strict server's
definition, which isn't always the case.
As part of follow-up changes, we'll need it, and it's handy to keep this
consistent with other types that have this.
In the case that we're referencing a type defined in an external
package, using an alias here results in build errors i.e.:

  ./api.gen.go:93:7: cannot define new methods on non-local type common.TypeNameHere

Instead, we can make sure we only alias when there's not an external
reference in use, using the new `Schema.IsExternalRef` function.
@jamietanna jamietanna added bug Something isn't working area:external-refs Anything related to external references (referencing other file(s) within a spec) labels Jan 25, 2024
@jamietanna jamietanna merged commit 390058d into master Jan 25, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:external-refs Anything related to external references (referencing other file(s) within a spec) bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant