Skip to content

Commit a334e3a

Browse files
committed
Fix directive definition
1 parent d79b986 commit a334e3a

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

juniper/src/schema/model.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,12 @@ impl<S> SchemaType<S> {
250250

251251
registry.get_type::<SchemaType<S>>(&());
252252

253-
let skip_directive = DirectiveType::new_skip(&mut registry);
254253
let include_directive = DirectiveType::new_include(&mut registry);
254+
let skip_directive = DirectiveType::new_skip(&mut registry);
255255
let deprecated_directive = DirectiveType::new_deprecated(&mut registry);
256256
let specified_by_directive = DirectiveType::new_specified_by(&mut registry);
257-
directives.insert(skip_directive.name.clone(), skip_directive);
258257
directives.insert(include_directive.name.clone(), include_directive);
258+
directives.insert(skip_directive.name.clone(), skip_directive);
259259
directives.insert(deprecated_directive.name.clone(), deprecated_directive);
260260
directives.insert(specified_by_directive.name.clone(), specified_by_directive);
261261

@@ -585,12 +585,12 @@ impl<S> DirectiveType<S> {
585585
}
586586
}
587587

588-
fn new_skip(registry: &mut Registry<S>) -> Self
588+
fn new_include(registry: &mut Registry<S>) -> Self
589589
where
590590
S: ScalarValue,
591591
{
592592
Self::new(
593-
arcstr::literal!("skip"),
593+
arcstr::literal!("include"),
594594
&[
595595
DirectiveLocation::Field,
596596
DirectiveLocation::FragmentSpread,
@@ -601,12 +601,12 @@ impl<S> DirectiveType<S> {
601601
)
602602
}
603603

604-
fn new_include(registry: &mut Registry<S>) -> Self
604+
fn new_skip(registry: &mut Registry<S>) -> Self
605605
where
606606
S: ScalarValue,
607607
{
608608
Self::new(
609-
arcstr::literal!("include"),
609+
arcstr::literal!("skip"),
610610
&[
611611
DirectiveLocation::Field,
612612
DirectiveLocation::FragmentSpread,
@@ -625,9 +625,15 @@ impl<S> DirectiveType<S> {
625625
arcstr::literal!("deprecated"),
626626
&[
627627
DirectiveLocation::FieldDefinition,
628+
DirectiveLocation::ArgumentDefinition,
629+
DirectiveLocation::InputFieldDefinition,
628630
DirectiveLocation::EnumValue,
629631
],
630-
&[registry.arg::<String>(arcstr::literal!("reason"), &())],
632+
&[registry.arg_with_default::<String>(
633+
arcstr::literal!("reason"),
634+
&"No longer supported".into(),
635+
&(),
636+
)],
631637
false,
632638
)
633639
}

juniper/src/tests/introspection_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ async fn test_introspection_directives() {
196196
"name": "deprecated",
197197
"locations": [
198198
"FIELD_DEFINITION",
199+
"ARGUMENT_DEFINITION",
200+
"INPUT_FIELD_DEFINITION",
199201
"ENUM_VALUE",
200202
],
201203
},

juniper/src/tests/schema_introspection.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,6 +1465,8 @@ pub(crate) fn schema_introspection_result() -> Value {
14651465
"isRepeatable": false,
14661466
"locations": [
14671467
"FIELD_DEFINITION",
1468+
"ARGUMENT_DEFINITION",
1469+
"INPUT_FIELD_DEFINITION",
14681470
"ENUM_VALUE"
14691471
],
14701472
"args": [
@@ -1480,7 +1482,7 @@ pub(crate) fn schema_introspection_result() -> Value {
14801482
"ofType": null
14811483
}
14821484
},
1483-
"defaultValue": null,
1485+
"defaultValue": "\"No longer supported\"",
14841486
"isDeprecated": false,
14851487
"deprecationReason": null
14861488
}
@@ -2924,6 +2926,8 @@ pub(crate) fn schema_introspection_result_without_descriptions() -> Value {
29242926
"isRepeatable": false,
29252927
"locations": [
29262928
"FIELD_DEFINITION",
2929+
"ARGUMENT_DEFINITION",
2930+
"INPUT_FIELD_DEFINITION",
29272931
"ENUM_VALUE"
29282932
],
29292933
"args": [
@@ -2938,7 +2942,7 @@ pub(crate) fn schema_introspection_result_without_descriptions() -> Value {
29382942
"ofType": null
29392943
}
29402944
},
2941-
"defaultValue": null,
2945+
"defaultValue": "\"No longer supported\"",
29422946
"isDeprecated": false,
29432947
"deprecationReason": null
29442948
}

0 commit comments

Comments
 (0)