Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ classifiers = [
dependencies = [
"granian>=1.0.0",
"orjson>=3.9.0",
"pydantic>=2.0.0,<3.0.0",
"pydantic-settings>=2.0.0",
"asyncpg>=0.29.0",
"prometheus-client>=0.19.0",
"python-jose[cryptography]>=3.3.0",
"python-multipart>=0.0.6",
"httpx>=0.25.0",
"aiofiles>=23.0.0",
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ xxhash>=3.6.0
itsdangerous>=2.0.0
nh3>=0.2.0
aiofiles>=23.0.0
prometheus-client>=0.19.0
httpx>=0.25.0
pytest>=7.4.0
mypy>=1.7.0
ruff>=0.5.0
Expand Down
1 change: 0 additions & 1 deletion velocix/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Built on top of:
- Granian (Rust ASGI server)
- orjson (Rust JSON serialization)
- httptools (C HTTP parsing)
- msgspec (Rust-speed validation)
- Radix tree routing with advanced caching
"""
Expand Down
73 changes: 0 additions & 73 deletions velocix/config/settings.py

This file was deleted.

49 changes: 2 additions & 47 deletions velocix/openapi/auto_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,6 @@ def is_msgspec_struct(annotation: Any) -> bool:
return False


def is_pydantic_model(annotation: Any) -> bool:
"""Check if annotation is a Pydantic BaseModel"""
try:
from pydantic import BaseModel

if hasattr(annotation, "__mro__"):
return BaseModel in annotation.__mro__
except (ImportError, AttributeError):
pass
return False


def is_body_parameter(param_name: str, param: inspect.Parameter, annotation: Any) -> bool:
"""
Determine if a parameter should be treated as request body.
Expand All @@ -73,8 +61,8 @@ def is_body_parameter(param_name: str, param: inspect.Parameter, annotation: Any
if param_name.lower() == "request":
return False

# If annotation is a Struct or Pydantic model, it's a body parameter
if is_msgspec_struct(annotation) or is_pydantic_model(annotation):
# If annotation is a Struct, it's a body parameter
if is_msgspec_struct(annotation):
return True

# Complex types without default values are likely body params
Expand Down Expand Up @@ -300,37 +288,6 @@ def _build_schema_from_type_info(type_info: Any) -> dict[str, Any]:
return {"type": "object"}


def generate_schema_from_pydantic(model_class: Any) -> dict[str, Any]:
"""Generate OpenAPI schema from Pydantic model"""
try:
# Try Pydantic v2 schema generation
if hasattr(model_class, "model_json_schema"):
return dict(model_class.model_json_schema())
# Fallback to Pydantic v1
elif hasattr(model_class, "schema"):
return dict(model_class.schema())
except Exception:
pass

# Manual fallback
schema_props = {}
required_fields = []

if hasattr(model_class, "__fields__"):
for field_name, field in model_class.__fields__.items():
field_type = field.annotation if hasattr(field, "annotation") else field.type_
schema_props[field_name] = {"type": python_type_to_schema_type(field_type).value}
if field.required if hasattr(field, "required") else True:
required_fields.append(field_name)

schema = {"type": "object", "properties": schema_props}

if required_fields:
schema["required"] = required_fields

return schema


def generate_operation_from_function(
func: Any,
path: str,
Expand Down Expand Up @@ -488,8 +445,6 @@ def generate_operation_from_function(
schema, defs = generate_schema_from_struct(annotation)
if schema_registry is not None:
schema_registry.update(defs)
elif is_pydantic_model(annotation):
schema = generate_schema_from_pydantic(annotation)
else:
# Generic schema for dict/list/other types
origin = get_origin(annotation)
Expand Down
Loading