Skip to content

Commit 8a26851

Browse files
committed
remove redundant util
1 parent b2ebc5c commit 8a26851

File tree

1 file changed

+1
-36
lines changed

1 file changed

+1
-36
lines changed

fastapi_mcp/openapi/utils.py

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, List, Optional
1+
from typing import Any, Dict
22

33

44
def get_single_param_type_from_schema(param_schema: Dict[str, Any]) -> str:
@@ -100,47 +100,12 @@ def clean_schema_for_display(schema: Dict[str, Any]) -> Dict[str, Any]:
100100
return schema
101101

102102

103-
def extract_model_examples_from_components(
104-
model_name: str, openapi_schema: Dict[str, Any]
105-
) -> Optional[List[Dict[str, Any]]]:
106-
"""
107-
Extract examples from a model definition in the OpenAPI components.
108-
109-
Args:
110-
model_name: The name of the model to extract examples from
111-
openapi_schema: The full OpenAPI schema
112-
113-
Returns:
114-
List of example dictionaries if found, None otherwise
115-
"""
116-
if "components" not in openapi_schema or "schemas" not in openapi_schema["components"]:
117-
return None
118-
119-
if model_name not in openapi_schema["components"]["schemas"]:
120-
return None
121-
122-
schema = openapi_schema["components"]["schemas"][model_name]
123-
124-
# Look for examples in the schema
125-
examples = None
126-
127-
# Check for examples field directly (OpenAPI 3.1.0+)
128-
if "examples" in schema:
129-
examples = schema["examples"]
130-
# Check for example field (older OpenAPI versions)
131-
elif "example" in schema:
132-
examples = [schema["example"]]
133-
134-
return examples
135-
136-
137103
def generate_example_from_schema(schema: Dict[str, Any]) -> Any:
138104
"""
139105
Generate a simple example response from a JSON schema.
140106
141107
Args:
142108
schema: The JSON schema to generate an example from
143-
model_name: Optional model name for special handling
144109
145110
Returns:
146111
An example object based on the schema

0 commit comments

Comments
 (0)