8

I am a beginner here and I have questions regarding JSON Hyper-Schema.

What is the purpose of links in Hyper-Schema and how do I validate them?

icc97
  • 11,395
  • 8
  • 76
  • 90
Lakshmanan
  • 91
  • 1
  • 5

1 Answers1

10

JsonSchema Hyper Schema is an extension to JsonSchema designed to support application level semantics, in a similar vein to something like swagger or RAML.

The JsonSchema standard was originally designed to have the same scope of something like XSD; that is, it's primarily about type definitions. Type definitions are important to things like API service contracts as it allows you to remove ambiguity about the resources your API deals with.

However, like XSD, JsonSchema says nothing about what kinds of operations your types will be exposed over. In the REST world, tools such as swagger were created to plug this gap. Hyper Schema would appear to be another tool for this purpose.

Onto your questions:

what is the purpose of links in hyper schema

Links are the mechanism by which a schema author can specify without ambiguity by what means the defined resources can be accessed.

how to validate them

You don't. A contract is a contract and does not require validation at the point of consumption. If your question is more about how to validate schema instances against a schema which contains links, again the answer is you do not. The links are there to tell any consumer how to semantically communicate with the resource.

tom redfern
  • 30,562
  • 14
  • 91
  • 126
  • thanks, tom I think I am a little bit clear now, but I have one small doubt is the hyper schema can be used for testing purposes in a recursive manner of calling those links and verifying the response with that schema. Is there any tool available for performing this kind of testing – Lakshmanan Apr 18 '17 at 15:02
  • 2
    @Lakshmanan - there is no built-in tooling I know of which would allow this kind of self-testing of linked targets. I think you'd have to create this yourself. If you do, open source it and I'll use it too! – tom redfern Apr 19 '17 at 13:03