Skip to content

Commit f8ff9d9

Browse files
committed
Mark semantic nullability config option as experimental
1 parent 4517542 commit f8ff9d9

File tree

48 files changed

+55
-51
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+55
-51
lines changed

compiler/crates/relay-config/src/typegen_config.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,17 @@ pub struct TypegenConfig {
112112
#[serde(default)]
113113
pub typescript_exclude_undefined_from_nullable_union: bool,
114114

115-
/// If your environment is configured to handles errors out of band, either via
115+
/// EXPERIMENTAL: If your environment is configured to handles errors out of band, either via
116116
/// a network layer which discards responses with errors, or via enabling strict
117117
/// error handling in the runtime, you can enable this flag to have Relay generate
118118
/// non-null types for fields which are marked as semantically non-null in
119119
/// the schema.
120+
///
121+
/// Currently semantically non-null fields must be specified in your schema
122+
/// using the `@semanticNonNull` directive as specified in:
123+
/// https://github.com/apollographql/specs/pull/42
120124
#[serde(default)]
121-
pub emit_semantic_nullability_types: bool,
125+
pub experimental_emit_semantic_nullability_types: bool,
122126
}
123127

124128
impl Default for TypegenConfig {

compiler/crates/relay-typegen/src/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2434,7 +2434,7 @@ fn field_type(field: &Field, typegen_options: &'_ TypegenContext<'_>) -> TypeRef
24342434
if typegen_options
24352435
.project_config
24362436
.typegen_config
2437-
.emit_semantic_nullability_types
2437+
.experimental_emit_semantic_nullability_types
24382438
{
24392439
field.semantic_type()
24402440
} else {

compiler/crates/relay-typegen/tests/generate_flow/fixtures/semantic_non_null_in_raw_response.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
==================================== INPUT ====================================
2-
# relay:emit_semantic_nullability_types
2+
# relay:experimental_emit_semantic_nullability_types
33
query MyQuery @raw_response_type {
44
opera {
55
composer {

compiler/crates/relay-typegen/tests/generate_flow/fixtures/semantic_non_null_in_raw_response.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# relay:emit_semantic_nullability_types
1+
# relay:experimental_emit_semantic_nullability_types
22
query MyQuery @raw_response_type {
33
opera {
44
composer {

compiler/crates/relay-typegen/tests/generate_flow/fixtures/semantic_non_null_items_in_matrix.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
==================================== INPUT ====================================
2-
# relay:emit_semantic_nullability_types
2+
# relay:experimental_emit_semantic_nullability_types
33
fragment MyFragment on Screen {
44
pixels
55
}

compiler/crates/relay-typegen/tests/generate_flow/fixtures/semantic_non_null_items_in_matrix.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# relay:emit_semantic_nullability_types
1+
# relay:experimental_emit_semantic_nullability_types
22
fragment MyFragment on Screen {
33
pixels
44
}

compiler/crates/relay-typegen/tests/generate_flow/fixtures/semantic_non_null_liked_field_resolver.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
==================================== INPUT ====================================
2-
# relay:emit_semantic_nullability_types
2+
# relay:experimental_emit_semantic_nullability_types
33
fragment MyFragment on ClientUser {
44
best_friend @waterfall {
55
name

compiler/crates/relay-typegen/tests/generate_flow/fixtures/semantic_non_null_liked_field_resolver.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# relay:emit_semantic_nullability_types
1+
# relay:experimental_emit_semantic_nullability_types
22
fragment MyFragment on ClientUser {
33
best_friend @waterfall {
44
name

compiler/crates/relay-typegen/tests/generate_flow/fixtures/semantic_non_null_liked_field_weak_resolver.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
==================================== INPUT ====================================
2-
# relay:emit_semantic_nullability_types
2+
# relay:experimental_emit_semantic_nullability_types
33
fragment MyFragment on ClientUser {
44
blob {
55
data

compiler/crates/relay-typegen/tests/generate_flow/fixtures/semantic_non_null_liked_field_weak_resolver.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# relay:emit_semantic_nullability_types
1+
# relay:experimental_emit_semantic_nullability_types
22
fragment MyFragment on ClientUser {
33
blob {
44
data

0 commit comments

Comments
 (0)