Skip to content

Commit

Permalink
feat: update internal/api/openapi.go
Browse files Browse the repository at this point in the history
* Review debug
  • Loading branch information
nick-rv authored and benoitdm-oslandia committed Apr 4, 2023
1 parent fd7b91b commit 76de7b3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion hugo/content/examples/ex_query_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,3 @@ The simplification operation is done using the Douglas-Peucker algorithm.
http://localhost:9001/collections/ne.countries/items/55
?max-allowable-offset=0.1
```

2 changes: 1 addition & 1 deletion internal/api/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ func GetOpenAPIContent(urlBase string) *openapi3.T {
Required: false,
Schema: &openapi3.SchemaRef{
Value: &openapi3.Schema{
Type: "integer",
Type: "number",
Min: openapi3.Float64Ptr(0),
Max: openapi3.Float64Ptr(float64(conf.Configuration.Paging.LimitMax)),
Default: conf.Configuration.Paging.LimitDefault,
Expand Down
10 changes: 5 additions & 5 deletions internal/service/db_test/handler_db_lod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ func (t *DbTests) TestGeometrySimplificationSeveralFeatures() {
// Test case with negative value as simplification factor
func (t *DbTests) TestGeometrySimplificationNegativeValue() {
t.Test.Run("TestGeometrySimplificationNegativeValue", func(t *testing.T) {
path := "/collections/mock_poly/items/6?max-allowable-offset=-0.01"
// If lower thant minVal, then minValue (0) is considered
path := "/collections/mock_poly/items/1?max-allowable-offset=-0.01"
// If lower than minVal, then minValue (0) is considered
hTest.DoRequestMethodStatus(t, "GET", path, nil, nil, http.StatusOK)
})
}
Expand All @@ -82,21 +82,21 @@ func (t *DbTests) TestGeometrySimplificationWrongFloatSeparatorValue() {
// Test case with various values as simplification factor
func (t *DbTests) TestGeometrySimplificationVariousSimplificationValues() {
t.Test.Run("TestGeometrySimplificationVariousSimplificationValues", func(t *testing.T) {
path := "/collections/mock_poly/items/4?max-allowable-offset=0.01"
path := "/collections/mock_poly/items/1?max-allowable-offset=0.01"
rr := hTest.DoRequestMethodStatus(t, "GET", path, nil, nil, http.StatusOK)
// Feature collection
var feat api.GeojsonFeatureData
errUnMarsh := json.Unmarshal(hTest.ReadBody(rr), &feat)
util.Assert(t, errUnMarsh == nil, fmt.Sprintf("%v", errUnMarsh))
util.Equals(t, 4, len(feat.Geom.Geometry().(orb.Polygon)[0]), "wrong number of simplified coordinates")

path = "/collections/mock_poly/items/4?max-allowable-offset=0.001"
path = "/collections/mock_poly/items/1?max-allowable-offset=0.001"
rr = hTest.DoRequestMethodStatus(t, "GET", path, nil, nil, http.StatusOK)
errUnMarsh = json.Unmarshal(hTest.ReadBody(rr), &feat)
util.Assert(t, errUnMarsh == nil, fmt.Sprintf("%v", errUnMarsh))
util.Equals(t, 10, len(feat.Geom.Geometry().(orb.Polygon)[0]), "wrong number of simplified coordinates")

path = "/collections/mock_poly/items/4?max-allowable-offset=1"
path = "/collections/mock_poly/items/1?max-allowable-offset=1"
rr = hTest.DoRequestMethodStatus(t, "GET", path, nil, nil, http.StatusOK)
errUnMarsh = json.Unmarshal(hTest.ReadBody(rr), &feat)
util.Assert(t, errUnMarsh == nil, fmt.Sprintf("%v", errUnMarsh))
Expand Down
2 changes: 1 addition & 1 deletion internal/utiltest/test_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func InsertSimpleDataset(db *pgxpool.Pool, schema string) {

// collections tables
type tableContent struct {
geometryType string
geometryType api.GeometryType
extent api.Extent
nx int
ny int
Expand Down

0 comments on commit 76de7b3

Please sign in to comment.