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
2 changes: 1 addition & 1 deletion flask_openapi/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def generate_spec_json(self):
spec.components = self.components

# Convert spec to JSON
self.spec_json = spec.model_dump(mode="json", by_alias=True, exclude_unset=True, warnings=False)
self.spec_json = spec.model_dump(mode="json", by_alias=True, exclude_none=True, warnings=False)

# Update with OpenAPI extensions
self.spec_json.update(**self.openapi_extensions)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ elements = ["flask-openapi-elements"]
[dependency-groups]
ty = ["ty"]
ruff = ["ruff"]
test = ["pytest", "asgiref", "pyyaml"]
test = ["pytest", "asgiref", "pyyaml", "openapi-spec-validator"]
doc = [
"mkdocs-static-i18n>=1.0",
"mkdocstrings[python]",
Expand Down
4 changes: 3 additions & 1 deletion tests/test_openapi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import pytest
from openapi_spec_validator import validate
from pydantic import BaseModel

from flask_openapi import APIBlueprint, OpenAPI, ValidationErrorModel
Expand Down Expand Up @@ -84,4 +85,5 @@ def get_api_book2(): ...
def test_openapi(client):
response = client.get("/openapi/openapi.json")
assert response.status_code == 200
client.get("/openapi/openapi.json")
_json = response.json
validate(_json)
Loading