devdigital / gatsby-source-openapi-aggregate Goto Github PK
View Code? Open in Web Editor NEWGatsby source plugin for pulling data into Gatsby from Open API/Swagger specifications
License: MIT License
Gatsby source plugin for pulling data into Gatsby from Open API/Swagger specifications
License: MIT License
We're migrating from 2.0 to 3.0 and we really like this plugin. Are there any plans to support OpenApi Specification 3.0?
I am running into a different issue now with this plugin.
Whenever I try run gatsby develop
this error shows up :
I branched this out from my existing project.
Here is the package.json
:
{
"name": "gatsby-starter-default",
"description": "Gatsby default starter",
"version": "1.0.0",
"author": "Kyle Mathews <[email protected]>",
"dependencies": {
"aws-amplify": "^1.1.13",
"aws-amplify-react": "^2.1.7",
"babel-polyfill": "^6.26.0",
"blob": "0.0.5",
"blob-polyfill": "^3.0.20180112",
"bootstrap": "^4.1.3",
"classnames": "^2.2.6",
"formdata-polyfill": "^3.0.13",
"gatsby": "^2.0.66",
"gatsby-image": "^2.0.15",
"gatsby-plugin-create-client-paths": "^2.0.2",
"gatsby-plugin-manifest": "^2.0.12",
"gatsby-plugin-offline": "^2.0.11",
"gatsby-plugin-react-helmet": "^3.0.0",
"gatsby-plugin-sharp": "^2.0.16",
"gatsby-plugin-typography": "^2.2.1",
"gatsby-remark-autolink-headers": "^2.0.12",
"gatsby-source-filesystem": "^2.0.4",
"gatsby-source-openapi-aggregate": "^0.1.8",
"gatsby-source-s3": "0.0.0",
"gatsby-transformer-remark": "^2.1.15",
"gatsby-transformer-sharp": "^2.1.4",
"glamor": "^2.20.40",
"glamorous": "^5.0.0",
"graphql": "^0.13.2",
"jquery": "^3.3.1",
"lodash.groupby": "^4.6.0",
"react": "^16.6.3",
"react-app-polyfill": "^0.1.3",
"react-country-region-selector": "^1.4.2",
"react-dom": "^16.6.3",
"react-helmet": "^5.2.0",
"react-icons": "^3.2.2",
"react-router-dom": "^4.3.1",
"react-transition-group": "^2.5.0",
"react-typography": "^0.16.13",
"reactstrap": "^6.5.0",
"styled-components": "^4.1.2",
"typography": "^0.16.17",
"validator": "^10.9.0",
"whatwg-fetch": "^2.0.4"
},
"keywords": [
"gatsby"
],
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"start": "npm run develop",
"format": "prettier --write \"src/**/*.js\"",
"test": "echo \"Error: no test specified\" && exit 1",
"cleancache": "rimraf .cache/*"
},
"devDependencies": {
"prettier": "^1.14.2"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
}
}
Seems like you just need to replace boundActionCreators
with actions
. I tried it locally and that seems to be only change needed to get this to work :)
The sample project probably needs to be updated to at least Gatsby 2 also.
Or if you want to support gatsby 1 through 3 maybe this would work...
exports.sourceNodes = async ({ actions, boundActionCreators }, options) => {
const { createNode } = actions || boundActionCreators;
the example field is not present on the property definitions
The current childrenOpenApiSpecDefinition
contains the primary definition only. The definition may reference other definitions (recursively?) to build up the full tree of definitions. I have this working locally for my 1-level nesting using the code:
const definitionId = ref ? ref.replace('#/definitions/', '') : null;
let children = definitionId ? [`${rootId}.definition.${definitionId}`] : [];
if (definitionId) {
const mainDefinition = definitions.filter(definition => definition.fields.name === definitionId)[0];
const referencedDefinitions =
mainDefinition.fields.properties.
map(prop => prop.referencedDefinition).
filter((p) => p).
map(id => `${rootId}.definition.${id}`);
children = children.concat(Array.from(new Set(referencedDefinitions)));
}
return {
id: `${rootId}.path.${p}.verb.${v}.response.${r}`,
parent: `${rootId}.path.${p}.verb.${v}`,
children,
fields: {
statusCode: r,
description: response.description
}
};
Hi!
using the example that you provided, i get GraphQLError: Cannot query field "allOpenApiSpec" on type "Query"
with gatsby-node.js
. While the graphQL queries work otherwise, gatsby-node.js
seems to trip on the definition when using the createPage method.
Something tells me it has to do with an older version of gastby that this example uses but i wonder if this is something you'd be able to reproduce.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.