Skip to content

Commit

Permalink
fixup! Add config to always show message examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tsauerwein committed Jun 24, 2024
1 parent 1548a10 commit 2bcfa1c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions docs/configuration/config-modification.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface ConfigInterface {
servers?: boolean;
operations?: boolean;
messages?: boolean;
messageExamplesAlways?: boolean;
messageExamples?: boolean;
schemas?: boolean;
errors?: boolean;
};
Expand Down Expand Up @@ -46,7 +46,10 @@ interface ConfigInterface {
- **show?: Partial<ShowConfig>**

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<SideBarConfig>**

Expand Down
2 changes: 1 addition & 1 deletion library/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface ShowConfig {
servers?: boolean;
operations?: boolean;
messages?: boolean;
messageExamplesAlways?: boolean;
messageExamples?: boolean;
schemas?: boolean;
errors?: boolean;
}
Expand Down
2 changes: 1 addition & 1 deletion library/src/config/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const defaultConfig: ConfigInterface = {
servers: true,
operations: true,
messages: true,
messageExamplesAlways: false,
messageExamples: false,
schemas: true,
errors: true,
},
Expand Down
2 changes: 1 addition & 1 deletion library/src/containers/Messages/Messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
/>
</li>
))}
Expand Down

0 comments on commit 2bcfa1c

Please sign in to comment.