Skip to content

Commit

Permalink
feat(cli): support x-fern-ignore extension for AsyncAPI channels. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
eyw520 authored Jan 24, 2025
1 parent 8f97bbd commit 83641f3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,16 @@ export const FernAsyncAPIExtension = {
* paths:
* /path/to/my/endpoint:
*/
BASE_PATH: "x-fern-base-path"
BASE_PATH: "x-fern-base-path",

/**
* Used to tell fern to ignore channels.
*
* channels:
* /my-channel:
* x-fern-ignore: true
*/
IGNORE: "x-fern-ignore"
} as const;

export type FernAsyncAPIExtension = Values<typeof FernAsyncAPIExtension>;
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ export function parseAsyncAPI({
const exampleFactory = new ExampleWebsocketSessionFactory(schemas, context);

for (const [channelPath, channel] of Object.entries(document.channels ?? {})) {
const shouldIgnore = getExtension<boolean>(channel, FernAsyncAPIExtension.IGNORE);
if (shouldIgnore != null && shouldIgnore) {
context.logger.info(`Channel ${channelPath} is marked with x-fern-ignore. Skipping.`);
continue;
}
if (channel.bindings?.ws == null) {
context.logger.error(`Channel ${channelPath} does not have websocket bindings. Skipping.`);
continue;
Expand Down

0 comments on commit 83641f3

Please sign in to comment.