New answers tagged

0

A good practice in Json communication is to never treat a missing field any differently from a field with null as the value. If you do, you will suffer in the future while trying to maintain sanity and backwards compatibility at the same time. You can ommit null in your response, to make it shorter, but don’t rely on it in your client. Take a look for ...


0

As already suggested by others, it is reasonable to allow a city contain more than one facility of each type. One more way to allow this would be to have each type of buildings represented by a property containing array of buildings of that type. This way if you have no hospital in a city you have empty array of hospitals. This gives you much stronger ...


2

Your design doesn’t allow a city to have two hospitals, Ewan’s approach allows it, so that’s a lot better. In your example, is there a port with no information, or no port? Again, in Ewan’s version you either have no “port” entry or an entry with type=port and nothing else. The additional entry [airport, railway_station ...] has no value. At best it is ...


2

Why do you think you need to specify keys for facilities that are not present? Why not just omit them entirely. { "city": { "cityName": "Gotham", "population": "8620000", "facilities": { "airport": { "name": "Batman International Airport", "numRunways": 7, "...


5

In your case where there simply isnt a building of that type I would go for an array of Building { "city" : { "buildings" : [ { "type": "airport", "name": "Batman International Airport", "numRunways": 7, "dailyCommuters": 340000 }, { ...


1

But what if someone in the front-end decides to send hundreds, thousands, or millions of these duplicated tags all at once? Can you handle it? (On both sides?) Imho, the easiest way for handling this is to make it so that, for example, the user interface in the front-end, uses a "chip-like" entry of data for these tags, that can come from a dropdown or ...


1

What does a version number represent? A release is the output generated by following a defined process using build tools on source code. So, if the release process or build tools change, even when used on the same source code, then the release should be considered a different version. It is because of this, that the version number should be managed by ...


5

Read the version from metadata generated at build time One thing you can do is to read the version from your Git tags at build time. Generate the version from your git tags after commiting, as a part of the release process. After determining the version at the beginning of the build process, store it as metadata in a text or key/value pair file, in a ...


Top 50 recent answers are included