MCPcopy
hub / github.com/swagger-api/swagger-ui / render

Method render

src/core/components/responses.jsx:61–169  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59 }
60
61 render() {
62 let {
63 responses,
64 tryItOutResponse,
65 getComponent,
66 getConfigs,
67 specSelectors,
68 fn,
69 producesValue,
70 displayRequestDuration,
71 specPath,
72 path,
73 method,
74 oas3Selectors,
75 oas3Actions,
76 } = this.props
77 let defaultCode = defaultStatusCode( responses )
78
79 const ContentType = getComponent( "contentType" )
80 const LiveResponse = getComponent( "liveResponse" )
81 const Response = getComponent( "response" )
82
83 let produces = this.props.produces && this.props.produces.size ? this.props.produces : Responses.defaultProps.produces
84
85 const isSpecOAS3 = specSelectors.isOAS3()
86
87 const acceptControllingResponse = isSpecOAS3 ?
88 getAcceptControllingResponse(responses) : null
89
90 const nonExtensionResponses = responses.filter((_, key) => !isExtension(key))
91 const regionId = createHtmlReadyId(`${method}${path}_responses`)
92 const controlId = `${regionId}_select`
93
94 return (!nonExtensionResponses || !nonExtensionResponses.size) ? null : (
95 <div className="responses-wrapper">
96 <div className="opblock-section-header">
97 <h4>Responses</h4>
98 { specSelectors.isOAS3() ? null : <label htmlFor={controlId}>
99 <span>Response content type</span>
100 <ContentType value={producesValue}
101 ariaControls={regionId}
102 ariaLabel="Response content type"
103 className="execute-content-type"
104 contentTypes={produces}
105 controlId={controlId}
106 onChange={this.onChangeProducesWrapper} />
107 </label> }
108 </div>
109 <div className="responses-inner">
110 {
111 !tryItOutResponse ? null
112 : <div>
113 <LiveResponse response={ tryItOutResponse }
114 getComponent={ getComponent }
115 getConfigs={ getConfigs }
116 specSelectors={ specSelectors }
117 path={ this.props.path }
118 method={ this.props.method }

Callers

nothing calls this directly

Calls 6

defaultStatusCodeFunction · 0.90
isExtensionFunction · 0.90
getComponentFunction · 0.85
createHtmlReadyIdFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected