Comments (4)
Hi @bourdakos1
I'm getting a Syntax error while trying to have the two APIs:
Compiled with problems:X
ERROR in ./.docusaurus/docusaurus-plugin-openapi/kiosk_rest_api/site-kiosk-rest-api-abc-description.md
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /home/anthony/safe_docs/safe/docs/.docusaurus/docusaurus-plugin-openapi/kiosk_rest_api/site-kiosk-rest-api-abc-description.md: Identifier 'React' has already been declared. (13:114)
11 | /* @jsxRuntime classic */
12 | /* @jsx mdx */
> 13 | import _extends from"/home/anthony/safe_docs/safe/docs/node_modules/@babel/runtime/helpers/esm/extends.js";import React from'react';import{mdx}from'@mdx-js/react';
| ^
14 | export const frontMatter = {};
15 | export const contentTitle = undefined;
16 | /* @jsxRuntime classic */
at Object._raise (/home/anthony/safe_docs/safe/docs/node_modules/@babel/parser/lib/index.js:541:17)
at Object.raiseWithData (/home/anthony/safe_docs/safe/docs/node_modules/@babel/parser/lib/index.js:534:17)
at Object.raise (/home/anthony/safe_docs/safe/docs/node_modules/@babel/parser/lib/index.js:495:17)
at ScopeHandler.checkRedeclarationInScope (/home/anthony/safe_docs/safe/docs/node_modules/@babel/parser/lib/index.js:1688:12)
at ScopeHandler.declareName (/home/anthony/safe_docs/safe/docs/node_modules/@babel/parser/lib/index.js:1654:12)
at Object.checkLVal (/home/anthony/safe_docs/safe/docs/node_modules/@babel/parser/lib/index.js:11086:24)
at Object.parseImportSpecifierLocal (/home/anthony/safe_docs/safe/docs/node_modules/@babel/parser/lib/index.js:14846:10)
at Object.maybeParseDefaultImportSpecifier (/home/anthony/safe_docs/safe/docs/node_modules/@babel/parser/lib/index.js:14944:12)
at Object.parseImport (/home/anthony/safe_docs/safe/docs/node_modules/@babel/parser/lib/index.js:14811:31)
at Object.parseStatementContent (/home/anthony/safe_docs/safe/docs/node_modules/@babel/parser/lib/index.js:13454:27)
at Object.parseStatement (/home/anthony/safe_docs/safe/docs/node_modules/@babel/parser/lib/index.js:13352:17)
at Object.parseBlockOrModuleBlockBody (/home/anthony/safe_docs/safe/docs/node_modules/@babel/parser/lib/index.js:13941:25)
at Object.parseBlockBody (/home/anthony/safe_docs/safe/docs/node_modules/@babel/parser/lib/index.js:13932:10)
at Object.parseProgram (/home/anthony/safe_docs/safe/docs/node_modules/@babel/parser/lib/index.js:13272:10)
at Object.parseTopLevel (/home/anthony/safe_docs/safe/docs/node_modules/@babel/parser/lib/index.js:13263:25)
at Object.parse (/home/anthony/safe_docs/safe/docs/node_modules/@babel/parser/lib/index.js:15037:10)
My docusaurus.config.js
:
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const remarkMermaid = require("remark-mermaid");
const lunrSearch = require.resolve("docusaurus-lunr-search");
const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'My Site',
tagline: 'Dinosaurs are cool',
url: 'https://your-docusaurus-test-site.com',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
organizationName: 'facebook', // Usually your GitHub org/user name.
projectName: 'docusaurus', // Usually your repo name.
scripts: [
"https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.8.4/mermaid.min.js",
"/init.js"
],
plugins: [
["docusaurus-plugin-openapi", {
id: "backoffice_rest_api",
routeBasePath: "backoffice-rest-api",
openapiPath: require.resolve("./backoffice_rest_api.json"),
proxy: {
"/proxy": {
target: "http://localhost:8090",
pathRewrite: { "^/proxy": "" }
}
}
}],
["docusaurus-plugin-openapi", {
id: "kiosk_rest_api",
routeBasePath: "kiosk-rest-api",
openapiPath: require.resolve("./kiosk_rest_api.json"),
proxy: {
"/proxy": {
target: "http://localhost:8091",
pathRewrite: { "^/proxy": "" }
}
}
}],
lunrSearch
],
presets: [
[
'@docusaurus/preset-classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo.
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
remarkPlugins: [[remarkMermaid, { simple: true }]]
},
blog: {
showReadingTime: true,
// Please change this to your repo.
editUrl:
'https://github.com/facebook/docusaurus/edit/main/website/blog/',
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
title: 'My Site',
logo: {
alt: 'My Site Logo',
src: 'img/logo.svg',
},
items: [
{
type : 'doc',
docId : 'intro',
position : 'left',
label : 'Tutorial',
},
{
to : '/backoffice-rest-api',
//activeBasePath: 'backoffice-rest-api',
label : 'Backoffice API',
position : 'left'
},
{
to : '/kiosk-rest-api',
//activeBasePath: 'kiosk-rest-api',
label : 'Kiosk API',
position : 'left'
},
{
to : '/blog',
label : 'Blog',
position : 'left'
},
{
href: 'https://github.com/facebook/docusaurus',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Tutorial',
to: '/docs/intro',
},
],
},
{
title: 'Community',
items: [
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/docusaurus',
},
{
label: 'Discord',
href: 'https://discordapp.com/invite/docusaurus',
},
{
label: 'Twitter',
href: 'https://twitter.com/docusaurus',
},
],
},
{
title: 'More',
items: [
{
label: 'Blog',
to: '/blog',
},
{
label: 'GitHub',
href: 'https://github.com/facebook/docusaurus',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
}),
};
module.exports = config;
I have both kiosk_rest_api.json
and backoffice_rest_api.json
with same content:
{
"openapi": "",
"info": {
"title": "",
"version": ""
},
"paths": {
"/users/{userId}": {
"get": {
"summary": "Returns a user by ID.",
"parameters": [
{
"name": "userId",
"in": "path",
"description": "The ID of the user to return.",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"200": {
"description": "A user object.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/User"
}
}
}
},
"400": {
"description": "The specified user ID is invalid (not a number)."
},
"404": {
"description": "A user with the specified ID was not found."
},
"default": {
"description": "Unexpected error"
}
}
}
}
},
"components": {}
}
from docusaurus-openapi.
I don't think activeBasePath
is necessary, this might have been a remnant of docusaurus alpha. The links/items section in the config is part of docusaurus and should be documented there
from docusaurus-openapi.
I'm having the same issue, still trying to figure out what the bug is.
from docusaurus-openapi.
A fix has been merged into main #69 and should be available in the next release
from docusaurus-openapi.
Related Issues (20)
- Add visual indicator for deprecated request/response body field
- Response schema marked as "Optional"
- Getting theme error while useing @docusaurus/preset-classic with docusaurus-plugin-openapi in plugins HOT 2
- Code examples tabs overflow in narrow browser windows
- Quick Overview failing HOT 1
- Support of readonly attributes HOT 1
- MDX content in params is displayed in form elements HOT 1
- embed generated API menu in an existing sidebar
- This page crashed - URI malformed - When inserting win10 keyboard emoji on api field HOT 6
- Mocking all the request/responses interactions
- Postman collection support
- Docusaurus 3.0 support HOT 4
- formatting issues in v0.7.0 HOT 3
- cURL highlighting issues on 0.7.1 HOT 1
- Docusaurus 3.1.0 - Breaking changes
- [ERROR] TypeError: Cannot read properties of undefined (reading 'result')
- Sharing URLs doesn't work
- Are you compatible with Docusaurus 3.x.x? HOT 1
- Docusaurus 3.2.0 - Breaking Changes HOT 2
- Modify Label in sidebar (autogenerated) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docusaurus-openapi.