Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Aug 12, 2025

Description

LCORE-433: ability to generate OpenAPI documentation

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement

Related Tickets & Documents

  • Related Issue #LCORE-433

Summary by CodeRabbit

  • Documentation

    • Added instructions for a new Make target to generate OpenAPI documentation.
    • Clarified how to produce Markdown output from the existing OpenAPI spec.
  • Chores

    • Introduced a Make target to build Markdown OpenAPI docs from the spec.
    • Added a development dependency to support OpenAPI-to-Markdown generation.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 12, 2025

Walkthrough

Introduces a Makefile target to generate Markdown documentation from docs/openapi.json using openapi-to-markdown, updates README with the new target description, and adds the openapi-to-md dev dependency in pyproject.toml.

Changes

Cohort / File(s) Summary of changes
Build tooling (Makefile)
Makefile
Added target openapi-doc that depends on docs/openapi.json and runs openapi-to-markdown to produce docs/output.md.
Documentation
README.md
Documented the new Make target openapi-doc in the Make targets section.
Dev dependencies
pyproject.toml
Added dev dependency openapi-to-md>=0.1.0b2 under [dependency-groups].dev.

Sequence Diagram(s)

sequenceDiagram
  actor Developer
  participant Make as Make (openapi-doc)
  participant O2M as openapi-to-markdown
  participant Repo as docs/

  Developer->>Make: make openapi-doc
  Make->>O2M: Generate Markdown from docs/openapi.json
  O2M-->>Repo: Write docs/output.md
  Make-->>Developer: Target completed
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

A rabbit taps the Makefile key,
“openapi-doc,” it squeaks with glee.
From JSON fields to Markdown bright,
Docs hop out, tidy, light.
With deps in tow, the path is laid—
README nods: “All set,” it bade. 🐇📜

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🔭 Outside diff range comments (1)
README.md (1)

300-302: Prevent broken link: ensure the generated filename matches or commit the doc.

The link points to docs/openapi.md, but the Makefile currently outputs docs/output.md. Either:

  • Adjust Makefile to generate docs/openapi.md (recommended; see Makefile comment), or
  • Update this link to the actual generated file and ensure it’s committed or published via Pages.

Also ensure the file is generated and committed or published so this link works on GitHub.

Apply this diff if you prefer to update the link instead (only if you keep the current Makefile output path):

-* [OpenAPI documentation](docs/openapi.md)
+* [OpenAPI documentation](docs/output.md)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0976655 and 79051c7.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • Makefile (1 hunks)
  • README.md (1 hunks)
  • pyproject.toml (1 hunks)
🔇 Additional comments (2)
pyproject.toml (1)

79-79: Confirm CLI and pre-release usage

  • The package installs the openapi-to-markdown CLI (with api2md as an alias), which matches your Makefile invocation on line 41.
  • As of today there is no final release on PyPI—only pre-releases (0.1.0b1 and 0.1.0b2).
    • Using openapi-to-md>=0.1.0b2 will pull in this pre-release now and automatically upgrade to any future stable release.
    • If you need strict reproducibility, pin to ==0.1.0b2 until a final version is published.

No code changes required unless you prefer exact version pinning.

README.md (1)

264-265: LGTM: Target listed and described consistently.

Comment on lines +40 to +42
openapi-doc: docs/openapi.json ## Generate OpenAPI documentation
openapi-to-markdown --input_file docs/openapi.json --output_file docs/output.md

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Align output filename with README link (docs/openapi.md vs docs/output.md).

README links to docs/openapi.md, but the Makefile generates docs/output.md. This will produce a broken link.

Apply this diff to generate the expected file:

-openapi-doc:  docs/openapi.json  ## Generate OpenAPI documentation
-	openapi-to-markdown --input_file docs/openapi.json --output_file docs/output.md
+openapi-doc:  docs/openapi.json  ## Generate OpenAPI documentation
+	openapi-to-markdown --input_file docs/openapi.json --output_file docs/openapi.md
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
openapi-doc: docs/openapi.json ## Generate OpenAPI documentation
openapi-to-markdown --input_file docs/openapi.json --output_file docs/output.md
openapi-doc: docs/openapi.json ## Generate OpenAPI documentation
openapi-to-markdown --input_file docs/openapi.json --output_file docs/openapi.md
🤖 Prompt for AI Agents
In Makefile around lines 40 to 42, the Make target writes the OpenAPI Markdown
to docs/output.md while README expects docs/openapi.md; change the output
filename in the openapi-doc recipe to docs/openapi.md so the generated file
matches the README link and avoids a broken link.

🛠️ Refactor suggestion

Make target resilient and run within the uv environment.

  • Ensure docs/openapi.json is built automatically by depending on the schema target.
  • Execute the CLI via uv to use the project’s virtual environment consistently (as done elsewhere in this Makefile).

[Suggest combined change below; verify the CLI name/flags in the next comment.]

Apply this diff:

