refactor: standardize logging usage across OpenAPI utilities (#1322)

Co-authored-by: chiliu <chiliu@paypal.com>
This commit is contained in:
633WHU 2025-08-01 20:29:17 +08:00 committed by GitHub
commit f9bb8e7005
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 8 deletions

View file

@ -6,10 +6,11 @@ to JSON Schema, inspired by py-openapi-schema-to-json-schema but optimized
for our specific use case.
"""
import logging
from typing import Any
logger = logging.getLogger(__name__)
from fastmcp.utilities.logging import get_logger
logger = get_logger(__name__)
# OpenAPI-specific fields that should be removed from JSON Schema
OPENAPI_SPECIFIC_FIELDS = {

View file

@ -1,6 +1,5 @@
"""OpenAPI parsing logic for converting OpenAPI specs to HTTPRoute objects."""
import logging
from typing import Any, Generic, TypeVar
from openapi_pydantic import (
@ -25,6 +24,8 @@ from openapi_pydantic.v3.v3_0 import Response as Response_30
from openapi_pydantic.v3.v3_0 import Schema as Schema_30
from pydantic import BaseModel, ValidationError
from fastmcp.utilities.logging import get_logger
from .models import (
HTTPRoute,
JsonSchema,
@ -35,7 +36,7 @@ from .models import (
)
from .schemas import _combine_schemas_and_map_params, _replace_ref_with_defs
logger = logging.getLogger(__name__)
logger = get_logger(__name__)
# Type variables for generic parser
TOpenAPI = TypeVar("TOpenAPI", OpenAPI, OpenAPI_30)

View file

@ -1,11 +1,12 @@
"""Schema manipulation utilities for OpenAPI operations."""
import logging
from typing import Any
from fastmcp.utilities.logging import get_logger
from .models import HTTPRoute, JsonSchema, ResponseInfo
logger = logging.getLogger(__name__)
logger = get_logger(__name__)
def clean_schema_for_display(schema: JsonSchema | None) -> JsonSchema | None:

View file

@ -1,5 +1,4 @@
import json
import logging
from typing import Any, Generic, Literal, TypeVar, cast
from openapi_pydantic import (
@ -24,9 +23,10 @@ from openapi_pydantic.v3.v3_0 import Response as Response_30
from openapi_pydantic.v3.v3_0 import Schema as Schema_30
from pydantic import BaseModel, Field, ValidationError
from fastmcp.utilities.logging import get_logger
from fastmcp.utilities.types import FastMCPBaseModel
logger = logging.getLogger(__name__)
logger = get_logger(__name__)
# --- Intermediate Representation (IR) Definition ---
# (IR models remain the same)