diff --git a/compiler/crates/relay-compiler/relay-compiler-config-schema.json b/compiler/crates/relay-compiler/relay-compiler-config-schema.json index b2dbcfc1f8e27..e833427feaff6 100644 --- a/compiler/crates/relay-compiler/relay-compiler-config-schema.json +++ b/compiler/crates/relay-compiler/relay-compiler-config-schema.json @@ -1577,8 +1577,10 @@ "default": null, "anyOf": [ { + "description": "Configuration for how the Relay Compiler should persist GraphQL queries.", "anyOf": [ { + "description": "This variant represents a remote persistence configuration, where GraphQL queries are sent to a remote endpoint for persistence.", "type": "object", "required": [ "url" @@ -1621,6 +1623,7 @@ "additionalProperties": false }, { + "description": "This variant represents a local persistence configuration, where GraphQL queries are persisted to a local JSON file.\n\nWhen this variant is used, the compiler will attempt to read the local file as a hash map, add new queries to the map, and then serialize and write the resulting map to the configured path.", "type": "object", "required": [ "file" @@ -3354,11 +3357,14 @@ "description": "Set of project names.", "type": "array", "items": { + "description": "Represents the name of a project in the Relay configuration.", "anyOf": [ { + "description": "No project name is specified.", "type": "null" }, { + "description": "A project name.\n\nThis should match one the keys in the `projects` map in the Relay compiler config.", "type": "string" } ] @@ -3408,11 +3414,14 @@ "default": null, "anyOf": [ { + "description": "Represents the name of a project in the Relay configuration.", "anyOf": [ { + "description": "No project name is specified.", "type": "null" }, { + "description": "A project name.\n\nThis should match one the keys in the `projects` map in the Relay compiler config.", "type": "string" } ] @@ -5018,8 +5027,10 @@ "description": "If this option is set, the compiler will persist queries using this config.", "anyOf": [ { + "description": "Configuration for how the Relay Compiler should persist GraphQL queries.", "anyOf": [ { + "description": "This variant represents a remote persistence configuration, where GraphQL queries are sent to a remote endpoint for persistence.", "type": "object", "required": [ "url" @@ -5062,6 +5073,7 @@ "additionalProperties": false }, { + "description": "This variant represents a local persistence configuration, where GraphQL queries are persisted to a local JSON file.\n\nWhen this variant is used, the compiler will attempt to read the local file as a hash map, add new queries to the map, and then serialize and write the resulting map to the configured path.", "type": "object", "required": [ "file" @@ -5460,11 +5472,14 @@ "additionalProperties": { "anyOf": [ { + "description": "Represents the name of a project in the Relay configuration.", "anyOf": [ { + "description": "No project name is specified.", "type": "null" }, { + "description": "A project name.\n\nThis should match one the keys in the `projects` map in the Relay compiler config.", "type": "string" } ] @@ -5472,11 +5487,14 @@ { "type": "array", "items": { + "description": "Represents the name of a project in the Relay configuration.", "anyOf": [ { + "description": "No project name is specified.", "type": "null" }, { + "description": "A project name.\n\nThis should match one the keys in the `projects` map in the Relay compiler config.", "type": "string" } ] diff --git a/compiler/crates/relay-compiler/src/artifact_map.rs b/compiler/crates/relay-compiler/src/artifact_map.rs index 4c17341a72838..f2601065ab92e 100644 --- a/compiler/crates/relay-compiler/src/artifact_map.rs +++ b/compiler/crates/relay-compiler/src/artifact_map.rs @@ -29,13 +29,16 @@ pub struct ArtifactRecord { #[derive(Default, Serialize, Deserialize, Debug, Clone)] pub struct ArtifactMap(pub DashMap>); +/// An enum used to identify the source type a relay compiler artifact is generated from. +/// +/// Artifacts can be derived from source types such as executable definitions, resolvers, or schemas. #[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq, Hash)] pub enum ArtifactSourceKey { - /// Derieved from a GraphQL Executable Definition + /// Derived from a GraphQL Executable Definition, such as a Query, Mutation, or Fragment. ExecutableDefinition(ExecutableDefinitionName), - /// Derieved from a RelayResolver docblock + /// Derived from a RelayResolver docblock. ResolverHash(ResolverSourceHash), - /// Derived from GraphQL Schema + /// Derived from GraphQL Schema. Schema(), } diff --git a/compiler/crates/relay-config/src/project_config.rs b/compiler/crates/relay-config/src/project_config.rs index 4f85ab11ecd0b..3bc11c0590385 100644 --- a/compiler/crates/relay-config/src/project_config.rs +++ b/compiler/crates/relay-config/src/project_config.rs @@ -108,10 +108,16 @@ pub struct LocalPersistConfig { pub include_query_text: bool, } +/// Configuration for how the Relay Compiler should persist GraphQL queries. #[derive(Debug, Serialize, Clone, JsonSchema)] #[serde(untagged)] pub enum PersistConfig { + /// This variant represents a remote persistence configuration, where GraphQL queries are sent to a remote endpoint for persistence. Remote(RemotePersistConfig), + /// This variant represents a local persistence configuration, where GraphQL queries are persisted to a local JSON file. + /// + /// When this variant is used, the compiler will attempt to read the local file as a hash map, + /// add new queries to the map, and then serialize and write the resulting map to the configured path. Local(LocalPersistConfig), } @@ -157,9 +163,12 @@ It also cannot be a local persist configuration due to: } } +/// Specifies the type of location of a GraphQL schema, and the path to the schema location. #[derive(Clone, Debug, JsonSchema)] pub enum SchemaLocation { + /// A single file containing the schema. File(PathBuf), + /// A directory containing multiple schema files. Directory(PathBuf), } diff --git a/compiler/crates/relay-config/src/project_name.rs b/compiler/crates/relay-config/src/project_name.rs index f5c6dd6d7ec56..8b384556b2fc5 100644 --- a/compiler/crates/relay-config/src/project_name.rs +++ b/compiler/crates/relay-config/src/project_name.rs @@ -16,10 +16,15 @@ use serde::Deserializer; use serde::Serialize; use serde::Serializer; +/// Represents the name of a project in the Relay configuration. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, JsonSchema, Ord, PartialOrd)] #[schemars(untagged)] pub enum ProjectName { + /// No project name is specified. Default, + /// A project name. + /// + /// This should match one the keys in the `projects` map in the Relay compiler config. Named(StringKey), }