Skip to content

feat: support non-JSON content types in write_attachments/read_attachments #124

@mother-6000

Description

@mother-6000

Context

The server (reductstore/reductstore#1371) now supports storing and retrieving schema/meta attachments in arbitrary formats (not just JSON). The storage uses the record's content_type to determine format. Existing JSON workflows are unchanged.

Required Changes

write_attachments

Add an optional content_type parameter (default: "application/json"):

  • If content_type is JSON-like (application/json, text/json, *+json): serialize values with the language's JSON encoder (current behavior, no change)
  • Otherwise: accept raw bytes and pass them directly as the record payload with the given content_type

read_attachments

Branch on the record's content_type response header:

  • If JSON-like: deserialize as today (no change)
  • Otherwise: return raw bytes along with the content_type string

Acceptance Criteria

  • write_attachments accepts optional content_type parameter
  • Non-JSON payloads are written as raw bytes with correct content_type header
  • read_attachments returns raw bytes + content_type for non-JSON records
  • Existing JSON-only callers continue working without changes (default behavior preserved)
  • Unit tests cover at least one non-JSON format (e.g. application/x-protobuf)
  • No breaking changes to existing public API

Notes

Parent issue: reductstore/reductstore#1371

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions