Generate rest-api docs from API.md

This commit is contained in:
Akshay 2022-02-23 17:31:49 +01:00
parent badeecf22b
commit 26f7f29b37
3 changed files with 37 additions and 37 deletions

View File

@ -96,7 +96,7 @@ module.exports = {
},
{
name: 'provider',
url: 'https://v4.provider.mainnet.oceanprotocol.com'
url: 'https://provider.mainnet.oceanprotocol.com/spec'
}
]
}

View File

@ -11,12 +11,12 @@
- group: Aquarius REST API
items:
- title: API Reference
link: /references/aquarius/
link: /references/aquarius-rest-api/
- group: provider REST API
items:
- title: API Reference
link: /references/provider/
link: /references/provider-rest-api/
- group: Provider Py Module
items:

View File

@ -165,26 +165,26 @@ exports.createPages = ({ graphql, actions }) => {
const providerList = filterMarkdownList(markdowns, 'provider')
const subgraphList = filterMarkdownList(markdowns, 'ocean-subgraph')
// const aquariusRestApi = getRestApiPageFromMarkdownList(
// markdowns,
// 'aquarius'
// )[0].node
const aquariusRestApi = getRestApiPageFromMarkdownList(
markdowns,
'aquarius'
)[0].node
// await createRestApiPage(
// createPage,
// aquariusRestApi,
// `/references/aquarius`
// )
await createRestApiPage(
createPage,
aquariusRestApi,
`/references/aquarius-rest-api`
)
// const providerRestApi = getRestApiPageFromMarkdownList(
// markdowns,
// 'provider'
// )[0].node
// await createRestApiPage(
// createPage,
// providerRestApi,
// `/references/provider`
// )
const providerRestApi = getRestApiPageFromMarkdownList(
markdowns,
'provider'
)[0].node
await createRestApiPage(
createPage,
providerRestApi,
`/references/provider-rest-api`
)
await createReadTheDocsPage(createPage, 'ocean-py', oceanPyList)
await createReadTheDocsPage(createPage, 'provider', providerList)
@ -314,20 +314,20 @@ const filterMarkdownList = (markdownList, string) => {
return markdownList.filter(({ node }) => node.frontmatter.app === string)
}
// const createRestApiPage = async (createPage, node, slug) => {
// const template = path.resolve('./src/templates/RestApi.jsx')
// createPage({
// path: slug,
// component: template,
// context: {
// node,
// slug
// }
// })
// }
const createRestApiPage = async (createPage, node, slug) => {
const template = path.resolve('./src/templates/RestApi.jsx')
createPage({
path: slug,
component: template,
context: {
node,
slug
}
})
}
// const getRestApiPageFromMarkdownList = (markdownList, string) => {
// return markdownList.filter(({ node }) => {
// return node.frontmatter.app === string && node.frontmatter.slug === 'API.md'
// })
// }
const getRestApiPageFromMarkdownList = (markdownList, string) => {
return markdownList.filter(({ node }) => {
return node.frontmatter.app === string && node.frontmatter.slug === 'API.md'
})
}