fhir-fuel.github.io icon indicating copy to clipboard operation
fhir-fuel.github.io copied to clipboard

naming conventions for collections

Open yogthos opened this issue 8 years ago • 8 comments

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.

yogthos avatar Jun 19 '17 16:06 yogthos

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

vadi2 avatar Jun 28 '17 12:06 vadi2

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

yogthos avatar Jun 29 '17 00:06 yogthos

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

Either

  • xml and json names differ
  • xml name is plural
  • json name is singular

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 [email protected] 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 / [email protected] / +61 411 867 065

grahamegrieve avatar Jun 29 '17 03:06 grahamegrieve

fair enough

yogthos avatar Jun 29 '17 12:06 yogthos

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

vadi2 avatar Jun 29 '17 12:06 vadi2

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 [email protected] 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 / [email protected] / +61 411 867 065

grahamegrieve avatar Jun 29 '17 13:06 grahamegrieve

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

vadi2 avatar Jun 29 '17 14:06 vadi2

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 [email protected] 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 / [email protected] / +61 411 867 065

grahamegrieve avatar Jun 29 '17 19:06 grahamegrieve