I'll have a more detailed read-through later, but much of it looks good at first glance.
You have mis-used "id", though - your reference {"$ref": "#/gallery"} points to the "gallery" property of the root object - which does not exist.
Don't use "id" here - just leave that property out, and use {"$ref": "#"} to refer back to the root of the document.
You also want to modify your URI Templates. By default, URI Templates percent-encode all values - so if your value of "id" is "/Gallery1/Gallery1.a", then the resulting URI for "href" will be "%2FGallery1%2FGallery1.a". You should use "{+id}" - the plus signifies that special characters should not be escaped.
Hi,
Please find, in attachment, a "draft" hyper schema, I apologize for the following dumb questions, but I'm warmming up with JSON hyper schema, and it would like some advices / opinions from "experts" about this example.
Thanks in advance !
Let me describe my sample, its constraints and what I would like to achieve.
I would like to have a schema for a data structure that represents a photo gallery (hyper schema specs draft #4)
I have 2 kind of data:
* a Gallery, a recursive structure :
- an id: opaque string, but that should be an URL where its information can be grabbed, required
- a parent: opaque string, but that should be an URL where its "parent" gallery information can be grabbed, required
- a name: string, required
- number of pictures in this gallery or its sub-galleries: integer, mandatory
- an array of sub-galleries: array of "gallery" objects, from 0 to unlimited items, recursion takes place here ..., required, but could be empty
- an array of pictures: see below, required but could be empty
* a Picture
- an id: opaque string, but that should be an URL where its information can be grabbed, required
- a name: string, required
Now, with this structure in mind, I would like to express with hyper schema the following "links" :
I would like each gallery to have a "link" to itself (self), its direct ancestor (parent) and to each picture it contains.
And then I would like a picture to have a "link" to itself (self) and its binary content.
Let's imagine that
- I have the following sub galleries:
- Each gallery has 0+ pictures
--
Tom