Commit 667297f
authored
[plugin] update client generator to support kotlinx serialization (#1069)
This is a second PR in a series to introduce support for both `Jackson` and `kotlinx.serialization` data formats for GraphQL Kotlin clients.
This PR updates `graphql-kotlin-client-generator` to allow generating data models supporting both formats. Due to the declaration limitations of Kotlin sealed classes (in Kotlin 1.4 sealed classes and their implementations have to be a top level definitions), generation logic was also updated to generate operation specific data models under package name matching that operation name. Common objects such as input objects, enums and custom scalars definitions will be shared across different queries.
Large size of PR is driven primarily with test cases - instead of comparing generated classes against a hard coded Strings, tests were updated to compare it against files. Generator tests were also updated to verify generated sources can be compiled.
* #1048 - this is an attempt to split it up to more manageable pieces
* #929 - add support for generating `kotlinx.serialization` data models
* #1066 - first PR in the series1 parent a9ad9fc commit 667297f
File tree
221 files changed
+4333
-3461
lines changed- examples/client
- gradle-client
- src/main/kotlin/com/expediagroup/graphql/examples/client/gradle
- maven-client/src/main/kotlin/com/expediagroup/graphql/examples/client/maven
- plugins
- client/graphql-kotlin-client-generator
- src
- main/kotlin/com/expediagroup/graphql/plugin/client
- generator
- types
- test
- data
- generator
- alias
- documentation
- documentationquery
- input_hard_coded
- input_self_reference
- inputs
- interface_diff_selection_sets
- differentselectionsetquery
- interface_impl_diff_selection_sets
- differentselectionsetquery
- interface_named_fragments
- interfacewithnamedfragmentsquery
- mutation
- inputs
- simplemutation
- object_diff_selection_set
- differentselectionsquery
- object_diff_sub_selection
- differentsubselectionquery
- object_list
- listquery
- object_named_fragments
- objectwithnamedfragmentquery
- object_self_reference
- nestedquery
- operation_name_missing
- anonymousquery
- operation_name_unchanged
- mixedcasequery
- reuse_list_types
- reusedlisttypesquery
- reuse_types
- reusedtypesquery
- scalar_typealias
- scalaraliasquery
- union_diff_selection_set2
- differentselectionsetquery
- union_diff_selection_set
- differentselectionsetquery
- union_named_fragments
- unionquerywithnamedfragments
- invalid
- deprecated
- fragment_doesnt_exist
- interface_empty_selection
- interface_missing_typename
- interface_missing_types
- invalid_field
- invalid_fragment
- object_empty_selection
- union_empty_selection
- union_missing_typename
- union_missing_types
- jackson
- custom_scalars
- customscalarquery
- scalars
- enums
- enums
- interface
- interfacewithinlinefragmentsquery
- object
- complexobjectquery
- union
- unionquerywithinlinefragments
- variables
- inputs
- kotlinx
- custom_scalars
- customscalarquery
- scalars
- deprecated_opt_in
- enums
- enums
- interface
- interfacewithinlinefragmentsquery
- multiple_queries
- enums
- firstquery
- inputs
- scalars
- secondquery
- object
- complexobjectquery
- union
- unionquerywithinlinefragments
- variables
- inputs
- kotlin/com/expediagroup/graphql/plugin/client/generator
- types
- graphql-kotlin-gradle-plugin
- src
- main/kotlin/com/expediagroup/graphql/plugin/gradle
- actions
- config
- parameters
- tasks
- test
- kotlin/com/expediagroup/graphql/plugin/gradle
- resources/templates
- graphql-kotlin-maven-plugin
- src
- integration
- basic-setup/src/test/kotlin/com/expediagroup/graphql/plugin/maven
- complete-setup/src/test/kotlin/com/expediagroup/graphql/plugin/maven
- main/kotlin/com/expediagroup/graphql/plugin/maven
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
221 files changed
+4333
-3461
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| |||
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | | - | |
35 | 33 | | |
36 | 34 | | |
37 | 35 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
74 | | - | |
| 76 | + | |
75 | 77 | | |
76 | 78 | | |
77 | | - | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
83 | | - | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
67 | | - | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | | - | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
76 | | - | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | 30 | | |
32 | 31 | | |
Lines changed: 7 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
| 5 | + | |
4 | 6 | | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 12 | + | |
15 | 13 | | |
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
| 17 | + | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| 21 | + | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
33 | | - | |
34 | 32 | | |
35 | 33 | | |
36 | 34 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
Lines changed: 46 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
55 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
56 | 66 | | |
57 | 67 | | |
58 | 68 | | |
| |||
67 | 77 | | |
68 | 78 | | |
69 | 79 | | |
70 | | - | |
| 80 | + | |
71 | 81 | | |
72 | 82 | | |
73 | 83 | | |
| |||
76 | 86 | | |
77 | 87 | | |
78 | 88 | | |
79 | | - | |
80 | | - | |
| 89 | + | |
| 90 | + | |
81 | 91 | | |
82 | 92 | | |
83 | 93 | | |
| |||
86 | 96 | | |
87 | 97 | | |
88 | 98 | | |
89 | | - | |
| 99 | + | |
| 100 | + | |
90 | 101 | | |
91 | 102 | | |
92 | 103 | | |
93 | 104 | | |
94 | 105 | | |
95 | 106 | | |
96 | | - | |
| 107 | + | |
97 | 108 | | |
98 | 109 | | |
99 | 110 | | |
| |||
106 | 117 | | |
107 | 118 | | |
108 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
109 | 123 | | |
110 | 124 | | |
111 | 125 | | |
| |||
137 | 151 | | |
138 | 152 | | |
139 | 153 | | |
140 | | - | |
141 | | - | |
142 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
143 | 173 | | |
144 | | - | |
| 174 | + | |
| 175 | + | |
145 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
146 | 181 | | |
147 | 182 | | |
148 | | - | |
| 183 | + | |
149 | 184 | | |
150 | 185 | | |
151 | 186 | | |
| |||
Lines changed: 6 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
55 | 51 | | |
Lines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
37 | 38 | | |
38 | | - | |
39 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
40 | 46 | | |
41 | 47 | | |
| 48 | + | |
| 49 | + | |
42 | 50 | | |
43 | 51 | | |
0 commit comments