'id' attribute annoying

228 views
Skip to first unread message

Walter

unread,
Apr 15, 2012, 9:49:47 PM4/15/12
to json-...@googlegroups.com
The notion of a self-reference seems like it could be useful sometimes.

However, with 'id' right now, one would assume that far more often it
will only serve to prevent the most obvious, concise, common and
simple means of providing existing unique object identifiers as a
field in a JSON schema (ie. using 'id' as a field providing the
primary identifier for some object from some backend database).

I suggest removing 'id' as and replacing it with '$self'.

This is unlikely to cause naming conflicts as it is out of
conventional namespace.

(Not sure what the formal significance of '$' was for '$ref', but I
see this as partly related functionality.)

- Walter

Walter

unread,
Apr 15, 2012, 10:21:07 PM4/15/12
to json-...@googlegroups.com
> I suggest removing 'id' as and replacing it with '$self'.
>
> This is unlikely to cause naming conflicts as it is out of
> conventional namespace.
>
> (Not sure what the formal significance of '$' was for '$ref', but I
> see this as partly related functionality.)

Erp. Actually just waking up and realised it's a level above
properties. But even then, it seems like rather than aligning the
naming of each it may be useful to include '$' as a prefix for all
aspects of a JSON Schema structure not directly describing a physical
property of the described structure in order to clearly delineate
them.

What was the rationale behind the use of '$' in some contexts,
originally? Only to delineate physical references from
meta-references within the properties portion of the JSON Schema?

Does anyone else feel it will increase conceptual clarity to prefix
everything non-physical within any JSON Schema document (properties,
links, type, format, etc.)?

- Walter

Francis Galiegue

unread,
Apr 16, 2012, 2:00:27 AM4/16/12
to json-...@googlegroups.com
On Mon, Apr 16, 2012 at 04:21, Walter <walter....@gmail.com> wrote:
[...]

>
> What was the rationale behind the use of '$' in some contexts,
> originally?  Only to delineate physical references from
> meta-references within the properties portion of the JSON Schema?
>
> Does anyone else feel it will increase conceptual clarity to prefix
> everything non-physical within any JSON Schema document (properties,
> links, type, format, etc.)?
>

No idea why the $ made its appearance at all, but your suggestion
makes sense. If not $self, then at least $id would be a good idea.

--
Francis Galiegue, fgal...@gmail.com
"It seems obvious [...] that at least some 'business intelligence'
tools invest so much intelligence on the business side that they have
nothing left for generating SQL queries" (Stéphane Faroult, in "The
Art of SQL", ISBN 0-596-00894-5)

Reply all
Reply to author
Forward
0 new messages