-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix missing return in model plugin getObject;
refactor to use `getObject` to create the base struct to be used in embedding; add test for embedded structs; update models.gotpl to not create the `` for tags when there are no tags
- Loading branch information
Adrian Lungu
committed
Sep 5, 2024
1 parent
384d4a0
commit 849731b
Showing
6 changed files
with
156 additions
and
12 deletions.
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
63 changes: 63 additions & 0 deletions
63
plugin/modelgen/out_embedded_structs_models/generated_embedded_structs_models.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,7 @@ | ||
schema: | ||
- "testdata/schema_embedded_structs_models.graphql" | ||
|
||
model: | ||
filename: out_embedded_structs_models/generated_embedded_structs_models.go | ||
|
||
omit_embedded_structs: false |
26 changes: 26 additions & 0 deletions
26
plugin/modelgen/testdata/schema_embedded_structs_models.graphql
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,26 @@ | ||
interface Node { | ||
id: ID! | ||
} | ||
|
||
interface Element implements Node { | ||
id: ID! | ||
name: String! | ||
} | ||
|
||
type Magnesium implements Element & Node { | ||
id: ID! | ||
name: String! | ||
types: Int! | ||
} | ||
|
||
type Potassium implements Element & Node { | ||
id: ID! | ||
name: String! | ||
price: Float! | ||
} | ||
|
||
type Carbon implements Element & Node { | ||
id: ID! | ||
name: String! | ||
footprint: String! | ||
} |