Skip to content

Commit

Permalink
Add schema name to project config
Browse files Browse the repository at this point in the history
Differential Revision: D64972904

fbshipit-source-id: f8f1f6d3a03ab9d9a737c0753dc76fdf4cf28a7b
  • Loading branch information
monicatang authored and facebook-github-bot committed Oct 25, 2024
1 parent ce1c2ca commit 733cc27
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5354,6 +5354,14 @@
"type": "string"
}
},
"schemaName": {
"description": "Schema name, if differs from project name. If schema name is unset, the project name will be used as schema name.",
"default": null,
"type": [
"string",
"null"
]
},
"shardOutput": {
"description": "If `output` is provided and `shard_output` is `true`, shard the files by putting them under `{output_dir}/{source_relative_path}`",
"default": false,
Expand Down
6 changes: 6 additions & 0 deletions compiler/crates/relay-compiler/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ impl Config {
shard_output: config_file_project.shard_output,
shard_strip_regex,
schema_location,
schema_name: config_file_project.schema_name,
schema_config: config_file_project.schema_config,
typegen_config: config_file_project.typegen_config,
persist: config_file_project.persist,
Expand Down Expand Up @@ -1030,6 +1031,11 @@ pub struct ConfigFileProject {
schema: Option<PathBuf>,
schema_dir: Option<PathBuf>,

/// Schema name, if differs from project name.
/// If schema name is unset, the project name will be used as schema name.
#[serde(default)]
schema_name: Option<StringKey>,

/// If this option is set, the compiler will persist queries using this
/// config.
persist: Option<PersistConfig>,
Expand Down
4 changes: 4 additions & 0 deletions compiler/crates/relay-config/src/project_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ pub struct ProjectConfig {
pub shard_strip_regex: Option<Regex>,
pub schema_extensions: Vec<PathBuf>,
pub enabled: bool,
pub schema_name: Option<StringKey>,
pub schema_location: SchemaLocation,
pub schema_config: SchemaConfig,
pub typegen_config: TypegenConfig,
Expand Down Expand Up @@ -272,6 +273,7 @@ impl Default for ProjectConfig {
schema_extensions: vec![],
enabled: true,
schema_location: SchemaLocation::File(PathBuf::default()),
schema_name: None,
schema_config: Default::default(),
typegen_config: Default::default(),
persist: None,
Expand Down Expand Up @@ -303,6 +305,7 @@ impl Debug for ProjectConfig {
schema_extensions,
enabled,
schema_location,
schema_name,
schema_config,
typegen_config,
persist,
Expand Down Expand Up @@ -330,6 +333,7 @@ impl Debug for ProjectConfig {
.field("schema_extensions", schema_extensions)
.field("enabled", enabled)
.field("schema_location", schema_location)
.field("schema_name", schema_name)
.field("schema_config", schema_config)
.field("typegen_config", typegen_config)
.field("persist", persist)
Expand Down

0 comments on commit 733cc27

Please sign in to comment.