Skip to content

Commit

Permalink
Location: Make lat/lon optional, but add more validation logic
Browse files Browse the repository at this point in the history
- The `location` fields needs at least one property
- If `lat` is specified, then `lon` is required as well (and vice versa)
  • Loading branch information
dbrgn committed Nov 10, 2024
1 parent c17a9d4 commit 1d32216
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
17 changes: 11 additions & 6 deletions 15-draft.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
"type": "string"
},
"lat": {
"description": "Latitude of your space location, in degree with decimal places. Use positive values for locations north of the equator, negative values for locations south of equator.",
"description": "Latitude of your space location, in degree with decimal places. Use positive values for locations north of the equator, negative values for locations south of equator. If set, then \"lon\" must be set as well.",
"type": "number"
},
"lon": {
"description": "Longitude of your space location, in degree with decimal places. Use positive values for locations east of Greenwich, and negative values for locations west of Greenwich.",
"description": "Longitude of your space location, in degree with decimal places. Use positive values for locations east of Greenwich, and negative values for locations west of Greenwich. If set, then \"lat\" must be set as well.",
"type": "number"
},
"timezone": {
Expand Down Expand Up @@ -106,10 +106,15 @@
"minItems": 1
}
},
"required": [
"lat",
"lon"
]
"minProperties": 1,
"dependentRequired": {
"lat": [
"lon"
],
"lon": [
"lat"
]
}
},
"spacefed": {
"description": "A flag indicating if the hackerspace uses SpaceFED, a federated login scheme so that visiting hackers can use the space WiFi with their home space credentials.",
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Root level:
- [added] The `areas` field was added ([#107])
- [added] The `hint` field was added ([#102])
- [changed] Make entire `location` field optional to enable the inclusion of groups without physical location ([#106])
- [changed] If the `location` field is present, it requires at least 1 property ([#115])
- [changed] Make the `lat`/`lon` fields optional, but if one of them is provided, then the other one must be provided too ([#115])

`sensors`:

Expand Down Expand Up @@ -115,3 +117,4 @@ Root level:
[#106]: https://github.com/SpaceApi/schema/pull/106
[#108]: https://github.com/SpaceApi/schema/pull/108
[#107]: https://github.com/SpaceApi/schema/pull/107
[#115]: https://github.com/SpaceApi/schema/pull/115

0 comments on commit 1d32216

Please sign in to comment.