Hi, All: Among other things, I hope that at the next PCP API meeting we will have a chance to discuss user feedback with regards to JSON Schemas. As far as I can see from the use cases discussed to date, we need an approach to providing end-user instructions, error feedback, and a clear understanding of how to handle this in multiple languages.
There is now a bit more concrete (slightly) prior art for us to consider. Over the weekend, the author of AJV released a library that addresses at least one of these concerns: https://github.com/epoberezkin/ajv-errors The new library adds support for an "errorMessage" keyword in schema definitions, which is in some ways similar to the "errors" keyword proposed as an addition to draft v5 of the JSON Schema standard <https://github.com/json-schema/json-schema/wiki/Custom-error-messages-(v5-proposal)> . Looking at their examples, it seems like the handling of "required" fields is already improved. You can specify a message by the required field name as opposed to specifying it by the position of the field in the "required" array. To fairly evaluate the new library, there are some questions about internationalisation that will need to be explored. In draft v5, it was possible to define error messages at a higher level that override the messages in parts of the deeper structure. In my opinion this was particularly useful for i18n and l10n, as you could simply inherit an underlying schema and overlay your own messages in a single block of top-level definitions. I will review the new library and see what (if any) tools they provide to help with i18n concerns. So, the library does not provide an approach to handling instructions, at least nothing beyond using the title and description keywords for labels and instructions respectively. If the title/description convention meets our needs, and if the i18n support is sufficient, the new library might be enough for our current needs, at least in the medium term. Even if the new library does not meet our needs, it's worth at least reviewing as a clear example of how we can define and seamlessly integrate a custom "metaschema" with AJV. So, that's all a bit detailed, but I wanted to share it early so that anyone who's interested can review and raise questions. As promised, I will be preparing a summary of the topic, including (hopefully) useful examples. I plan to include approaches to handling instructions, errors, and i18n, and to document and research as many questions and concerns raised in response to this thread as possible. I will send my summary around later in the week, likely late in the day on Wednesday. Any questions or concerns coming in after then, we can discuss in the meeting. Cheers, Tony
_______________________________________________ Architecture mailing list [email protected] http://lists.gpii.net/mailman/listinfo/architecture
