Configuration¶
QueryStringManager reads settings from Django NINJA_JSONAPI.
Settings¶
NINJA_JSONAPI = {
"DEFAULT_PAGE_SIZE": 20,
"MAX_PAGE_SIZE": 100,
"MAX_INCLUDE_DEPTH": 3,
"ALLOW_DISABLE_PAGINATION": False,
"INCLUDE_JSONAPI_OBJECT": False,
"JSONAPI_VERSION": "1.0",
"INFLECTION": None, # or "dasherize" or "camelize"
}
Keys¶
DEFAULT_PAGE_SIZE: default number of items per page when the client doesn't sendpage[size].MAX_PAGE_SIZE: hard upper limit forpage[size]. Client-requested sizes above this value are clamped silently.MAX_INCLUDE_DEPTH: maximum include chain depth (for examplea.b.c).ALLOW_DISABLE_PAGINATION: allows/disallowspage[size]=0.- When
True,page[size]=0disables pagination. - When
False,page[size]=0falls back to the default page size.
- When
INCLUDE_JSONAPI_OBJECT: whenTrue, adds top-leveljsonapiobject to responses.JSONAPI_VERSION: version string used whenINCLUDE_JSONAPI_OBJECT=True.INFLECTION: attribute-key transformation applied to JSON:API documents.None(default) — keys match Python field names."dasherize"—first_name→first-name."camelize"—first_name→firstName.- See Inflection for details.
Practical guidance¶
- Keep
MAX_INCLUDE_DEPTHconservative to avoid expensive graph traversal. - Set
MAX_PAGE_SIZEbased on endpoint cost and typical client use.
Query parameters supported¶
filterfilter[field]=valuesortincludefields[resource_type]page[number],page[size],page[offset],page[limit]page[cursor](cursor pagination)
Query parameter validation¶
- Unknown query parameters are rejected with
400 Bad Request. - Repeated parameters are rejected for non-
filterkeys (for example repeatingsortorpage[size]). - Repeating
filter[...]keys is allowed.