Skip to content

Commit d70f000

Browse files
committed
address comments
1 parent f605df1 commit d70f000

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

crates/apollo-mcp-server/src/operations/operation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ fn get_json_schema(
543543
.map(|d| d.join("#"))
544544
});
545545

546-
let nested = schema_walker::walk(
546+
let nested = schema_walker::type_to_schema(
547547
variable.ty.as_ref(),
548548
graphql_schema,
549549
&mut definitions,
@@ -656,7 +656,7 @@ mod tests {
656656
.expect("schema should be valid")
657657
});
658658

659-
/// JSON-ifies the input, sorting the object keys
659+
/// Serializes the input to JSON, sorting the object keys
660660
macro_rules! to_sorted_json {
661661
($json:expr) => {{
662662
let mut j = serde_json::json!($json);

crates/apollo-mcp-server/src/operations/schema_walker.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ use serde_json::{Map, Value};
99

1010
use crate::custom_scalar_map::CustomScalarMap;
1111

12-
pub(super) mod name;
13-
pub(super) mod r#type;
12+
mod name;
13+
mod r#type;
1414

15-
/// Walk a top-level type and generate a JSON Schema
16-
pub fn walk(
15+
/// Convert a GraphQL type into a JSON Schema.
16+
///
17+
/// Note: This is recursive, which might cause a stack overflow if the type is
18+
/// sufficiently nested / complex.
19+
pub fn type_to_schema(
1720
r#type: &Type,
1821
schema: &GraphQLSchema,
1922
definitions: &mut Map<String, Value>,

0 commit comments

Comments
 (0)