Skip to content

Commit 798ed73

Browse files
Merge pull request #25 from asfadmin/test
V1.0.1 Update
2 parents 9f3789c + 5c49993 commit 798ed73

4 files changed

Lines changed: 24 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,20 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
2828
------
2929
## [1.0.1](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v1.0.0...v1.0.1)
3030

31+
### Fixed
32+
- Generic searches (non-search related params) no longer accepted, raise 400
33+
- Fixed string comparison of numbers in range filters
34+
35+
### Changed
36+
- Include wkt in error when raising in `validate_wkt()`
37+
3138
### Added
3239
- Add dedicated dev branch for test-staging deployment
3340
- Intended Dev->Release workflow
3441
- dev -> test -> prod-staging -> prod
3542

3643
### Changed
37-
- pin `asf-search` to v8.2.3, All basic Vertex dataset searches working
44+
- pin `asf-search` to v8.3.0, All basic Vertex dataset searches working
3845

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

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ ujson==5.7.0
2222
uvicorn==0.21.1
2323
watchfiles==0.19.0
2424

25-
asf_search==8.2.3
25+
asf_search==8.3.0
2626
python-json-logger==2.0.7
2727

28-
pyshp
28+
pyshp==2.1.3
2929
geopandas
3030
geomet
3131
kml2geojson

src/SearchAPI/application/application.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@ async def query_params(searchOptions: SearchOptsModel = Depends(process_search_r
4242
output = searchOptions.output
4343
opts = searchOptions.opts
4444

45+
non_search_param = ['output', 'maxresults', 'pagesize', 'maturity']
46+
try:
47+
any_searchables = any([key.lower() not in non_search_param for key, _ in opts])
48+
if not any_searchables:
49+
raise ValueError(
50+
'No searchable parameters specified, queries must include'
51+
' parameters besides output= and maxresults='
52+
)
53+
except ValueError as exc:
54+
raise HTTPException(detail=repr(exc), status_code=400) from exc
55+
4556
if output.lower() == 'count':
4657
start = time.perf_counter()
4758
count=asf.search_count(opts=opts)
@@ -222,7 +233,7 @@ def validate_wkt(wkt: str):
222233
wrapped, unwrapped, reports = asf.validate_wkt(wkt)
223234
repairs = [{'type': report.report_type, 'report': report.report} for report in reports if report.report_type != "'type': 'WRAP'"]
224235
except Exception as exc:
225-
raise HTTPException(detail=f"Failed to validate wkt: {exc}", status_code=400) from exc
236+
raise HTTPException(detail=f"Failed to validate wkt {wkt}: {exc}", status_code=400) from exc
226237

227238
return {
228239
'wkt': {

src/SearchAPI/application/asf_opts.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from .logger import api_logger
1515

16+
non_search_param = ['output', 'maxresults', 'pagesize', 'maturity']
1617

1718
def string_to_range(v: Union[str, list]) -> tuple:
1819
if isinstance(v, list):
@@ -23,7 +24,7 @@ def string_to_range(v: Union[str, list]) -> tuple:
2324
if m is None:
2425
raise ValueError(f'Invalid range: {v}')
2526
a = (m.group(1), m.group(3))
26-
if a[0] > a[1]:
27+
if float(a[0]) > float(a[1]):
2728
raise ValueError()
2829
if a[0] == a[1]:
2930
a = a[0]

0 commit comments

Comments
 (0)