Files
threshold/website/components/openapi-page/partials/response-object/index.js
T
Zachary ShiltonandKyle MacDonald 1cc8737540 Add generated API docs to website (#537)
* Add dependencies for openapi-page component

* Add openapi-page component

* Use openapi-page component for /api-docs page

* add /api link to nav  (#570)

* website: remove superflous netlify config file

* website: misc clean up website/readme
- remove netlify badge
- run through prettier markdown fmt

* website: add /api docs to nav
- adds /api-docs => /api rewrite
- updates open-api component base api path to be /api
- adds .html rewrite for good measure

* Fix currentPath highlight issue in subnav

* Clean up inline styles in operation-object

* Remove React imports

* Remove api-docs rewrite

Co-authored-by: Kyle MacDonald <kylemac@users.noreply.github.com>
2020-10-09 13:26:32 -07:00

28 lines
867 B
JavaScript

import PropertyObject from '../property-object'
function ResponseObject({ data }) {
// `schema` can be empty, which means the response does not return content
// We currently only support object responses (ie those that have schema.properties) in the UI
// Ref: https://swagger.io/specification/v2/#response-object
if (!data || !data.schema || !data.schema.properties) {
return <div>No content.</div>
}
return (
<div>
{Object.keys(data.schema.properties).map((propertyKey, idx) => {
return (
<PropertyObject
key={propertyKey}
name={propertyKey}
data={data.schema.properties[propertyKey]}
isFirstItem={idx === 0}
isLastItem={idx === Object.keys(data.schema.properties).length - 1}
/>
)
})}
</div>
)
}
export default ResponseObject