Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot mix different versions of joi schemas when adding docusaurus-plugin-openapi. #240

Open
LakshmiLavanyaKasturi opened this issue Feb 14, 2023 · 0 comments

Comments

@LakshmiLavanyaKasturi
Copy link

I did the following steps

  1. npm install docusaurus-preset-openapi - Followed https://www.npmjs.com/package/docusaurus-preset-openapi
  2. yarn add docusaurus-preset-openapi. - Plugin added to the package.json file.
  3. yarn to add dependencies
  4. yarn build
  5. yarn start

Error:
[ERROR] Error: Cannot mix different versions of joi schemas
at new module.exports (/Users/lavanyakasturi/workspace/node_modules/@hapi/hoek/lib/error.js:23:19)
at module.exports (/Users/lavanyakasturi/workspace/node_modules/@hapi/hoek/lib/assert.js:21:11)
at exports.isSchema (/Users/lavanyakasturi/workspace/node_modules/joi/lib/common.js:132:5)
at internals.schema (/Users/lavanyakasturi/workspace/node_modules/joi/lib/compile.js:66:16)
at exports.schema (/Users/lavanyakasturi/workspace/node_modules/joi/lib/compile.js:17:26)
at internals.Base.$_compile (/Users/lavanyakasturi/workspace/node_modules/joi/lib/base.js:646:24)
at /Users/lavanyakasturi/workspace/node_modules/joi/lib/types/keys.js:262:92
at exports.tryWithPath (/Users/lavanyakasturi/workspace/node_modules/joi/lib/common.js:176:16)
at internals.Base.method [as keys] (/Users/lavanyakasturi/workspace/node_modules/joi/lib/types/keys.js:262:32)
at internals.Base.method [as append] (/Users/lavanyakasturi/workspace/node_modules/joi/lib/types/keys.js:191:29)

docusaurus.config.js file:

const lightCodeTheme = require('prism-react-renderer/themes/github');

const darkCodeTheme = require('prism-react-renderer/themes/dracula');

