Skip to content

Commit 4c9d823

Browse files
committed
fix new lints
1 parent cadaa22 commit 4c9d823

File tree

5 files changed

+81
-95
lines changed

5 files changed

+81
-95
lines changed

crates/apollo-mcp-registry/src/uplink.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,11 @@ where
402402
.send()
403403
.await
404404
.inspect_err(|e| {
405-
if let Some(hyper_err) = e.source() {
406-
if let Some(os_err) = hyper_err.source() {
407-
if os_err.to_string().contains("tcp connect error: Cannot assign requested address (os error 99)") {
408-
tracing::warn!("If your MCP server is executing within a kubernetes pod, this failure may be caused by istio-proxy injection. See https://github.com/apollographql/router/issues/3533 for more details about how to solve this");
409-
}
405+
if let Some(hyper_err) = e.source() &&
406+
let Some(os_err) = hyper_err.source() &&
407+
os_err.to_string().contains("tcp connect error: Cannot assign requested address (os error 99)") {
408+
tracing::warn!("If your MCP server is executing within a kubernetes pod, this failure may be caused by istio-proxy injection. See https://github.com/apollographql/router/issues/3533 for more details about how to solve this");
410409
}
411-
}
412410
})?;
413411
tracing::debug!("uplink response {:?}", res);
414412
let response_body: graphql_client::Response<Query::ResponseData> = res.json().await?;

crates/apollo-mcp-registry/src/uplink/schema.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,6 @@ impl SchemaSource {
181181
}
182182
}
183183

