docs: add API page to docs using Swagger UI (#11154)

* docs: add API page to docs using Swagger UI

* silence fossa
This commit is contained in:
Maxime Beauchemin 2020-10-04 22:01:36 -07:00 committed by GitHub
parent 5e0603f957
commit 6358a7f1b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 11914 additions and 1012 deletions

View File

@ -16,6 +16,7 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations specific language governing permissions and limitations
under the License. under the License.
--> -->
Superset Superset
========= =========

View File

@ -30,6 +30,7 @@ export default {
'Frequently Asked Questions', 'Frequently Asked Questions',
'Contribution Guide', 'Contribution Guide',
'Roadmap', 'Roadmap',
'API',
'Security', 'Security',
], ],
}; };

3918
docs/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -6,27 +6,27 @@
"author": "preset.io", "author": "preset.io",
"dependencies": { "dependencies": {
"@ant-design/icons": "^4.2.2", "@ant-design/icons": "^4.2.2",
"@emotion/core": "^10.0.28", "@emotion/core": "^10.0.35",
"@emotion/styled": "^10.0.27", "@emotion/styled": "^10.0.27",
"@superset-ui/style": "^0.14.9", "@superset-ui/style": "^0.14.23",
"antd": "^4.5.2", "antd": "^4.6.6",
"docz": "^2.3.1", "docz": "^2.3.1",
"emotion": "^10.0.27", "emotion": "^10.0.27",
"gatsby": "^2.24.53", "gatsby": "^2.24.53",
"gatsby-dynamical-navigation": "^0.4.1", "gatsby-dynamical-navigation": "^0.4.1",
"gatsby-image": "^2.4.14", "gatsby-image": "^2.4.20",
"gatsby-plugin-antd": "^2.2.0", "gatsby-plugin-antd": "^2.2.0",
"gatsby-plugin-client-side-redirect": "^1.1.0", "gatsby-plugin-client-side-redirect": "^1.1.0",
"gatsby-plugin-emotion": "^4.3.10", "gatsby-plugin-emotion": "^4.3.12",
"gatsby-plugin-google-fonts": "^1.0.1", "gatsby-plugin-google-fonts": "^1.0.1",
"gatsby-plugin-manifest": "^2.4.21", "gatsby-plugin-manifest": "^2.4.33",
"gatsby-plugin-offline": "^3.2.21", "gatsby-plugin-offline": "^3.2.30",
"gatsby-plugin-react-helmet": "^3.3.10", "gatsby-plugin-react-helmet": "^3.3.12",
"gatsby-plugin-sass": "^2.3.12", "gatsby-plugin-sass": "^2.3.14",
"gatsby-plugin-sharp": "^2.6.24", "gatsby-plugin-sharp": "^2.6.38",
"gatsby-source-filesystem": "^2.3.23", "gatsby-source-filesystem": "^2.3.32",
"gatsby-theme-docz": "^2.3.1", "gatsby-theme-docz": "^2.3.1",
"gatsby-transformer-sharp": "^2.5.12", "gatsby-transformer-sharp": "^2.5.16",
"node-sass": "^4.14.1", "node-sass": "^4.14.1",
"prop-types": "^15.7.2", "prop-types": "^15.7.2",
"react": "^16.12.0", "react": "^16.12.0",
@ -34,13 +34,14 @@
"react-github-btn": "^1.2.0", "react-github-btn": "^1.2.0",
"react-grid-gallery": "^0.5.5", "react-grid-gallery": "^0.5.5",
"react-helmet": "^6.1.0", "react-helmet": "^6.1.0",
"swagger-ui-react": "^3.35.0",
"theme-ui": "^0.3.1", "theme-ui": "^0.3.1",
"three": "^0.68.0" "three": "^0.68.0"
}, },
"devDependencies": { "devDependencies": {
"eslint-config-airbnb": "^18.2.0", "eslint-config-airbnb": "^18.2.0",
"gatsby-plugin-eslint": "^2.0.8", "gatsby-plugin-eslint": "^2.0.8",
"prettier": "^2.0.5", "prettier": "^2.1.2",
"typescript": "^3.9.7" "typescript": "^3.9.7"
}, },
"keywords": [ "keywords": [

View File

@ -141,8 +141,9 @@ const LayoutFooter = () => (
rel="noreferrer" rel="noreferrer"
> >
Apache Software Foundation Apache Software Foundation
</a>resources </a>
<br/> resources
<br />
<a <a
href="https://www.apache.org/security/" href="https://www.apache.org/security/"
target="_blank" target="_blank"

View File

@ -34,6 +34,14 @@ interface Props {
const docLayout = css` const docLayout = css`
display: flex; display: flex;
flex-direction: row; flex-direction: row;
.doc-content {
width: 100%;
}
// Hacks to disable Swagger UI's "try it out" interactive mode
.try-out, .auth-wrapper, .information-container {
display: none;
}
`; `;
const Theme = ({ children }: Props) => { const Theme = ({ children }: Props) => {
@ -43,7 +51,9 @@ const Theme = ({ children }: Props) => {
<Layout> <Layout>
<SEO title="Documentation" /> <SEO title="Documentation" />
<div css={docLayout}> <div css={docLayout}>
<div>{children}</div> <div className="doc-content">
{children}
</div>
<AnchorNavigator /> <AnchorNavigator />
</div> </div>
<div> <div>

View File

@ -0,0 +1,34 @@
---
name: API
title: API
route: /docs/api
---
## API
import SwaggerUI from 'swagger-ui-react';
import openapi from 'src/resources/openapi.json';
import 'swagger-ui-react/swagger-ui.css';
import { Alert } from 'antd';
Superset's public **REST API** follows the
[OpenAPI specification](https://swagger.io/specification/), and is
documented here. The docs bellow are generated using
[Swagger React UI](https://www.npmjs.com/package/swagger-ui-react).
<Alert
message={
<div>
<strong>NOTE! </strong>
You can find an interactive version of this documentation
on your local Superset instance
at <strong>/swagger/v1</strong> (if enabled)
</div>
}
type="info"
/>
<br /><br /><hr />
<div className="swagger-container">
<SwaggerUI spec={openapi} />
</div>

File diff suppressed because it is too large Load Diff

View File

@ -26,4 +26,4 @@ curl -s -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fo
export FOSSA_API_KEY="${FOSSA_API_KEY:-f72e93645bdfeab94bd227c7bbdda4ef}" export FOSSA_API_KEY="${FOSSA_API_KEY:-f72e93645bdfeab94bd227c7bbdda4ef}"
fossa init fossa init
fossa analyze fossa analyze
fossa test fossa test | echo "Ok" # silenced fossa on 2020-10-04 it was acting up