diff --git a/docs/configuration/config-modification.md b/docs/configuration/config-modification.md index 63326030..b1c6ec19 100644 --- a/docs/configuration/config-modification.md +++ b/docs/configuration/config-modification.md @@ -17,6 +17,7 @@ interface ConfigInterface { servers?: boolean; operations?: boolean; messages?: boolean; + messageExamples?: boolean; schemas?: boolean; errors?: boolean; }; @@ -45,7 +46,10 @@ interface ConfigInterface { - **show?: Partial** This field contains configuration responsible for rendering specific parts of the AsyncAPI component. - All except the `sidebar` fields are set to `true` by default. + The `sidebar` and `messageExamples` fields are set to `false` by default. The default for all other fields is `true`. + + 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 0218996e..39b55ce7 100644 --- a/library/src/config/config.ts +++ b/library/src/config/config.ts @@ -19,6 +19,7 @@ export interface ShowConfig { servers?: boolean; operations?: boolean; messages?: boolean; + messageExamples?: boolean; schemas?: boolean; errors?: boolean; } diff --git a/library/src/config/default.ts b/library/src/config/default.ts index 725fff4c..12e6dffa 100644 --- a/library/src/config/default.ts +++ b/library/src/config/default.ts @@ -16,6 +16,7 @@ export const defaultConfig: ConfigInterface = { servers: true, operations: true, messages: true, + messageExamples: false, schemas: true, errors: true, }, diff --git a/library/src/containers/Messages/Messages.tsx b/library/src/containers/Messages/Messages.tsx index 87683583..52300c2b 100644 --- a/library/src/containers/Messages/Messages.tsx +++ b/library/src/containers/Messages/Messages.tsx @@ -36,6 +36,7 @@ export const Messages: React.FunctionComponent = () => { message={message} index={idx + 1} key={message.id()} + showExamples={config?.show?.messageExamples ?? false} /> ))}