184-
#[derive(thiserror::Error, Debug)]
185-
enum FetcherError {
186-
#[error("failed to build http client")]
187-
InitializationError(#[from] reqwest::Error),
188-
}
189-
190184
// Encapsulates fetching the schema from the first viable url.
191185
// It will try each url in order until it finds one that works.
192186
#[allow(clippy::unwrap_used)] // TODO - existing unwrap from router code

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

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -490,12 +490,11 @@ pub fn variable_description_overrides(
490490
let comment = last_offset
491491
.map(|start_offset| &source_text[start_offset..source_span.offset()]);
492492

493-
if let Some(description) = comment.filter(|d| !d.is_empty() && d.contains('#')) {
494-
if let Some(description) =
493+
if let Some(description) = comment.filter(|d| !d.is_empty() && d.contains('#'))
494+
&& let Some(description) =
495495
extract_and_format_comments(Some(description.to_string()))
496-
{
497-
argument_overrides_map.insert(v.name.to_string(), description);
498-
}
496+
{
497+
argument_overrides_map.insert(v.name.to_string(), description);
499498
}
500499

501500
last_offset = Some(source_span.end_offset());
@@ -731,16 +730,15 @@ impl Operation {
731730
}
732731

733732
fn ensure_properties_exists(json_object: &mut Value) {
734-
if let Some(obj_type) = json_object.get("type") {
735-
if obj_type == "object" {
736-
if let Some(obj_map) = json_object.as_object_mut() {
737-
let props = obj_map
738-
.entry("properties")
739-
.or_insert_with(|| Value::Object(serde_json::Map::new()));
740-
if !props.is_object() {
741-
*props = Value::Object(serde_json::Map::new());
742-
}
743-
}
733+
if let Some(obj_type) = json_object.get("type")
734+
&& obj_type == "object"
735+
&& let Some(obj_map) = json_object.as_object_mut()
736+
{
737+
let props = obj_map
738+
.entry("properties")
739+
.or_insert_with(|| Value::Object(serde_json::Map::new()));
740+
if !props.is_object() {
741+
*props = Value::Object(serde_json::Map::new());
744742
}
745743
}
746744
}

crates/apollo-mcp-server/src/schema_tree_shake.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -532,16 +532,15 @@ fn retain_argument_descriptions(
532532
) {
533533
let operation_argument_name = operation_arguments.get(arg.name.as_str());
534534

535-
if let Some(op_arg_name) = operation_argument_name {
536-
if let Some(description) = arg.description.as_deref() {
537-
if !description.trim().is_empty() {
538-
let descriptions = tree_shaker
539-
.arguments_descriptions
540-
.entry(op_arg_name.to_string())
541-
.or_default();
542-
descriptions.push(description.trim().to_string())
543-
}
544-
}
535+
if let Some(op_arg_name) = operation_argument_name
536+
&& let Some(description) = arg.description.as_deref()
537+
&& !description.trim().is_empty()
538+
{
539+
let descriptions = tree_shaker
540+
.arguments_descriptions
541+
.entry(op_arg_name.to_string())
542+
.or_default();
543+
descriptions.push(description.trim().to_string())
545544
}
546545
}
547546

crates/apollo-schema-index/src/traverse.rs

Lines changed: 55 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -53,67 +53,64 @@ impl SchemaExt for Schema {
5353
);
5454

5555
let cloned = current_path.clone();
56-
if let Some(extended_type) = self.types.get(named_type) {
57-
if !extended_type.is_built_in() {
58-
if traverse_children {
59-
match extended_type {
60-
ExtendedType::Object(obj) => {
61-
stack.extend(obj.fields.values().map(|field| {
62-
let field_type = field.ty.inner_named_type();
63-
let field_args = field
64-
.arguments
65-
.iter()
66-
.map(|arg| arg.ty.inner_named_type().clone())
67-
.collect::<Vec<_>>();
68-
(
69-
field_type,
70-
current_path.clone().add_child(
71-
Some(field.name.clone()),
72-
field_args,
73-
field_type.clone(),
74-
),
75-
)
76-
}));
77-
}
78-
ExtendedType::Interface(interface) => {
79-
stack.extend(interface.fields.values().map(|field| {
80-
let field_type = field.ty.inner_named_type();
81-
let field_args = field
82-
.arguments
83-
.iter()
84-
.map(|arg| arg.ty.inner_named_type().clone())
85-
.collect::<Vec<_>>();
86-
(
87-
field_type,
88-
current_path.clone().add_child(
89-
Some(field.name.clone()),
90-
field_args,
91-
field_type.clone(),
92-
),
93-
)
94-
}));
95-
}
96-
ExtendedType::Union(union) => {
97-
stack.extend(
98-
union.members.iter().map(|member| &member.name).map(
99-
|next_type| {
100-
(
101-
next_type,
102-
current_path.clone().add_child(
103-
None,
104-
vec![],
105-
next_type.clone(),
106-
),
107-
)
108-
},
56+
if let Some(extended_type) = self.types.get(named_type)
57+
&& !extended_type.is_built_in()
58+
&& traverse_children
59+
{
60+
match extended_type {
61+
ExtendedType::Object(obj) => {
62+
stack.extend(obj.fields.values().map(|field| {
63+
let field_type = field.ty.inner_named_type();
64+
let field_args = field
65+
.arguments
66+
.iter()
67+
.map(|arg| arg.ty.inner_named_type().clone())
68+
.collect::<Vec<_>>();
69+
(
70+
field_type,
71+
current_path.clone().add_child(
72+
Some(field.name.clone()),
73+
field_args,
74+
field_type.clone(),
75+
),
76+
)
77+
}));
78+
}
79+
ExtendedType::Interface(interface) => {
80+
stack.extend(interface.fields.values().map(|field| {
81+
let field_type = field.ty.inner_named_type();
82+
let field_args = field
83+
.arguments
84+
.iter()
85+
.map(|arg| arg.ty.inner_named_type().clone())
86+
.collect::<Vec<_>>();
87+
(
88+
field_type,
89+
current_path.clone().add_child(
90+
Some(field.name.clone()),
91+
field_args,
92+
field_type.clone(),
93+
),
94+
)
95+
}));
96+
}
97+
ExtendedType::Union(union) => {
98+
stack.extend(union.members.iter().map(|member| &member.name).map(
99+
|next_type| {
100+
(
101+
next_type,
102+
current_path.clone().add_child(
103+
None,
104+
vec![],
105+
next_type.clone(),
109106
),
110-
);
111-
}
112-
_ => {}
113-
}
107+
)
108+
},
109+
));
114110
}
115-
return Some((extended_type, cloned));
111+
_ => {}
116112
}
113+
return Some((extended_type, cloned));
117114
}
118115
}
119116
None

0 commit comments

Comments
 (0)