Skip to content

feat(docs): architecture diagrams and JSDoc improvements#8

Open
dihannahdi wants to merge 1 commit intoUniversal-Commerce-Protocol:mainfrom
dihannahdi:feat/comprehensive-improvements
Open

feat(docs): architecture diagrams and JSDoc improvements#8
dihannahdi wants to merge 1 commit intoUniversal-Commerce-Protocol:mainfrom
dihannahdi:feat/comprehensive-improvements

Conversation

@dihannahdi
Copy link

@dihannahdi dihannahdi commented Jan 11, 2026

Summary

This PR introduces documentation and code quality improvements for the UCP codebase.

Note: This PR was rebased onto the latest main after upstream removed generate_schemas.py, validate_specs.py, and schema_utils.py (replaced by ucp-schema CLI in #125). Changes that targeted those deleted files have been dropped. The remaining changes below are still relevant and valuable.

Features

  • feat(docs): Add interactive architecture diagrams with Mermaid
    • Protocol overview diagram showing UCP components
    • Checkout flow sequence diagram
    • Capability and extension architecture
    • Payment handler data flow
    • Schema composition visualization
    • Checkout lifecycle state machine
    • Transport binding comparison

Documentation

  • docs(generate_ts_schema_types): Add comprehensive JSDoc comments
    • File-level documentation with usage instructions
    • Function-level JSDoc with @param and @returns
    • Refactored for better code organization and readability

Files Changed

File Change Type Description
docs/documentation/architecture-diagrams.md New Mermaid architecture diagrams
generate_ts_schema_types.js Modified JSDoc documentation
mkdocs.yml Modified Added architecture diagrams nav entry
tests/__init__.py New Test package init

Changes Dropped (due to upstream restructuring)

The following changes from the original PR were dropped because upstream deleted the target files in #125 (replaced by ucp-schema CLI):

  • generate_schemas.py - bug fix + replace_json_suffix() helper
  • validate_specs.py - OpenAPI 3.1 and JSON Schema validation
  • main.py - logging, error handling, type hints (upstream restructured entirely)
  • tests/test_schema_utils.py - unit tests for deleted schema_utils.py

Testing

  • Mermaid diagrams render correctly in MkDocs
  • Rebased cleanly onto latest upstream/main

Checklist

  • I have signed the Contributor License Agreement
  • My code follows the project style guidelines
  • I have used Conventional Commits format
  • I have updated documentation as needed

This contribution follows the guidelines in CONTRIBUTING.md and GOVERNANCE.md

@dihannahdi dihannahdi requested a review from a team January 11, 2026 21:15
@google-cla
Copy link

google-cla bot commented Jan 11, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@dihannahdi dihannahdi force-pushed the feat/comprehensive-improvements branch from 4482b94 to 1a9b703 Compare January 11, 2026 21:30
@jingyli
Copy link
Contributor

jingyli commented Jan 13, 2026

Thank you for this contribution! We are evaluating the changes and will provide a formal response within 1-2 weeks.

@dihannahdi
Copy link
Author

thank you so much for the attentions. id really love to hear whatever it is!

n-watts pushed a commit to n-watts/ucp that referenced this pull request Jan 15, 2026
Updated 'simple_happy_path_client.py' to prepend an HTML comment to the
exported markdown log, indicating that the file is automatically
generated and should not be modified manually.
BREAKING CHANGE: None

This commit introduces multiple improvements across the UCP codebase:

- fix(generate_schemas): replace .json suffix only when it's actually a suffix
  Fixes issue where str.replace('.json') replaced ALL occurrences including
  directory names like 'json.schemas/'. Added replace_json_suffix() helper.

- feat(validate_specs): add OpenAPI 3.1 compliance and JSON Schema validation
  - Added structured ValidationResult and ValidationIssue classes
  - OpenAPI 3.1 structure validation (version, info, paths, webhooks)
  - JSON Schema structure validation (, , naming conventions)
  - Command-line arguments for --verbose, --continue, --openapi-only

- feat(main): add structured logging and improved error handling
  - Added SchemaLoadError, SchemaReferenceError, OperationNotFoundError
  - Added _format_error() and _safe_load_json() helpers
  - Type hints and comprehensive docstrings for all macros
  - Better error messages with context for debugging

- feat(docs): add interactive architecture diagrams with Mermaid
  - Protocol overview diagram showing UCP components
  - Checkout flow sequence diagram
  - Capability & extension architecture
  - Payment handler data flow
  - Schema composition visualization
  - Checkout lifecycle state machine

- docs(generate_ts_schema_types): add comprehensive JSDoc comments
  - File-level documentation with usage instructions
  - Function-level JSDoc with @param and @returns
  - Refactored for better code organization

- test(schema_utils): add comprehensive unit test suite
  - TestColors: ANSI color constant tests
  - TestResolveRefPath: JSON pointer resolution tests
  - TestLoadJson: File loading tests
  - TestResolveInternalRef: Internal reference tests
  - TestMergeSchemas: Schema merging tests
  - TestResolveSchema: Schema resolution tests
  - TestJsonSuffixReplacement: New suffix replacement tests

Signed-off-by: Contributor
@dihannahdi dihannahdi force-pushed the feat/comprehensive-improvements branch from 1a9b703 to 44aa4a4 Compare February 22, 2026 12:13
@dihannahdi dihannahdi requested review from a team as code owners February 22, 2026 12:13
@dihannahdi dihannahdi changed the title feat: comprehensive improvements for code quality and documentation feat(docs): architecture diagrams and JSDoc improvements Feb 22, 2026
@HanaMulyaSesinawati
Copy link

Rebase & Conflict Resolution Update

This PR has been rebased onto the latest main branch to resolve merge conflicts (mergeable_state was dirty).

What changed:

  • Upstream removed generate_schemas.py, validate_specs.py, and schema_utils.py in fix(schema): publish UCP annotated schemas #125 (replaced by ucp-schema CLI)
  • Our modifications to those files were no longer applicable, so they've been dropped
  • main.py was also reverted to upstream's version since it was heavily restructured
  • tests/test_schema_utils.py removed (tested the now-deleted schema_utils.py)

What remains (4 files, +509/-66):

  • docs/documentation/architecture-diagrams.md — Mermaid architecture diagrams
  • generate_ts_schema_types.js — JSDoc documentation improvements
  • mkdocs.yml — nav entry for architecture diagrams
  • tests/__init__.py — test package init

PR title and description updated to reflect the reduced scope.

@nearlyforget nearlyforget requested a review from jingyli February 23, 2026 20:15
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