DaveJS / dave.schema.json

JSON Schema for JSON Hypermedia API Language.
Mozilla Public License 2.0
19 stars 7 forks source link

Validate _links.*.href as URIs or URI Templates with pattern #2

Open superstructor opened 12 years ago

superstructor commented 12 years ago

Implement a regular expression to be used as a pattern to validation link hrefs as URIs or URI Templates. format is not suitable because the uri format won't work for URI Templates.

talios commented 12 years ago

If the check matches a URI Template, if the associated "templated": true attribute should present as per section 5.2, is such a conditional check possible with JSON Schema?

superstructor commented 12 years ago

Conditionals are not supported by JSON Schema.

Union types are supported which means an instance must be one of the provided types.

It will be implemented with a type for URI and a type for URI template, checking both href and templated values.

Its possible I'll use extends to share common schema rules for URI vs URI template links.