Skip to content

Fix Anthropic spec compatibility#69

Merged
christianhelle merged 6 commits into
mainfrom
fix-anthropic-compatibility
Jul 20, 2026
Merged

Fix Anthropic spec compatibility#69
christianhelle merged 6 commits into
mainfrom
fix-anthropic-compatibility

Conversation

@christianhelle

@christianhelle christianhelle commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Fixes build errors in generated anthropic.zig by:

  • Making InputMessageContent template spec-aware for InputContent vs InputContentBlock
  • Detecting method_name == operation_id to avoid ambiguous resource wrapper references
  • Replacing allOf with single in BetaManagedAgentsSession schemas

Summary by CodeRabbit

  • Bug Fixes

    • Improved generated API resource wrapper naming to better avoid ambiguous method/operation conflicts.
    • Fixed generated message content models and parsing to select the correct schema variant based on available input content definitions.
  • Refactor

    • Simplified API schema references for session and thread fields (usage, stats, and agent) by removing redundant schema composition wrappers.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 78f6a761-f51c-4858-baf5-2b5448e1c95a

📥 Commits

Reviewing files that changed from the base of the PR and between c003239 and 430e394.

📒 Files selected for processing (1)
  • src/generators/unified/model_generator.zig
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/generators/unified/model_generator.zig

📝 Walkthrough

Walkthrough

The OpenAPI document now uses direct component references for selected session and thread properties. Unified generators also detect operation ID wrapper collisions and conditionally select the input content type for generated InputMessageContent fields and parsing.

Changes

Schema and generator updates

Layer / File(s) Summary
Direct OpenAPI schema references
openapi/v3.1/anthropic.json
Session and thread usage, stats, and agent properties replace single-reference allOf wrappers with direct $ref values.
Resource wrapper collision detection
src/generators/unified/api_generator.zig
Wrapper alias detection treats matches with either the final path segment or the operation ID as collisions.
Conditional input content generation
src/generators/unified/model_generator.zig
Schema context is established during generation, and InputMessageContent uses InputContent when available or InputContentBlock otherwise for its parts field and array parser.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: enhancement

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main goal: improving Anthropic spec compatibility across the generator and schema changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-anthropic-compatibility

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/generators/unified/model_generator.zig`:
- Around line 1003-1004: Prevent generateManualSchema from silently skipping
InputMessageContent when source_schemas is null. Update the source_schemas
handling around generateManualSchema and generateManualAliases so the fallback
remains able to generate InputMessageContent when InputContent is guaranteed
present, preferably by keeping source_schemas available through
generateManualAliases via generate rather than clearing it inside
generateSchemas.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 73378847-7e36-4050-84b6-ae11125d4bc4

📥 Commits

Reviewing files that changed from the base of the PR and between 34b2185 and c003239.

⛔ Files ignored due to path filters (10)
  • generated/anthropic.zig is excluded by !**/generated/**
  • generated/generated_v2.zig is excluded by !**/generated/**
  • generated/generated_v2_yaml.zig is excluded by !**/generated/**
  • generated/generated_v3.zig is excluded by !**/generated/**
  • generated/generated_v31.zig is excluded by !**/generated/**
  • generated/generated_v31_yaml.zig is excluded by !**/generated/**
  • generated/generated_v32.zig is excluded by !**/generated/**
  • generated/generated_v3_yaml.zig is excluded by !**/generated/**
  • generated/lmstudio.zig is excluded by !**/generated/**
  • generated/main.zig is excluded by !**/generated/**
📒 Files selected for processing (3)
  • openapi/v3.1/anthropic.json
  • src/generators/unified/api_generator.zig
  • src/generators/unified/model_generator.zig

Comment thread src/generators/unified/model_generator.zig
@christianhelle christianhelle added the enhancement New feature or request label Jul 20, 2026
@christianhelle christianhelle self-assigned this Jul 20, 2026
@christianhelle
christianhelle merged commit ffd71a4 into main Jul 20, 2026
17 checks passed
@christianhelle
christianhelle deleted the fix-anthropic-compatibility branch July 20, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant