jazzband / jsonmodels

jsonmodels is library to make it easier for you to deal with structures that are converted to, or read from JSON.
http://jsonmodels.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
335 stars 51 forks source link

Simple support for JSON-LD linked data fields #49

Closed ViktorHaag closed 9 years ago

ViktorHaag commented 9 years ago

Is it feasible to add a simple level of compatibility for JSON-LD linked data fields, without diving into the JSON-LD spec (i.e. just treat the fields as standard JSON fields, but with some recognition of their special names and formats).

I'm thinking maybe a "LinkedDataField" that derives from BaseField that starts with the standard var name in Python, and then appends/transforms the JSON-LD decorators as appropriate:

'id' = '' in Python that's a LinkedDataField becomes '@id' in the JSON serialized form?

or 'ld_at_id' in Python becomes '@id'?

This might be very convenient, but shouldn't necessarily mistaken for "full support for JSON-LD"...

Does this seem like a good idea? Or would you rather "support JSON-LD 'the right way' or not at all"?

I could probably see my way to adding a pull request for adding simple field name transformation, with maybe a little guidance, but only if you think it's a reasonable approach to take.

beregond commented 9 years ago

Hmmm... I don't say no, but let me first dive into JSON-LD more and think about it :)

ViktorHaag commented 9 years ago

That's quite fair. Thanks.

beregond commented 9 years ago

Well, I've looked a bit into it, so definitely json-ld is something worth implementing, yet still wonder about some technical stuff, like:

Anyway generating names with @ shouldn't be a big problem, stay tuned, I will give you more details about this soon.

beregond commented 9 years ago

@ViktorAtD2L - see this ticket -> #53