diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f1748b44..aac93da77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [2.17.2] +### Fixed +- `GET /jobs` requests now accept `name` parameters up to 100 characters. Fixes [#1019](https://github.com/ASFHyP3/hyp3/issues/1019). + ## [2.17.1] ### Fixed - Fix how we fetch jobs that are waiting for step function execution, so that we actually start up to 400 executions at a time. diff --git a/apps/api/src/hyp3_api/api-spec/job_parameters.yml.j2 b/apps/api/src/hyp3_api/api-spec/job_parameters.yml.j2 index e34bf61db..46a8e2c70 100644 --- a/apps/api/src/hyp3_api/api-spec/job_parameters.yml.j2 +++ b/apps/api/src/hyp3_api/api-spec/job_parameters.yml.j2 @@ -59,9 +59,7 @@ components: enum: - {{ job_type }} name: - type: string - minLength: 1 - maxLength: 100 + $ref: "./openapi-spec.yml#components/schemas/name" job_parameters: $ref: "#/components/schemas/{{ job_type }}Parameters" @@ -78,9 +76,7 @@ components: enum: - {{ job_type }} name: - type: string - minLength: 1 - maxLength: 100 + $ref: "./openapi-spec.yml#components/schemas/name" job_parameters: type: object additionalProperties: false diff --git a/apps/api/src/hyp3_api/api-spec/openapi-spec.yml b/apps/api/src/hyp3_api/api-spec/openapi-spec.yml index 89b0e2cd9..d29b1a52d 100644 --- a/apps/api/src/hyp3_api/api-spec/openapi-spec.yml +++ b/apps/api/src/hyp3_api/api-spec/openapi-spec.yml @@ -479,7 +479,7 @@ components: description: User provided text to name the job type: string minLength: 1 - maxLength: 20 + maxLength: 100 example: Job Name start_token: diff --git a/tests/test_api/test_list_jobs.py b/tests/test_api/test_list_jobs.py index 3e1aab4ee..a44a222fb 100644 --- a/tests/test_api/test_list_jobs.py +++ b/tests/test_api/test_list_jobs.py @@ -50,9 +50,12 @@ def test_list_jobs(client, tables): def test_list_jobs_by_name(client, tables): + long_name = 'item with a long name' + '-' * 79 + assert len(long_name) == 100 + items = [ make_db_record('0ddaeb98-7636-494d-9496-03ea4a7df266', name='item1'), - make_db_record('27836b79-e5b2-4d8f-932f-659724ea02c3', name='item2') + make_db_record('27836b79-e5b2-4d8f-932f-659724ea02c3', name=long_name) ] for item in items: tables.jobs_table.put_item(Item=item) @@ -66,6 +69,13 @@ def test_list_jobs_by_name(client, tables): assert response.status_code == HTTPStatus.OK assert response.json == {'jobs': []} + response = client.get(JOBS_URI, query_string={'name': long_name}) + assert response.status_code == HTTPStatus.OK + assert response.json == {'jobs': [items[1]]} + + response = client.get(JOBS_URI, query_string={'name': long_name + '-'}) + assert response.status_code == HTTPStatus.BAD_REQUEST + def test_list_jobs_by_type(client, tables): items = [