You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
boundary/website/components/openapi-page/partials/response-object/index.js

28 lines
867 B

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