Skip to content

Commit

Permalink
feat: disable batch/stream toggle (#4108)
Browse files Browse the repository at this point in the history
fix: disable stream toggle flag
  • Loading branch information
abvthecity authored Jul 24, 2024
1 parent ed71266 commit bccbdaf
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/cli/configuration/fern/definition/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -821,3 +821,9 @@ types:
docs: |
List of relative paths to folders or files that end in .{ts,tsx,js,jsx},
and makes them available for use in MDX files.
disable-stream-toggle:
type: optional<boolean>
docs: |
If `disable-stream-toggle` is set to true, the stream toggle will be disabled.
This behavior is unstable and may change in the future.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ export interface ExperimentalConfig {
* and makes them available for use in MDX files.
*/
mdxComponents?: string[];
/**
* If `disable-stream-toggle` is set to true, the stream toggle will be disabled.
*
* This behavior is unstable and may change in the future.
*/
disableStreamToggle?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ export const ExperimentalConfig: core.serialization.ObjectSchema<
"mdx-components",
core.serialization.list(core.serialization.string()).optional()
),
disableStreamToggle: core.serialization.property("disable-stream-toggle", core.serialization.boolean().optional()),
});

export declare namespace ExperimentalConfig {
interface Raw {
"mdx-components"?: string[] | null;
"disable-stream-toggle"?: boolean | null;
}
}
6 changes: 6 additions & 0 deletions packages/cli/docs-resolver/src/ApiReferenceNodeConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class ApiReferenceNodeConverter {
#children: FernNavigation.ApiPackageChild[] = [];
#overviewPageId: FernNavigation.PageId | undefined;
#slug: FernNavigation.SlugGenerator;
private disableEndpointPairs;
constructor(
private apiSection: docsYml.DocsNavigationItem.ApiSection,
api: APIV1Read.ApiDefinition,
Expand All @@ -32,6 +33,7 @@ export class ApiReferenceNodeConverter {
private taskContext: TaskContext,
private markdownFilesToFullSlugs: Map<AbsoluteFilePath, string>
) {
this.disableEndpointPairs = docsWorkspace.config.experimental?.disableStreamToggle ?? false;
this.apiDefinitionId = FernNavigation.ApiDefinitionId(api.id);
this.#holder = ApiDefinitionHolder.create(api, taskContext);

Expand Down Expand Up @@ -625,6 +627,10 @@ export class ApiReferenceNodeConverter {
}

private mergeEndpointPairs(children: FernNavigation.ApiPackageChild[]): FernNavigation.ApiPackageChild[] {
if (this.disableEndpointPairs) {
return children;
}

const toRet: FernNavigation.ApiPackageChild[] = [];

const methodAndPathToEndpointNode = new Map<string, FernNavigation.EndpointNode>();
Expand Down

0 comments on commit bccbdaf

Please sign in to comment.