Skip to content

Is pydantic pedantic enough? / json false is saved as "False" #814

@jaroel

Description

@jaroel

I was mucking about with fastapi and tried sending the json value false to a str field.
Imagine my surprise when "False" was saved in my database instead of getting a 4xx response.

Now, I might have done something wrong, though I've just copied/pasted the docs - which just use the default settings.

The data passed into pydantic really is a False

> request._json
{'text': False, 'completed': True}

See pydantic/pydantic#1130 as well.

I'm wondering if the default settings are pedantic is enough or if fastapi should ship with a StrictModel instead?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions