Add OpenAPI schema file
I wanted a way to browse the API through Postman and I found that Django has a tool for creating Open API schema files.
Without the changes in serializers.py
I got this error (below is an excerpt):
File "/usr/local/lib/python3.11/site-packages/rest_framework/generics.py", line 114, in get_serializer
return serializer_class(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: OptimizedInitiativeSerializer.__init__() missing 1 required positional argument: 'i'
Maybe
- the schema-generation could be integrated into some CI/CD process.
- the schema API endpoint that I added is overkill
Edited by William Johnsson