Don't try to render responses if none are defined by the user (#255)

* don't try to parse responses if none are defined

* don't try to render responses if none exists

* move logic back into component
This commit is contained in:
Scott Cazan
2024-03-13 14:37:21 +01:00
committed by GitHub
parent 9f83b0e783
commit fc11ffdc8b
@@ -13,6 +13,11 @@ export function OpenAPIResponseExample(props: {
}) {
const { data, context } = props;
// if there are no responses defined for the operation
if (!data.operation.responses) {
return null;
}
const responses = Object.entries(data.operation.responses);
// Sort response to get 200, and 2xx first
responses.sort(([a], [b]) => {