Add OAS3 indicator
This commit is contained in:
@@ -87,12 +87,13 @@ export default class Info extends React.Component {
|
|||||||
const { url:externalDocsUrl, description:externalDocsDescription } = (externalDocs || fromJS({})).toJS()
|
const { url:externalDocsUrl, description:externalDocsDescription } = (externalDocs || fromJS({})).toJS()
|
||||||
|
|
||||||
const Markdown = getComponent("Markdown")
|
const Markdown = getComponent("Markdown")
|
||||||
|
const VersionStamp = getComponent("VersionStamp")
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="info">
|
<div className="info">
|
||||||
<hgroup className="main">
|
<hgroup className="main">
|
||||||
<h2 className="title" >{ title }
|
<h2 className="title" >{ title }
|
||||||
{ version && <small><pre className="version"> { version } </pre></small> }
|
{ version && <VersionStamp version={version}></VersionStamp> }
|
||||||
</h2>
|
</h2>
|
||||||
{ host || basePath ? <Path host={ host } basePath={ basePath } /> : null }
|
{ host || basePath ? <Path host={ host } basePath={ basePath } /> : null }
|
||||||
{ url && <a target="_blank" href={ url }><span className="url"> { url } </span></a> }
|
{ url && <a target="_blank" href={ url }><span className="url"> { url } </span></a> }
|
||||||
|
|||||||
5
src/core/components/version-stamp.jsx
Normal file
5
src/core/components/version-stamp.jsx
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import React from "react"
|
||||||
|
|
||||||
|
export default ({ version }) => {
|
||||||
|
return <small><pre className="version"> { version } </pre></small>
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
|
|
||||||
const SUPPORTED_OPENAPI_VERSIONS = ["3.0.0-rc0"]
|
const SUPPORTED_OPENAPI_VERSIONS = ["3.0.0-rc0", "3.0.0-RC1"]
|
||||||
|
|
||||||
export function isOAS3(jsSpec) {
|
export function isOAS3(jsSpec) {
|
||||||
return !!jsSpec.openapi && SUPPORTED_OPENAPI_VERSIONS.indexOf(jsSpec.openapi) > -1
|
return !!jsSpec.openapi && SUPPORTED_OPENAPI_VERSIONS.indexOf(jsSpec.openapi) > -1
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import Markdown from "./markdown"
|
import Markdown from "./markdown"
|
||||||
import parameters from "./parameters"
|
import parameters from "./parameters"
|
||||||
|
import VersionStamp from "./version-stamp"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
Markdown,
|
Markdown,
|
||||||
parameters
|
parameters,
|
||||||
|
VersionStamp
|
||||||
}
|
}
|
||||||
|
|||||||
13
src/core/plugins/oas3/wrap-components/version-stamp.jsx
Normal file
13
src/core/plugins/oas3/wrap-components/version-stamp.jsx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import React from "react"
|
||||||
|
import { OAS3ComponentWrapFactory } from "../helpers"
|
||||||
|
|
||||||
|
export default OAS3ComponentWrapFactory((props) => {
|
||||||
|
const { Ori } = props
|
||||||
|
|
||||||
|
return <span>
|
||||||
|
<Ori {...props} />
|
||||||
|
<small style={{ backgroundColor: "#89bf04" }}>
|
||||||
|
<pre className="version">OAS3</pre>
|
||||||
|
</small>
|
||||||
|
</span>
|
||||||
|
})
|
||||||
@@ -45,6 +45,7 @@ import ModelExample from "core/components/model-example"
|
|||||||
import Model from "core/components/model"
|
import Model from "core/components/model"
|
||||||
import Models from "core/components/models"
|
import Models from "core/components/models"
|
||||||
import TryItOutButton from "core/components/try-it-out-button"
|
import TryItOutButton from "core/components/try-it-out-button"
|
||||||
|
import VersionStamp from "core/components/version-stamp"
|
||||||
|
|
||||||
import Markdown from "core/components/providers/markdown"
|
import Markdown from "core/components/providers/markdown"
|
||||||
|
|
||||||
@@ -92,7 +93,8 @@ export default function() {
|
|||||||
models: Models,
|
models: Models,
|
||||||
TryItOutButton,
|
TryItOutButton,
|
||||||
Markdown,
|
Markdown,
|
||||||
BaseLayout
|
BaseLayout,
|
||||||
|
VersionStamp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user