Redoc: Regression: Double slashes added to full URL display

Created on 13 May 2019  路  19Comments  路  Source: Redocly/redoc

Attempted to upgrade to [email protected] this morning and noticed that it is inserting double slashes in the full url for a route:

image

Minimal reproduction.

openapi: 3.0.2

info:
  title: Double Slash
  version: v1
servers:
  - url: https://api.test.invalid

paths:
  /v1:
    get:
      summary: Double slash bug
      responses:
        200:
          description: OK

Most helpful comment

Will release a new version closer to the end of the week.

Is a new release still planned anytime soon? I would love to update to the latest version for IE11 fixes but this issue is blocking us.

All 19 comments

This also broke our documentation examples as well. @mramato, what is your current work around? I'm using NSwag which brings in https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js. And when I look at the js in the link it shows Version: "2.0.0-rc.7", so maybe both versions are affected, or js comments are not updated. (??)

Hey @mramato.

Are you sure you are running [email protected]? You can check the comment block on the top of the file or run in console: Redoc.version

I can't reproduce the issue on the latest version. I can reproduce using 2.0.0-rc.7 though. @EspressoBeans it must be jsdelivr cache. It should get propagated to the latest version within the next 24 hours.

There indeed was a minor regression and I just fixed it.
But @mramato, your example works fine for me on rc.8-1.

Will release a new version closer to the end of the week.

@RomanGotsiy I was using the CDN:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/bundles/redoc.standalone.js"> </script>

And Redoc.version is "2.0.0-rc.8-1"

My api redoc page is automatically bringing in https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js and the version within the js file is:

/*!
 * ReDoc - OpenAPI/Swagger-generated API Reference Documentation
 * -------------------------------------------------------------
 *   Version: "2.0.0-rc.8-1"
 *   Repo: https://github.com/Rebilly/ReDoc
 */

I'm still experiencing the extra slash at the end of the host server. Is there any information I can give you to help you fix?

@EspressoBeans could you share your spec servers? Do you use OpenAPI 3 or OpenAPI 2?

Ideally would be great if you can just share the link to your docs.

Thanks!

Unfortunately I cannot share a link to my docs because they are still internal links (not public), however here is the top section of my spec document. It shows that I'm using OpenAPI 3 and shows my server URL:

{
  "x-generator": "NSwag v12.2.5.0 (NJsonSchema v9.13.37.0 (Newtonsoft.Json v12.0.0.0))",
  "openapi": "3.0.0",
  "info": {
    "title": "Warehouse API",
    "description": "This API is for interfacing with Crane warehouse data for consumption into reports, data processing, and web applications.\n\n___\n# Versioning\nAPI released versions are summarized below:\n\nAPI version | Changes\n-------------| ---------\n1.3 | Added inventory available quantity across all warehouses.\n1.2 | Added inventory available quantity for single material.\n1.1 | Updated endpoint routing convention.\n1.0 | Initial version for material details.\n\n\n___\n# Errors\nThe API uses standard HTTP status codes to indicate the success or failure of the API call. The body of an error response will be JSON in the following format:\n\n```\n{\n  \"apiErrorMessage\": \"The requested shipment does not exist\"\n}\n```\n\n\n___\n",
    "version": "v1.4",
    "x-logo": {
      "url": "https://mc1.airscorp.com/portal-upload/RMPOD1WebDocument/2019/2/clientdata_1024732/20/1655/d424c4f2-38c2-4eaa-bb4f-6862197bf467.jpg",
      "altText": "Logo",
      "href": "https://craneww.com/"
    }
  },
  "servers": [
    {
      "url": "https://xxxx.api.craneww.com:12443"
    }
  ],
  "paths": {
    "/v1/inventory/customer/{customer}/warehouse/{warehouse}/material/{material}/detail": {
      "get": {
        "tags": [
          "Inventory"
        ],
        "summary": "Inventory Detail",
        "description": "Returns detailed information for a given customer, material, and warehouse.\n            \n    GET v1/inventory/customer/xxx/warehouse/IAH/material/xxx/detail",
        "operationId": "GetInventory",
        "parameters": [
          {
            "name": "customer",
            "in": "path",
            "required": true,
            "description": "Provide the Project Lookup Code",
            "schema": {
              "type": "string",
              "nullable": true
            },
            "x-position": 1
          },
...

I've also included the first operation, to show that it only has a single slash at the beginning (as expected). However notice that the server url does not contain an ending slash. However the page when displayed and you expand the GET operation link in the right pane. It shows the server name with a slash at the end (in black font, same as server), then the remainder of the url with blue font also has the slash at the beginning - which together is two slashes next to each other after the server.

Here is what it looks like in my application.

image

If it helps any, I noticed that your commited changes to src/utils/openapi.ts (https://github.com/Rebilly/ReDoc/commit/f29a4fe2eee39f7ef018c125d460ee8898856ce4) are not seen in the source files of my application:

image

i have confirmed that https://github.com/Rebilly/ReDoc/tree/v2.0.0-alpha.41 version does not have the problem in my API documents.

I can see double-slash after server with my API description (OpenAPI 2): https://raw.githubusercontent.com/darklynx/request-baskets/master/doc/api-swagger.yaml

It has basePath: / hence doubles the // when it is combined with paths that also have leading slashes according to spec.

Hopefully its fixed with v2.0.0-alpha.41, thanks!

Will release a new version closer to the end of the week.

Is a new release still planned anytime soon? I would love to update to the latest version for IE11 fixes but this issue is blocking us.

I also would like an update on when the new release is please. This is currently affecting our production documentation and would like to know if we should wait for the release or roll back to an older version.

Thanks

Any updates would be greatly appreciated. I'd also like to know if a new release is planned soon.

Thanks!

A new release is coming in 2-3 days max.

A new release is coming in 2-3 days max.

Hello @RomanHotsiy are there any updates about the possible release date?
Thanks

The latest version has been released already: v2.0.0-rc.10.

Could somebody try and verify if the issue is fixed? Thanks!

@RomanHotsiy I tried the new version a moment ago, and the issue seems to have been fixed :tada:

The latest version has been released already: v2.0.0-rc.10.

Could somebody try and verify if the issue is fixed? Thanks!

Can also confirm v2.0.0-rc.10 fixes this issue, woo! I think the only thing remaining is to bump the latest tag in the redoc npm package. I'm still seeing latest pointed to v2.0.0-rc.8-1, but I do see redoc-cli npm package bumped up to 0.8.5 with the dependency to v2.0.0-rc.10.

Thanks again, really appreciate it!

I can also confirm that problem is fixed in latest version (2.0.0-rc.10) even for Swagger v2 (OpenAPI 2) description. My example is rendered properly: https://rbaskets.in/api.html

Thank you very much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gavinkalika picture gavinkalika  路  3Comments

dvh picture dvh  路  3Comments

typekpb picture typekpb  路  4Comments

bmarwell picture bmarwell  路  3Comments

RomanHotsiy picture RomanHotsiy  路  3Comments