vitalik / django-ninja

💨 Fast, Async-ready, Openapi, type hints based framework for building APIs
https://django-ninja.dev
MIT License
7.38k stars 439 forks source link

0.15.0 Regression with `.` in `Field(alias)` #238

Closed jlward closed 3 years ago

jlward commented 3 years ago

Howdy,

While trying to upgrade from 0.13.2 to 0.15.0, I've run into a problem with query params whose fields have a . in their alias. We have something that looks like this:

class BaseListFilter(Schema):
    sort_by: str = Field('', alias='sort.by')

And it's being used like:

@router.get('')
def list_things(request, filters: BaseListFilter = Query(...)):
    ...

And filters in list_things is no longer setting filters.sort_by correctly after the upgrade. This is happening for all fields that have a . in them.

I checked out the diff between 0.13.2 and 0.15.0 and if I was a gambling man, I would say the issue is happening here, but that is mostly a guess.

Although we have the ability to change the data we are getting to stop using . in them, it would be an enormous amount of work and coordination. Got any workarounds?

Love the lib, keep up the great work.

jlward commented 3 years ago

This is probably the fastest turn around I've seen from an open source project. I look forward to pulling down the new tag once it's up on PyPi. Thanks for all that you do.

vitalik commented 3 years ago

Hey @jlward This has landed to 0.16, please try latest from pypi

jlward commented 3 years ago

0.16.0 worked great. Thanks for the quick update. Keep up the great work.