chore(docs): Refactor API Reference (#1883)

This commit is contained in:
Shahed Nasser
2022-08-05 14:06:12 +02:00
committed by GitHub
parent b126ab4dec
commit 73383cc466
625 changed files with 52358 additions and 11660 deletions
+61 -5
View File
@@ -1,5 +1,6 @@
const path = require("path")
const docsPath = path.join(__dirname, "../../docs/content")
const apisPath = path.join(__dirname, "../../docs/api")
const algoliaAppId = process.env.ALGOLIA_APP_ID || "temp"
const algoliaApiKey = process.env.ALGOLIA_API_KEY || "temp"
@@ -65,13 +66,32 @@ module.exports = {
},
{
type: 'dropdown',
label: 'References',
label: 'REST API Reference',
items: [
{
href: `https://docs.medusajs.com/api/store`,
target: "_self",
label: "API Reference",
type: 'html',
value: `
<a href="/api/store" target="_blank" rel="noopener noreferrer" class="dropdown__link">Store
<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_node_modules-@docusaurus-theme-classic-lib-theme-Icon-ExternalLink-styles-module">
<path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path>
</svg>
</a>`
},
{
type: 'html',
value: `
<a href="/api/admin" target="_blank" rel="noopener noreferrer" class="dropdown__link">Admin
<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_node_modules-@docusaurus-theme-classic-lib-theme-Icon-ExternalLink-styles-module">
<path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path>
</svg>
</a>`
},
],
},
{
type: 'dropdown',
label: 'References',
items: [
{
to: "cli/reference",
label: "CLI Reference",
@@ -158,9 +178,45 @@ module.exports = {
showLastUpdateTime: true
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
customCss: require.resolve("./src/css/custom.css")
},
},
],
[
'redocusaurus',
{
// Plugin Options for loading OpenAPI files
specs: [
{
spec: path.join(apisPath, 'store/openapi.yaml'),
route: '/api/store',
layout: {
noFooter: true
}
},
{
spec: path.join(apisPath, 'admin/openapi.yaml'),
route: '/api/admin',
layout: {
noFooter: true
}
}
],
// Theme Options for modifying how redoc renders them
theme: {
primaryColorDark: '#242526',
options: {
disableSearch: true,
nativeScrollbars: true,
sortTagsAlphabetically: true,
hideDownloadButton: true,
expandResponses: "200,204",
generatedPayloadSamplesMaxDepth: 4,
showObjectSchemaExamples: true,
requiredPropsFirst: true
}
}
},
],
],
}