How to add a schema under actions in django_rest_framework

def createUser(request):


    serializer = UserSerializer(
    if serializer.is_valid():
        return Response(, status=201)
        return Response(serializer.errors, status=400)`

For example I would like for this to be returned

  "name": "Token Refresh",
  "description": "Takes a refresh type JSON web token and returns an access type JSON web\ntoken if the refresh token is valid.",
  "renders": ["application/json", "text/html"],
  "parses": [
  "actions": {
    "POST": {
      "refresh": {
        "type": "string",
        "required": true,
        "read_only": false,
        "label": "Refresh"
      "access": {
        "type": "string",
        "required": false,
        "read_only": true,
        "label": "Access"

This is from an built in view from rest_framework_simplejwt. Overall I would like to add a schema such as the actions data which shows for the method post refresh and access are required. I want something like this for my createUser view as I can easily see what attribute the api endpoint takes for example username or password,

I looked online and found this but I couldn't get it to work. I looked at other solutions also but they were just showing to create a different view which sends a JSON schema back as get request. Overall I just want something simple that I can easily use to communicate with my backend without having to go look at my backend code to see what values this view takes for its Serializer.

Back to Top