Skip to content

fix: report malformed pyproject TOML as a CLI error - #508

Open
AgiKukudala wants to merge 1 commit into
fastapi:mainfrom
AgiKukudala:fix/toml-configuration-errors
Open

AgiKukudala wants to merge 1 commit into
fastapi:mainfrom
AgiKukudala:fix/toml-configuration-errors

Conversation

@AgiKukudala

Copy link
Copy Markdown

Malformed TOML in pyproject.toml currently escapes the CLI's configuration error handling as an uncaught TOMLDecodeError. Both fastapi dev and fastapi run now print Invalid TOML in pyproject.toml: with the parser's diagnostic and exit with status 1 before starting Uvicorn.

The configuration reader translates syntax errors to FastAPICLIException; existing Pydantic validation diagnostics remain unchanged. Regression tests cover an incomplete table declaration and a duplicate entrypoint for both commands, and fail on the unchanged code.

Validation: 105 tests passed on Python 3.10; mypy, ty, Ruff lint and formatting checks passed.

Prepared with assistance from OpenAI Codex; the diff was reviewed and the checks above were run locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant