-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Description
This issue occurs when using the updated OpenAPI schema generation by @carltongibson (#6532).
Most OpenAPI client tools, such as apistar
or openapi3
, require an operationId
property to be able to perform requests. In the case of APIStar, if the operation ID is missing, a slugified title is used (code here); however the title
property seems to also be missing. For those reasons, opening a generated schema with a client will show zero available endpoints.
Checklist
- I have verified that that issue exists against the
master
branch of Django REST framework. - I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- This is not a usage question. (Those should be directed to the discussion group instead.)
- This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
- I have reduced the issue to the simplest possible case.
- I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.)
Steps to reproduce
Run ./manage.py generateschema
on any project that has an API endpoint, then load the generated YAML schema with a client library such as API Star:
>>> import apistar
>>> client = apistar.Client('schema.yaml')
>>> client.document.get_links()
[]
APIStar will state that the schema is valid, because operationId
is not required but recommended, but it will be empty.
Expected behavior
An OpenAPI schema with operationId
properties to give a name to each endpoint. It seems the renderer on 3.9/master did set the property.
Actual behavior
Each path in the schema is missing a name, description, or any kind of identifier that could be used by client libraries.