Fix: Refer to external refs correctly in strict interfaces#1387
Merged
jamietanna merged 3 commits intomasterfrom Jan 25, 2024
Merged
Fix: Refer to external refs correctly in strict interfaces#1387jamietanna merged 3 commits intomasterfrom
jamietanna merged 3 commits intomasterfrom
Conversation
jamietanna
commented
Dec 18, 2023
875db16 to
71813ff
Compare
71813ff to
520ad55
Compare
This was referenced Dec 18, 2023
Closed
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.
520ad55 to
1ef78fc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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