diff --git a/gatsby-config.js b/gatsby-config.js index 79cea804..6464be02 100755 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -9,22 +9,6 @@ if (!process.env.GITHUB_TOKEN) { const config = require('./config.js') -const fs = require('fs') -const path = require('path') - -const fromJson = filePath => { - return new Promise((resolve, reject) => { - fs.readFile(filePath, 'utf8', (err, data) => { // eslint-disable-line - if (err) { - reject(err) - return - } - - resolve(data) - }) - }) -} - module.exports = { siteMetadata: { // spread all of our config values here @@ -122,27 +106,6 @@ module.exports = { ] } }, - { - resolve: 'gatsby-source-openapi-aggregate', - options: { - specs: [ - { - name: 'aquarius', - resolve: () => - fromJson( - path.resolve(__dirname, './data/aquarius.json') - ) - }, - { - name: 'brizo', - resolve: () => - fromJson( - path.resolve(__dirname, './data/brizo.json') - ) - } - ] - } - }, 'gatsby-transformer-yaml', { resolve: 'gatsby-plugin-sass', diff --git a/gatsby-node.js b/gatsby-node.js index 38f75c42..e4b2edea 100755 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -135,7 +135,7 @@ exports.createPages = ({ graphql, actions }) => { component: apiSwaggerTemplate, context: { slug: aquariusSlug, - json: aquariusSpecs + api: aquariusSpecs } }) @@ -147,7 +147,7 @@ exports.createPages = ({ graphql, actions }) => { component: apiSwaggerTemplate, context: { slug: brizoSlug, - json: brizoSpecs + api: brizoSpecs } }) diff --git a/package.json b/package.json index 9fcc5eed..7c410eb9 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,6 @@ "gatsby-remark-smartypants": "^2.0.6", "gatsby-source-filesystem": "^2.0.9", "gatsby-source-graphql": "^2.0.6", - "gatsby-source-openapi-aggregate": "^0.1.8", "gatsby-transformer-remark": "^2.1.12", "gatsby-transformer-sharp": "^2.1.8", "gatsby-transformer-yaml": "^2.1.5", diff --git a/src/templates/ApiSwagger.jsx b/src/templates/ApiSwagger.jsx index 7527c9f3..bb601671 100644 --- a/src/templates/ApiSwagger.jsx +++ b/src/templates/ApiSwagger.jsx @@ -20,8 +20,8 @@ export default class ApiSwaggerTemplate extends Component { render() { const { location, data, pageContext } = this.props - const sections = this.props.data.allSectionsYaml.edges - const { title, description } = pageContext.json.info + const sections = data.allSectionsYaml.edges + const { title, description } = pageContext.api.info // output section title as defined in sections.yml const sectionTitle = sections.map(({ node }) => { @@ -31,8 +31,6 @@ export default class ApiSwaggerTemplate extends Component { } }) - console.log(data) - return ( <> @@ -61,7 +59,7 @@ export default class ApiSwaggerTemplate extends Component {
- {Object.keys(pageContext.json.paths).map( + {Object.keys(pageContext.api.paths).map( path => (

{path}

@@ -79,13 +77,7 @@ export default class ApiSwaggerTemplate extends Component { } export const pageQuery = graphql` - query($slug: String!) { - markdownRemark(fields: { slug: { eq: $slug } }) { - id - tableOfContents - html - } - + query { allSectionsYaml { edges { node {