Comments (5)
Maybe we should make the location required again, but allow omitting all fields?
I don't think this provides much value. What's the purpose of an empty object?
Alternatively, we could keep location as optional, but make location.lat and location.lon optional as well. (Potentially with some rules to say that if one of them is defined, the other one must be defined as well.)
I'd like that.
This question is a release blocker for v15.
I don't think it should really be a blocker.
from schema.
I don't think this provides much value. What's the purpose of an empty object?
The empty object isn't the goal in itself, but it would be an alternative form of indicating that a space has no location.
The suggestion with a required "location" would mainly be that there aren't two ways to communicate the same thing. If the location can be omitted, and lat/lon are optional as well, then these two variants are equivalent in meaning:
{
"location": {}, // Legal, because lat/lon are optional
}
{
// Omit location completely
}
With the discussion about null potentially being an allowed value, there would even be a third way to indicate the same thing (although we don't currently allow null anywhere in the v15 draft):
{
"location": null,
}
I generally prefer to have one right (canonical) way to represent something.
Keep in mind that in v15 we're explicitly making the location key optional. The first suggestion would be to instead make the lat/lon fields optional. That's also why I marked it as release blocker, because the discussion is about potentially reverting a decision we did in the current v15 draft. (And such things are easier before the release.)
from schema.
My favored solution would be to have location
optional but require that if it is provided that at least one subkey must be provided (so making "location": {}
illegal).
from schema.
My favored solution would be to have
location
optional but require that if it is provided that at least one subkey must be provided (so making"location": {}
illegal).
Can this be easily implemented? Sounds like quite complex validation logic to me, that probably not every consumer of the JSON schema will implement 🙂
But to keep things simple, we can simply make both lat/lon optional and keep the location key optional as well (because I also think that an empty object is a bit ugly). The vast majority of spaces will have a location anyways.
from schema.
I'd suggest to leave it as is for v15 (optional location
field, but if it is present have at least lat
/lon
) to not block the release.
But to keep things simple, we can simply make both lat/lon optional and keep the location key optional as well (because I also think that an empty object is a bit ugly). The vast majority of spaces will have a location anyways.
This can then be implemented in a v16 and we could add validation that if lat
is present also lon
is present or similar (should be doable with anyOf
).
from schema.
Related Issues (20)
- Tag the schema HOT 2
- nullable state.open HOT 10
- Location: Space address vs postal address HOT 3
- Provide at least one reference implementation for v15
- Streams HOT 1
- 3D Printers HOT 4
- Update to new JSON Schema version HOT 2
- Make SpaceAPI REST again HOT 11
- Release 0.14 HOT 1
- Schema not reachable via $id HOT 9
- Country code HOT 3
- Validate schema fails HOT 2
- Proper examples in schema HOT 1
- state.open cannot be undefined when supporting both v13 and v0.14 HOT 3
- Allow adding metadata to webcams HOT 1
- Space state via MQTT HOT 5
- Add extra `location` details HOT 3
- Add optional `lastchange` for sensor values
- Question: how to provide forward compatibility for newer clients? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from schema.