Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of Python Pydantic #1474

Closed
Forden opened this issue May 16, 2020 · 3 comments
Closed

Add support of Python Pydantic #1474

Forden opened this issue May 16, 2020 · 3 comments

Comments

@Forden
Copy link

Forden commented May 16, 2020

It would be great to implement generating of Pydantic models.
It's like Python3.6, but without __init__ and with Field with alias definition.

from typing import Optional

from pydantic import BaseModel, Field


class Test(BaseModel):
    test_value: str = Field(..., alias='testValue')
    another_value: Optional[int] = Field(alias='another_value')


data = Test(**{'testValue': 'some data'})

print(data.test_value)
# > some data

other_data = Test(**{'testValue': 'more data', 'another_value': 123})

print(other_data.test_value)
# > more data
print(other_data.another_value)
# > 123
@Forden Forden changed the title Adding Python Pydantic Add support of Python Pydantic May 16, 2020
@dvdsgl
Copy link
Member

dvdsgl commented May 31, 2020

Great idea! We would love this as a Python option. Closing, though, because we do not keep feature requests as open issues.

@dvdsgl dvdsgl closed this as completed May 31, 2020
@RazCrimson
Copy link

@dvdsgl

Is there any work or progress on this?

If not, will contributions for this be accepted?

@dvdsgl
Copy link
Member

dvdsgl commented Jan 5, 2023

@RazCrimson sure! If you make a PR with supporting test fixture that passes.

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

No branches or pull requests

3 participants