fhir-fuel / fhir-fuel.github.io

Place to prepare proposal to FHIR about JSON, JSON-Schema, Swagger/OpenAPI, JSON native databases and other JSON-frendly formats (yaml, edn, avro, protobuf etc) and technologies
Other
21 stars 0 forks source link

naming conventions for collections #7

Open yogthos opened 7 years ago

yogthos commented 7 years ago

Problem

Idiomatic JSON naming convention is to use plural names for collections, e.g:

{
   "name": [...]
}

Solution

We propose using plural names to hint that the value is a collection type:

{
   "names": [...]
}

This convention provides a hint to the user to indicate that the value referenced by the key is a collection, and makes it easier to navigate the JSON structure.

vadi2 commented 7 years ago

How do you propose it is displayed in the resource viewer however where it'll be name [0..*]?

yogthos commented 7 years ago

That's an interesting point, this would add inconvenience in mapping resource definitions to JSON.

grahamegrieve commented 7 years ago

we've talked about this on and off, but not as much as I expected to.

Either

is either is plural, then the question is, what's the algorithm for pluralising them? Would it be the java one in the build tool?

I think the current arrangement is least worse....

Grahame

On Tue, Jun 20, 2017 at 2:00 AM, Dmitri Sotnikov notifications@github.com wrote:

Problem

Idiomatic JSON naming convention is to use plural names for collections, e.g:

{ "name": [...] }

Solution

We propose using plural names to hint that the value is a collection type:

{ "names": [...] }

This convention provides a hint to the user to indicate that the value referenced by the key is a collection, and makes it easier to navigate the JSON structure.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fhir-fuel/fhir-fuel.github.io/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/AFllFcubdnhry8AU9fReDlArAHpWXBqvks5sFpsXgaJpZM4N-cMg .

--

http://www.healthintersections.com.au / grahame@healthintersections.com.au / +61 411 867 065

yogthos commented 7 years ago

fair enough

vadi2 commented 7 years ago

Asking a possibly stupid question, why not call it names in the FHIR resource model if has max >1 multiplicity?

grahamegrieve commented 7 years ago

that would be the 'make the XML name plural' option.

And the simple reason is: FHIR was originally derived from 37Signals 'baseacamp', and they did it the way we do it.

How's that for a prosaic?

Grahame

On Thu, Jun 29, 2017 at 10:50 PM, Vadim Peretokin notifications@github.com wrote:

Asking a possibly stupid question, why not call it names in the FHIR resource model if has max >1 multiplicity?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fhir-fuel/fhir-fuel.github.io/issues/7#issuecomment-311956391, or mute the thread https://github.com/notifications/unsubscribe-auth/AFllFaN608KraeA88JTe2PLa0Q3DASSGks5sI52HgaJpZM4N-cMg .

--

http://www.healthintersections.com.au / grahame@healthintersections.com.au / +61 411 867 065

vadi2 commented 7 years ago

Yep, fair enough. XML is still kicking around so it's a topic to revisit in a decade...

grahamegrieve commented 7 years ago

there's one thing the json crowd could do to make it easier for us to fix on json only eventually, and that's to add comments.

Grahame

On Fri, Jun 30, 2017 at 12:30 AM, Vadim Peretokin notifications@github.com wrote:

Yep, fair enough. XML is still kicking around so it's a topic to revisit in a decade...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fhir-fuel/fhir-fuel.github.io/issues/7#issuecomment-311984625, or mute the thread https://github.com/notifications/unsubscribe-auth/AFllFe4qs0ZQ3JxytMXB9IUrtbOPi6toks5sI7UIgaJpZM4N-cMg .

--

http://www.healthintersections.com.au / grahame@healthintersections.com.au / +61 411 867 065