Skip to content

Toolcraft SDK: preserve arbitrary S.Json object keys in generated types #528

Description

@kamilio

Problem

Commands with an S.Json() parameter accept native JSON objects at runtime, but the generated SDK type recursively applies key camel-casing to the JSON string index signature. TypeScript reduces that signature to a malformed { "": any }-like union, so ordinary calls such as sdk.command({ payloadJson: { file_upload: "id" } }) fail to compile.

The runtime already preserves arbitrary JSON keys correctly.

Expected

  • SDK parameter names continue to camel-case.
  • Keys inside S.Json() and other string-indexed records remain arbitrary and unchanged.
  • Native JSON object literals type-check.

Proposed fix

Teach the SDK's type-level Camelize helper to leave string-indexed object types intact, and add a compile check plus runtime key-preservation coverage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions