Skip to content

fix: parse boolean query params from strings - #134

Merged
yoreley777 merged 1 commit into
testfrom
bugfix-bool-query-params
Sep 21, 2026
Merged

yoreley777 merged 1 commit into
testfrom
bugfix-bool-query-params

Conversation

@yoreley777

@yoreley777 yoreley777 commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator

Purpose

Needed for TOOL-5054 (single observation search in Vertex). Boolean keywords like jointObservation arrive as strings in the request, and bool("false") is True, so jointobservation=false returned the same results as true. Kim suggested handling this in SearchAPI with the string_to_obj_map.

Description

Added a small string_to_bool and mapped bool to it in string_to_obj_map, so "true"/"false" (any case) are parsed correctly for jointObservation and collectionAlias. Other strings (like "asdf") now return a 400 instead of quietly becoming true. No packaging changes, no new endpoints.

Snippet

curl 'http://127.0.0.1:8080/services/search/param?dataset=NISAR&processinglevel=RSLC&output=count&jointobservation=false'

Before: same count as jointobservation=true (20272). After: 118427 (no filter is 138699, so joint + single add up).

jointobservation=asdf now returns 400 {"error": {"type": "ERROR", "report": "ValueError('Invalid boolean: asdf')"}}.

Error/Warning/Regression Free

Checked locally with the app for GET, POST and output=python (the script now shows "jointObservation": False).

Unit Tests

Added tests/unit/test_asf_opts.py (3 tests) and two yml cases: 200 with "false" and 400 with "asdf".

Target Merge Branch

test


Checklist

  • Purpose
  • Description
  • Snippet
  • Error/Warning/Regression Free
  • Unit Tests
  • Target Merge Branch

@yoreley777
yoreley777 merged commit 1300c67 into test Sep 21, 2026
3 of 5 checks passed
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.

2 participants