Skip to content
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

[API View] Generate API Report in JSON #2019

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

HarshaNalluru
Copy link
Member

@HarshaNalluru HarshaNalluru commented Jan 23, 2025

Description

This pull request introduces the generate_api_report tool, which generates a JSON report of the API documentation for a specified Rust package. The tool processes the JSON output from cargo +nightly rustdoc ... to remove unnecessary attributes and outputs a cleaned-up version of the JSON.

Changes

  • Added generate_api_report tool in the eng/tools/ directory.
    • Main Functionality: Implemented in src/main.rs to handle the command-line interface and processing logic.
    • Data Models: Defined in src/models.rs to represent the minimal structure of the JSON data from rustdoc.
    • Dependencies: Updated Cargo.toml to include dependencies on serde and serde_json for JSON parsing and serialization.
  • Added README.md explaining the usage and functionality of the tool.

Usage

To run the tool, navigate to the root of the azure-sdk-for-rust repository and use the following command:

cargo run --manifest-path eng/tools/generate_api_report/Cargo.toml -- --package <package_name>

This generates <package_name>_compact.json in the doc directory, adjacent to the rustdoc JSON (<package_name>.json) output in the target/doc folder.

Example

For example, to generate the report for a package named docs, run:

cargo run --manifest-path eng/tools/generate_api_report/Cargo.toml -- --package docs

Related work

The output from this tool is fed as the input to the rust-api-parser at Azure/azure-sdk-tools#9592

@heaths heaths changed the title [DRAFT] [API View] Generate API Report in JSON [API View] Generate API Report in JSON Jan 27, 2025
@@ -14,6 +14,7 @@ members = [
"eng/test/mock_transport",
"sdk/storage",
"sdk/storage/azure_storage_blob",
"sdk/temp-project/docs",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want this part of the main workspace. We should put this under eng/tools which can have a separate workspace, if even needed there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now. This is for a "template" project. We could use what @hallipr wants as well, which I plan to basically be Key Vault Secrets anyway, which is what most other languages use for their "template" projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants