courtlistener
courtlistener copied to clipboard
Swagger (OpenAPI) schema contain wrong URLs
The Swagger (OpenAPI) schema contain wrong URLs to the API. For example: https://www.courtlistener.com/api/rest/v3/api/rest/{version}/dockets/
Step to reproduce:
- Browse to: https://www.courtlistener.com/api/swagger/
- See the links in the returned json.
- Link points to wrong location. and
- {version} is in the path
The duplication of the /api/v3/
fragment isn't the only issue with the paths object. Field names of the paths object (that is, the urls at which the API endpoints may be found) are not meant to be absolute URLs: "A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended (no relative URL resolution) to the expanded URL from the Server Object’s url field in order to construct the full URL." (OpenAPI specification version 3.0.2, § 4.7.8 Paths Object). That issue is a result of encode/django-rest-framework#7631; the issue is marked as stale, but the maintainers seemed amenable to receiving a PR that fixes it in their last comment, so I'll see if I can get that fixed myself.
Woah! That's great research, thank you!