-
|
I've been playing with https://openapi-generator.tech (how-to described here) to automatically generate all the necessary models and services for an Angular single page app based on the drf-spectacular-json-api generated OAS schema doc. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
The support for sort description is done by now. {
"name": "sort",
"required": false,
"in": "query",
"description": "[list of fields to sort by](https://jsonapi.org/format/#fetching-sorting)",
"schema": {
"type": "array",
"items": {
"type": "string",
"enum": [
"id",
"-id",
"username",
"-username",
"firstName",
"-firstName",
"lastName",
"-lastName",
"email",
"-email",
"isActive",
"-isActive",
"dateJoined",
"-dateJoined"
]
}
},
"explode": false
}Class based View example: class WebMapServiceViewSet(
ModelViewSet
):
....
search_fields = ("id", "title", "abstract", "keywords__keyword")
ordering_fields = ["id", "title", "abstract", "hits", "date_stamp"]Maybe you did miss this definitions on your views? Little hint: It seems you are generating the client models statically based on the openapi schema. Here is a CreateGuesser component, based on react admin, where i get the different inputs for the form from the openapi definitions. There is also an EditGuesser, ListGuesser and so on. For now it is part of the main project. But in the future it could be a separated package. If you are interested in it, feel free to start discussions on the mrmap project. |
Beta Was this translation helpful? Give feedback.
The support for sort description is done by now.
If you define the
ordering_fieldsin your class based view for example, the sort parameter shout be injected like:{ "name": "sort", "required": false, "in": "query", "description": "[list of fields to sort by](https://jsonapi.org/format/#fetching-sorting)", "schema": { "type": "array", "items": { "type": "string", "enum": [ "id", "-id", "username", "-username", "firstName", "-firstName", "lastName", "-lastName", "email", "-…