Skip to content

[azpysdk] Add --md flag to azpysdk apistub to generate api.md #45758

@swathipil

Description

@swathipil

Description

Part of Azure/azure-sdk-tools#12851.

Add an --md flag to azpysdk apistub. When passed, the command will additionally run Export-APIViewMarkdown.ps1 on the generated JSON token file to produce api.md.

azpysdk apistub . --md

Potential Implementation

Changes to eng/tools/azure-sdk-tools/azpysdk/apistub.py:

  1. Add --md flag (action="store_true", default False) in the register() method.
  2. After successfully writing the JSON token file, if --md is set, invoke via subprocess:
    subprocess.run(
        ["pwsh", "eng/common/scripts/Export-APIViewMarkdown.ps1",
         "-TokenJsonPath", <json_file>, "-OutputPath", <out_dir>],
        check=True
    )
    If pwsh is not available, fail with a clear error.
  3. Place api.md in the same output directory as the token file (under <dest-dir>/<package-name>/ if --dest-dir is provided).

Deliverables

  • azpysdk apistub supports a new --md to create an api.md file, which is output to the same directory as the APIView token file.
  • If pwsh is not available, the utility fails gracefully with a clear error message.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions