Skip to content

"from" keyword in data to validate raises an Syntax error #153

@vincestus

Description

@vincestus

Hello,

I'm running into a problem when validating the following data with pydantic:

{ "validity_dates": { "from": "2014-12-31", "to": "2015-12-31" } }
It's the "from" key in the data that is problematic:

class ValidityDates(pydantic.BaseModel): from: str to: str

This code raises a SyntaxError: invalid syntax. How can I map a supported class attribute like "from_" to the dict key "from" when:

  1. validating the data
  2. serialising the model

Thanks fo your help

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