/** * @prettier */ import React from "react" import PropTypes from "prop-types" import { sanitizeUrl } from "core/utils" const Info = ({ getComponent, specSelectors }) => { const version = specSelectors.version() const url = specSelectors.url() const basePath = specSelectors.basePath() const host = specSelectors.host() const summary = specSelectors.selectInfoSummaryField() const description = specSelectors.selectInfoDescriptionField() const title = specSelectors.selectInfoTitleField() const termsOfServiceUrl = specSelectors.selectInfoTermsOfServiceUrl() const externalDocsUrl = specSelectors.selectExternalDocsUrl() const externalDocsDesc = specSelectors.selectExternalDocsDescriptionField() const contact = specSelectors.contact() const license = specSelectors.license() const Markdown = getComponent("Markdown", true) const Link = getComponent("Link") const VersionStamp = getComponent("VersionStamp") const OpenAPIVersion = getComponent("OpenAPIVersion") const InfoUrl = getComponent("InfoUrl") const InfoBasePath = getComponent("InfoBasePath") const License = getComponent("License", true) const Contact = getComponent("Contact", true) const JsonSchemaDialect = getComponent("JsonSchemaDialect", true) return (

{title} {version && }

{(host || basePath) && } {url && }
{summary &&

{summary}

}
{termsOfServiceUrl && (
Terms of service
)} {contact.size > 0 && } {license.size > 0 && } {externalDocsUrl && ( {externalDocsDesc || externalDocsUrl} )}
) } Info.propTypes = { getComponent: PropTypes.func.isRequired, specSelectors: PropTypes.shape({ version: PropTypes.func.isRequired, url: PropTypes.func.isRequired, basePath: PropTypes.func.isRequired, host: PropTypes.func.isRequired, selectInfoSummaryField: PropTypes.func.isRequired, selectInfoDescriptionField: PropTypes.func.isRequired, selectInfoTitleField: PropTypes.func.isRequired, selectInfoTermsOfServiceUrl: PropTypes.func.isRequired, selectExternalDocsUrl: PropTypes.func.isRequired, selectExternalDocsDescriptionField: PropTypes.func.isRequired, contact: PropTypes.func.isRequired, license: PropTypes.func.isRequired, }).isRequired, } export default Info