diff --git a/api/releases.go b/api/releases.go index e0ec1080..a4a25cd8 100644 --- a/api/releases.go +++ b/api/releases.go @@ -45,7 +45,7 @@ func CreateReleaseRequest(w http.ResponseWriter, req *http.Request, validator Qu fromDate, err := validator.Validate(ctx, "date", fromDateParam) if err != nil { log.Warn(ctx, err.Error(), log.Data{"param": "fromDate", "value": fromDateParam}) - http.Error(w, "Invalid dateFrom parameter", http.StatusBadRequest) + http.Error(w, "Invalid fromDate parameter", http.StatusBadRequest) return "", nil } @@ -53,7 +53,7 @@ func CreateReleaseRequest(w http.ResponseWriter, req *http.Request, validator Qu toDate, err := validator.Validate(ctx, "date", toDateParam) if err != nil { log.Warn(ctx, err.Error(), log.Data{"param": "toDate", "value": toDateParam}) - http.Error(w, "Invalid dateTo parameter", http.StatusBadRequest) + http.Error(w, "Invalid toDate parameter", http.StatusBadRequest) return "", nil } diff --git a/features/search-release.feature b/features/search-release.feature index e671a1e8..84d8e97b 100644 --- a/features/search-release.feature +++ b/features/search-release.feature @@ -2,7 +2,7 @@ Feature: search/releases endpoint should return data for various combinations of Scenario: When Searching for published releases relating to 'Education in Wales' between certain dates I get one result Given elasticsearch is healthy And elasticsearch returns one item in search/release response - When I GET "/search/releases?q=Education+in+Wales&dateFrom=2020-01-01&dateTo=2020-12-31&release-type=type-published" + When I GET "/search/releases?q=Education+in+Wales&fromDate=2020-01-01&toDate=2020-12-31&release-type=type-published" And the HTTP status code should be "200" And the response header "Content-Type" should be "application/json;charset=utf-8" And the response body is the same as the json in "./features/testdata/expected_single_search_release_result.json" @@ -10,7 +10,7 @@ Feature: search/releases endpoint should return data for various combinations of Scenario: When Searching for published releases relating to 'Education in Wales' between certain dates with highlighting turned off and I get one result Given elasticsearch is healthy And elasticsearch returns one item in search/release response - When I GET "/search/releases?q=Education+in+Wales&dateFrom=2020-01-01&dateTo=2020-12-31&release-type=type-published&highlight=false" + When I GET "/search/releases?q=Education+in+Wales&response=2020-01-01&toDate=2020-12-31&release-type=type-published&highlight=false" Then the HTTP status code should be "200" And the response header "Content-Type" should be "application/json;charset=utf-8" And the response body is the same as the json in "./features/testdata/expected_single_search_release_result_nohighlight.json" @@ -18,7 +18,7 @@ Feature: search/releases endpoint should return data for various combinations of Scenario: When Searching for published releases relating to 'Education in Wales' between certain dates I get multiple results Given elasticsearch is healthy And elasticsearch returns multiple items in search/release response - When I GET "/search/releases?q=Education+in+Wales&dateFrom=2020-01-01&dateTo=2020-12-31&release-type=type-published" + When I GET "/search/releases?q=Education+in+Wales&response=2020-01-01&toDate=2020-12-31&release-type=type-published" Then the HTTP status code should be "200" And the response header "Content-Type" should be "application/json;charset=utf-8" And the response body is the same as the json in "./features/testdata/expected_multiple_search_release_results.json" @@ -26,7 +26,7 @@ Feature: search/releases endpoint should return data for various combinations of Scenario: When Searching for published releases relating to 'Education in Wales' between certain dates I get zero results Given elasticsearch is healthy And elasticsearch returns zero items in search/release response - When I GET "/search/releases?q=Education+in+Scotland&dateFrom=2020-01-01&dateTo=2020-12-31&release-type=type-published" + When I GET "/search/releases?q=Education+in+Scotland&response=2020-01-01&toDate=2020-12-31&release-type=type-published" Then the HTTP status code should be "200" And the response header "Content-Type" should be "application/json;charset=utf-8" And the response body is the same as the json in "./features/testdata/expected_zero_search_release_results.json" @@ -34,6 +34,6 @@ Feature: search/releases endpoint should return data for various combinations of Scenario: When Searching for published releases relating to 'Education in Wales' between certain dates, I get internal server error Given elasticsearch is healthy And elasticsearch returns internal server error - When I GET "/search/releases?q=Education+in+Scotland&dateFrom=2020-01-01&dateTo=2020-12-31&release-type=type-published" + When I GET "/search/releases?q=Education+in+Scotland&response=2020-01-01&toDate=2020-12-31&release-type=type-published" Then the HTTP status code should be "500" And the response header "Content-Type" should be "text/plain; charset=utf-8" diff --git a/go.mod b/go.mod index ebf4bb3b..2bc73526 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/ONSdigital/dp-component-test v0.7.0 github.com/ONSdigital/dp-elasticsearch/v3 v3.0.1-alpha.4.0.20230308115225-bb7559a89d0c github.com/ONSdigital/dp-healthcheck v1.6.1 - github.com/ONSdigital/dp-net/v2 v2.9.1 + github.com/ONSdigital/dp-net/v2 v2.11.0 github.com/ONSdigital/dp-search-data-extractor v1.1.0 github.com/ONSdigital/dp-search-data-importer v1.0.0 github.com/ONSdigital/log.go/v2 v2.4.1 @@ -76,10 +76,10 @@ require ( github.com/xdg-go/stringprep v1.0.4 // indirect github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect go.mongodb.org/mongo-driver v1.9.1 // indirect - golang.org/x/crypto v0.8.0 // indirect - golang.org/x/net v0.9.0 // indirect + golang.org/x/crypto v0.12.0 // indirect + golang.org/x/net v0.14.0 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.7.0 // indirect - golang.org/x/text v0.9.0 // indirect + golang.org/x/sys v0.11.0 // indirect + golang.org/x/text v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 33be924f..2c72aee3 100644 --- a/go.sum +++ b/go.sum @@ -542,8 +542,8 @@ github.com/ONSdigital/dp-net v1.0.5-0.20200805150805-cac050646ab5/go.mod h1:de3L github.com/ONSdigital/dp-net v1.0.7/go.mod h1:1QFzx32FwPKD2lgZI6MtcsUXritsBdJihlzIWDrQ/gc= github.com/ONSdigital/dp-net v1.0.12/go.mod h1:2lvIKOlD4T3BjWQwjHhBUO2UNWDk82u/+mHRn0R3C9A= github.com/ONSdigital/dp-net v1.2.0/go.mod h1:NinlaqcsPbIR+X7j5PXCl3UI5G2zCL041SDF6WIiiO4= -github.com/ONSdigital/dp-net/v2 v2.9.1 h1:2hGa0ArL0m2pMT9cFxMPcSOgvJ0zstH3NxWeykU9Elg= -github.com/ONSdigital/dp-net/v2 v2.9.1/go.mod h1:iy1XmnqC7aKwHCpbTDhfAVrlYDGJGkZl36zeXyHq+Hw= +github.com/ONSdigital/dp-net/v2 v2.11.0 h1:XXst84GpXhBiyKoqLuohR7CvzrCBfSkq6YsveTarlt4= +github.com/ONSdigital/dp-net/v2 v2.11.0/go.mod h1:4T3GgoonNt2nZZJJer9cx7j/3XGJ1UhTp16flx+uDeA= github.com/ONSdigital/dp-rchttp v0.0.0-20190919143000-bb5699e6fd59/go.mod h1:KkW68U3FPuivW4ogi9L8CPKNj9ZxGko4qcUY7KoAAkQ= github.com/ONSdigital/dp-rchttp v0.0.0-20200114090501-463a529590e8/go.mod h1:821jZtK0oBsV8hjIkNr8vhAWuv0FxJBPJuAHa2B70Gk= github.com/ONSdigital/dp-rchttp v1.0.0 h1:K/1/gDtfMZCX1Mbmq80nZxzDirzneqA1c89ea26FqP4= @@ -942,8 +942,8 @@ golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= -golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= +golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1054,8 +1054,8 @@ golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1177,8 +1177,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1201,8 +1201,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/swagger.yaml b/swagger.yaml index c3d34e40..db0d580b 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -181,13 +181,13 @@ paths: type: string required: false - in: query - name: dateFrom - description: "Specifies candidate Releases by their ReleaseDate, which must be on or after the dateFrom" + name: fromDate + description: "Specifies candidate Releases by their ReleaseDate, which must be on or after the fromDate" type: string required: false - in: query - name: dateTo - description: "Specifies candidate Releases by their ReleaseDate, which must be on or before the dateTo" + name: toDate + description: "Specifies candidate Releases by their ReleaseDate, which must be on or before the toDate" type: string required: false - in: query