-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reviewed By: captbaritone Differential Revision: D57081977 fbshipit-source-id: 39d93f228adeda6a96d7fb0fd71747fa43ae6354
- Loading branch information
1 parent
24c9a53
commit 5052062
Showing
4 changed files
with
361 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
286 changes: 286 additions & 0 deletions
286
compiler/crates/relay-schema-generation/tests/docblock/fixtures/primitive-types.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,286 @@ | ||
==================================== 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. | ||
*/ | ||
|
||
//- module.js | ||
|
||
import type CatFlowType from 'Cat'; | ||
|
||
/** | ||
* @RelayResolver | ||
*/ | ||
export function Cat(id: DataID): CatFlowType { | ||
return {}; | ||
} | ||
|
||
|
||
/** | ||
* @RelayResolver | ||
*/ | ||
export function ages(cat: CatFlowType): ?number { | ||
return 2; | ||
} | ||
|
||
|
||
/** | ||
* @RelayResolver | ||
*/ | ||
export function hungry1(cat: CatFlowType): ?boolean { | ||
return false; | ||
} | ||
|
||
/** | ||
* @RelayResolver | ||
*/ | ||
export function hungry2(cat: CatFlowType): ?false { | ||
return false; | ||
} | ||
|
||
/** | ||
* @RelayResolver | ||
*/ | ||
export function hungry3(cat: CatFlowType): true { | ||
return false; | ||
} | ||
==================================== OUTPUT =================================== | ||
StrongObjectResolver( | ||
StrongObjectIr { | ||
type_name: Identifier { | ||
span: 272:275, | ||
token: Token { | ||
span: 272:275, | ||
kind: Identifier, | ||
}, | ||
value: "Cat", | ||
}, | ||
rhs_location: module.js:272:275, | ||
root_fragment: WithLocation { | ||
location: module.js:272:275, | ||
item: FragmentDefinitionName( | ||
"Cat__id", | ||
), | ||
}, | ||
description: None, | ||
deprecated: None, | ||
live: None, | ||
semantic_non_null: None, | ||
location: module.js:272:275, | ||
implements_interfaces: [], | ||
source_hash: ResolverSourceHash( | ||
"5e42d8055bf96703110b4485122e0e0f", | ||
), | ||
}, | ||
) | ||
type Cat @__RelayResolverModel { | ||
id: ID! | ||
__relay_model_instance: RelayResolverValue! @relay_resolver(import_path: "module.js", fragment_name: "Cat__id", generated_fragment: true, inject_fragment_data: "id", import_name: "Cat") @resolver_source_hash(value: "5e42d8055bf96703110b4485122e0e0f") @unselectable(reason: "This field is intended only for Relay's internal use") | ||
} | ||
|
||
|
||
TerseRelayResolver( | ||
TerseRelayResolverIr { | ||
field: FieldDefinition { | ||
name: Identifier { | ||
span: 362:366, | ||
token: Token { | ||
span: 362:366, | ||
kind: Identifier, | ||
}, | ||
value: "ages", | ||
}, | ||
type_: Named( | ||
NamedTypeAnnotation { | ||
name: Identifier { | ||
span: 387:393, | ||
token: Token { | ||
span: 387:393, | ||
kind: Identifier, | ||
}, | ||
value: "Float", | ||
}, | ||
}, | ||
), | ||
arguments: None, | ||
directives: [], | ||
description: None, | ||
hack_source: None, | ||
span: 362:366, | ||
}, | ||
type_: WithLocation { | ||
location: <generated>:272:275, | ||
item: "Cat", | ||
}, | ||
root_fragment: None, | ||
deprecated: None, | ||
semantic_non_null: None, | ||
live: None, | ||
location: module.js:362:366, | ||
fragment_arguments: None, | ||
source_hash: ResolverSourceHash( | ||
"5e42d8055bf96703110b4485122e0e0f", | ||
), | ||
}, | ||
) | ||
extend type Cat { | ||
ages: Float @relay_resolver(import_path: "module.js", fragment_name: "Cat____relay_model_instance", generated_fragment: true, inject_fragment_data: "__relay_model_instance", has_output_type: true, import_name: "ages") @resolver_source_hash(value: "5e42d8055bf96703110b4485122e0e0f") | ||
} | ||
|
||
|
||
TerseRelayResolver( | ||
TerseRelayResolverIr { | ||
field: FieldDefinition { | ||
name: Identifier { | ||
span: 454:461, | ||
token: Token { | ||
span: 454:461, | ||
kind: Identifier, | ||
}, | ||
value: "hungry1", | ||
}, | ||
type_: Named( | ||
NamedTypeAnnotation { | ||
name: Identifier { | ||
span: 482:489, | ||
token: Token { | ||
span: 482:489, | ||
kind: Identifier, | ||
}, | ||
value: "Boolean", | ||
}, | ||
}, | ||
), | ||
arguments: None, | ||
directives: [], | ||
description: None, | ||
hack_source: None, | ||
span: 454:461, | ||
}, | ||
type_: WithLocation { | ||
location: <generated>:272:275, | ||
item: "Cat", | ||
}, | ||
root_fragment: None, | ||
deprecated: None, | ||
semantic_non_null: None, | ||
live: None, | ||
location: module.js:454:461, | ||
fragment_arguments: None, | ||
source_hash: ResolverSourceHash( | ||
"5e42d8055bf96703110b4485122e0e0f", | ||
), | ||
}, | ||
) | ||
extend type Cat { | ||
hungry1: Boolean @relay_resolver(import_path: "module.js", fragment_name: "Cat____relay_model_instance", generated_fragment: true, inject_fragment_data: "__relay_model_instance", has_output_type: true, import_name: "hungry1") @resolver_source_hash(value: "5e42d8055bf96703110b4485122e0e0f") | ||
} | ||
|
||
|
||
TerseRelayResolver( | ||
TerseRelayResolverIr { | ||
field: FieldDefinition { | ||
name: Identifier { | ||
span: 553:560, | ||
token: Token { | ||
span: 553:560, | ||
kind: Identifier, | ||
}, | ||
value: "hungry2", | ||
}, | ||
type_: Named( | ||
NamedTypeAnnotation { | ||
name: Identifier { | ||
span: 581:586, | ||
token: Token { | ||
span: 581:586, | ||
kind: Identifier, | ||
}, | ||
value: "Boolean", | ||
}, | ||
}, | ||
), | ||
arguments: None, | ||
directives: [], | ||
description: None, | ||
hack_source: None, | ||
span: 553:560, | ||
}, | ||
type_: WithLocation { | ||
location: <generated>:272:275, | ||
item: "Cat", | ||
}, | ||
root_fragment: None, | ||
deprecated: None, | ||
semantic_non_null: None, | ||
live: None, | ||
location: module.js:553:560, | ||
fragment_arguments: None, | ||
source_hash: ResolverSourceHash( | ||
"5e42d8055bf96703110b4485122e0e0f", | ||
), | ||
}, | ||
) | ||
extend type Cat { | ||
hungry2: Boolean @relay_resolver(import_path: "module.js", fragment_name: "Cat____relay_model_instance", generated_fragment: true, inject_fragment_data: "__relay_model_instance", has_output_type: true, import_name: "hungry2") @resolver_source_hash(value: "5e42d8055bf96703110b4485122e0e0f") | ||
} | ||
|
||
|
||
TerseRelayResolver( | ||
TerseRelayResolverIr { | ||
field: FieldDefinition { | ||
name: Identifier { | ||
span: 650:657, | ||
token: Token { | ||
span: 650:657, | ||
kind: Identifier, | ||
}, | ||
value: "hungry3", | ||
}, | ||
type_: NonNull( | ||
NonNullTypeAnnotation { | ||
span: 677:681, | ||
type_: Named( | ||
NamedTypeAnnotation { | ||
name: Identifier { | ||
span: 677:681, | ||
token: Token { | ||
span: 677:681, | ||
kind: Identifier, | ||
}, | ||
value: "Boolean", | ||
}, | ||
}, | ||
), | ||
exclamation: Token { | ||
span: 0:0, | ||
kind: Empty, | ||
}, | ||
}, | ||
), | ||
arguments: None, | ||
directives: [], | ||
description: None, | ||
hack_source: None, | ||
span: 650:657, | ||
}, | ||
type_: WithLocation { | ||
location: <generated>:272:275, | ||
item: "Cat", | ||
}, | ||
root_fragment: None, | ||
deprecated: None, | ||
semantic_non_null: None, | ||
live: None, | ||
location: module.js:650:657, | ||
fragment_arguments: None, | ||
source_hash: ResolverSourceHash( | ||
"5e42d8055bf96703110b4485122e0e0f", | ||
), | ||
}, | ||
) | ||
extend type Cat { | ||
hungry3: Boolean! @relay_resolver(import_path: "module.js", fragment_name: "Cat____relay_model_instance", generated_fragment: true, inject_fragment_data: "__relay_model_instance", has_output_type: true, import_name: "hungry3") @resolver_source_hash(value: "5e42d8055bf96703110b4485122e0e0f") | ||
} |
47 changes: 47 additions & 0 deletions
47
compiler/crates/relay-schema-generation/tests/docblock/fixtures/primitive-types.input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
//- module.js | ||
|
||
import type CatFlowType from 'Cat'; | ||
|
||
/** | ||
* @RelayResolver | ||
*/ | ||
export function Cat(id: DataID): CatFlowType { | ||
return {}; | ||
} | ||
|
||
|
||
/** | ||
* @RelayResolver | ||
*/ | ||
export function ages(cat: CatFlowType): ?number { | ||
return 2; | ||
} | ||
|
||
|
||
/** | ||
* @RelayResolver | ||
*/ | ||
export function hungry1(cat: CatFlowType): ?boolean { | ||
return false; | ||
} | ||
|
||
/** | ||
* @RelayResolver | ||
*/ | ||
export function hungry2(cat: CatFlowType): ?false { | ||
return false; | ||
} | ||
|
||
/** | ||
* @RelayResolver | ||
*/ | ||
export function hungry3(cat: CatFlowType): true { | ||
return false; | ||
} |
Oops, something went wrong.