Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add configuration to always show message examples #1016

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/configuration/config-modification.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface ConfigInterface {
servers?: boolean;
operations?: boolean;
messages?: boolean;
messageExamples?: boolean;
schemas?: boolean;
errors?: boolean;
};
Expand Down Expand Up @@ -45,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` 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<SideBarConfig>**

Expand Down
1 change: 1 addition & 0 deletions library/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface ShowConfig {
servers?: boolean;
operations?: boolean;
messages?: boolean;
messageExamples?: boolean;
schemas?: boolean;
errors?: boolean;
}
Expand Down
1 change: 1 addition & 0 deletions library/src/config/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const defaultConfig: ConfigInterface = {
servers: true,
operations: true,
messages: true,
messageExamples: false,
schemas: true,
errors: true,
},
Expand Down
1 change: 1 addition & 0 deletions library/src/containers/Messages/Messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const Messages: React.FunctionComponent = () => {
message={message}
index={idx + 1}
key={message.id()}
showExamples={config?.show?.messageExamples ?? false}
/>
</li>
))}
Expand Down
Loading