rapi-doc / RapiDoc

RapiDoc -WebComponent for OpenAPI Spec
https://rapidocweb.com
MIT License
1.71k stars 285 forks source link

$ref doesn't work #1059

Closed sledgehammer999 closed 1 week ago

sledgehammer999 commented 1 week ago

The following sample spec doesn't get fully rendered because rapidoc doesn't follow the $ref document. No console output to debug with. Meanwhile @redocly/cli generates a static html which includes the referenced yaml too.

rapidoc version: 9.3.8

Here is a sample spec:

main.yml

openapi: '3.1.0'
info:
  description: some description
  title: WebAPI
  version: '2.11.2'
servers:
  - url: 'https://localhost:{port}/api/v2'
    variables:
      port:
        default: "8080"
paths:
  $ref: './api-part1.yml'

api-part1.yml

/transfer/uploadLimit:
  get:
    summary: Get upload speed limit.
    responses:
      '200':
        description: OK
        content:
          text/plain; charset=UTF-8:
            schema:
              type: string

index.html

<!doctype html> <!-- Important: must specify -->
<html>
  <head>
    <meta charset="utf-8"> <!-- Important: rapi-doc uses utf8 characters -->
    <script type="module" src="node_modules/rapidoc/dist/rapidoc-min.js"></script>
  </head>
  <body>
    <rapi-doc spec-url="main.yml" load-fonts="false"> </rapi-doc>
  </body>
</html>

It is rendered like this: Untitled1

But it should have been rendered like this: Untitled1

mrin9 commented 1 week ago

duplicate of #1027

sledgehammer999 commented 1 week ago

@mrin9 would it be possible to at least output something in the console so one can debug this?

Btw, the linter from @redocly/cli doesn't report this as a problem. But I guess it's a problem with their own parser, because the OpenAPI spec indeed doesn't allow for $ref in the paths object.

In any case, this spec limitation really makes it hard to split off parts of the API into their own groups and hinders maintainability. /rant