-
Notifications
You must be signed in to change notification settings - Fork 52
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
Duplicated types error handling #91
Open
lukap3
wants to merge
9
commits into
wI2L:master
Choose a base branch
from
lukap3:duplicated-types
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cc8348d
Move test types to test_types package
lukap3 7429ccf
Add additional "duplicated" types
lukap3 2856380
Add error for duplicated type names
lukap3 d854206
Add test for duplicated types
lukap3 57b6a77
Move test types
lukap3 7d53731
Merge and resolve conflicts
lukap3 cf409b7
Merge branch 'master' into duplicated-types
lukap3 97759e7
Add duplicated type error checks
lukap3 1ea0568
Add camelcase import alias
lukap3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package base_types | ||
|
||
import "time" | ||
|
||
type ( | ||
W struct { | ||
A, B string | ||
} | ||
u struct { | ||
S int | ||
} | ||
q int | ||
ns string | ||
ni int | ||
X struct { | ||
*X // ignored, recursive embedding | ||
*Y | ||
A string `validate:"required"` | ||
B *int | ||
C bool `deprecated:"true"` | ||
D []*Y | ||
E [3]*X | ||
F *X | ||
G *Y | ||
H map[int]*Y // ignored, unsupported keys type | ||
*u | ||
uu *u // ignored, unexported field | ||
q // ignored, embedded field of non-struct type | ||
*Q | ||
*V `json:"data"` | ||
NS ns | ||
NI *ni | ||
} | ||
Y struct { | ||
H float32 `validate:"required"` | ||
I time.Time `format:"date"` | ||
J *uint8 `deprecated:"oui"` // invalid value, interpreted as false | ||
K *Z `validate:"required"` | ||
N struct { | ||
Na, Nb string | ||
Nc time.Duration | ||
} | ||
l int // ignored | ||
M int `json:"-"` | ||
} | ||
Z map[string]*Y | ||
Q struct { | ||
NnNnnN string `json:"nnNnnN"` | ||
} | ||
V struct { | ||
L int | ||
} | ||
) | ||
|
||
func (*X) TypeName() string { return "XXX" } | ||
func (*W) Format() string { return "wallet" } | ||
func (*W) Type() string { return "string" } | ||
func (ns) Nullable() bool { return true } | ||
func (ni) Nullable() bool { return false } |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package extra_types | ||
|
||
import ( | ||
baseTypes "github.com/wI2L/fizz/openapi/test_types/base_types" | ||
) | ||
|
||
type W struct { | ||
C, D int | ||
} | ||
|
||
type D struct { | ||
Winternal W | ||
Wexternal baseTypes.W | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also test that the error is a
TypeError
containing the messageencountered duplicated type
, where theerror.T
is effectivelyextratypes.D
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