courtlistener icon indicating copy to clipboard operation
courtlistener copied to clipboard

Swagger (OpenAPI) schema contain wrong URLs

Open elibrin opened this issue 3 years ago • 2 comments

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:

  1. Browse to: https://www.courtlistener.com/api/swagger/
  2. See the links in the returned json.
  3. Link points to wrong location. and
  4. {version} is in the path

elibrin avatar Mar 15 '21 20:03 elibrin

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.

cite-reader avatar Jul 18 '22 18:07 cite-reader

Woah! That's great research, thank you!

mlissner avatar Jul 18 '22 20:07 mlissner