diff --git a/__tests__/cmds/openapi/__snapshots__/inspect.test.ts.snap b/__tests__/cmds/openapi/__snapshots__/inspect.test.ts.snap index c679f9e75..136924d36 100644 --- a/__tests__/cmds/openapi/__snapshots__/inspect.test.ts.snap +++ b/__tests__/cmds/openapi/__snapshots__/inspect.test.ts.snap @@ -197,7 +197,7 @@ OpenAPI Features │ webhooks │ │ Webhooks allow you to describe out of band requests that may be initiated by │ │ │ │ your users. │ │ │ │ │ -│ │ │ [object Object] │ +│ │ │ This feature is not available on OpenAPI v3.0. │ ├──────────────────────┼───────┼──────────────────────────────────────────────────────────────────────────────────┤ │ xml │ ✅ │ Any parameter and/or request body that accepts XML or responses that return XML │ │ │ │ payloads. │ @@ -307,7 +307,7 @@ OpenAPI Features │ webhooks │ │ Webhooks allow you to describe out of band requests that may be initiated by │ │ │ │ your users. │ │ │ │ │ -│ │ │ [object Object] │ +│ │ │ This feature is not available on OpenAPI v3.0. │ ├──────────────────────┼───────┼──────────────────────────────────────────────────────────────────────────────────┤ │ xml │ │ Any parameter and/or request body that accepts XML or responses that return XML │ │ │ │ payloads. │ @@ -417,7 +417,7 @@ OpenAPI Features │ webhooks │ │ Webhooks allow you to describe out of band requests that may be initiated by │ │ │ │ your users. │ │ │ │ │ -│ │ │ [object Object] │ +│ │ │ This feature is not available on OpenAPI v3.0. │ ├──────────────────────┼───────┼──────────────────────────────────────────────────────────────────────────────────┤ │ xml │ │ Any parameter and/or request body that accepts XML or responses that return XML │ │ │ │ payloads. │ diff --git a/src/cmds/openapi/inspect.ts b/src/cmds/openapi/inspect.ts index 977245d70..a0dff4411 100644 --- a/src/cmds/openapi/inspect.ts +++ b/src/cmds/openapi/inspect.ts @@ -57,7 +57,7 @@ export default class OpenAPIInspectCommand extends Command { .reduce((prev, next) => Object.assign(prev, next)); } - getFeatureDocsURL(feature: AnalyzedFeature) { + getFeatureDocsURL(feature: AnalyzedFeature): string { if (!feature.url) { return undefined; } @@ -66,12 +66,11 @@ export default class OpenAPIInspectCommand extends Command { // We don't need to do any Swagger or Postman determination here because this command // always converts their spec to OpenAPI 3.0. if (this.definitionVersion.startsWith('3.0')) { - if (feature.url?.['3.0']) { - return feature.url['3.0']; - } - } else { - return feature.url['3.1']; + return feature.url?.['3.0'] || 'This feature is not available on OpenAPI v3.0.'; + } else if (this.definitionVersion.startsWith('3.1')) { + return feature.url?.['3.1'] || 'This feature is not available on OpenAPI v3.1.'; } + return ''; } return feature.url;