You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, is there a way to expose the ordering fields as openapi types instead of a string as of currently?
Would help with the integration with a typescript frontend.
What we ended up doing, if it helps anyone:
from typing import Literal, get_args
from ninja import Schema
from ninja_extra.ordering import Ordering, ordering
class MyOrdering(Schema):
id: Literal["id"]
@ordering(Ordering, ordering_fields=[
get_args(annotation)[0]
for annotation in MyOrdering.__annotations__.values()
])
def list_objects(...):
...