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

Method render

src/core/components/headers.jsx:13–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11 }
12
13 render() {
14 let { headers, getComponent } = this.props
15
16 const Property = getComponent("Property")
17 const Markdown = getComponent("Markdown", true)
18
19 if ( !headers || !headers.size )
20 return null
21
22 return (
23 <div className="headers-wrapper">
24 <h4 className="headers__title">Headers:</h4>
25 <table className="headers">
26 <thead>
27 <tr className="header-row">
28 <th className="header-col">Name</th>
29 <th className="header-col">Description</th>
30 <th className="header-col">Type</th>
31 </tr>
32 </thead>
33 <tbody>
34 {
35 headers.entrySeq().map( ([ key, header ]) => {
36 if(!Im.Map.isMap(header)) {
37 return null
38 }
39
40 const description = header.get("description")
41 const type = header.getIn(["schema"]) ? header.getIn(["schema", "type"]) : header.getIn(["type"])
42 const schemaExample = header.getIn(["schema", "example"])
43
44 return (<tr key={ key }>
45 <td className="header-col">{ key }</td>
46 <td className="header-col">{
47 !description ? null : <Markdown source={ description } />
48 }</td>
49 <td className="header-col">{ type } { schemaExample ? <Property propKey={ "Example" } propVal={ schemaExample } propClass={ propClass } /> : null }</td>
50 </tr>)
51 }).toArray()
52 }
53 </tbody>
54 </table>
55 </div>
56 )
57 }
58}

Callers

nothing calls this directly

Calls 2

getComponentFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected