Skip to content

Commit 282829f

Browse files
authored
feat: add configuration to always show message examples (#1016)
1 parent 482464d commit 282829f

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

docs/configuration/config-modification.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ interface ConfigInterface {
1717
servers?: boolean;
1818
operations?: boolean;
1919
messages?: boolean;
20+
messageExamples?: boolean;
2021
schemas?: boolean;
2122
errors?: boolean;
2223
};
@@ -45,7 +46,10 @@ interface ConfigInterface {
4546
- **show?: Partial<ShowConfig>**
4647

4748
This field contains configuration responsible for rendering specific parts of the AsyncAPI component.
48-
All except the `sidebar` fields are set to `true` by default.
49+
The `sidebar` and `messageExamples` fields are set to `false` by default. The default for all other fields is `true`.
50+
51+
The examples for messages shown within an operation are always displayed. To also show examples for the
52+
standalone messages in the "Messages" section, set `messageExamples` to `true`.
4953

5054
- **sidebar?: Partial<SideBarConfig>**
5155

library/src/config/config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export interface ShowConfig {
1919
servers?: boolean;
2020
operations?: boolean;
2121
messages?: boolean;
22+
messageExamples?: boolean;
2223
schemas?: boolean;
2324
errors?: boolean;
2425
}

library/src/config/default.ts

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const defaultConfig: ConfigInterface = {
1616
servers: true,
1717
operations: true,
1818
messages: true,
19+
messageExamples: false,
1920
schemas: true,
2021
errors: true,
2122
},

library/src/containers/Messages/Messages.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const Messages: React.FunctionComponent = () => {
3636
message={message}
3737
index={idx + 1}
3838
key={message.id()}
39+
showExamples={config?.show?.messageExamples ?? false}
3940
/>
4041
</li>
4142
))}

0 commit comments

Comments
 (0)