11import React , { Component } from "react"
22import PropTypes from "prop-types"
3- import { getExtensions } from "core/utils"
3+ import { getExtensions , sanitizeUrl } from "core/utils"
44
55const propClass = "property primitive"
66
@@ -33,12 +33,17 @@ export default class Primitive extends Component {
3333 let description = schema . get ( "description" )
3434 let extensions = getExtensions ( schema )
3535 let properties = schema
36- . filter ( ( _ , key ) => [ "enum" , "type" , "format" , "description" , "$$ref" ] . indexOf ( key ) === - 1 )
36+ . filter ( ( _ , key ) => [ "enum" , "type" , "format" , "description" , "$$ref" , "externalDocs" ] . indexOf ( key ) === - 1 )
3737 . filterNot ( ( _ , key ) => extensions . has ( key ) )
38+ let externalDocsUrl = schema . getIn ( [ "externalDocs" , "url" ] )
39+ let externalDocsDescription = schema . getIn ( [ "externalDocs" , "description" ] )
40+
3841 const Markdown = getComponent ( "Markdown" , true )
3942 const EnumModel = getComponent ( "EnumModel" )
4043 const Property = getComponent ( "Property" )
4144 const ModelCollapse = getComponent ( "ModelCollapse" )
45+ const Link = getComponent ( "Link" )
46+
4247 const titleEl = title &&
4348 < span className = "model-title" >
4449 < span className = "model-title__text" > { title } </ span >
@@ -60,6 +65,12 @@ export default class Primitive extends Component {
6065 ! description ? null :
6166 < Markdown source = { description } />
6267 }
68+ {
69+ externalDocsUrl &&
70+ < div className = "external-docs" >
71+ < Link target = "_blank" href = { sanitizeUrl ( externalDocsUrl ) } > { externalDocsDescription || externalDocsUrl } </ Link >
72+ </ div >
73+ }
6374 {
6475 xml && xml . size ? ( < span > < br /> < span className = { propClass } > xml:</ span >
6576 {
0 commit comments