-
Notifications
You must be signed in to change notification settings - Fork 202
feat: Add AsyncAPI support in the stats command #2553
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@redocly/openapi-core": major | ||
| --- | ||
|
|
||
| Added AsyncAPI support to the stats command. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,58 @@ export const Stats = (statsAccumulator: StatsAccumulator) => { | |
| }, | ||
| }, | ||
| }, | ||
| // AsyncAPI 2.x support | ||
| ChannelMap: { | ||
| Channel: { | ||
| leave() { | ||
| statsAccumulator.pathItems.total++; | ||
| }, | ||
| Operation: { | ||
| leave(operation: any) { | ||
| statsAccumulator.operations.total++; | ||
| if (operation.tags) { | ||
| for (const tag of operation.tags) { | ||
| statsAccumulator.tags.items!.add(tag); | ||
| } | ||
| } | ||
| }, | ||
| }, | ||
| Parameter: { | ||
| leave(parameter: any) { | ||
| if (parameter.name) { | ||
| statsAccumulator.parameters.items!.add(parameter.name); | ||
| } | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| // AsyncAPI 3.x support | ||
|
||
| NamedChannels: { | ||
| Channel: { | ||
| leave() { | ||
| statsAccumulator.pathItems.total++; | ||
| }, | ||
| Parameter: { | ||
| leave(parameter: any) { | ||
| if (parameter.name) { | ||
| statsAccumulator.parameters.items!.add(parameter.name); | ||
| } | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| NamedOperations: { | ||
| Operation: { | ||
| leave(operation: any) { | ||
| statsAccumulator.operations.total++; | ||
| if (operation.tags) { | ||
| for (const tag of operation.tags) { | ||
| statsAccumulator.tags.items!.add(tag); | ||
| } | ||
| } | ||
| }, | ||
| }, | ||
| }, | ||
| NamedSchemas: { | ||
| Schema: { | ||
| leave() { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| ../../../../resources/pets.yaml | ||
| ../../../../resources/pets.yaml | ||
DmitryAnansky marked this conversation as resolved.
Show resolved
Hide resolved
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PathItemin OAS is not quite the same asChannelin AsyncAPI, although they serve analogous purposes in their respective specifications.Have you considered a different accumulator options? Like maybe have a separate collector and tune the output with a different label, like Channels?