Queries

The library provide some useful tooling for creating dataclasses for validating schema when querying, ordering or searching.

Query

class openapi.rest.Query(limit=None, offset=None)[source]

Base dataclass for querying pagination

orderable

openapi.rest.orderable(*orderable_fields)[source]

Create a dataclass with order_by choice field and the order_desc boolean field.

Parameters

*orderable_fields

fields which can be used for ordering

Return type

type

searchable

openapi.rest.searchable(*searchable_fields)[source]

Create a dataclass with search_fields class attribute and search field. The search field is a set of field which can be used for searching and it is used internally by the library, while the search field is the query string passed in the url.

Parameters

searchable_fields – fields which can be used for searching

Return type

type