// With JSDoc @type annotations, IDEs can provide config autocompletion
/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = {
title: 'Hiro Docs',
tagline: 'Developer tools for Stacks',
url: 'https://docs.hiro.so',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
organizationName: 'hirosystems', // Usually your GitHub org/user name.
projectName: 'docs', // Usually your repo name.
trailingSlash: false,

plugins: [
require.resolve('@cmfcmf/docusaurus-search-local'),
require.resolve('docusaurus-plugin-segment'),
['./src/_plugins/google-tag-manager', { id: 'GTM-59XXGSG' }],
["docusaurus-plugin-remote-content",
{

      name: "remote-docs-stx-blockchain-api-docs", 
      sourceBaseUrl: "https://raw.githubusercontent.com/hirosystems/stacks-blockchain-api/master/content/", 
      outDir: "docs/stacks-blockchain-api", 
      documents: ["faqs.md", "getting-started.md","overview.md", "troubleshooting.md"
        ], 
      
     
      
  }],
["docusaurus-plugin-remote-content",
  {
      
      name: "remote-docs-stx-blockchain-api-feature-guides", 
      sourceBaseUrl: "https://raw.githubusercontent.com/hirosystems/stacks-blockchain-api/master/content/feature-guides", 
      outDir: "docs/stacks-blockchain-api/feature-guides", 
      documents: ["gaia-storage.md",
      "microblocks.md", "nonce-handling.md", "openapi-spec.md", "pagination.md", 
      "rate-limiting.md", "requesting-proofs.md", "rosetta-support.md", "search-endpoint.md",
      "search-endpoint.md", "transactions.md", "use-clarity-values.md","use-stacks-blockchain-api.md"
        ], 
      
     
      
  }],
  ["docusaurus-plugin-remote-content",
  {
      
      name: "remote-docs-stx-blockchain-api-how-to", 
      sourceBaseUrl: "https://raw.githubusercontent.com/hirosystems/stacks-blockchain-api/master/content/how-to-guides/", 
      outDir: "docs/stacks-blockchain-api/how-to-guides", 
      documents: ["how-to-deploy-service-dependencies.md",
      "how-to-handle-errors.md",
      "how-to-install-stacks-cli.md",
      "how-to-query-stacks2.0-blockchain.md",
      "how-to-run-api-node.md",
      "how-to-run-mainnet-node.md",
      "how-to-run-stacks-blockchain-api-docker.md",
      "how-to-run-testnet-node.md",
      "how-to-upgrade-stacks-blockchain-api.md",
      "how-to-use-docker-with-Stacks-blockchain-api.md",
        ], 
      
     
      
  }],
  ["docusaurus-plugin-remote-content",
        {
            name: "remote-docs-stx-blockchain-api-images", // path safe name to have multiple versions for the plugin
            sourceBaseUrl: "https://raw.github.com/hirosystems/stacks-blockchain-api/master/content/", // url from where the files are donwloaded from
            outDir: "docs/stacks-blockchain-api/", // content directory where the downloaded files are stored
            documents: [
             "images/api-architecture.png", ], // named files list to be downloaded
            requestConfig: { responseType: "arraybuffer" }, // required for non-text downloads
            headers: {
              'accept': 'image*',
              'Content-Type': 'image/jpeg', // required for image downloads
            }
            }
            
  ],
  ["docusaurus-plugin-remote-content",
  {
      
      name: "remote-docs-stx-js-docs", 
      sourceBaseUrl: "https://raw.githubusercontent.com/hirosystems/stacks.js/master/docs/", 
      outDir: "docs/stacks.js", 
      documents: ["faq.md", "getting-started.md","overview.md", "troubleshooting.md"
        ], 
      
     
      
  }],     
  ["docusaurus-plugin-remote-content",
  {
      
      name: "remote-docs-stx-js-includes", 
      sourceBaseUrl: "https://raw.githubusercontent.com/hirosystems/stacks.js/master/docs/includes", 
      outDir: "docs/stacks.js/includes/", 
      documents: ["stacks.js-starters-note.mdx"
        ], 
      
     
      
  }],     
  ["docusaurus-plugin-remote-content",
  {
      
      name: "remote-docs-stx-js-feature-guides", 
      sourceBaseUrl: "https://raw.githubusercontent.com/hirosystems/stacks.js/master/docs/feature-guides", 
      outDir: "docs/stacks.js/feature-guides", 
      documents: ["authenticate-users-with-connect.md",
      "sign-messages.md", "sign-transactions.md", "store-data-securely.md" ], 
      
     
      
  }],
  ["docusaurus-plugin-remote-content",
  {
      
      name: "remote-docs-stx-js-how-to", 
      sourceBaseUrl: "https://raw.githubusercontent.com/hirosystems/stacks.js/master/docs/how-to-guides/", 
      outDir: "docs/stacks.js/how-to-guides", 
      documents: ["how-to-integrate-stacking-delegation.md",
      "how-to-integrate-stacking.md",
      "how-to-migrate-from-blockstack.js.md",
      "how-to-use-stacks-connect-with-angular.md",
      
        ], 
      
     
      
  }],
  ["docusaurus-plugin-remote-content",
  {
      
      name: "remote-docs-clarinet-docs", 
      sourceBaseUrl: "https://raw.githubusercontent.com/hirosystems/clarinet/develop/docs/", 
      outDir: "docs/clarinet", 
      documents: ["faq.md", "getting-started.md","introduction.md", "troubleshooting.md"
        ], 
      
     
      
  }],     
  ["docusaurus-plugin-remote-content",
  {
      
      name: "remote-docs-clarinet-feature-guides", 
      sourceBaseUrl: "https://raw.githubusercontent.com/hirosystems/clarinet/develop/docs/feature-guides", 
      outDir: "docs/clarinet/feature-guides", 
      documents: ["analyze-with-check-checker.md",
      "chainhooks.md", "clarinet-deploy.md", "clarinet-integrate.md","extend-clarinet.md" ], 
      
     
      
  }],
  ["docusaurus-plugin-remote-content",
  {
      
      name: "remote-docs-clarinet-how-to", 
      sourceBaseUrl: "https://raw.githubusercontent.com/hirosystems/clarinet/develop/docs/how-to-guides/", 
      outDir: "docs/clarinet/how-to-guides", 
      documents: ["how-to-add-contract.md", "how-to-check-contract.md", "how-to-create-new-project.md",
      "how-to-debug-contract.md",
      "how-to-deploy-contracts.md", "how-to-deploy-with-subnets.md", "how-to-run-integration-environment.md", "how-to-set-up-local-development-environment.md"
      ,"how-to-test-contract.md"
        ], 
      
     
      
  }],
  ["docusaurus-plugin-remote-content",
        {
            
            name: "remote-docs-clarinet-images", 
            sourceBaseUrl: "https://raw.github.com/hirosystems/clarinet/develop/docs/images", 
            outDir: "docs/clarinet/images", 
            documents: [
             "breakpoint.png", 
             "clarinet-banner.bmp", 
             "clarinet-dialog.bmp", 
             "clarinet-faq-1.png", 
             "clarinet-faq-2.png", 
             "clarinet-faq-3.png", 
             "clarinet-faq-4.png", 
             "clarinet.ico", 
             "clarinet.png", 
             "clarinet101.png", 
             "costs.gif", 
             "debug-console.png", 
             "debug-toolbar.png", 
             "demo.gif", 
             "deno-error.png", 
             "jupyter.png", 
             "lcov.png", 
             "run-and-debug.png", 
             "sidebar.png", 
             "trace.png", 
             "watchpoint.png", 
            ], 
            requestConfig: { responseType: "arraybuffer" },
            
            headers: {
              'accept': 'image*',
              'Content-Type': 'image/jgeg',
            }
            }
            
  ],
  ["docusaurus-plugin-remote-content",
  {
      
      name: "remote-docs-explorer-docs", 
      sourceBaseUrl: "https://raw.githubusercontent.com/hirosystems/explorer/main/docs/", 
      outDir: "docs/explorer", 
      documents: ["getting-started.md","overview.md"
        ], 
      
     
      
  }],     
  
  ["docusaurus-plugin-remote-content",
  {
      
      name: "remote-docs-explorer-how-to", 
      sourceBaseUrl: "https://raw.githubusercontent.com/hirosystems/explorer/main/docs/how-to-guides/", 
      outDir: "docs/explorer/how-to-guides", 
      documents: ["build-explorer.md",
        ],  
  }],
  [
    "docusaurus-plugin-openapi",
    {
      id: "cos",
      path: "examples/openapi-cos.json",
      routeBasePath: "api",
    },
  ],

],

presets: [
[
'@docusaurus/preset-classic',
/** @type {import('@docusaurus/preset-classic').Options} */
{
docs: {
sidebarPath: require.resolve('./sidebars.js'),

      editUrl({ docPath }) {
        const repoUrls = {
          clarinet: 'https://github.com/hirosystems/clarinet/blob/main/docs',
          explorer: 'https://github.com/hirosystems/explorer/blob/main/docs',
          'stacks.js': 'https://github.com/hirosystems/stacks.js/blob/master/docs',
          'stacks-blockchain-api':
            'https://github.com/hirosystems/stacks-blockchain-api/blob/master/content',
        };
        console.log('docPath', docPath);
        const [repo, ...rem] = docPath.split('/');
        if (repo in repoUrls) {
          return `${repoUrls[repo]}/${rem.join('/')}`;
        }

        return `https://github.com/hirosystems/docs/blob/main/docs/${docPath}`;
      },
      routeBasePath: '/',
      breadcrumbs: false, // todo: enable at some point (breadcrumbs need a design overhaul first)
    },
    theme: {
      customCss: require.resolve('./src/css/custom.css'),
    },
  },
],
[
  "docusaurus-preset-openapi",
  /** @type {import('docusaurus-preset-openapi').Options} */
  ({
    api: {
      path: "https://raw.githubusercontent.com/hirosystems/stacks-blockchain-api/gh-pages/openapi.resolved.yaml",
      routeBasePath: "petstore",
    },
    docs: {
      sidebarPath: require.resolve("./sidebars.js"),
      // Please change this to your repo.
      editUrl:
        "https://github.com/cloud-annotations/docusaurus-openapi/edit/main/demo/",
    },
    blog: false,
    theme: {
      primaryColor: '#FF5500',
    },
  }),
],

],

themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
logo: {
alt: 'Hiro developers',
src: 'img/hiro-docs-logo.svg',
srcDark: 'img/hiro-docs-logo-dark.svg',
target: '_self',
className: 'hiro-logo',
},
items: [
{
type: 'doc',
label: 'Documentation',
docId: 'intro',
position: 'right',
},
{
type: 'dropdown',
label: 'References',
position: 'right',
items: [
{
label: 'Stacks Blockchain API',
to: '/api',
},
{
label: 'Token Metadata Service',
href: 'https://token-metadata-service-dlkidjgff-blockstack.vercel.app/',
},
{
label: 'Stacks CLI',
to: '/references/stacks-cli',
},
{
label: 'Stacks.js',
href: 'https://stacks.js.org',
},
{
label: 'Stacks Connect',
href: 'https://connect.stacks.js.org',
},
{
label: 'Clarity Functions',
href: 'https://docs.stacks.co/docs/clarity/language-functions',
},
{
label: 'Clarity Keywords',
href: 'https://docs.stacks.co/docs/clarity/language-keywords',
},
{
label: 'Clarity Types',
href: 'https://docs.stacks.co/docs/clarity/language-types',
},
],
},
{
type: 'dropdown',
label: 'Learn & Build',
position: 'right',
items: [
{
type: 'doc',
label: 'Tutorials',
docId: 'tutorials',
},
{
type: 'doc',
label: 'Example Apps',
docId: 'example-apps',
},
{
type: 'doc',
label: 'Stacks.js Starters',
docId: 'stacksjs-starters',
},

        ],
      },
      {
        type: 'doc',
        docId: 'roadmap',
        label: 'Roadmap',
        position: 'right',
      },
      {
        href: 'https://github.com/hirosystems/docs',
        className: 'header-github-link',
        title: 'GitHub Repository',
        'aria-label': 'GitHub Repository',
        position: 'right',
      },
    ],
  },
  footer: {
    logo: {
      alt: 'Hiro developers',
      src: 'img/hiro-docs-footer.svg',
      srcDark: 'img/hiro-docs-footer-light.svg',
    },
    links: [
      {
        title: 'Hiro Developers',
        items: [
          {
            label: 'Documentation',
            to: '/intro',
          },
          {
            label: 'Stacks API',
            to: '/api',
          },
          {
            label: 'Tutorials',
            to: '/tutorials',
          },
          {
            label: 'Example Apps',
            to: '/example-apps',
          },
          {
            label: 'Contributors Guide',
            to: '/contributors-guide',
          },
          {
            label: 'Product Changelog',
            to: '/changelog-intro',
          },
        ],
      },
      {
        title: 'More',
        items: [
          {
            label: 'GitHub',
            href: 'https://github.com/hirosystems/docs',
          },
          {
            label: 'Stacks Docs',
            href: 'https://docs.stacks.co',
          },
          {
            label: 'Blog',
            href: 'https://www.hiro.so/blog',
          },
          {
            label: 'Twitter',
            href: 'https://twitter.com/hirosystems',
          },
          {
            label: 'Youtube',
            href: 'https://www.youtube.com/channel/UC3xNLj2Mu7fW-BCq-vC9xKQ',
          },
          {
            label: 'Newsletter',
            href: 'https://hiro.so/updates-docs',
          },
        ],
      },
      {
        title: 'Stacks Community',
        items: [
          {
            label: 'Discord',
            href: 'https://stacks.chat',
          },
          {
            label: 'Stacks Forum',
            href: 'https://forum.stacks.org',
          },
          {
            label: 'Reddit',
            href: 'https://www.reddit.com/r/stacks',
          },
        ],
      },
    ],
    copyright: `Copyright © ${new Date().getFullYear()} Hiro Systems, PBC.`,
  },
  prism: {
    theme: lightCodeTheme,
    darkTheme: darkCodeTheme,
    additionalLanguages: ['toml', 'lisp'],
  },
  segment: {
    apiKey: 'qabJfWPhi2L9CeMk22A1XlYmabsNtgKy',
  },
}),

};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant