Skip to content

Commit 1a57f08

Browse files
eMerzhfacebook-github-bot
authored andcommitted
FIX(Graphql): Add support for input with default values (#4540)
Summary: Hello here 👋 We have a few inputs with default required fields that have default values like here : ```graphql input StoryPinInput { id: ID! isGlobal: Boolean! = false } ``` but the TS generated for this look like ```ts export type StoryPinInput = { id: string; isGlobal: boolean; }; ``` which is not ideal ... so i marked the field as optional if it has a default :) Pull Request resolved: #4540 Reviewed By: voideanvalue Differential Revision: D52629725 Pulled By: captbaritone fbshipit-source-id: 472a6fcda0862cf974f16d2bbfe6c401b5415544
1 parent 0e963dd commit 1a57f08

File tree

72 files changed

+262
-169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+262
-169
lines changed

compiler/crates/graphql-ir/tests/parse/fixtures/argument_definitions.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fragment TestFragment on User
6969
},
7070
],
7171
used_global_variables: [],
72-
type_condition: Object(69),
72+
type_condition: Object(70),
7373
directives: [
7474
Directive {
7575
name: WithLocation {
@@ -87,7 +87,7 @@ fragment TestFragment on User
8787
alias: None,
8888
definition: WithLocation {
8989
location: argument_definitions.graphql:161:171,
90-
item: FieldID(516),
90+
item: FieldID(518),
9191
},
9292
arguments: [],
9393
directives: [],

compiler/crates/graphql-ir/tests/parse/fixtures/directive-generic.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ fragment TestFragment on User {
1414
},
1515
variable_definitions: [],
1616
used_global_variables: [],
17-
type_condition: Object(69),
17+
type_condition: Object(70),
1818
directives: [],
1919
selections: [
2020
ScalarField {
2121
alias: None,
2222
definition: WithLocation {
2323
location: directive-generic.graphql:34:36,
24-
item: FieldID(459),
24+
item: FieldID(461),
2525
},
2626
arguments: [],
2727
directives: [

compiler/crates/graphql-ir/tests/parse/fixtures/directive-include.expected

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fragment Foo on User {
3838
directives: [],
3939
},
4040
],
41-
type_condition: Object(69),
41+
type_condition: Object(70),
4242
directives: [],
4343
selections: [
4444
Condition {
@@ -47,7 +47,7 @@ fragment Foo on User {
4747
alias: None,
4848
definition: WithLocation {
4949
location: directive-include.graphql:34:36,
50-
item: FieldID(459),
50+
item: FieldID(461),
5151
},
5252
arguments: [],
5353
directives: [],
@@ -75,15 +75,15 @@ fragment Foo on User {
7575
selections: [
7676
InlineFragment {
7777
type_condition: Some(
78-
Object(69),
78+
Object(70),
7979
),
8080
directives: [],
8181
selections: [
8282
ScalarField {
8383
alias: None,
8484
definition: WithLocation {
8585
location: directive-include.graphql:97:106,
86-
item: FieldID(456),
86+
item: FieldID(458),
8787
},
8888
arguments: [],
8989
directives: [],
@@ -154,14 +154,14 @@ fragment Foo on User {
154154
},
155155
variable_definitions: [],
156156
used_global_variables: [],
157-
type_condition: Object(69),
157+
type_condition: Object(70),
158158
directives: [],
159159
selections: [
160160
ScalarField {
161161
alias: None,
162162
definition: WithLocation {
163163
location: directive-include.graphql:168:170,
164-
item: FieldID(459),
164+
item: FieldID(461),
165165
},
166166
arguments: [],
167167
directives: [],

compiler/crates/graphql-ir/tests/parse/fixtures/enum-values.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ query EnumValueQuery {
3434
alias: None,
3535
definition: WithLocation {
3636
location: enum-values.graphql:34:48,
37-
item: FieldID(473),
37+
item: FieldID(475),
3838
},
3939
arguments: [
4040
Argument {
@@ -60,7 +60,7 @@ query EnumValueQuery {
6060
alias: None,
6161
definition: WithLocation {
6262
location: enum-values.graphql:72:75,
63-
item: FieldID(179),
63+
item: FieldID(181),
6464
},
6565
arguments: [],
6666
directives: [],

compiler/crates/graphql-ir/tests/parse/fixtures/field-arguments.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ query TestQuery {
9292
alias: None,
9393
definition: WithLocation {
9494
location: field-arguments.graphql:89:107,
95-
item: FieldID(513),
95+
item: FieldID(515),
9696
},
9797
arguments: [],
9898
directives: [],
@@ -144,7 +144,7 @@ query TestQuery {
144144
alias: None,
145145
definition: WithLocation {
146146
location: field-arguments.graphql:164:169,
147-
item: FieldID(54),
147+
item: FieldID(55),
148148
},
149149
arguments: [],
150150
directives: [],

compiler/crates/graphql-ir/tests/parse/fixtures/fixme_fat_interface_on_union.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ query Test {
3333
alias: None,
3434
definition: WithLocation {
3535
location: fixme_fat_interface_on_union.graphql:51:53,
36-
item: FieldID(377),
36+
item: FieldID(379),
3737
},
3838
arguments: [],
3939
directives: [

compiler/crates/graphql-ir/tests/parse/fixtures/fragment-with-arguments-syntax.expected

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ fragment Foo($localId: ID!) on User {
8585
directives: [],
8686
},
8787
],
88-
type_condition: Object(69),
88+
type_condition: Object(70),
8989
directives: [],
9090
selections: [
9191
LinkedField {
9292
alias: None,
9393
definition: WithLocation {
9494
location: fragment-with-arguments-syntax.graphql:71:85,
95-
item: FieldID(473),
95+
item: FieldID(475),
9696
},
9797
arguments: [
9898
Argument {
@@ -128,7 +128,7 @@ fragment Foo($localId: ID!) on User {
128128
alias: None,
129129
definition: WithLocation {
130130
location: fragment-with-arguments-syntax.graphql:112:115,
131-
item: FieldID(179),
131+
item: FieldID(181),
132132
},
133133
arguments: [],
134134
directives: [],
@@ -144,7 +144,7 @@ fragment Foo($localId: ID!) on User {
144144
),
145145
definition: WithLocation {
146146
location: fragment-with-arguments-syntax.graphql:138:152,
147-
item: FieldID(473),
147+
item: FieldID(475),
148148
},
149149
arguments: [
150150
Argument {
@@ -180,7 +180,7 @@ fragment Foo($localId: ID!) on User {
180180
alias: None,
181181
definition: WithLocation {
182182
location: fragment-with-arguments-syntax.graphql:172:175,
183-
item: FieldID(179),
183+
item: FieldID(181),
184184
},
185185
arguments: [],
186186
directives: [],
@@ -253,14 +253,14 @@ fragment Foo($localId: ID!) on User {
253253
},
254254
],
255255
used_global_variables: [],
256-
type_condition: Object(69),
256+
type_condition: Object(70),
257257
directives: [],
258258
selections: [
259259
ScalarField {
260260
alias: None,
261261
definition: WithLocation {
262262
location: fragment-with-arguments-syntax.graphql:246:248,
263-
item: FieldID(459),
263+
item: FieldID(461),
264264
},
265265
arguments: [],
266266
directives: [],

compiler/crates/graphql-ir/tests/parse/fixtures/fragment-with-arguments.expected

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fragment Foo on User @argumentDefinitions(localId: {type: "ID!"}) {
8686
directives: [],
8787
},
8888
],
89-
type_condition: Object(69),
89+
type_condition: Object(70),
9090
directives: [
9191
Directive {
9292
name: WithLocation {
@@ -104,7 +104,7 @@ fragment Foo on User @argumentDefinitions(localId: {type: "ID!"}) {
104104
alias: None,
105105
definition: WithLocation {
106106
location: fragment-with-arguments.graphql:131:145,
107-
item: FieldID(473),
107+
item: FieldID(475),
108108
},
109109
arguments: [
110110
Argument {
@@ -140,7 +140,7 @@ fragment Foo on User @argumentDefinitions(localId: {type: "ID!"}) {
140140
alias: None,
141141
definition: WithLocation {
142142
location: fragment-with-arguments.graphql:172:175,
143-
item: FieldID(179),
143+
item: FieldID(181),
144144
},
145145
arguments: [],
146146
directives: [],
@@ -156,7 +156,7 @@ fragment Foo on User @argumentDefinitions(localId: {type: "ID!"}) {
156156
),
157157
definition: WithLocation {
158158
location: fragment-with-arguments.graphql:198:212,
159-
item: FieldID(473),
159+
item: FieldID(475),
160160
},
161161
arguments: [
162162
Argument {
@@ -192,7 +192,7 @@ fragment Foo on User @argumentDefinitions(localId: {type: "ID!"}) {
192192
alias: None,
193193
definition: WithLocation {
194194
location: fragment-with-arguments.graphql:232:235,
195-
item: FieldID(179),
195+
item: FieldID(181),
196196
},
197197
arguments: [],
198198
directives: [],
@@ -265,7 +265,7 @@ fragment Foo on User @argumentDefinitions(localId: {type: "ID!"}) {
265265
},
266266
],
267267
used_global_variables: [],
268-
type_condition: Object(69),
268+
type_condition: Object(70),
269269
directives: [
270270
Directive {
271271
name: WithLocation {
@@ -283,7 +283,7 @@ fragment Foo on User @argumentDefinitions(localId: {type: "ID!"}) {
283283
alias: None,
284284
definition: WithLocation {
285285
location: fragment-with-arguments.graphql:347:349,
286-
item: FieldID(459),
286+
item: FieldID(461),
287287
},
288288
arguments: [],
289289
directives: [],

compiler/crates/graphql-ir/tests/parse/fixtures/fragment-with-literal-arguments.expected

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fragment ChildFragment on User
2121
},
2222
variable_definitions: [],
2323
used_global_variables: [],
24-
type_condition: Object(69),
24+
type_condition: Object(70),
2525
directives: [],
2626
selections: [
2727
FragmentSpread {
@@ -84,7 +84,7 @@ fragment ChildFragment on User
8484
},
8585
],
8686
used_global_variables: [],
87-
type_condition: Object(69),
87+
type_condition: Object(70),
8888
directives: [
8989
Directive {
9090
name: WithLocation {
@@ -102,7 +102,7 @@ fragment ChildFragment on User
102102
alias: None,
103103
definition: WithLocation {
104104
location: fragment-with-literal-arguments.graphql:174:188,
105-
item: FieldID(473),
105+
item: FieldID(475),
106106
},
107107
arguments: [
108108
Argument {
@@ -138,7 +138,7 @@ fragment ChildFragment on User
138138
alias: None,
139139
definition: WithLocation {
140140
location: fragment-with-literal-arguments.graphql:215:218,
141-
item: FieldID(179),
141+
item: FieldID(181),
142142
},
143143
arguments: [],
144144
directives: [],

compiler/crates/graphql-ir/tests/parse/fixtures/fragment-with-literal-enum-arguments-into-enum-list.expected

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fragment ChildFragment on User
2424
},
2525
variable_definitions: [],
2626
used_global_variables: [],
27-
type_condition: Object(69),
27+
type_condition: Object(70),
2828
directives: [],
2929
selections: [
3030
LinkedField {
@@ -36,7 +36,7 @@ fragment ChildFragment on User
3636
),
3737
definition: WithLocation {
3838
location: fragment-with-literal-enum-arguments-into-enum-list.graphql:53:61,
39-
item: FieldID(450),
39+
item: FieldID(452),
4040
},
4141
arguments: [
4242
Argument {
@@ -66,7 +66,7 @@ fragment ChildFragment on User
6666
alias: None,
6767
definition: WithLocation {
6868
location: fragment-with-literal-enum-arguments-into-enum-list.graphql:92:97,
69-
item: FieldID(54),
69+
item: FieldID(55),
7070
},
7171
arguments: [],
7272
directives: [],
@@ -133,7 +133,7 @@ fragment ChildFragment on User
133133
},
134134
],
135135
used_global_variables: [],
136-
type_condition: Object(69),
136+
type_condition: Object(70),
137137
directives: [
138138
Directive {
139139
name: WithLocation {
@@ -151,7 +151,7 @@ fragment ChildFragment on User
151151
alias: None,
152152
definition: WithLocation {
153153
location: fragment-with-literal-enum-arguments-into-enum-list.graphql:253:261,
154-
item: FieldID(450),
154+
item: FieldID(452),
155155
},
156156
arguments: [
157157
Argument {
@@ -191,7 +191,7 @@ fragment ChildFragment on User
191191
alias: None,
192192
definition: WithLocation {
193193
location: fragment-with-literal-enum-arguments-into-enum-list.graphql:297:302,
194-
item: FieldID(54),
194+
item: FieldID(55),
195195
},
196196
arguments: [],
197197
directives: [],

0 commit comments

Comments
 (0)