mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-19 17:15:24 +00:00
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:
@@ -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]) => {
|
||||
|
||||
Reference in New Issue
Block a user