Files
coder/docs/reference/api
Nick Vigilante 585485c8bf fix: document raw JSON as objects and byte fields as base64 strings (#30123)
Swagger renders `json.RawMessage` and `[]byte` fields as integer arrays,
so the API reference showed chat tool calls as `"args": [0]` even though
tool arguments and results are JSON values.

Render every `json.RawMessage` as an object with one `.swaggo` replace
rule, and tag `[]byte` fields, which JSON-encode as base64,
`swaggertype:"string" format:"byte"`. This covers
`ChatMessagePart.args`, `.result`, `.data`, `ToolResult.output`,
`DynamicTool.input_schema`, both workspace build `state` fields,
`TemplateBuilderModuleVariable.default`, and
`CreateTestAuditLogRequest.additional_fields`.

`ChatMessagePart.provider_metadata` is internal only, so it is hidden
with `swaggerignore:"true"` like its siblings. `ChatMessagePart.result`
and `ToolResult.output` can hold any JSON value, and
`TemplateBuilderModuleVariable.default` holds a string, number, or
boolean, so `object` is an approximation for all three and the field
comments say so. swag rejects an untyped `.swaggo` override for
`json.RawMessage`.

Part of DOCS-1122, split from #30121.

---
🤖 Built with AI assistance.
2026-11-05 13:15:40 -05:00
..