Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add zoom query parameter to Resources OpenAPI definition #1852

Merged
merged 2 commits into from
Dec 23, 2024
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
8 changes: 8 additions & 0 deletions docs/src/develop/rest-api/resources_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ A filtered list of entries can be retrieved based on criteria such as:
- being within a bounded area
- distance from vessel
- total entries returned
- map zoom level

by supplying a query string containing `key | value` pairs in the request.

Expand All @@ -54,6 +55,13 @@ _Example 3: Retrieve waypoints within a bounded area. Note: the bounded area is
HTTP GET 'http://hostname:3000/signalk/v2/api/resources/waypoints?bbox=[-135.5,38,-134,38.5]'
```

_Example 4: Return notes for display on a map view at zoom level 5.

```typescript
HTTP GET 'http://hostname:3000/signalk/v2/api/resources/notes?zoom=5'
```

It is up to the provider to determine which resource entries are returned for any given zoom level. As a guide we recommend alignment with the criteria in the following document: https://wiki.openstreetmap.org/wiki/Zoom_levels_.

### Deleting Resources
---
Expand Down
25 changes: 24 additions & 1 deletion src/api/resources/openApi.json
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,17 @@
"example": [135.5, -25.2]
}
},
"ZoomParam": {
"in": "query",
"name": "zoom",
"description": "Zoom level of the map used by the client to display the returned resource entries. Refer: [OSM Zoom Levels](https://wiki.openstreetmap.org/wiki/Zoom_levels)",
"schema": {
"type": "integer",
"format": "int32",
"minimum": 1,
"example": 4
}
},
"ProviderParam": {
"in": "query",
"name": "provider",
Expand Down Expand Up @@ -828,7 +839,7 @@
"summary": "Retrieve list of available resource types",
"responses": {
"default": {
"description": "List of avaialble resource types identified by name",
"description": "List of available resource types identified by name",
"content": {
"application/json": {
"schema": {
Expand Down Expand Up @@ -872,6 +883,9 @@
},
{
"$ref": "#/components/parameters/PositionParam"
},
{
"$ref": "#/components/parameters/ZoomParam"
}
],
"responses": {
Expand Down Expand Up @@ -1002,6 +1016,9 @@
},
{
"$ref": "#/components/parameters/PositionParam"
},
{
"$ref": "#/components/parameters/ZoomParam"
}
],
"responses": {
Expand Down Expand Up @@ -1132,6 +1149,9 @@
},
{
"$ref": "#/components/parameters/PositionParam"
},
{
"$ref": "#/components/parameters/ZoomParam"
}
],
"responses": {
Expand Down Expand Up @@ -1263,6 +1283,9 @@
{
"$ref": "#/components/parameters/PositionParam"
},
{
"$ref": "#/components/parameters/ZoomParam"
},
{
"name": "href",
"in": "query",
Expand Down
Loading