-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flag and validation for strict resolver flavors
Reviewed By: captbaritone Differential Revision: D48844413 fbshipit-source-id: 99810d110c01e0eb72933d21e93e3dcf82d134e0
- Loading branch information
1 parent
5c069d7
commit 77304c2
Showing
17 changed files
with
354 additions
and
1 deletion.
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
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
34 changes: 34 additions & 0 deletions
34
...ock/tests/parse/fixtures/strict-flavors-live-resolver-with-root-fragment.invalid.expected
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,34 @@ | ||
==================================== INPUT ==================================== | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// expected-to-throw | ||
// relay:enable_strict_resolver_flavors | ||
|
||
/** | ||
* @RelayResolver User.favorite_page: Page | ||
* @rootFragment myRootFragment | ||
* @live | ||
* | ||
* The user's favorite page! They probably clicked something in the UI | ||
* to tell us that it was their favorite page and then we put that in a | ||
* database or something. Then we got that info out again and put it out | ||
* again. Anyway, I'm rambling now. Its a page that the user likes. A lot. | ||
*/ | ||
graphql` | ||
fragment myRootFragment on User { | ||
name | ||
} | ||
` | ||
==================================== ERROR ==================================== | ||
✖︎ @live is incompatible with @rootFragment | ||
|
||
/path/to/test/fixture/strict-flavors-live-resolver-with-root-fragment.invalid.js:14:5 | ||
13 │ * @rootFragment myRootFragment | ||
14 │ * @live | ||
│ ^^^^ | ||
15 │ * |
25 changes: 25 additions & 0 deletions
25
...-docblock/tests/parse/fixtures/strict-flavors-live-resolver-with-root-fragment.invalid.js
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,25 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// expected-to-throw | ||
// relay:enable_strict_resolver_flavors | ||
|
||
/** | ||
* @RelayResolver User.favorite_page: Page | ||
* @rootFragment myRootFragment | ||
* @live | ||
* | ||
* The user's favorite page! They probably clicked something in the UI | ||
* to tell us that it was their favorite page and then we put that in a | ||
* database or something. Then we got that info out again and put it out | ||
* again. Anyway, I'm rambling now. Its a page that the user likes. A lot. | ||
*/ | ||
graphql` | ||
fragment myRootFragment on User { | ||
name | ||
} | ||
` |
47 changes: 47 additions & 0 deletions
47
...rates/relay-docblock/tests/parse/fixtures/strict-flavors-multiple-errors.invalid.expected
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,47 @@ | ||
==================================== INPUT ==================================== | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// expected-to-throw | ||
// relay:enable_strict_resolver_flavors | ||
// relay:enable_output_type | ||
|
||
/** | ||
* @RelayResolver | ||
* @fieldName favorite_page | ||
* @onType User | ||
* @rootFragment myRootFragment | ||
* @outputType SomeType | ||
* @live | ||
* | ||
* The user's favorite page! They probably clicked something in the UI | ||
* to tell us that it was their favorite page and then we put that in a | ||
* database or something. Then we got that info out again and put it out | ||
* again. Anyway, I'm rambling now. Its a page that the user likes. A lot. | ||
*/ | ||
graphql` | ||
fragment myRootFragment on User { | ||
name | ||
} | ||
` | ||
==================================== ERROR ==================================== | ||
✖︎ @live is incompatible with @rootFragment | ||
|
||
/path/to/test/fixture/strict-flavors-multiple-errors.invalid.js:18:5 | ||
17 │ * @outputType SomeType | ||
18 │ * @live | ||
│ ^^^^ | ||
19 │ * | ||
|
||
|
||
✖︎ @outputType is incompatible with @rootFragment | ||
|
||
/path/to/test/fixture/strict-flavors-multiple-errors.invalid.js:17:5 | ||
16 │ * @rootFragment myRootFragment | ||
17 │ * @outputType SomeType | ||
│ ^^^^^^^^^^ | ||
18 │ * @live |
29 changes: 29 additions & 0 deletions
29
...iler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-multiple-errors.invalid.js
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,29 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// expected-to-throw | ||
// relay:enable_strict_resolver_flavors | ||
// relay:enable_output_type | ||
|
||
/** | ||
* @RelayResolver | ||
* @fieldName favorite_page | ||
* @onType User | ||
* @rootFragment myRootFragment | ||
* @outputType SomeType | ||
* @live | ||
* | ||
* The user's favorite page! They probably clicked something in the UI | ||
* to tell us that it was their favorite page and then we put that in a | ||
* database or something. Then we got that info out again and put it out | ||
* again. Anyway, I'm rambling now. Its a page that the user likes. A lot. | ||
*/ | ||
graphql` | ||
fragment myRootFragment on User { | ||
name | ||
} | ||
` |
37 changes: 37 additions & 0 deletions
37
...block/tests/parse/fixtures/strict-flavors-output-type-with-root-fragment.invalid.expected
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,37 @@ | ||
==================================== INPUT ==================================== | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// expected-to-throw | ||
// relay:enable_strict_resolver_flavors | ||
// relay:enable_output_type | ||
|
||
/** | ||
* @RelayResolver | ||
* @onType User | ||
* @fieldName favorite_page | ||
* @rootFragment myRootFragment | ||
* @outputType SomeType | ||
* | ||
* The user's favorite page! They probably clicked something in the UI | ||
* to tell us that it was their favorite page and then we put that in a | ||
* database or something. Then we got that info out again and put it out | ||
* again. Anyway, I'm rambling now. Its a page that the user likes. A lot. | ||
*/ | ||
graphql` | ||
fragment myRootFragment on User { | ||
name | ||
} | ||
` | ||
==================================== ERROR ==================================== | ||
✖︎ @outputType is incompatible with @rootFragment | ||
|
||
/path/to/test/fixture/strict-flavors-output-type-with-root-fragment.invalid.js:17:5 | ||
16 │ * @rootFragment myRootFragment | ||
17 │ * @outputType SomeType | ||
│ ^^^^^^^^^^ | ||
18 │ * |
28 changes: 28 additions & 0 deletions
28
...ay-docblock/tests/parse/fixtures/strict-flavors-output-type-with-root-fragment.invalid.js
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,28 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// expected-to-throw | ||
// relay:enable_strict_resolver_flavors | ||
// relay:enable_output_type | ||
|
||
/** | ||
* @RelayResolver | ||
* @onType User | ||
* @fieldName favorite_page | ||
* @rootFragment myRootFragment | ||
* @outputType SomeType | ||
* | ||
* The user's favorite page! They probably clicked something in the UI | ||
* to tell us that it was their favorite page and then we put that in a | ||
* database or something. Then we got that info out again and put it out | ||
* again. Anyway, I'm rambling now. Its a page that the user likes. A lot. | ||
*/ | ||
graphql` | ||
fragment myRootFragment on User { | ||
name | ||
} | ||
` |
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
Oops, something went wrong.