Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 3, 2025

Adds a JsonServiceClient for Zig to consume ServiceStack APIs with strongly-typed DTOs.

Core Implementation

  • src/client.zig (196 lines): HTTP client supporting GET, POST, PUT, DELETE, PATCH with JSON serialization
  • Returns json.Parsed(T) for explicit memory ownership - callers must defer parsed.deinit()
  • Configurable max response size and timeout (timeout currently unused by std.http)
  • Uses Content-Length header instead of chunked encoding for JSON payloads

Build & Infrastructure

  • build.zig: Standard library, tests, and example builds
  • build.zig.zon: Package metadata for dependency management
  • .github/workflows/ci.yml: CI with minimal permissions

Examples & Documentation

  • 3 examples (517 lines): basic usage, advanced patterns, comprehensive DTO library
  • 5 documentation files (1,163 lines): README, quickstart, usage guide, DTO creation guide, contributing

Usage

var client = try JsonServiceClient.init(allocator, "https://api.example.com");
defer client.deinit();

const parsed = try client.post(HelloResponse, "/hello", request);
defer parsed.deinit();
const response = parsed.value;

DTOs are plain Zig structs matching ServiceStack contracts. See ADD_SERVICESTACK_REFERENCE.md for type mappings and patterns.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • canonical-bos01.cdn.snapcraftcontent.com
    • Triggering command: /usr/lib/snapd/snapd (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)
  • ziglang.org
    • Triggering command: wget REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Creating a ServiceStack JsonServiceClient for the Zig programming language that uses the Zig Add ServiceStack Language DTOs to make API Requests


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Nov 3, 2025
Copilot AI and others added 6 commits November 3, 2025 18:12
Co-authored-by: mythz <89361+mythz@users.noreply.github.com>
Co-authored-by: mythz <89361+mythz@users.noreply.github.com>
Co-authored-by: mythz <89361+mythz@users.noreply.github.com>
Co-authored-by: mythz <89361+mythz@users.noreply.github.com>
…g and configurable response size

Co-authored-by: mythz <89361+mythz@users.noreply.github.com>
Co-authored-by: mythz <89361+mythz@users.noreply.github.com>
Copilot AI changed the title [WIP] Create ServiceStack JsonServiceClient for Zig programming language Implement ServiceStack JsonServiceClient for Zig Nov 3, 2025
Copilot finished work on behalf of mythz November 3, 2025 18:36
Copilot AI requested a review from mythz November 3, 2025 18:36
@mythz mythz marked this pull request as ready for review November 4, 2025 08:27
@mythz mythz merged commit 8ce8e23 into main Nov 4, 2025
0 of 2 checks passed
@mythz mythz deleted the copilot/create-jsonserviceclient-zig branch November 4, 2025 08:30
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.

2 participants