Skip to content

Commit

Permalink
Add feature flag to allow opt-out
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias-tengler committed Sep 20, 2024
1 parent 1d32830 commit 45b2e04
Show file tree
Hide file tree
Showing 4 changed files with 300 additions and 4 deletions.
5 changes: 5 additions & 0 deletions compiler/crates/common/src/feature_flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ pub struct FeatureFlags {
/// Generate the `moduleImports` field in the Reader AST.
#[serde(default)]
pub use_reader_module_imports: FeatureFlag,

/// Disable the generation of a more precise raw response type
/// for selections on abstract types.
#[serde(default)]
pub disable_more_precise_abstract_selection_raw_response_type: FeatureFlag,
}

#[derive(Debug, Deserialize, Clone, Serialize, Default, JsonSchema)]
Expand Down
261 changes: 261 additions & 0 deletions compiler/crates/relay-compiler/relay-compiler-config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,92 @@
}
]
},
"disable_more_precise_abstract_selection_raw_response_type": {
"description": "Disable the generation of a more precise raw response type for selections on abstract types.",
"default": {
"kind": "disabled"
},
"oneOf": [
{
"description": "Fully disabled: developers may not use this feature",
"type": "object",
"required": [
"kind"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"disabled"
]
}
}
},
{
"description": "Fully enabled: developers may use this feature",
"type": "object",
"required": [
"kind"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"enabled"
]
}
}
},
{
"description": "Partially enabled: developers may only use this feature on the listed items (fragments, fields, types).",
"type": "object",
"required": [
"allowlist",
"kind"
],
"properties": {
"allowlist": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
},
"kind": {
"type": "string",
"enum": [
"limited"
]
}
}
},
{
"description": "Partially enabled: used for gradual rollout of the feature",
"type": "object",
"required": [
"kind",
"rollout"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"rollout"
]
},
"rollout": {
"description": "A utility to enable gradual rollout of large codegen changes. Can be constructed as the Default which passes or a percentage between 0 and 100.",
"type": [
"integer",
"null"
],
"format": "uint8",
"minimum": 0.0
}
}
}
]
},
"disable_resolver_reader_ast": {
"description": "Mirror of `enable_resolver_normalization_ast` excludes resolver metadata from reader ast",
"default": false,
Expand Down Expand Up @@ -1894,6 +1980,9 @@
"disable_full_argument_type_validation": {
"kind": "disabled"
},
"disable_more_precise_abstract_selection_raw_response_type": {
"kind": "disabled"
},
"disable_resolver_reader_ast": false,
"disable_schema_validation": false,
"enable_3d_branch_arg_generation": false,
Expand Down Expand Up @@ -2529,6 +2618,92 @@
}
]
},
"disable_more_precise_abstract_selection_raw_response_type": {
"description": "Disable the generation of a more precise raw response type for selections on abstract types.",
"default": {
"kind": "disabled"
},
"oneOf": [
{
"description": "Fully disabled: developers may not use this feature",
"type": "object",
"required": [
"kind"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"disabled"
]
}
}
},
{
"description": "Fully enabled: developers may use this feature",
"type": "object",
"required": [
"kind"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"enabled"
]
}
}
},
{
"description": "Partially enabled: developers may only use this feature on the listed items (fragments, fields, types).",
"type": "object",
"required": [
"allowlist",
"kind"
],
"properties": {
"allowlist": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
},
"kind": {
"type": "string",
"enum": [
"limited"
]
}
}
},
{
"description": "Partially enabled: used for gradual rollout of the feature",
"type": "object",
"required": [
"kind",
"rollout"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"rollout"
]
},
"rollout": {
"description": "A utility to enable gradual rollout of large codegen changes. Can be constructed as the Default which passes or a percentage between 0 and 100.",
"type": [
"integer",
"null"
],
"format": "uint8",
"minimum": 0.0
}
}
}
]
},
"disable_resolver_reader_ast": {
"description": "Mirror of `enable_resolver_normalization_ast` excludes resolver metadata from reader ast",
"default": false,
Expand Down Expand Up @@ -3996,6 +4171,92 @@
}
]
},
"disable_more_precise_abstract_selection_raw_response_type": {
"description": "Disable the generation of a more precise raw response type for selections on abstract types.",
"default": {
"kind": "disabled"
},
"oneOf": [
{
"description": "Fully disabled: developers may not use this feature",
"type": "object",
"required": [
"kind"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"disabled"
]
}
}
},
{
"description": "Fully enabled: developers may use this feature",
"type": "object",
"required": [
"kind"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"enabled"
]
}
}
},
{
"description": "Partially enabled: developers may only use this feature on the listed items (fragments, fields, types).",
"type": "object",
"required": [
"allowlist",
"kind"
],
"properties": {
"allowlist": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
},
"kind": {
"type": "string",
"enum": [
"limited"
]
}
}
},
{
"description": "Partially enabled: used for gradual rollout of the feature",
"type": "object",
"required": [
"kind",
"rollout"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"rollout"
]
},
"rollout": {
"description": "A utility to enable gradual rollout of large codegen changes. Can be constructed as the Default which passes or a percentage between 0 and 100.",
"type": [
"integer",
"null"
],
"format": "uint8",
"minimum": 0.0
}
}
}
]
},
"disable_resolver_reader_ast": {
"description": "Mirror of `enable_resolver_normalization_ast` excludes resolver metadata from reader ast",
"default": false,
Expand Down
Loading

0 comments on commit 45b2e04

Please sign in to comment.