INNER CODE UNIT · Python

obj

smagafurov/fastapi-jsonrpc · fastapi_jsonrpc/__init__.py:173

        obj = create_model(name, **opts)

        # Set unique title for pydantic schema generation to prevent deduplication
        # Pydantic uses title (if set) for schema key generation
        if needs_module_prefix:
            obj.model_config['title'] = f'{effective_module}.{name}'

        if module is not None:
            obj.__module__ = module  # see: pydantic._internal._core_utils.get_type_ref

        key = (name, effective_module)
        if key in components:
            lhs = components[key].model_json_schema()
            rhs = obj.model_json_schema()
            if lhs != rhs:
                raise RuntimeError(
                    f"Different models with the same name detected: {lhs!r} != {rhs}"
                )

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…