Skip to content

Commit

Permalink
Add default values correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ljodal committed Jul 26, 2023
1 parent fbef5a5 commit edb0f3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions django_api_decorator/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ def to_ref_if_object(schema: dict[str, Any]) -> dict[str, Any]:
ref_template=schema_ref
)
schema = to_ref_if_object(schema)
if field.default != PydanticUndefined:
schema["default"] = field.default

param = {
"name": field.alias or name,
"in": "query",
"required": field.is_required(),
"schema": schema,
}
if field.default != PydanticUndefined:
param["default"] = field.default
parameters.append(param)

# Assuming standard django folder structure with [project name]/[app name]/....
Expand Down

0 comments on commit edb0f3f

Please sign in to comment.