Skip to content

Commit

Permalink
feat: ignore unknown json fields when parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
nilslice committed Oct 3, 2024
1 parent 245e59f commit 989aa99
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion template/src/schema.zig.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub const Host = struct {
<% if (imp.output.contentType === 'application/json') { -%>
const buffer = try _plugin.allocator.alloc(u8, @intCast(outMem.length));
outMem.load(buffer);
const out = try std.json.parseFromSlice(<%- toZigType(imp.output) %>, _plugin.allocator, buffer, .{ .allocate = .alloc_always });
const out = try std.json.parseFromSlice(<%- toZigType(imp.output) %>, _plugin.allocator, buffer, .{ .allocate = .alloc_always, .ignore_unknown_fields = true });
return out.value;
<% } else if (imp.output.contentType === 'text/plain; charset=UTF-8') { -%>
const buffer = try _plugin.allocator.alloc(u8, @intCast(outMem.length));
Expand Down

0 comments on commit 989aa99

Please sign in to comment.