Sitelet https://github.com/cloud-annotations/docusaurus-openapi/issues/231
Skip to content

Support for external OpenAPI spec #231

Description

@mathieu-souchet

Hi all,

Today I tried to upgrade the versions of the NPM modules of my documentation with docusaurus-preset-openapiand i am facing following issue :

❯ npx docusaurus start
[INFO] Starting the development server...
[SUCCESS] Docusaurus website is running at: http://localhost:3000/xxx/documentation/
[ERROR] ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
 - configuration.module.rules[12] should be one of these:
   ["..." | object { assert?, compiler?, dependency?, descriptionData?, enforce?, exclude?, generator?, include?, issuer?, issuerLayer?, layer?, loader?, mimetype?, oneOf?, options?, parser?, realResource?, resolve?, resource?, resourceFragment?, resourceQuery?, rules?, scheme?, sideEffects?, test?, type?, use? }, ...]
   -> A rule.
   Details:
    * configuration.module.rules[11].include[1]: The provided value "http://my-domain.com/v1/documentation/json/" is not an absolute path!
    * configuration.module.rules[11].include[1]: The provided value "http://my-domain.com/v1/documentation/json/" is not an absolute path!
    * configuration.module.rules[12].exclude[7]: The provided value "http://my-domain.com/v1/documentation/json/" is not an absolute path!
    * configuration.module.rules[12].exclude[7]: The provided value "http://my-domain.com/v1/documentation/json/" is not an absolute path!
    at validate (/Users/xxx/xxx/node_modules/webpack/node_modules/schema-utils/dist/validate.js:105:11)
    at validateSchema (/Users/xxx/xxx/node_modules/webpack/lib/validateSchema.js:78:2)
    at create (/Users/xxx/xxx/node_modules/webpack/lib/webpack.js:111:24)
    at webpack (/Users/xxx/xxx/node_modules/webpack/lib/webpack.js:158:32)
    at f (/Users/xxx/xxx/node_modules/webpack/lib/index.js:64:16)
    at Command.start (/Users/xxx/xxx/node_modules/@docusaurus/core/lib/commands/start.js:124:44)
[INFO] Docusaurus version: 2.2.0
Node version: v18.3.0

My plugin configuration is as following :

  presets: [
    [
      "docusaurus-preset-openapi",
      /** @type {import('docusaurus-preset-openapi').Options} */
      ({
        docs: {
          sidebarPath: require.resolve("./sidebars.js"),
          editUrl: "https://git.xxx.com/xxx/"
        },
        theme: {
          customCss: require.resolve("./src/css/custom.css"),
        },
        api: {
          path: "http://my-domain.com/v1/documentation/json"
        }
      }),
    ],
  ]

It is curious because with following npm depencies versions my doc is running well :

{
  "dependencies": {
    "@docusaurus/core": "^2.0.0",
    "@mdx-js/react": "^1.6.21",
    "clsx": "^1.1.1",
    "docusaurus-preset-openapi": "0.6.1",
    "prism-react-renderer": "^1.2.1",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "url": "^0.11.0"
  }
}

And with following versions it doesn't work :

{
  "dependencies": {
    "@docusaurus/core": "^2.2.0",
    "@mdx-js/react": "^1.6.21",
    "clsx": "^1.1.1",
    "docusaurus-preset-openapi": "0.6.3",
    "prism-react-renderer": "^1.2.1",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "url": "^0.11.0"
  }
}

I'm afraid of an answer like "Sorry but you have to put locally your OpenAPI spec file" because my documentation is in another repository than my API 😅

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions