diff --git a/compiler/crates/common/src/feature_flags.rs b/compiler/crates/common/src/feature_flags.rs index 262fce22a159c..aa9bbfcb776a6 100644 --- a/compiler/crates/common/src/feature_flags.rs +++ b/compiler/crates/common/src/feature_flags.rs @@ -76,6 +76,10 @@ pub struct FeatureFlags { /// Enforce strict flavors for relay resolvers and disallow mixing flavors #[serde(default)] pub relay_resolvers_enable_strict_resolver_flavors: FeatureFlag, + + /// Allow legacy verbose resolver syntax + #[serde(default)] + pub relay_resolvers_allow_legacy_verbose_syntax: FeatureFlag, } #[derive(Debug, Deserialize, Clone, Serialize)] diff --git a/compiler/crates/relay-compiler/src/docblocks.rs b/compiler/crates/relay-compiler/src/docblocks.rs index 70dd5001e1c87..e559685f76065 100644 --- a/compiler/crates/relay-compiler/src/docblocks.rs +++ b/compiler/crates/relay-compiler/src/docblocks.rs @@ -82,6 +82,9 @@ fn parse_source( enable_strict_resolver_flavors: &project_config .feature_flags .relay_resolvers_enable_strict_resolver_flavors, + allow_legacy_verbose_syntax: &project_config + .feature_flags + .relay_resolvers_allow_legacy_verbose_syntax, }, )?; maybe_ir diff --git a/compiler/crates/relay-compiler/tests/compile_relay_artifacts/mod.rs b/compiler/crates/relay-compiler/tests/compile_relay_artifacts/mod.rs index b6578c7cd73c4..961a995c01839 100644 --- a/compiler/crates/relay-compiler/tests/compile_relay_artifacts/mod.rs +++ b/compiler/crates/relay-compiler/tests/compile_relay_artifacts/mod.rs @@ -120,6 +120,7 @@ pub async fn transform_fixture(fixture: &Fixture<'_>) -> Result .contains("# enable_resolver_normalization_ast"), enable_schema_resolvers: false, relay_resolvers_enable_strict_resolver_flavors: FeatureFlag::Disabled, + relay_resolvers_allow_legacy_verbose_syntax: FeatureFlag::Disabled, }; let default_project_config = ProjectConfig { diff --git a/compiler/crates/relay-compiler/tests/compile_relay_artifacts_with_custom_id/mod.rs b/compiler/crates/relay-compiler/tests/compile_relay_artifacts_with_custom_id/mod.rs index aea4b22ab3bbc..13784bdae0257 100644 --- a/compiler/crates/relay-compiler/tests/compile_relay_artifacts_with_custom_id/mod.rs +++ b/compiler/crates/relay-compiler/tests/compile_relay_artifacts_with_custom_id/mod.rs @@ -98,6 +98,7 @@ pub async fn transform_fixture(fixture: &Fixture<'_>) -> Result enable_resolver_normalization_ast: false, enable_schema_resolvers: false, relay_resolvers_enable_strict_resolver_flavors: FeatureFlag::Disabled, + relay_resolvers_allow_legacy_verbose_syntax: FeatureFlag::Disabled, }; let default_schema_config = SchemaConfig::default(); diff --git a/compiler/crates/relay-docblock/src/docblock_ir.rs b/compiler/crates/relay-docblock/src/docblock_ir.rs index 2a02b627c3c88..2fd414c7340cc 100644 --- a/compiler/crates/relay-docblock/src/docblock_ir.rs +++ b/compiler/crates/relay-docblock/src/docblock_ir.rs @@ -55,9 +55,9 @@ use crate::ir::WeakObjectIr; use crate::untyped_representation::AllowedFieldName; use crate::untyped_representation::UntypedDocblockRepresentation; use crate::DocblockIr; +use crate::LegacyVerboseResolverIr; use crate::On; use crate::ParseOptions; -use crate::RelayResolverIr; pub(crate) fn parse_docblock_ir( project_name: ProjectName, @@ -97,7 +97,7 @@ pub(crate) fn parse_docblock_ir( }; let parsed_docblock_ir = match resolver_field { IrField::UnpopulatedIrField(unpopulated_ir_field) => { - DocblockIr::RelayResolver(parse_relay_resolver_ir( + let legacy_verbose_resolver = parse_relay_resolver_ir( &mut fields, definitions_in_file, description, @@ -106,7 +106,35 @@ pub(crate) fn parse_docblock_ir( unpopulated_ir_field, parse_options, source_hash, - )?) + )?; + + let field_name = format!( + "{}.{}", + legacy_verbose_resolver.on.type_name(), + legacy_verbose_resolver.field.name.value + ) + .intern(); + + if !parse_options + .allow_legacy_verbose_syntax + .is_enabled_for(field_name) + { + match legacy_verbose_resolver.on { + On::Type(field) => { + return Err(vec![Diagnostic::error( + IrParsingErrorMessages::UnexpectedOnType { field_name }, + field.key_location, + )]); + } + On::Interface(field) => { + return Err(vec![Diagnostic::error( + IrParsingErrorMessages::UnexpectedOnInterface { field_name }, + field.key_location, + )]); + } + } + } + DocblockIr::LegacyVerboseResolver(legacy_verbose_resolver) } IrField::PopulatedIrField(populated_ir_field) => { if populated_ir_field.value.item.lookup().contains('.') { @@ -165,7 +193,7 @@ fn parse_relay_resolver_ir( _resolver_field: UnpopulatedIrField, parse_options: &ParseOptions<'_>, source_hash: ResolverSourceHash, -) -> DiagnosticsResult { +) -> DiagnosticsResult { let root_fragment = get_optional_populated_field_named(fields, AllowedFieldName::RootFragmentField)?; let field_name = @@ -215,7 +243,7 @@ fn parse_relay_resolver_ir( validate_field_arguments(&field_definition_stub.arguments, location.source_location())?; - Ok(RelayResolverIr { + Ok(LegacyVerboseResolverIr { live: get_optional_unpopulated_field_named(fields, AllowedFieldName::LiveField)?, on, root_fragment: root_fragment @@ -729,7 +757,7 @@ fn extract_fragment_arguments( fn get_resolver_field_path(docblock_ir: &DocblockIr) -> Option { match docblock_ir { - DocblockIr::RelayResolver(resolver_ir) => { + DocblockIr::LegacyVerboseResolver(resolver_ir) => { let parent_type_name = match resolver_ir.on { On::Type(field) => field.value.item, On::Interface(field) => field.value.item, @@ -757,7 +785,7 @@ fn validate_strict_resolver_flavors( output_type: Option, } let validation_info: Option = match docblock_ir { - DocblockIr::RelayResolver(resolver_ir) => { + DocblockIr::LegacyVerboseResolver(resolver_ir) => { let output_type_location = resolver_ir.output_type.as_ref().map(|ot| { let type_loc = ot.inner().location; let (type_start, _) = type_loc.span().as_usize(); @@ -806,14 +834,14 @@ fn validate_strict_resolver_flavors( let mut errs = vec![]; if let Some(live_loc) = validation_info.live { errs.push(Diagnostic::error( - "@live is incompatible with @rootFragment", + IrParsingErrorMessages::IncompatibleLiveAndRootFragment, live_loc, )); } if let Some(output_type_loc) = validation_info.output_type { errs.push(Diagnostic::error( - "@outputType is incompatible with @rootFragment", + IrParsingErrorMessages::IncompatibleOutputTypeAndRootFragment, output_type_loc, )); } diff --git a/compiler/crates/relay-docblock/src/errors.rs b/compiler/crates/relay-docblock/src/errors.rs index 7b54cedc5b3e2..9052cd3b20c88 100644 --- a/compiler/crates/relay-docblock/src/errors.rs +++ b/compiler/crates/relay-docblock/src/errors.rs @@ -122,6 +122,22 @@ pub enum IrParsingErrorMessages { "Unexpected `@outputType`. The deprecated `@outputType` option is not enabled for the field `{field_name}`." )] UnexpectedOutputType { field_name: StringKey }, + + #[error( + "Unexpected `@onType`. The deprecated `@onType` option is not enabled for the field `{field_name}`. Please use the new syntax: `@RelayResolver ParentType.field_name`." + )] + UnexpectedOnType { field_name: StringKey }, + + #[error( + "Unexpected `@onInterface`. The deprecated `@onType` option is not enabled for the field `{field_name}`. Please use the new syntax: `@RelayResolver ParentInterface.field_name`." + )] + UnexpectedOnInterface { field_name: StringKey }, + + #[error("@live is incompatible with @rootFragment")] + IncompatibleLiveAndRootFragment, + + #[error("@outputType is incompatible with @rootFragment")] + IncompatibleOutputTypeAndRootFragment, } #[derive(Clone, Debug, Error, Eq, PartialEq, Ord, PartialOrd, Hash)] diff --git a/compiler/crates/relay-docblock/src/ir.rs b/compiler/crates/relay-docblock/src/ir.rs index ed26e7a70698b..b7709856728e9 100644 --- a/compiler/crates/relay-docblock/src/ir.rs +++ b/compiler/crates/relay-docblock/src/ir.rs @@ -89,7 +89,7 @@ lazy_static! { #[derive(Debug, Clone, PartialEq)] pub enum DocblockIr { - RelayResolver(RelayResolverIr), + LegacyVerboseResolver(LegacyVerboseResolverIr), TerseRelayResolver(TerseRelayResolverIr), StrongObjectResolver(StrongObjectIr), WeakObjectType(WeakObjectIr), @@ -98,7 +98,7 @@ pub enum DocblockIr { impl DocblockIr { pub(crate) fn get_variant_name(&self) -> &'static str { match self { - DocblockIr::RelayResolver(_) => "legacy resolver declaration", + DocblockIr::LegacyVerboseResolver(_) => "legacy resolver declaration", DocblockIr::TerseRelayResolver(_) => "terse resolver declaration", DocblockIr::StrongObjectResolver(_) => "strong object type declaration", DocblockIr::WeakObjectType(_) => "weak object type declaration", @@ -143,7 +143,7 @@ impl DocblockIr { }; match self { - DocblockIr::RelayResolver(relay_resolver) => { + DocblockIr::LegacyVerboseResolver(relay_resolver) => { relay_resolver.to_graphql_schema_ast(project_config) } DocblockIr::TerseRelayResolver(relay_resolver) => { @@ -229,6 +229,15 @@ pub enum On { Interface(PopulatedIrField), } +impl On { + pub fn type_name(&self) -> StringKey { + match self { + On::Type(field) => field.value.item, + On::Interface(field) => field.value.item, + } + } +} + #[derive(Debug, Clone, PartialEq)] pub struct Argument { pub name: Identifier, @@ -745,7 +754,7 @@ impl ResolverTypeDefinitionIr for TerseRelayResolverIr { } #[derive(Debug, Clone, PartialEq)] -pub struct RelayResolverIr { +pub struct LegacyVerboseResolverIr { pub field: FieldDefinitionStub, pub on: On, pub root_fragment: Option>, @@ -759,7 +768,7 @@ pub struct RelayResolverIr { pub source_hash: ResolverSourceHash, } -impl ResolverIr for RelayResolverIr { +impl ResolverIr for LegacyVerboseResolverIr { fn definitions( self, project_config: ResolverProjectConfig<'_, '_>, @@ -897,7 +906,7 @@ impl ResolverIr for RelayResolverIr { } } -impl ResolverTypeDefinitionIr for RelayResolverIr { +impl ResolverTypeDefinitionIr for LegacyVerboseResolverIr { fn field_name(&self) -> &Identifier { &self.field.name } diff --git a/compiler/crates/relay-docblock/src/lib.rs b/compiler/crates/relay-docblock/src/lib.rs index 7b8139b126cf5..ab90ce0ac81fb 100644 --- a/compiler/crates/relay-docblock/src/lib.rs +++ b/compiler/crates/relay-docblock/src/lib.rs @@ -31,8 +31,8 @@ use graphql_syntax::ExecutableDefinition; use graphql_syntax::TypeSystemDefinition; use intern::Lookup; pub use ir::DocblockIr; +use ir::LegacyVerboseResolverIr; pub use ir::On; -use ir::RelayResolverIr; use relay_config::ProjectName; use schema::SDLSchema; use untyped_representation::parse_untyped_docblock_representation; @@ -40,6 +40,7 @@ use untyped_representation::parse_untyped_docblock_representation; pub struct ParseOptions<'a> { pub enable_output_type: &'a FeatureFlag, pub enable_strict_resolver_flavors: &'a FeatureFlag, + pub allow_legacy_verbose_syntax: &'a FeatureFlag, } pub fn parse_docblock_ast( diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-non-null-plural-item.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-non-null-plural-item.invalid.expected index 9cd364d6e06d8..a33415e47836d 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-non-null-plural-item.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-non-null-plural-item.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -30,8 +31,8 @@ graphql` ==================================== ERROR ==================================== ✖︎ Unexpected non-nullable item in list type given in `@edgeTo`. - /path/to/test/fixture/edge-to-non-null-plural-item.invalid.js:15:12 - 14 │ * @fieldName favorite_page - 15 │ * @edgeTo [Page!] + /path/to/test/fixture/edge-to-non-null-plural-item.invalid.js:16:12 + 15 │ * @fieldName favorite_page + 16 │ * @edgeTo [Page!] │ ^^^^^^^ - 16 │ * @rootFragment myRootFragment + 17 │ * @rootFragment myRootFragment diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-non-null-plural-item.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-non-null-plural-item.invalid.js index 08f87bc68f426..d2a14c9acf5df 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-non-null-plural-item.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-non-null-plural-item.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-non-null.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-non-null.invalid.expected index ac7e711deb006..0dc6429496979 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-non-null.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-non-null.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -30,8 +31,8 @@ graphql` ==================================== ERROR ==================================== ✖︎ Unexpected non-nullable type given in `@edgeTo`. - /path/to/test/fixture/edge-to-non-null.invalid.js:15:12 - 14 │ * @fieldName favorite_page - 15 │ * @edgeTo Page! + /path/to/test/fixture/edge-to-non-null.invalid.js:16:12 + 15 │ * @fieldName favorite_page + 16 │ * @edgeTo Page! │ ^^^^^ - 16 │ * @rootFragment myRootFragment + 17 │ * @rootFragment myRootFragment diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-non-null.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-non-null.invalid.js index 4a8a746a064f3..5b6e1b058ff4e 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-non-null.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-non-null.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-not-identifier.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-not-identifier.invalid.expected index fb3c06696a444..cbd7cb8c970e4 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-not-identifier.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-not-identifier.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -30,35 +31,35 @@ graphql` ==================================== ERROR ==================================== ✖︎ Unsupported character - /path/to/test/fixture/edge-to-not-identifier.invalid.js:15:12 - 14 │ * @fieldName favorite_page - 15 │ * @edgeTo **LOL** + /path/to/test/fixture/edge-to-not-identifier.invalid.js:16:12 + 15 │ * @fieldName favorite_page + 16 │ * @edgeTo **LOL** │ ^ - 16 │ * @rootFragment myRootFragment + 17 │ * @rootFragment myRootFragment ✖︎ Unsupported character - /path/to/test/fixture/edge-to-not-identifier.invalid.js:15:13 - 14 │ * @fieldName favorite_page - 15 │ * @edgeTo **LOL** + /path/to/test/fixture/edge-to-not-identifier.invalid.js:16:13 + 15 │ * @fieldName favorite_page + 16 │ * @edgeTo **LOL** │ ^ - 16 │ * @rootFragment myRootFragment + 17 │ * @rootFragment myRootFragment ✖︎ Unsupported character - /path/to/test/fixture/edge-to-not-identifier.invalid.js:15:17 - 14 │ * @fieldName favorite_page - 15 │ * @edgeTo **LOL** + /path/to/test/fixture/edge-to-not-identifier.invalid.js:16:17 + 15 │ * @fieldName favorite_page + 16 │ * @edgeTo **LOL** │ ^ - 16 │ * @rootFragment myRootFragment + 17 │ * @rootFragment myRootFragment ✖︎ Unsupported character - /path/to/test/fixture/edge-to-not-identifier.invalid.js:15:18 - 14 │ * @fieldName favorite_page - 15 │ * @edgeTo **LOL** + /path/to/test/fixture/edge-to-not-identifier.invalid.js:16:18 + 15 │ * @fieldName favorite_page + 16 │ * @edgeTo **LOL** │ ^ - 16 │ * @rootFragment myRootFragment + 17 │ * @rootFragment myRootFragment diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-not-identifier.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-not-identifier.invalid.js index 2693a1766bc96..876c0bf197929 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-not-identifier.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/edge-to-not-identifier.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/output-type-edge-to-invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/output-type-edge-to-invalid.expected index 16c200c770e0a..386533c78daee 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/output-type-edge-to-invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/output-type-edge-to-invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -31,8 +32,8 @@ graphql` ==================================== ERROR ==================================== ✖︎ Unexpected `@outputType`. The deprecated `@outputType` option is not enabled for the field `favorite_page`. - /path/to/test/fixture/output-type-edge-to-invalid.js:15:5 - 14 │ * @fieldName favorite_page - 15 │ * @outputType ClientPage + /path/to/test/fixture/output-type-edge-to-invalid.js:16:5 + 15 │ * @fieldName favorite_page + 16 │ * @outputType ClientPage │ ^^^^^^^^^^ - 16 │ * @edgeTo Page + 17 │ * @edgeTo Page diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/output-type-edge-to-invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/output-type-edge-to-invalid.js index 55910e8ed77c7..aa9c6ab64fb16 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/output-type-edge-to-invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/output-type-edge-to-invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/output-type-invalid-type.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/output-type-invalid-type.expected index 9584fbeb282a2..3df0fd6cd64ea 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/output-type-invalid-type.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/output-type-invalid-type.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -30,8 +31,8 @@ graphql` ==================================== ERROR ==================================== ✖︎ Unexpected `@outputType`. The deprecated `@outputType` option is not enabled for the field `favorite_page`. - /path/to/test/fixture/output-type-invalid-type.js:15:5 - 14 │ * @fieldName favorite_page - 15 │ * @outputType **LOL** + /path/to/test/fixture/output-type-invalid-type.js:16:5 + 15 │ * @fieldName favorite_page + 16 │ * @outputType **LOL** │ ^^^^^^^^^^ - 16 │ * @rootFragment myRootFragment + 17 │ * @rootFragment myRootFragment diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/output-type-invalid-type.js b/compiler/crates/relay-docblock/tests/parse/fixtures/output-type-invalid-type.js index f394b4cc19a30..c2fdc34a8d2d7 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/output-type-invalid-type.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/output-type-invalid-type.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-deprecated-no-description.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-deprecated-no-description.expected index 6662dbec14164..438e88ca9915c 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-deprecated-no-description.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-deprecated-no-description.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * @@ -22,8 +24,8 @@ graphql` } ` ==================================== OUTPUT =================================== -RelayResolver( - RelayResolverIr { +LegacyVerboseResolver( + LegacyVerboseResolverIr { field: FieldDefinitionStub { name: Identifier { span: 53:66, diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-deprecated-no-description.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-deprecated-no-description.js index b1bcec0a6e2b8..9bcc55f45a9c2 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-deprecated-no-description.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-deprecated-no-description.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-deprecated.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-deprecated.expected index 13641cfae20b0..b4387a2a526ec 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-deprecated.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-deprecated.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * @@ -22,8 +24,8 @@ graphql` } ` ==================================== OUTPUT =================================== -RelayResolver( - RelayResolverIr { +LegacyVerboseResolver( + LegacyVerboseResolverIr { field: FieldDefinitionStub { name: Identifier { span: 53:66, diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-deprecated.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-deprecated.js index 3dc6cfabb9a5a..3fc5fc9b6a103 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-deprecated.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-deprecated.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-invalid-field.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-invalid-field.invalid.expected index b0972b372c5be..e6b91e7d776a7 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-invalid-field.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-invalid-field.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -25,8 +26,8 @@ graphql` ==================================== ERROR ==================================== ✖︎ Unexpected docblock field `@notValid` - /path/to/test/fixture/relay-resolver-invalid-field.invalid.js:16:5 - 15 │ * @rootFragment myRootFragment - 16 │ * @notValid myRootFragment + /path/to/test/fixture/relay-resolver-invalid-field.invalid.js:17:5 + 16 │ * @rootFragment myRootFragment + 17 │ * @notValid myRootFragment │ ^^^^^^^^ - 17 │ + 18 │ diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-invalid-field.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-invalid-field.invalid.js index f63ed662ba59e..245d748ab5776 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-invalid-field.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-invalid-field.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-live-with-text.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-live-with-text.invalid.expected index 71900cc360586..39d36ec2fe447 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-live-with-text.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-live-with-text.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -26,8 +27,8 @@ graphql` ==================================== ERROR ==================================== ✖︎ The `@RelayResolver` field `@live` does not accept data. Remove everything after `@live`. - /path/to/test/fixture/relay-resolver-live-with-text.invalid.js:17:5 - 16 │ * @rootFragment myRootFragment - 17 │ * @live in the moment + /path/to/test/fixture/relay-resolver-live-with-text.invalid.js:18:5 + 17 │ * @rootFragment myRootFragment + 18 │ * @live in the moment │ ^^^^ - 18 │ + 19 │ diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-live-with-text.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-live-with-text.invalid.js index d92f50bc3954e..435e84def590b 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-live-with-text.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-live-with-text.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-live.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-live.expected index 3a64794debe73..38f95ca7c2ed7 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-live.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-live.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * @@ -22,8 +24,8 @@ graphql` } ` ==================================== OUTPUT =================================== -RelayResolver( - RelayResolverIr { +LegacyVerboseResolver( + LegacyVerboseResolverIr { field: FieldDefinitionStub { name: Identifier { span: 53:66, diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-live.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-live.js index 598ee5de40351..4685e27732597 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-live.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-live.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-named-export.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-named-export.expected index 311fe248fdc19..48ce543e2b668 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-named-export.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-named-export.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * @@ -25,8 +27,8 @@ graphql` } ` ==================================== OUTPUT =================================== -RelayResolver( - RelayResolverIr { +LegacyVerboseResolver( + LegacyVerboseResolverIr { field: FieldDefinitionStub { name: Identifier { span: 53:66, diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-named-export.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-named-export.js index 60a25f38e5207..34026ec50e5cd 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-named-export.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-named-export.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-mismatch.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-mismatch.invalid.expected index 8f0aa18ac7584..c397549c40664 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-mismatch.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-mismatch.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -25,16 +26,16 @@ graphql` ==================================== ERROR ==================================== ✖︎ The type specified in the fragment (`User`) and the type specified in `@onInterface` (`Node`) are different. Please make sure these are exactly the same. - /path/to/test/fixture/relay-resolver-on-interface-mismatch.invalid.js:13:17 - 12 │ * - 13 │ * @onInterface Node + /path/to/test/fixture/relay-resolver-on-interface-mismatch.invalid.js:14:17 + 13 │ * + 14 │ * @onInterface Node │ ^^^^ - 14 │ * @fieldName favorite_page + 15 │ * @fieldName favorite_page ℹ︎ with fragment type condition - /path/to/test/fixture/relay-resolver-on-interface-mismatch.invalid.js:20:27 - 19 │ - 20 │ fragment myRootFragment on User { + /path/to/test/fixture/relay-resolver-on-interface-mismatch.invalid.js:21:27 + 20 │ + 21 │ fragment myRootFragment on User { │ ^^^^^^^ - 21 │ name + 22 │ name diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-mismatch.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-mismatch.invalid.js index 58990b2dd252a..224e2078fcfb9 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-mismatch.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-mismatch.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-no-value.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-no-value.invalid.expected index 2031e632a55fb..2c828765379e0 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-no-value.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-no-value.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -25,8 +26,8 @@ graphql` ==================================== ERROR ==================================== ✖︎ Expected docblock field `@onInterface` to have specified a value. - /path/to/test/fixture/relay-resolver-on-interface-no-value.invalid.js:13:5 - 12 │ * - 13 │ * @onInterface + /path/to/test/fixture/relay-resolver-on-interface-no-value.invalid.js:14:5 + 13 │ * + 14 │ * @onInterface │ ^^^^^^^^^^^ - 14 │ * @fieldName favorite_page + 15 │ * @fieldName favorite_page diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-no-value.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-no-value.invalid.js index 472c374cc7370..5fb2e84d933fb 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-no-value.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-no-value.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-not-allowed.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-not-allowed.invalid.expected new file mode 100644 index 0000000000000..2d4dff2ce2eea --- /dev/null +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-not-allowed.invalid.expected @@ -0,0 +1,36 @@ +==================================== 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 + +/** + * @RelayResolver + * + * @onInterface Viewer + * @fieldName favorite_page + * @rootFragment myRootFragment + * + * 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 Viewer { + name + } +` +==================================== ERROR ==================================== +✖︎ Unexpected `@onInterface`. The deprecated `@onType` option is not enabled for the field `Viewer.favorite_page`. Please use the new syntax: `@RelayResolver ParentInterface.field_name`. + + /path/to/test/fixture/relay-resolver-on-interface-not-allowed.invalid.js:13:5 + 12 │ * + 13 │ * @onInterface Viewer + │ ^^^^^^^^^^^ + 14 │ * @fieldName favorite_page diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-not-allowed.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-not-allowed.invalid.js new file mode 100644 index 0000000000000..aee69675a815d --- /dev/null +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-interface-not-allowed.invalid.js @@ -0,0 +1,27 @@ +/** + * 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 + +/** + * @RelayResolver + * + * @onInterface Viewer + * @fieldName favorite_page + * @rootFragment myRootFragment + * + * 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 Viewer { + name + } +` diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-and-on-interface.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-and-on-interface.invalid.expected index a9e6726f8527f..114a5dbae172f 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-and-on-interface.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-and-on-interface.invalid.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + // expected-to-throw /** @@ -26,16 +28,16 @@ graphql` ==================================== ERROR ==================================== ✖︎ Unexpected `@onType` and `@onInterface`. Only one of these docblock fields should be defined on a given `@RelayResolver`. - /path/to/test/fixture/relay-resolver-on-type-and-on-interface.invalid.js:13:5 - 12 │ * - 13 │ * @onType User + /path/to/test/fixture/relay-resolver-on-type-and-on-interface.invalid.js:15:5 + 14 │ * + 15 │ * @onType User │ ^^^^^^ - 14 │ * @onInterface Node + 16 │ * @onInterface Node ℹ︎ @onInterface - /path/to/test/fixture/relay-resolver-on-type-and-on-interface.invalid.js:14:5 - 13 │ * @onType User - 14 │ * @onInterface Node + /path/to/test/fixture/relay-resolver-on-type-and-on-interface.invalid.js:16:5 + 15 │ * @onType User + 16 │ * @onInterface Node │ ^^^^^^^^^^^ - 15 │ * @fieldName favorite_page + 17 │ * @fieldName favorite_page diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-and-on-interface.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-and-on-interface.invalid.js index 89da6eb96048f..331e0cb6c7e2a 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-and-on-interface.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-and-on-interface.invalid.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + // expected-to-throw /** diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-mismatch.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-mismatch.invalid.expected index 2decf0eeef7dc..15c34c0e5274f 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-mismatch.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-mismatch.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -25,16 +26,16 @@ graphql` ==================================== ERROR ==================================== ✖︎ The type specified in the fragment (`User`) and the type specified in `@onType` (`Query`) are different. Please make sure these are exactly the same. - /path/to/test/fixture/relay-resolver-on-type-mismatch.invalid.js:13:12 - 12 │ * - 13 │ * @onType Query + /path/to/test/fixture/relay-resolver-on-type-mismatch.invalid.js:14:12 + 13 │ * + 14 │ * @onType Query │ ^^^^^ - 14 │ * @fieldName favorite_page + 15 │ * @fieldName favorite_page ℹ︎ with fragment type condition - /path/to/test/fixture/relay-resolver-on-type-mismatch.invalid.js:20:27 - 19 │ - 20 │ fragment myRootFragment on User { + /path/to/test/fixture/relay-resolver-on-type-mismatch.invalid.js:21:27 + 20 │ + 21 │ fragment myRootFragment on User { │ ^^^^^^^ - 21 │ name + 22 │ name diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-mismatch.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-mismatch.invalid.js index b1f14546977c5..87fdc6082c1d4 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-mismatch.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-mismatch.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-no-value.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-no-value.invalid.expected index 78af772c446dd..40eef300f9a2e 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-no-value.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-no-value.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -25,8 +26,8 @@ graphql` ==================================== ERROR ==================================== ✖︎ Expected docblock field `@onType` to have specified a value. - /path/to/test/fixture/relay-resolver-on-type-no-value.invalid.js:13:5 - 12 │ * - 13 │ * @onType + /path/to/test/fixture/relay-resolver-on-type-no-value.invalid.js:14:5 + 13 │ * + 14 │ * @onType │ ^^^^^^ - 14 │ * @fieldName favorite_page + 15 │ * @fieldName favorite_page diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-no-value.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-no-value.invalid.js index 76f830aec9e93..b17234c51a92c 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-no-value.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-no-value.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-not-allowed.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-not-allowed.invalid.expected new file mode 100644 index 0000000000000..245f1b684ec7e --- /dev/null +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-not-allowed.invalid.expected @@ -0,0 +1,36 @@ +==================================== 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 + +/** + * @RelayResolver + * + * @onType User + * @fieldName favorite_page + * @rootFragment myRootFragment + * + * 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 ==================================== +✖︎ Unexpected `@onType`. The deprecated `@onType` option is not enabled for the field `User.favorite_page`. Please use the new syntax: `@RelayResolver ParentType.field_name`. + + /path/to/test/fixture/relay-resolver-on-type-not-allowed.invalid.js:13:5 + 12 │ * + 13 │ * @onType User + │ ^^^^^^ + 14 │ * @fieldName favorite_page diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-not-allowed.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-not-allowed.invalid.js new file mode 100644 index 0000000000000..7729447b723bd --- /dev/null +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-on-type-not-allowed.invalid.js @@ -0,0 +1,27 @@ +/** + * 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 + +/** + * @RelayResolver + * + * @onType User + * @fieldName favorite_page + * @rootFragment myRootFragment + * + * 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 + } +` diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args-default-value.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args-default-value.invalid.expected index 3c1dee099a1e9..bdd509eba9f9f 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args-default-value.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args-default-value.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -16,8 +17,8 @@ ==================================== ERROR ==================================== ✖︎ Defining arguments with default values for resolver fields is not supported, yet. - /path/to/test/fixture/relay-resolver-with-args-default-value.invalid.js:13:37 - 12 │ * @onType User - 13 │ * @fieldName hello(world: String = "World") + /path/to/test/fixture/relay-resolver-with-args-default-value.invalid.js:14:37 + 13 │ * @onType User + 14 │ * @fieldName hello(world: String = "World") │ ^^^^^^^ - 14 │ + 15 │ diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args-default-value.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args-default-value.invalid.js index 7075f7be25750..d21c59bc05f22 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args-default-value.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args-default-value.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args-syntax-error.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args-syntax-error.invalid.expected index d439e0e9f9382..6057534b8e0bd 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args-syntax-error.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args-syntax-error.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -25,8 +26,8 @@ graphql` ==================================== ERROR ==================================== ✖︎ Expected a colon (':') - /path/to/test/fixture/relay-resolver-with-args-syntax-error.invalid.js:14:34 - 13 │ * @onType User - 14 │ * @fieldName greeting(salutation) + /path/to/test/fixture/relay-resolver-with-args-syntax-error.invalid.js:15:34 + 14 │ * @onType User + 15 │ * @fieldName greeting(salutation) │ ^ - 15 │ * @rootFragment myRootFragment + 16 │ * @rootFragment myRootFragment diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args-syntax-error.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args-syntax-error.invalid.js index ad274ddd328f4..dec048133aea8 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args-syntax-error.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args-syntax-error.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args.expected index 91c6583b6f184..358f7bfee318c 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * @@ -25,8 +27,8 @@ graphql` } ` ==================================== OUTPUT =================================== -RelayResolver( - RelayResolverIr { +LegacyVerboseResolver( + LegacyVerboseResolverIr { field: FieldDefinitionStub { name: Identifier { span: 53:66, diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args.js index bc914b394cc15..1a2ded6a8df1f 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-args.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-conflicting-args.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-conflicting-args.invalid.expected index fd77d0a1ae234..44a71a86f3248 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-conflicting-args.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-conflicting-args.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -25,16 +26,16 @@ graphql` ==================================== ERROR ==================================== ✖︎ Unexpected conflicting argument name. This field argument - /path/to/test/fixture/relay-resolver-with-conflicting-args.invalid.js:14:24 - 13 │ * @onType User - 14 │ * @fieldName greeting(salutation: String!) + /path/to/test/fixture/relay-resolver-with-conflicting-args.invalid.js:15:24 + 14 │ * @onType User + 15 │ * @fieldName greeting(salutation: String!) │ ^^^^^^^^^^ - 15 │ * @rootFragment myRootFragment + 16 │ * @rootFragment myRootFragment ℹ︎ conflicts with this fragment argument - /path/to/test/fixture/relay-resolver-with-conflicting-args.invalid.js:20:56 - 19 │ - 20 │ fragment myRootFragment on User @argumentDefinitions(salutation: {type: "String!"}) { + /path/to/test/fixture/relay-resolver-with-conflicting-args.invalid.js:21:56 + 20 │ + 21 │ fragment myRootFragment on User @argumentDefinitions(salutation: {type: "String!"}) { │ ^^^^^^^^^^ - 21 │ name + 22 │ name diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-conflicting-args.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-conflicting-args.invalid.js index 5de99a6a38393..cde25a724db64 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-conflicting-args.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-conflicting-args.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-field-and-fragment-args.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-field-and-fragment-args.expected index 8817c48c40508..596ed9e6a8d96 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-field-and-fragment-args.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-field-and-fragment-args.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * @@ -21,8 +23,8 @@ graphql` } ` ==================================== OUTPUT =================================== -RelayResolver( - RelayResolverIr { +LegacyVerboseResolver( + LegacyVerboseResolverIr { field: FieldDefinitionStub { name: Identifier { span: 53:61, diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-field-and-fragment-args.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-field-and-fragment-args.js index 71b0530919e17..8bbf6b791db3e 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-field-and-fragment-args.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-field-and-fragment-args.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-field-args.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-field-args.expected index 5128a32defe67..5a105ff0cea03 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-field-args.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-field-args.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * @@ -21,8 +23,8 @@ graphql` } ` ==================================== OUTPUT =================================== -RelayResolver( - RelayResolverIr { +LegacyVerboseResolver( + LegacyVerboseResolverIr { field: FieldDefinitionStub { name: Identifier { span: 53:61, diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-field-args.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-field-args.js index 4c65c814c0d79..ef416893d314d 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-field-args.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-field-args.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-fragment.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-fragment.expected index 5a3adde02431b..1f2ada5991b36 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-fragment.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-fragment.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * @@ -20,8 +22,8 @@ graphql` } ` ==================================== OUTPUT =================================== -RelayResolver( - RelayResolverIr { +LegacyVerboseResolver( + LegacyVerboseResolverIr { field: FieldDefinitionStub { name: Identifier { span: 53:61, diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-fragment.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-fragment.invalid.expected index 8b61c84eed469..03bdbe1258f9e 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-fragment.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-fragment.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax graphql` fragment myRootFragment on User { @@ -24,8 +25,8 @@ graphql` ==================================== ERROR ==================================== ✖︎ Fragment `missingFragment` not found. Did you mean `myRootFragment`? - /path/to/test/fixture/relay-resolver-with-fragment.invalid.js:21:18 - 20 │ * @fieldName my_field - 21 │ * @rootFragment missingFragment + /path/to/test/fixture/relay-resolver-with-fragment.invalid.js:22:18 + 21 │ * @fieldName my_field + 22 │ * @rootFragment missingFragment │ ^^^^^^^^^^^^^^^ - 22 │ + 23 │ diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-fragment.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-fragment.invalid.js index 700dfdb135adb..b793b7e0ec1a1 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-fragment.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-fragment.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax graphql` fragment myRootFragment on User { diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-fragment.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-fragment.js index 603d79a39c580..08005c34078e8 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-fragment.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-fragment.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-output-type.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-output-type.expected index e8b72ff9f02fe..f2a746e820118 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-output-type.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-output-type.expected @@ -7,6 +7,7 @@ */ // relay:enable_output_type +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -28,8 +29,8 @@ graphql` } ` ==================================== OUTPUT =================================== -RelayResolver( - RelayResolverIr { +LegacyVerboseResolver( + LegacyVerboseResolverIr { field: FieldDefinitionStub { name: Identifier { span: 53:66, diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-output-type.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-output-type.js index 1faff444d1b61..355226907ccdd 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-output-type.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver-with-output-type.js @@ -6,6 +6,7 @@ */ // relay:enable_output_type +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver.expected index 7612dcda71977..36b8d52a098ae 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * @@ -26,8 +28,8 @@ graphql` } ` ==================================== OUTPUT =================================== -RelayResolver( - RelayResolverIr { +LegacyVerboseResolver( + LegacyVerboseResolverIr { field: FieldDefinitionStub { name: Identifier { span: 53:66, diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver.js b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver.js index acaf5a0b9ae9c..9e61999d4fd25 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/relay-resolver.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-multiple-errors.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-multiple-errors.invalid.expected index 36258fb8e980f..1444c89ac1119 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-multiple-errors.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-multiple-errors.invalid.expected @@ -9,6 +9,7 @@ // expected-to-throw // relay:enable_strict_resolver_flavors // relay:enable_output_type +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -31,17 +32,17 @@ ==================================== ERROR ==================================== ✖︎ @live is incompatible with @rootFragment - /path/to/test/fixture/strict-flavors-multiple-errors.invalid.js:18:5 - 17 │ * @outputType SomeType - 18 │ * @live + /path/to/test/fixture/strict-flavors-multiple-errors.invalid.js:19:5 + 18 │ * @outputType SomeType + 19 │ * @live │ ^^^^ - 19 │ * + 20 │ * ✖︎ @outputType is incompatible with @rootFragment - /path/to/test/fixture/strict-flavors-multiple-errors.invalid.js:17:5 - 16 │ * @rootFragment myRootFragment - 17 │ * @outputType SomeType + /path/to/test/fixture/strict-flavors-multiple-errors.invalid.js:18:5 + 17 │ * @rootFragment myRootFragment + 18 │ * @outputType SomeType │ ^^^^^^^^^^ - 18 │ * @live + 19 │ * @live diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-multiple-errors.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-multiple-errors.invalid.js index 59fbe16158a01..d9dc14142c20c 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-multiple-errors.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-multiple-errors.invalid.js @@ -8,6 +8,7 @@ // expected-to-throw // relay:enable_strict_resolver_flavors // relay:enable_output_type +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-output-type-with-root-fragment.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-output-type-with-root-fragment.invalid.expected index 8713cf67483ea..456c1dccd3321 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-output-type-with-root-fragment.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-output-type-with-root-fragment.invalid.expected @@ -9,6 +9,7 @@ // expected-to-throw // relay:enable_strict_resolver_flavors // relay:enable_output_type +// relay:allow_legacy_verbose_syntax /** * @RelayResolver @@ -30,8 +31,8 @@ ==================================== 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 + /path/to/test/fixture/strict-flavors-output-type-with-root-fragment.invalid.js:18:5 + 17 │ * @rootFragment myRootFragment + 18 │ * @outputType SomeType │ ^^^^^^^^^^ - 18 │ * + 19 │ * diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-output-type-with-root-fragment.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-output-type-with-root-fragment.invalid.js index c6bf3546f3984..6790ee9a41e3e 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-output-type-with-root-fragment.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/strict-flavors-output-type-with-root-fragment.invalid.js @@ -8,6 +8,7 @@ // expected-to-throw // relay:enable_strict_resolver_flavors // relay:enable_output_type +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/terse-relay-resolver-forbidden-fields.invalid.expected b/compiler/crates/relay-docblock/tests/parse/fixtures/terse-relay-resolver-forbidden-fields.invalid.expected index 37a185056ec9b..b49dbfea2e950 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/terse-relay-resolver-forbidden-fields.invalid.expected +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/terse-relay-resolver-forbidden-fields.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver User.favorite_page: Page @@ -31,56 +32,56 @@ ==================================== ERROR ==================================== ✖︎ The compiler attempted to parse this `@RelayResolver` block as a terse resolver declaration, but there were unexpected fields: @fieldName, @onType, @onInterface, @edgeTo, @outputType, and @weak. - /path/to/test/fixture/terse-relay-resolver-forbidden-fields.invalid.js:11:5 - 10 │ * - 11 │ * @RelayResolver User.favorite_page: Page + /path/to/test/fixture/terse-relay-resolver-forbidden-fields.invalid.js:12:5 + 11 │ * + 12 │ * @RelayResolver User.favorite_page: Page │ ^^^^^^^^^^^^^ - 12 │ * @rootFragment myRootFragment + 13 │ * @rootFragment myRootFragment ℹ︎ Unexpected field - /path/to/test/fixture/terse-relay-resolver-forbidden-fields.invalid.js:13:5 - 12 │ * @rootFragment myRootFragment - 13 │ * @onType User + /path/to/test/fixture/terse-relay-resolver-forbidden-fields.invalid.js:14:5 + 13 │ * @rootFragment myRootFragment + 14 │ * @onType User │ ^^^^^^ - 14 │ * @edgeTo User + 15 │ * @edgeTo User ℹ︎ Unexpected field - /path/to/test/fixture/terse-relay-resolver-forbidden-fields.invalid.js:14:5 - 13 │ * @onType User - 14 │ * @edgeTo User + /path/to/test/fixture/terse-relay-resolver-forbidden-fields.invalid.js:15:5 + 14 │ * @onType User + 15 │ * @edgeTo User │ ^^^^^^ - 15 │ * @onInterface User + 16 │ * @onInterface User ℹ︎ Unexpected field - /path/to/test/fixture/terse-relay-resolver-forbidden-fields.invalid.js:15:5 - 14 │ * @edgeTo User - 15 │ * @onInterface User + /path/to/test/fixture/terse-relay-resolver-forbidden-fields.invalid.js:16:5 + 15 │ * @edgeTo User + 16 │ * @onInterface User │ ^^^^^^^^^^^ - 16 │ * @outputType User + 17 │ * @outputType User ℹ︎ Unexpected field - /path/to/test/fixture/terse-relay-resolver-forbidden-fields.invalid.js:16:5 - 15 │ * @onInterface User - 16 │ * @outputType User + /path/to/test/fixture/terse-relay-resolver-forbidden-fields.invalid.js:17:5 + 16 │ * @onInterface User + 17 │ * @outputType User │ ^^^^^^^^^^ - 17 │ * @fieldName my_field + 18 │ * @fieldName my_field ℹ︎ Unexpected field - /path/to/test/fixture/terse-relay-resolver-forbidden-fields.invalid.js:17:5 - 16 │ * @outputType User - 17 │ * @fieldName my_field + /path/to/test/fixture/terse-relay-resolver-forbidden-fields.invalid.js:18:5 + 17 │ * @outputType User + 18 │ * @fieldName my_field │ ^^^^^^^^^ - 18 │ * @weak + 19 │ * @weak ℹ︎ Unexpected field - /path/to/test/fixture/terse-relay-resolver-forbidden-fields.invalid.js:18:5 - 17 │ * @fieldName my_field - 18 │ * @weak + /path/to/test/fixture/terse-relay-resolver-forbidden-fields.invalid.js:19:5 + 18 │ * @fieldName my_field + 19 │ * @weak │ ^^^^ - 19 │ * + 20 │ * diff --git a/compiler/crates/relay-docblock/tests/parse/fixtures/terse-relay-resolver-forbidden-fields.invalid.js b/compiler/crates/relay-docblock/tests/parse/fixtures/terse-relay-resolver-forbidden-fields.invalid.js index e4e91469f3cd9..72e99e458f28e 100644 --- a/compiler/crates/relay-docblock/tests/parse/fixtures/terse-relay-resolver-forbidden-fields.invalid.js +++ b/compiler/crates/relay-docblock/tests/parse/fixtures/terse-relay-resolver-forbidden-fields.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver User.favorite_page: Page diff --git a/compiler/crates/relay-docblock/tests/parse/mod.rs b/compiler/crates/relay-docblock/tests/parse/mod.rs index 17dfc6ae2ba2d..311c9f5e0bf50 100644 --- a/compiler/crates/relay-docblock/tests/parse/mod.rs +++ b/compiler/crates/relay-docblock/tests/parse/mod.rs @@ -79,6 +79,14 @@ pub async fn transform_fixture(fixture: &Fixture<'_>) -> Result } else { &FeatureFlag::Disabled }, + allow_legacy_verbose_syntax: if fixture + .content + .contains("// relay:allow_legacy_verbose_syntax") + { + &FeatureFlag::Enabled + } else { + &FeatureFlag::Disabled + }, }, ) }) diff --git a/compiler/crates/relay-docblock/tests/parse_test.rs b/compiler/crates/relay-docblock/tests/parse_test.rs index 5fd44cfcb8e67..7af7a4ba79a2b 100644 --- a/compiler/crates/relay-docblock/tests/parse_test.rs +++ b/compiler/crates/relay-docblock/tests/parse_test.rs @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> */ mod parse; @@ -124,6 +124,13 @@ async fn relay_resolver_on_interface_no_value_invalid() { test_fixture(transform_fixture, "relay-resolver-on-interface-no-value.invalid.js", "parse/fixtures/relay-resolver-on-interface-no-value.invalid.expected", input, expected).await; } +#[tokio::test] +async fn relay_resolver_on_interface_not_allowed_invalid() { + let input = include_str!("parse/fixtures/relay-resolver-on-interface-not-allowed.invalid.js"); + let expected = include_str!("parse/fixtures/relay-resolver-on-interface-not-allowed.invalid.expected"); + test_fixture(transform_fixture, "relay-resolver-on-interface-not-allowed.invalid.js", "parse/fixtures/relay-resolver-on-interface-not-allowed.invalid.expected", input, expected).await; +} + #[tokio::test] async fn relay_resolver_on_type_and_on_interface_invalid() { let input = include_str!("parse/fixtures/relay-resolver-on-type-and-on-interface.invalid.js"); @@ -145,6 +152,13 @@ async fn relay_resolver_on_type_no_value_invalid() { test_fixture(transform_fixture, "relay-resolver-on-type-no-value.invalid.js", "parse/fixtures/relay-resolver-on-type-no-value.invalid.expected", input, expected).await; } +#[tokio::test] +async fn relay_resolver_on_type_not_allowed_invalid() { + let input = include_str!("parse/fixtures/relay-resolver-on-type-not-allowed.invalid.js"); + let expected = include_str!("parse/fixtures/relay-resolver-on-type-not-allowed.invalid.expected"); + test_fixture(transform_fixture, "relay-resolver-on-type-not-allowed.invalid.js", "parse/fixtures/relay-resolver-on-type-not-allowed.invalid.expected", input, expected).await; +} + #[tokio::test] async fn relay_resolver_strong_object() { let input = include_str!("parse/fixtures/relay-resolver-strong-object.js"); diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-relay-resolver.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-relay-resolver.expected index eae14786aa94e..8fd521ace11d2 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-relay-resolver.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-relay-resolver.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-relay-resolver.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-relay-resolver.js index 01d61ceeeea8d..933ac69a77164 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-relay-resolver.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-relay-resolver.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-to-non-null-plural-server-object-relay-resolver.invalid.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-to-non-null-plural-server-object-relay-resolver.invalid.expected index 6da7e125f81f0..a4ed54f64b40d 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-to-non-null-plural-server-object-relay-resolver.invalid.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-to-non-null-plural-server-object-relay-resolver.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-to-non-null-plural-server-object-relay-resolver.invalid.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-to-non-null-plural-server-object-relay-resolver.invalid.js index 5d991ef9903c1..018ad38b2acfa 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-to-non-null-plural-server-object-relay-resolver.invalid.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-to-non-null-plural-server-object-relay-resolver.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-to-plural-server-object-relay-resolver.invalid.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-to-plural-server-object-relay-resolver.invalid.expected index e4a79288aa1f0..be5022c578352 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-to-plural-server-object-relay-resolver.invalid.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-to-plural-server-object-relay-resolver.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-to-plural-server-object-relay-resolver.invalid.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-to-plural-server-object-relay-resolver.invalid.js index e509ae0908e0a..3a8d627a3ea45 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-to-plural-server-object-relay-resolver.invalid.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/client-edge-to-plural-server-object-relay-resolver.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/legacy-relay-resolver-with-root-fragment-on-model.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/legacy-relay-resolver-with-root-fragment-on-model.expected index 310a6b05cfc9d..4b9f2d6668f6a 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/legacy-relay-resolver-with-root-fragment-on-model.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/legacy-relay-resolver-with-root-fragment-on-model.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver MyType */ diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/legacy-relay-resolver-with-root-fragment-on-model.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/legacy-relay-resolver-with-root-fragment-on-model.js index cb8e2db7106e0..40396ae7b0ad9 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/legacy-relay-resolver-with-root-fragment-on-model.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/legacy-relay-resolver-with-root-fragment-on-model.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver MyType */ diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-deprecated-no-description.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-deprecated-no-description.expected index 207ae5baffc73..05cbac5f6374a 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-deprecated-no-description.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-deprecated-no-description.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-deprecated-no-description.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-deprecated-no-description.js index 6323335391023..03221053de3df 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-deprecated-no-description.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-deprecated-no-description.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-deprecated.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-deprecated.expected index 43da87d591826..c264843bc23eb 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-deprecated.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-deprecated.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-deprecated.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-deprecated.js index 06d951851e16c..c25c198020c0c 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-deprecated.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-deprecated.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-id.invalid.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-id.invalid.expected index d0714e313cda2..8c9d7b473c9a4 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-id.invalid.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-id.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-id.invalid.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-id.invalid.js index cbbdf08466eab..6a273167a3860 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-id.invalid.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-id.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-implementing-a-field-defined-by-grandparent-interface.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-implementing-a-field-defined-by-grandparent-interface.expected index c76eec706553e..0e8d038fb2d52 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-implementing-a-field-defined-by-grandparent-interface.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-implementing-a-field-defined-by-grandparent-interface.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-implementing-a-field-defined-by-grandparent-interface.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-implementing-a-field-defined-by-grandparent-interface.js index ff7f2a5c5d85c..0d314ff855825 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-implementing-a-field-defined-by-grandparent-interface.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-implementing-a-field-defined-by-grandparent-interface.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-implementing-a-field-defined-by-parent-interface.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-implementing-a-field-defined-by-parent-interface.expected index 041547f4351a4..8d0ac6ad758d3 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-implementing-a-field-defined-by-parent-interface.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-implementing-a-field-defined-by-parent-interface.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-implementing-a-field-defined-by-parent-interface.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-implementing-a-field-defined-by-parent-interface.js index 543fd50dc72b0..0906ab3c7b85e 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-implementing-a-field-defined-by-parent-interface.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-implementing-a-field-defined-by-parent-interface.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-named-export.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-named-export.expected index a9c157016f668..7189d4d854ebc 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-named-export.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-named-export.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-named-export.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-named-export.js index 60a25f38e5207..34026ec50e5cd 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-named-export.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-named-export.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface-implementing-a-field-defined-by-parent-interface.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface-implementing-a-field-defined-by-parent-interface.expected index 5997de85870ca..09620f98909f2 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface-implementing-a-field-defined-by-parent-interface.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface-implementing-a-field-defined-by-parent-interface.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface-implementing-a-field-defined-by-parent-interface.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface-implementing-a-field-defined-by-parent-interface.js index 6c7aa1671f20a..aa4930bfcc5bb 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface-implementing-a-field-defined-by-parent-interface.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface-implementing-a-field-defined-by-parent-interface.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface-with-type.invalid.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface-with-type.invalid.expected index b76802016c3c4..ce3780f6ff1a5 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface-with-type.invalid.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface-with-type.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface-with-type.invalid.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface-with-type.invalid.js index 5b95735507768..37dbc6df0a2ee 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface-with-type.invalid.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface-with-type.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface.expected index d12194eebd7ad..a0dace5990ef0 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface.js index d06c197d5135d..535e566a649dc 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-interface.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-invalid-interface.invalid.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-invalid-interface.invalid.expected index bd3f2b99672f5..666ad19bb50bd 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-invalid-interface.invalid.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-invalid-interface.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-invalid-interface.invalid.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-invalid-interface.invalid.js index 5b95735507768..37dbc6df0a2ee 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-invalid-interface.invalid.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-invalid-interface.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-invalid-type.invalid.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-invalid-type.invalid.expected index 1180bbdba5df0..74b5722668abf 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-invalid-type.invalid.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-invalid-type.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-invalid-type.invalid.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-invalid-type.invalid.js index 7349ca9b5b909..aeb297090a483 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-invalid-type.invalid.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-invalid-type.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-type-with-interface.invalid.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-type-with-interface.invalid.expected index edda06b165368..3ae8428960451 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-type-with-interface.invalid.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-type-with-interface.invalid.expected @@ -7,6 +7,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-type-with-interface.invalid.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-type-with-interface.invalid.js index 866bfa805edcb..5e01f9e335a12 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-type-with-interface.invalid.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-on-type-with-interface.invalid.js @@ -6,6 +6,7 @@ */ // expected-to-throw +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-args.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-args.expected index 7394d92d66636..ea0169caedf60 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-args.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-args.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-args.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-args.js index bc914b394cc15..1a2ded6a8df1f 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-args.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-args.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-field-and-fragment-args.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-field-and-fragment-args.expected index bf15384401226..3d10a4f2cd697 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-field-and-fragment-args.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-field-and-fragment-args.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-field-and-fragment-args.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-field-and-fragment-args.js index 71b0530919e17..8bbf6b791db3e 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-field-and-fragment-args.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-field-and-fragment-args.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-field-args.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-field-args.expected index ba2ba2d185eb0..90136522e9b9e 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-field-args.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-field-args.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-field-args.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-field-args.js index 4c65c814c0d79..ef416893d314d 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-field-args.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-field-args.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-output-type.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-output-type.expected index 850550699cda5..74d66c6c015e0 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-output-type.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-output-type.expected @@ -7,6 +7,7 @@ */ // relay:enable_output_type +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-output-type.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-output-type.js index 37614f7b4dd87..6d1a574a04bdc 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-output-type.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver-with-output-type.js @@ -6,6 +6,7 @@ */ // relay:enable_output_type +// relay:allow_legacy_verbose_syntax /** * @RelayResolver diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver.expected b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver.expected index 9a067aeb4e513..faf179dfad7fc 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver.expected +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver.expected @@ -6,6 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver.js b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver.js index 60a25f38e5207..34026ec50e5cd 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver.js +++ b/compiler/crates/relay-docblock/tests/to_schema/fixtures/relay-resolver.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +// relay:allow_legacy_verbose_syntax + /** * @RelayResolver * diff --git a/compiler/crates/relay-docblock/tests/to_schema/mod.rs b/compiler/crates/relay-docblock/tests/to_schema/mod.rs index f9179c5152d29..ad01df44e24b4 100644 --- a/compiler/crates/relay-docblock/tests/to_schema/mod.rs +++ b/compiler/crates/relay-docblock/tests/to_schema/mod.rs @@ -81,6 +81,14 @@ pub async fn transform_fixture(fixture: &Fixture<'_>) -> Result } else { &FeatureFlag::Disabled }, + allow_legacy_verbose_syntax: if fixture + .content + .contains("// relay:allow_legacy_verbose_syntax") + { + &FeatureFlag::Enabled + } else { + &FeatureFlag::Disabled + }, }, )? .unwrap(); diff --git a/compiler/crates/relay-lsp/src/docblock_resolution_info.rs b/compiler/crates/relay-lsp/src/docblock_resolution_info.rs index 0d36fdf0903dc..37b7885780914 100644 --- a/compiler/crates/relay-lsp/src/docblock_resolution_info.rs +++ b/compiler/crates/relay-lsp/src/docblock_resolution_info.rs @@ -23,7 +23,7 @@ pub fn create_docblock_resolution_info( position_span: Span, ) -> Option { match docblock_ir { - DocblockIr::RelayResolver(resolver_ir) => { + DocblockIr::LegacyVerboseResolver(resolver_ir) => { match resolver_ir.on { On::Type(on_type) => { if on_type.value.location.contains(position_span) { diff --git a/compiler/crates/relay-lsp/src/references/mod.rs b/compiler/crates/relay-lsp/src/references/mod.rs index 246adfb674999..06983a8ca59d3 100644 --- a/compiler/crates/relay-lsp/src/references/mod.rs +++ b/compiler/crates/relay-lsp/src/references/mod.rs @@ -76,7 +76,7 @@ fn get_references_response( FeatureResolutionInfo::DocblockNode(docblock_node) => { if let DocblockResolutionInfo::FieldName(field_name) = docblock_node.resolution_info { let type_name = match docblock_node.ir { - DocblockIr::RelayResolver(relay_resolver) => match relay_resolver.on { + DocblockIr::LegacyVerboseResolver(relay_resolver) => match relay_resolver.on { On::Type(type_) => type_.value.item, On::Interface(interface) => interface.value.item, }, diff --git a/compiler/crates/relay-lsp/src/server/lsp_state.rs b/compiler/crates/relay-lsp/src/server/lsp_state.rs index 0275fc6451d1b..f438d2b0f4575 100644 --- a/compiler/crates/relay-lsp/src/server/lsp_state.rs +++ b/compiler/crates/relay-lsp/src/server/lsp_state.rs @@ -302,6 +302,9 @@ impl