Skip to content

fix(domain): let JSON options omit individual fields - #2

Draft
autoantohaki wants to merge 1 commit into
mainfrom
fix/partial-ocr-options
Draft

autoantohaki wants to merge 1 commit into
mainfrom
fix/partial-ocr-options

Conversation

@autoantohaki

Copy link
Copy Markdown
Member

Requested by mau

Before: POST /v1/ocr (and batch items and the MCP ocr_recognize and ocr_batch arguments) rejected a partial options object, for example {"options":{"include_words":false}}, with 400 invalid_request. Only options as a whole had a serde default, so language and minimum_confidence were required whenever options was present. The OpenAPI document and both MCP JSON schemas declare all three fields optional.

After: omitted option fields take the existing OcrOptions::default() values (english, include_words: true, minimum_confidence: 0), as the schemas describe. Requests that send all fields behave as before.

How: add a container-level #[serde(default)] to OcrOptions, plus an HTTP test that sends {}, each field on its own, and checks both the 200 status and whether words are included.

Note: this PR changes .rs sources, so the Windows runtime qualification attestation has to be re-recorded before verify-runtime-qualification-attestation.ps1 passes.

The OpenAPI document and the MCP JSON schemas declare every field of
options as optional, but OcrOptions only had a default for the whole
object. A request such as {"options":{"include_words":false}} was
rejected as invalid_request because language and minimum_confidence were
missing. Apply the existing Default impl per field.
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.

1 participant