Add schema object deprecation display
This commit is contained in:
@@ -192,7 +192,7 @@ class ArrayModel extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class Model extends Component {
|
export class Model extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
schema: PropTypes.object.isRequired,
|
schema: PropTypes.object.isRequired,
|
||||||
getComponent: PropTypes.func.isRequired,
|
getComponent: PropTypes.func.isRequired,
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import Markdown from "./markdown"
|
import Markdown from "./markdown"
|
||||||
import parameters from "./parameters"
|
import parameters from "./parameters"
|
||||||
import VersionStamp from "./version-stamp"
|
import VersionStamp from "./version-stamp"
|
||||||
|
import Model from "./model"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
Markdown,
|
Markdown,
|
||||||
parameters,
|
parameters,
|
||||||
VersionStamp
|
VersionStamp,
|
||||||
|
model: Model
|
||||||
}
|
}
|
||||||
|
|||||||
35
src/core/plugins/oas3/wrap-components/model.jsx
Normal file
35
src/core/plugins/oas3/wrap-components/model.jsx
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import React, { Component, PropTypes } from "react"
|
||||||
|
import { OAS3ComponentWrapFactory } from "../helpers"
|
||||||
|
import { Model } from "core/components/model"
|
||||||
|
|
||||||
|
|
||||||
|
class ModelComponent extends Component {
|
||||||
|
static propTypes = {
|
||||||
|
schema: PropTypes.object.isRequired,
|
||||||
|
name: PropTypes.string,
|
||||||
|
getComponent: PropTypes.func.isRequired,
|
||||||
|
specSelectors: PropTypes.object.isRequired,
|
||||||
|
expandDepth: PropTypes.number
|
||||||
|
}
|
||||||
|
|
||||||
|
render(){
|
||||||
|
let { schema } = this.props
|
||||||
|
let classes = ["model-box"]
|
||||||
|
let isDeprecated = schema.get("deprecated") === true
|
||||||
|
let message = null
|
||||||
|
|
||||||
|
if(isDeprecated) {
|
||||||
|
classes.push("deprecated")
|
||||||
|
message = <span className="model-deprecated-warning">Deprecated:</span>
|
||||||
|
}
|
||||||
|
return <div className={classes.join(" ")}>
|
||||||
|
{message}
|
||||||
|
<Model { ...this.props }
|
||||||
|
depth={ 1 }
|
||||||
|
expandDepth={ this.props.expandDepth || 0 }
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default OAS3ComponentWrapFactory(ModelComponent)
|
||||||
@@ -195,6 +195,11 @@ section.models
|
|||||||
position: relative;
|
position: relative;
|
||||||
top: 4px;
|
top: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.deprecated
|
||||||
|
{
|
||||||
|
opacity: .5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -205,6 +210,14 @@ section.models
|
|||||||
@include text_headline(#555);
|
@include text_headline(#555);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.model-deprecated-warning
|
||||||
|
{
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-right: 1em;
|
||||||
|
@include text_headline($_color-delete);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
span
|
span
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user