-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: validate latitude and longitude (#16)
It is now impossible to decode a position with an invalid latitude or longitude. There are two motivations for this change: 1. General correctness. 2. `@mapeo/mock-data` is currently generating invalid latitudes and longitudes because of the schema in this repo. That causes [some workarounds if you need valid coordinates][0], and I plan to add more tests that will require similar workarounds. I felt that fixing the problem here, at the source, was best. [0]: https://github.com/digidem/comapeo-cloud/blob/d6ab53197ac3970ee8f287ddb30663a04c6449d1/test/add-alerts-endpoint.js#L240-L243
- Loading branch information
Showing
10 changed files
with
51 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"type": "TYPE_POINT", | ||
"coordinates": [123, 91], | ||
"lengths": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"type": "TYPE_POINT", | ||
"coordinates": [181, 12], | ||
"lengths": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "TYPE_UNSPECIFIED", | ||
"coordinates": [100, 102], | ||
"coordinates": [123, 45], | ||
"lengths": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "TYPE_POLYGON", | ||
"coordinates": [100, 101, 102, 103, 104, 105], | ||
"coordinates": [1, 2, 3, 4, 5, 6], | ||
"lengths": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "TYPE_POLYGON", | ||
"coordinates": [100, 101, 102, 103, 104, 105, 106, 107], | ||
"coordinates": [0, 1, 2, 3, 4, 5, 6, 7], | ||
"lengths": [5] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "TYPE_POINT", | ||
"coordinates": [100, 101, 102], | ||
"coordinates": [12, 34, 56], | ||
"lengths": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,9 @@ | |
[ | ||
[ | ||
[0, 0], | ||
[100, 0], | ||
[100, 100], | ||
[0, 100], | ||
[12, 0], | ||
[123, 45], | ||
[0, 12], | ||
[0, 0] | ||
] | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters