Is there any current or planned support for JSON Hyper-Schema?

[original thread by Ryan Riley]

Hi @ryan-riley(ryan-riley), sadly we don’t support the JSON Hyper-Schema nor do we plan to support it in the near future. Can you elaborate on your use cases for which you would like to see JSON Forms supporting the JSON Hyper-Schema?

[Ryan Riley]

I would like to have a way of exposing the different actions that a user could take from a given form, e.g. submit, cancel, save and continue editing, perhaps a link to a policy, etc.

Usually these actions are handled outside of JSON Forms. However if you would like to handle them within JSON Forms you can simply add these buttons and links via custom renderers.

[maulik-modi]

@sdirix(sdirix) , We have a requirement to pull dropdown options from remote source/REST API endpoint instead of describing as Enum in schema.json - https://restcountries.eu/rest/v2/all

[maulik-modi]

@ryan-riley(ryan-riley) , do you think Json hyper-schema is a good fit

[maulik-modi]

there are other REST based APIs as well - Airport codes, Area codes, States, Currency

Hi @maulik-modi(maulik-modi), in cases like this we usually recommend to write a custom renderer which handles the REST communication and renders the result by reusing the existing enum renderers. In the extended material renderers we also offer an autocomplete-text-enum combination which you can reuse.

The custom renderer can be implemented generically, for example by specifying the REST url in the JSON Schema or UI Schema.

[maulik-modi]

@sdirix(sdirix) , Is there any way to extend Json schema with custom attributes e.g. apiUrl / remoteSource or any other custom fields

[maulik-modi]

We still want to validate json schema on frontend before begining rendering

Hi @maulik-modi(maulik-modi), in JSON Schema you can define arbitrary references. However you then need tools like ‘json-refs’ which are able to resolve them. We even have some way to resolve them within JSON Forms, see the docs here.

However you usually want to validate on the server in any case. So when you resolve the schema anyway on the server you could also already hand over the resolved JSON Schema to the client (i.e. JSON Forms). This reduces the overall complexity and makes sure that server and client can’t be mismatched.

[maulik-modi]

@sdirix(sdirix) thanks a lot

[maulik-modi]

@sdirix(sdirix) , Does json form complain if we add links field

[maulik-modi]

“links”: [{
“rel”: “author”,
“href”: “https://api.dashron.com/users/12345”,
“targetMediaType”: “application/json”,
“targetSchema”: {
“id”: { “type”: “number” },
“name”: { “type”: “string” }
}
}]

Depends where it is added :wink: Most likely it’ll just be ignored.

[maulik-modi]

SubmissionSchema and TargetSchema are really interesting from the forms point of view, imagine a situation where form is loaded from one site and submitted to another endpoint

[maulik-modi]

@ryan-riley(ryan-riley) thanks for bringing this topic

[maulik-modi]

I could host my form on SSG host such as Netlify and post form to some Serverless endpoint - heroku/lambda

The main use case of JSON Forms is to render forms. Communication from and to different end points is usually handled by the application using JSON Forms.