Skip to content

[APIView] Generate API Report in JSON #2019

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

Merged
merged 44 commits into from
Feb 28, 2025

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 toml, 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 cleaned-up JSON to a new file package_name/review/package_name.rust.json.

Example

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

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

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
@HarshaNalluru HarshaNalluru requested a review from heaths February 21, 2025 22:22
@heaths heaths changed the title [API View] Generate API Report in JSON [APIView] Generate API Report in JSON Feb 27, 2025
@heaths
Copy link
Member

heaths commented Feb 27, 2025

If this is working well enough, let's merge this and start a new PR. You don't want topic branches open so long when their target branches are changing as significantly as main...and it's about to get a whole lot worse.

Copy link
Member

@RickWinter RickWinter left a comment

Choose a reason for hiding this comment

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

Looks good, lets get this in.

@HarshaNalluru HarshaNalluru merged commit f736f5d into Azure:main Feb 28, 2025
17 checks passed
@HarshaNalluru HarshaNalluru deleted the harshan/apiview branch February 28, 2025 21:55
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.

3 participants