Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,20 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
------
## [1.0.1](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v1.0.0...v1.0.1)

### Fixed
- Generic searches (non-search related params) no longer accepted, raise 400
- Fixed string comparison of numbers in range filters

### Changed
- Include wkt in error when raising in `validate_wkt()`

### Added
- Add dedicated dev branch for test-staging deployment
- Intended Dev->Release workflow
- dev -> test -> prod-staging -> prod

### Changed
- pin `asf-search` to v8.2.3, All basic Vertex dataset searches working
- pin `asf-search` to v8.3.0, All basic Vertex dataset searches working

## [1.0.0](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v0.1.0...v1.0.0)

Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ ujson==5.7.0
uvicorn==0.21.1
watchfiles==0.19.0

asf_search==8.2.3
asf_search==8.3.0
python-json-logger==2.0.7

pyshp
pyshp==2.1.3
geopandas
geomet
kml2geojson
Expand Down
13 changes: 12 additions & 1 deletion src/SearchAPI/application/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ async def query_params(searchOptions: SearchOptsModel = Depends(process_search_r
output = searchOptions.output
opts = searchOptions.opts

non_search_param = ['output', 'maxresults', 'pagesize', 'maturity']
try:
any_searchables = any([key.lower() not in non_search_param for key, _ in opts])
if not any_searchables:
raise ValueError(
'No searchable parameters specified, queries must include'
' parameters besides output= and maxresults='
)
except ValueError as exc:
raise HTTPException(detail=repr(exc), status_code=400) from exc

if output.lower() == 'count':
start = time.perf_counter()
count=asf.search_count(opts=opts)
Expand Down Expand Up @@ -222,7 +233,7 @@ def validate_wkt(wkt: str):
wrapped, unwrapped, reports = asf.validate_wkt(wkt)
repairs = [{'type': report.report_type, 'report': report.report} for report in reports if report.report_type != "'type': 'WRAP'"]
except Exception as exc:
raise HTTPException(detail=f"Failed to validate wkt: {exc}", status_code=400) from exc
raise HTTPException(detail=f"Failed to validate wkt {wkt}: {exc}", status_code=400) from exc

return {
'wkt': {
Expand Down
3 changes: 2 additions & 1 deletion src/SearchAPI/application/asf_opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from .logger import api_logger

non_search_param = ['output', 'maxresults', 'pagesize', 'maturity']

def string_to_range(v: Union[str, list]) -> tuple:
if isinstance(v, list):
Expand All @@ -23,7 +24,7 @@ def string_to_range(v: Union[str, list]) -> tuple:
if m is None:
raise ValueError(f'Invalid range: {v}')
a = (m.group(1), m.group(3))
if a[0] > a[1]:
if float(a[0]) > float(a[1]):
raise ValueError()
if a[0] == a[1]:
a = a[0]
Expand Down