Skip to content

feat: add ParseResult JSON schema output#14

Closed
abhijeetnardele24-hash wants to merge 1 commit intovericontext:mainfrom
abhijeetnardele24-hash:add-output-schema
Closed

feat: add ParseResult JSON schema output#14
abhijeetnardele24-hash wants to merge 1 commit intovericontext:mainfrom
abhijeetnardele24-hash:add-output-schema

Conversation

@abhijeetnardele24-hash
Copy link
Copy Markdown
Contributor

Adds parsemux schema --output-schema to print the ParseResult Pydantic JSON Schema. Also adds a CLI test for the new output.

Closes #12

Signed-off-by: abhijeet nardele <234410808+abhijeetnardele24-hash@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 2, 2026 17:04
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 2, 2026

@abhijeetnardele24-hash is attempting to deploy a commit to the Kiyeon Jeon's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a CLI surface for exporting the Pydantic JSON Schema for ParseResult, enabling external tools to validate parsemux JSON output (per Issue #12).

Changes:

  • Extend parsemux schema with --output-schema to print ParseResult.model_json_schema() as JSON.
  • Add CLI tests covering schema output (and version output).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/parsemux/cli/main.py Adds --output-schema handling to print the ParseResult JSON Schema.
tests/test_cli.py Adds Typer CLI tests for schema --output-schema (and version output assertions).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +18 to +24
def test_version_flag_outputs_version() -> None:
result = runner.invoke(app, ["--version"])

assert result.exit_code == 0
assert result.stdout.strip() == f"parsemux {__version__}"


Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

--version isn’t implemented in the Typer app (no callback/option defines it in src/parsemux/cli/main.py), so this test will fail with an “No such option: --version” error. Either add a global --version option on the app callback (printing parsemux {__version__}) or remove this test if only the version subcommand is supported.

Suggested change
def test_version_flag_outputs_version() -> None:
result = runner.invoke(app, ["--version"])
assert result.exit_code == 0
assert result.stdout.strip() == f"parsemux {__version__}"

Copilot uses AI. Check for mistakes.
Comment on lines 217 to +226
def schema(
command: Optional[str] = typer.Argument(None, help="Command name (omit for all)"),
output_schema: bool = typer.Option(False, "--output-schema", help="Print the ParseResult JSON Schema"),
) -> None:
"""Show machine-readable schema for CLI commands (for AI agents)."""
if output_schema:
from parsemux.core.models import ParseResult

typer.echo(json.dumps(ParseResult.model_json_schema(), indent=2))
return
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

The schema command docstring says it shows machine-readable schemas for CLI commands, but with --output-schema it outputs the Pydantic JSON Schema for ParseResult instead. Please update the docstring/help text (and the command-schemas payload below, if that’s meant to be complete for agents) to reflect this additional behavior/flag.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@kiyeonjeon21 kiyeonjeon21 left a comment

Choose a reason for hiding this comment

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

Nice work, this is a useful addition for AI agents!

One thing: this PR has a merge conflict with #13 on tests/test_cli.py (both create the same file). Once #13 is merged, please rebase this branch:

git fetch origin
git rebase origin/main

The test file in #13 already has the version tests, so you'd just need to add your test_schema_output_schema_prints_parse_result_schema to it.

Code itself looks good — will approve after rebase.

@abhijeetnardele24-hash abhijeetnardele24-hash closed this by deleting the head repository Apr 4, 2026
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.

Add structured output: JSON schema for ParseResult

3 participants