Better pydantic support in python fast api server#16321
Better pydantic support in python fast api server#16321
Conversation
|
To test the branch, simply run the following: |
|
We'll consider this PR as a bug fix (non breaking change) to the upcoming 7.x release. |
Is there a timeline of when this is planned to be released? |
|
@wing328 I have tried and tested if I can gladly say that it does fix the I haven't had the time to test this branch yet but I hope that things like that is under your scope during implmentation. |
|
@yahiaosama thanks for reviewing the testing this change. Can you please PM me via Slack for a few quick questions if you've time? |
|
These changes generate incorrect code for my usecase. TextTopic:
description: foobar
enum:
- foo
- bar
title: TextTopic
type: stringTurns into: class TextTopic(int, Enum):
"""
foobar
"""
"""
allowed enum values
"""
NUMBER_'foo' = 'foo'
NUMBER_'bar' = 'bar'
@classmethod
def from_json(cls, json_str: str) -> TextTopic:
"""Create an instance of TextTopic from a JSON string"""
return TextTopic(json.loads(json_str))The same code generates correctly using #14242. |
|
I've filed #17369 instead to support pydantic v2 in the python-fastapi generator. please review and test that one instead. closing this one. |
PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.For Windows users, please run the script in Git BASH.
master(6.3.0) (minor release - breaking changes with fallbacks),7.0.x(breaking changes without fallbacks)