This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to convert Response schema from jade to jsx
- Loading branch information
Showing
2 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const React = require('react'); | ||
const PropTypes = require('prop-types'); | ||
const marked = require('./lib/markdown/index'); | ||
const convertToParams = require('../../../legacy-stuff/swagger'); | ||
|
||
function ResponseSchema({ swagger }) { | ||
const i = 0; | ||
return ( | ||
<div className="hub-reference-response-definitions"> | ||
<h3> | ||
<div className="pull-right"> | ||
<select className="switcher-switch"> | ||
{swagger._endpoint.response.forEach((response, status) => ( | ||
<option value={status}>status</option> | ||
))} | ||
</select> | ||
Response | ||
{swagger._endpoint.response.forEach((response, status) => { | ||
<div switcher={status} style={i === 0 ? '' : 'display: none'}> | ||
{response.description && | ||
<p desc={response.description} />( | ||
response.schema && | ||
response.schema.type === 'object' && | ||
response.schema.properties, | ||
)( | ||
<table> | ||
{swaggerUtils.convertToParams([response], 'response').forEach(param => { | ||
<tr> | ||
<th>param.name</th> | ||
<td> | ||
param.type | ||
{param.description && marked(param.description)} | ||
</td> | ||
</tr>; | ||
})} | ||
</table>, | ||
)} | ||
</div>; | ||
})} | ||
</div> | ||
</h3> | ||
</div> | ||
); | ||
} | ||
|
||
ResponseSchema.PropTypes = { | ||
swagger: PropTypes.shape({}).isRequired, | ||
}; | ||
|
||
module.exports = ResponseSchema; |