Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
544 changes: 297 additions & 247 deletions generated/anthropic.zig

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion generated/generated_v2.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <auto-generated>
// this code was generated by openapi2zig 0.4.0 (ecbd8f7) on 2026-07-19 22:45:59 UTC
// this code was generated by openapi2zig 0.4.0 (9d2949a) on 2026-07-20 01:02:07 UTC
// changes to this file may cause incorrect behavior and will be lost if the code is regenerated
// </auto-generated>

Expand Down
2 changes: 1 addition & 1 deletion generated/generated_v2_yaml.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <auto-generated>
// this code was generated by openapi2zig 0.4.0 (ecbd8f7) on 2026-07-19 22:46:01 UTC
// this code was generated by openapi2zig 0.4.0 (9d2949a) on 2026-07-20 01:02:07 UTC
// changes to this file may cause incorrect behavior and will be lost if the code is regenerated
// </auto-generated>

Expand Down
2 changes: 1 addition & 1 deletion generated/generated_v3.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <auto-generated>
// this code was generated by openapi2zig 0.4.0 (ecbd8f7) on 2026-07-19 22:45:58 UTC
// this code was generated by openapi2zig 0.4.0 (9d2949a) on 2026-07-20 01:02:07 UTC
// changes to this file may cause incorrect behavior and will be lost if the code is regenerated
// </auto-generated>

Expand Down
2 changes: 1 addition & 1 deletion generated/generated_v31.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <auto-generated>
// this code was generated by openapi2zig 0.4.0 (ecbd8f7) on 2026-07-19 22:45:59 UTC
// this code was generated by openapi2zig 0.4.0 (9d2949a) on 2026-07-20 01:02:07 UTC
// changes to this file may cause incorrect behavior and will be lost if the code is regenerated
// </auto-generated>

Expand Down
2 changes: 1 addition & 1 deletion generated/generated_v31_yaml.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <auto-generated>
// this code was generated by openapi2zig 0.4.0 (ecbd8f7) on 2026-07-19 22:45:59 UTC
// this code was generated by openapi2zig 0.4.0 (9d2949a) on 2026-07-20 01:02:07 UTC
// changes to this file may cause incorrect behavior and will be lost if the code is regenerated
// </auto-generated>

Expand Down
2 changes: 1 addition & 1 deletion generated/generated_v32.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <auto-generated>
// this code was generated by openapi2zig 0.4.0 (ecbd8f7) on 2026-07-19 22:45:59 UTC
// this code was generated by openapi2zig 0.4.0 (9d2949a) on 2026-07-20 01:02:07 UTC
// changes to this file may cause incorrect behavior and will be lost if the code is regenerated
// </auto-generated>

Expand Down
2 changes: 1 addition & 1 deletion generated/generated_v3_yaml.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <auto-generated>
// this code was generated by openapi2zig 0.4.0 (ecbd8f7) on 2026-07-19 22:46:00 UTC
// this code was generated by openapi2zig 0.4.0 (9d2949a) on 2026-07-20 01:02:07 UTC
// changes to this file may cause incorrect behavior and will be lost if the code is regenerated
// </auto-generated>

Expand Down
2 changes: 1 addition & 1 deletion generated/lmstudio.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <auto-generated>
// this code was generated by openapi2zig 0.4.0 (ecbd8f7) on 2026-07-19 22:45:59 UTC
// this code was generated by openapi2zig 0.4.0 (9d2949a) on 2026-07-20 01:02:07 UTC
// changes to this file may cause incorrect behavior and will be lost if the code is regenerated
// </auto-generated>

Expand Down
1 change: 1 addition & 0 deletions generated/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const v3_yaml = @import("generated_v3_yaml.zig");
const v31_yaml = @import("generated_v31_yaml.zig");
const lmstudio = @import("lmstudio.zig");
const openai = @import("openai.zig");
const anthropic = @import("anthropic.zig");

