Skip to content

Commit 3a16e22

Browse files
captbaritonefacebook-github-bot
authored andcommitted
Allow @dangerously_unaliased_fixme in updatable fragments
Reviewed By: gordyf Differential Revision: D69608990 fbshipit-source-id: 7c8383f4372834d4e9c05d949da5c431b1883bda
1 parent de6da29 commit 3a16e22

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

compiler/crates/relay-transforms/src/assignable_fragment_spread/validate_updatable_directive.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ use schema::Schema;
3535
use super::ValidationMessage;
3636
use super::ASSIGNABLE_DIRECTIVE;
3737
use super::UPDATABLE_DIRECTIVE;
38+
use crate::fragment_alias_directive::FRAGMENT_DANGEROUSLY_UNALIAS_DIRECTIVE_NAME;
3839

3940
lazy_static! {
4041
static ref ALLOW_LISTED_DIRECTIVES: Vec<DirectiveName> = vec![
4142
*UPDATABLE_DIRECTIVE,
43+
*FRAGMENT_DANGEROUSLY_UNALIAS_DIRECTIVE_NAME,
4244
// TODO have a global list of directives...?
4345
DirectiveName("fb_owner".intern()),
4446
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
==================================== INPUT ====================================
2+
query TestQuery @updatable {
3+
node(id: 4) {
4+
...FragmentOnUser @dangerously_unaliased_fixme
5+
}
6+
}
7+
8+
fragment FragmentOnUser on User @assignable {
9+
__typename
10+
}
11+
==================================== OUTPUT ===================================
12+
OK
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
query TestQuery @updatable {
2+
node(id: 4) {
3+
...FragmentOnUser @dangerously_unaliased_fixme
4+
}
5+
}
6+
7+
fragment FragmentOnUser on User @assignable {
8+
__typename
9+
}

compiler/crates/relay-transforms/tests/updatable_directive_test.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<97d52b0fa84f80726d7eb06310a18c0d>>
7+
* @generated SignedSource<<424418c51b45b6086d00947be17a05cd>>
88
*/
99

1010
mod updatable_directive;
@@ -33,6 +33,13 @@ async fn client_side_updatable() {
3333
test_fixture(transform_fixture, file!(), "client-side-updatable.graphql", "updatable_directive/fixtures/client-side-updatable.expected", input, expected).await;
3434
}
3535

36+
#[tokio::test]
37+
async fn dangerously_unaliased_allowed() {
38+
let input = include_str!("updatable_directive/fixtures/dangerously-unaliased-allowed.graphql");
39+
let expected = include_str!("updatable_directive/fixtures/dangerously-unaliased-allowed.expected");
40+
test_fixture(transform_fixture, file!(), "dangerously-unaliased-allowed.graphql", "updatable_directive/fixtures/dangerously-unaliased-allowed.expected", input, expected).await;
41+
}
42+
3643
#[tokio::test]
3744
async fn directive_fragment_spread_invalid() {
3845
let input = include_str!("updatable_directive/fixtures/directive-fragment-spread.invalid.graphql");

0 commit comments

Comments
 (0)