-openapi-doc:  docs/openapi.json  ## Generate OpenAPI documentation
-	openapi-to-markdown --input_file docs/openapi.json --output_file docs/openapi.md
+openapi-doc: schema docs/openapi.json ## Generate OpenAPI documentation
+	uv run openapi-to-markdown --input_file docs/openapi.json --output_file docs/openapi.md

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In Makefile around lines 40-42, the openapi-doc target should depend on the
target that builds docs/openapi.json and should invoke the CLI through the
project's virtual environment runner; modify the target so docs/openapi.json is
declared as a prerequisite (e.g. openapi-doc: docs/openapi.json) and replace the
direct CLI invocation with the uv-backed invocation used elsewhere (e.g. run the
openapi-to-markdown command via uv so it uses the venv), keeping the same
input/output arguments and flags.

💡 Verification agent

🧩 Analysis chain

Verify CLI name and flags match the dependency (openapi-to-md).

The dependency added is openapi-to-md, but the command uses openapi-to-markdown. The CLI entry point and flag names may differ (e.g., openapi-to-md vs openapi-to-markdown; --input/--output vs --input_file/--output_file). Please confirm the correct binary and flags.

Run this script to identify usage and reconcile names, and to flag a missing generated file:

And verify the correct CLI/flags on the web:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Searching for CLI invocations..."
rg -n "openapi-to-(markdown|md)" -A2 -B2

echo
echo "Checking README link target existence..."
if [ -f docs/openapi.md ]; then
  echo "OK: docs/openapi.md exists"
else
  echo "WARN: docs/openapi.md is missing; Makefile should generate it or the file should be committed"
fi

Length of output: 1441


🌐 Web query:

What is the correct CLI name and usage for the PyPI package "openapi-to-md"? Is the command "openapi-to-md" or "openapi-to-markdown", and what are the expected flag names for input/output?

💡 Result:

The PyPI package you’re looking for is not “openapi-to-md”; that name refers to an npm package whose CLI is openapi-to-md with Node-style flags.[1] For Python, there are similarly named packages, but their CLIs differ:

  • open-api-schemas-to-markdown (PyPI) provides the CLI oa-to-md, not openapi-to-md or openapi-to-markdown.[4]
    Usage: oa-to-md INPUT_FILE OUTPUT_FILE [locale]. Flags are positional only; there are no -i/-o flags. Example: oa-to-md open_api.yml documentation.md.[4]

  • openapi-markdown (PyPI) provides the CLI openapi2markdown.[7]
    Usage: openapi2markdown [OPTIONS] INPUT_FILE [OUTPUT_FILE]. Optional flags include:

    • -t, --templates-dir DIRECTORY
    • -f, --filter-paths TEXT
      Output file is optional; if omitted, it defaults to INPUT_FILE with a .md extension.[7]

Therefore:

  • The command “openapi-to-md” is the npm tool’s CLI, not a Python CLI.[1]
  • For Python CLIs:
    • Use oa-to-md (positional input/output, no -i/-o flags).[4]
    • Or use openapi2markdown with the options above (no -i/-o; output is positional or inferred).[7]

Citations:


Use the correct OpenAPI-to-Markdown CLI and flags

The Makefile currently invokes openapi-to-markdown --input_file docs/openapi.json --output_file docs/output.md, but:

  • Your pyproject.toml depends on openapi-to-md, which is an npm package (not a Python tool) and provides a different CLI.
  • No Python tool named openapi-to-markdown is installed, so the Makefile target will fail.

You have two Python-native options—pick one and align both dependency and Makefile:

• openapi-markdown (PyPI)
– Dependency: replace "openapi-to-md>=0.1.0b2" with e.g. "openapi-markdown>=1.0.0"
– CLI: openapi2markdown
– Usage (positional):
openapi2markdown docs/openapi.json docs/output.md

• open-api-schemas-to-markdown (PyPI)
– Dependency: replace "openapi-to-md>=0.1.0b2" with e.g. "open-api-schemas-to-markdown>=0.2.0"
– CLI: oa-to-md
– Usage (positional):
oa-to-md docs/openapi.json docs/output.md

Locations to update:

  • pyproject.toml: swap out openapi-to-md for your chosen Python package
  • Makefile (lines 40–42): invoke the matching CLI and positional arguments
🤖 Prompt for AI Agents
In Makefile around lines 40–42 and pyproject.toml, the Makefile calls a
non‑existent Python CLI `openapi-to-markdown` while pyproject currently depends
on `openapi-to-md` (an npm package); replace the dependency with the Python
package `openapi-markdown>=1.0.0` in pyproject.toml and update the Makefile
target to call the matching CLI `openapi2markdown` with positional args (e.g.
`openapi2markdown docs/openapi.json docs/output.md`), ensuring the dependency
name and the Makefile command match.

@tisnik tisnik merged commit ecd1609 into lightspeed-core:main Aug 12, 2025
18 checks passed
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.

1 participant