Merge branch 'master' into next
This commit is contained in:
@@ -3,6 +3,16 @@ import ImmutablePureComponent from "react-immutable-pure-component"
|
||||
import ImPropTypes from "react-immutable-proptypes"
|
||||
import PropTypes from "prop-types"
|
||||
|
||||
const decodeRefName = uri => {
|
||||
const unescaped = uri.replace(/~1/g, "/").replace(/~0/g, "~")
|
||||
|
||||
try {
|
||||
return decodeURIComponent(unescaped)
|
||||
} catch {
|
||||
return unescaped
|
||||
}
|
||||
}
|
||||
|
||||
export default class Model extends ImmutablePureComponent {
|
||||
static propTypes = {
|
||||
schema: ImPropTypes.map.isRequired,
|
||||
@@ -22,10 +32,10 @@ export default class Model extends ImmutablePureComponent {
|
||||
|
||||
getModelName =( ref )=> {
|
||||
if ( ref.indexOf("#/definitions/") !== -1 ) {
|
||||
return ref.replace(/^.*#\/definitions\//, "")
|
||||
return decodeRefName(ref.replace(/^.*#\/definitions\//, ""))
|
||||
}
|
||||
if ( ref.indexOf("#/components/schemas/") !== -1 ) {
|
||||
return ref.replace(/^.*#\/components\/schemas\//, "")
|
||||
return decodeRefName(ref.replace(/^.*#\/components\/schemas\//, ""))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user