Skip to content

Commit d7812da

Browse files
iscai-msftCopilot
andcommitted
feat: enable generate-api-md by default
Default generate-api-md to true. Silently skip if apiview-stub-generator is not installed (only warn if it is installed but fails). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ea96ce0 commit d7812da

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

packages/http-client-python/emitter/src/emitter.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ function addDefaultOptions(sdkContext: PythonSdkContext) {
3030
const defaultOptions = {
3131
"package-version": "1.0.0b1",
3232
"generate-packaging-files": true,
33+
"generate-api-md": true,
3334
"validate-versioning": true,
3435
"clear-output-folder": false,
3536
};
@@ -355,6 +356,14 @@ async function generateApiMd(
355356
root: string,
356357
packageName: string,
357358
): Promise<void> {
359+
// Check if apiview-stub-generator is installed before attempting
360+
try {
361+
execFileSync(venvPath, ["-c", "import apistub"], { stdio: "pipe" });
362+
} catch {
363+
// apiview-stub-generator not installed — silently skip
364+
return;
365+
}
366+
358367
const apiviewOutDir = path.join(os.tmpdir(), `tsp-apiview-${randomUUID()}`);
359368
try {
360369
fs.mkdirSync(apiviewOutDir, { recursive: true });

packages/http-client-python/emitter/src/lib.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export const PythonEmitterOptionsSchema: JSONSchemaType<PythonEmitterOptions> =
122122
type: "boolean",
123123
nullable: true,
124124
description:
125-
"Whether to generate an api.md file containing the public API surface. Defaults to `false`. Requires `apiview-stub-generator` to be installed.",
125+
"Whether to generate an api.md file containing the public API surface. Defaults to `true`. Requires `apiview-stub-generator` to be installed.",
126126
},
127127
},
128128
required: [],

0 commit comments

Comments
 (0)