From e9c5bccedabc59f474c6cd49936517bd844f1233 Mon Sep 17 00:00:00 2001 From: Tobias Sauerwein Date: Mon, 24 Jun 2024 13:35:49 +0200 Subject: [PATCH] fixup! Add config to always show message examples --- docs/configuration/config-modification.md | 7 +++++-- library/src/config/config.ts | 2 +- library/src/config/default.ts | 2 +- library/src/containers/Messages/Messages.tsx | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/configuration/config-modification.md b/docs/configuration/config-modification.md index 8150b5af8..1324d4380 100644 --- a/docs/configuration/config-modification.md +++ b/docs/configuration/config-modification.md @@ -17,7 +17,7 @@ interface ConfigInterface { servers?: boolean; operations?: boolean; messages?: boolean; - messageExamplesAlways?: boolean; + messageExamples?: boolean; schemas?: boolean; errors?: boolean; }; @@ -46,7 +46,10 @@ interface ConfigInterface { - **show?: Partial** This field contains configuration responsible for rendering specific parts of the AsyncAPI component. - All except the `sidebar` and `messageExamplesAlways` fields are set to `true` by default. + All except the `sidebar` and `messageExamples` fields are set to `true` by default. + + The examples for messages shown within an operation are always displayed. To also show examples for the + standalone messages in the "Messages" section, set `messageExamples` to `true`. - **sidebar?: Partial** diff --git a/library/src/config/config.ts b/library/src/config/config.ts index ebffb20d5..39b55ce7f 100644 --- a/library/src/config/config.ts +++ b/library/src/config/config.ts @@ -19,7 +19,7 @@ export interface ShowConfig { servers?: boolean; operations?: boolean; messages?: boolean; - messageExamplesAlways?: boolean; + messageExamples?: boolean; schemas?: boolean; errors?: boolean; } diff --git a/library/src/config/default.ts b/library/src/config/default.ts index 598e4c6a3..12e6dffa6 100644 --- a/library/src/config/default.ts +++ b/library/src/config/default.ts @@ -16,7 +16,7 @@ export const defaultConfig: ConfigInterface = { servers: true, operations: true, messages: true, - messageExamplesAlways: false, + messageExamples: false, schemas: true, errors: true, }, diff --git a/library/src/containers/Messages/Messages.tsx b/library/src/containers/Messages/Messages.tsx index dc5a16e82..054fee160 100644 --- a/library/src/containers/Messages/Messages.tsx +++ b/library/src/containers/Messages/Messages.tsx @@ -36,7 +36,7 @@ export const Messages: React.FunctionComponent = () => { message={message} index={idx + 1} key={message.id()} - showExamples={config?.show?.messageExamplesAlways || false} + showExamples={config?.show?.messageExamples || false} /> ))}