[PR #4338] fix: replace union type with enum "true"/"false" in /find/file endpoint #10939

Closed
opened 2026-02-16 18:15:42 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/4338

State: closed
Merged: Yes


The dirs query param on /find/file uses a union of ('true' | 'false') instead of a normal boolean type, which Hono and OpenAPI 3.1 both accept.

Problem is that downstream code generators assume that query parameters are primitive types (string/number/boolean), and the use of a union/sum type causes bugs in e.g. oapi-codegen.

This change maintains backward compatibility, and tests still pass, while fixing downstream codegen issues.

Essentially I replaced the following openapi snippet:

  "/find/file":
    get:
      operationId: "find.files"
      parameters:
        # ... (other params)
        - in: "query"
          name: "dirs"
          schema:
            anyOf:
              - type: "string"
                const: "true"
              - type: "string"
                const: "false"

With the following, simpler idiom:

  "/find/file":
    get:
      operationId: "find.files"
      parameters:
        # ... (other params)
        - in: "query"
          name: "dirs"
          schema:
            type: "string"
            enum: ["true", "false"]

edit: changed yaml to match revised submission

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/4338 **State:** closed **Merged:** Yes --- The `dirs` query param on `/find/file` uses a union of ('true' | 'false') instead of a normal boolean type, which Hono and OpenAPI 3.1 both accept. Problem is that downstream code generators assume that query parameters are primitive types (string/number/boolean), and the use of a union/sum type causes bugs in e.g. `oapi-codegen`. This change maintains backward compatibility, and tests still pass, while fixing downstream codegen issues. Essentially I replaced the following openapi snippet: ```yaml "/find/file": get: operationId: "find.files" parameters: # ... (other params) - in: "query" name: "dirs" schema: anyOf: - type: "string" const: "true" - type: "string" const: "false" ``` With the following, simpler idiom: ```yaml "/find/file": get: operationId: "find.files" parameters: # ... (other params) - in: "query" name: "dirs" schema: type: "string" enum: ["true", "false"] ``` **edit: changed yaml to match revised submission**
yindo added the pull-request label 2026-02-16 18:15:42 -05:00
yindo closed this issue 2026-02-16 18:15:42 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10939