fn logRequest(ctx: ?*anyopaque, method: std.http.Method, url: []const u8, headers: []const std.http.Header, body: ?[]const u8) void {
_ = ctx;
Expand Down
30 changes: 5 additions & 25 deletions openapi/v3.1/anthropic.json
Original file line number Diff line number Diff line change
Expand Up @@ -36155,11 +36155,7 @@
},
"usage": {
"description": "Cumulative token usage for the session.",
"allOf": [
{
"$ref": "#/components/schemas/BetaManagedAgentsSessionUsage"
}
],
"$ref": "#/components/schemas/BetaManagedAgentsSessionUsage",
"examples": [
{
"input_tokens": 0,
Expand All @@ -36170,11 +36166,7 @@
},
"stats": {
"description": "Timing statistics for the session.",
"allOf": [
{
"$ref": "#/components/schemas/BetaManagedAgentsSessionStats"
}
],
"$ref": "#/components/schemas/BetaManagedAgentsSessionStats",
"examples": [
{
"duration_seconds": 0,
Expand Down Expand Up @@ -37246,11 +37238,7 @@
},
"agent": {
"description": "Resolved agent definition for this thread. Snapshot of the agent at thread creation time.",
"allOf": [
{
"$ref": "#/components/schemas/BetaManagedAgentsSessionThreadAgent"
}
],
"$ref": "#/components/schemas/BetaManagedAgentsSessionThreadAgent",
"examples": [
{
"type": "agent",
Expand Down Expand Up @@ -37324,11 +37312,7 @@
},
"usage": {
"description": "Cumulative token usage for this thread. Null until the thread's first idle transition.",
"allOf": [
{
"$ref": "#/components/schemas/BetaManagedAgentsSessionThreadUsage"
}
],
"$ref": "#/components/schemas/BetaManagedAgentsSessionThreadUsage",
"nullable": true,
"examples": [
{
Expand All @@ -37344,11 +37328,7 @@
},
"stats": {
"description": "Timing statistics for this thread. Null until the thread's first status transition.",
"allOf": [
{
"$ref": "#/components/schemas/BetaManagedAgentsSessionThreadStats"
}
],
"$ref": "#/components/schemas/BetaManagedAgentsSessionThreadStats",
"nullable": true,
"examples": [
{
Expand Down
3 changes: 2 additions & 1 deletion src/generators/unified/api_generator.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1014,9 +1014,10 @@ pub const UnifiedApiGenerator = struct {
std.mem.sort(ResourceWrapper, wrappers.items, {}, resourceWrapperLessThan);

// Detect when wrapper method name matches its containing struct name
// or when the derived method name equals the operation id (ambiguous reference)
for (wrappers.items) |*wrapper| {
const last_segment = wrapper.segments[wrapper.segments.len - 1];
if (std.mem.eql(u8, wrapper.method_name, last_segment)) {
if (std.mem.eql(u8, wrapper.method_name, last_segment) or std.mem.eql(u8, wrapper.method_name, wrapper.operation_id)) {
wrapper.collides = true;
wrapper.needs_alias = true;
}
Expand Down
19 changes: 14 additions & 5 deletions src/generators/unified/model_generator.zig
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ pub const UnifiedModelGenerator = struct {
try self.generateHeader();

if (document.schemas) |schemas| {
self.source_schemas = &schemas;
defer self.source_schemas = null;
try self.generateSchemas(schemas);
try self.generateManualAliases(schemas);
}
Expand All @@ -48,9 +50,6 @@ pub const UnifiedModelGenerator = struct {
}

fn generateSchemas(self: *UnifiedModelGenerator, schemas: std.StringHashMap(Schema)) !void {
self.source_schemas = &schemas;
defer self.source_schemas = null;

var schema_iterator = schemas.iterator();
while (schema_iterator.next()) |entry| {
const schema_name = entry.key_ptr.*;
Expand Down Expand Up @@ -1000,10 +999,16 @@ pub const UnifiedModelGenerator = struct {
}

if (std.mem.eql(u8, name, "InputMessageContent")) {
const schemas = self.source_schemas orelse return false;
const content_type: []const u8 = if (schemas.contains("InputContent")) "InputContent" else "InputContentBlock";
Comment thread
coderabbitai[bot] marked this conversation as resolved.
try self.buffer.appendSlice(self.allocator,
\\pub const InputMessageContent = union(enum) {
\\ text: []const u8,
\\ parts: []const InputContent,
\\ parts: []const
);
try self.buffer.appendSlice(self.allocator, content_type);
try self.buffer.appendSlice(self.allocator,
\\,
\\ raw: std.json.Value,
\\
\\ pub fn jsonParse(allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions) !@This() {
Expand All @@ -1014,7 +1019,11 @@ pub const UnifiedModelGenerator = struct {
\\ pub fn jsonParseFromValue(allocator: std.mem.Allocator, source: std.json.Value, options: std.json.ParseOptions) !@This() {
\\ return switch (source) {
\\ .string => |value| .{ .text = value },
\\ .array => .{ .parts = try std.json.parseFromValueLeaky([]const InputContent, allocator, source, options) },
\\ .array => .{ .parts = try std.json.parseFromValueLeaky([]const
);
try self.buffer.appendSlice(self.allocator, content_type);
try self.buffer.appendSlice(self.allocator,
\\, allocator, source, options) },
\\ else => .{ .raw = source },
\\ };
\\ }
Expand Down
Loading