Skip to content
Open
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
feat: handle FileNotFound or unreadable json
  • Loading branch information
antoine-charlet committed Feb 12, 2025
commit 505fe8d7f384dfae39c050d3a4faab1ca741798d
7 changes: 5 additions & 2 deletions fastapi-generate-openapi-specification.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ def main() -> None:

new_spec = app.openapi()

with open(args.spec_file_path) as f:
old_spec = json.load(f)
try:
with open(args.spec_file_path) as f:
old_spec = json.load(f)
except Exception:
old_spec = None

should_update_spec = old_spec != new_spec

Expand Down