Skip to content

Commit c84e0b4

Browse files
committed
Mark semantic nullability config option as experimental
1 parent 2ce7b7d commit c84e0b4

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
@@ -115,13 +115,17 @@ pub struct TypegenConfig {
115115
#[serde(default)]
116116
pub typescript_exclude_undefined_from_nullable_union: bool,
117117

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

127131
#[derive(Default, Debug, Serialize, Deserialize, Clone, Copy)]

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)