React-jsonschema-form: "title" in jsonschema vs "ui:title" in uischema

Created on 19 Jun 2018  路  3Comments  路  Source: rjsf-team/react-jsonschema-form

Which of these props is preferred? "ui:title" seems like the best option, since the field title/label is purely cosmetic (i.e. it does not affect the schema). But "ui:title" doesn't seem to work across the board. For example, it has no effect for array or boolean types ("title" in the jsonschema works fine for both).

There are also examples that have both "title" and "ui:title" defined. Is there any reason for this or are these examples "in transition"?

bug documentation help wanted

Most helpful comment

Just a few thoughts on this:

  • While "title" is defined as a valid JSON Schema keyword (https://json-schema.org/understanding-json-schema/reference/generic.html), my interpretation is that it's meant to describe the schema, combined with "description", not necessarily something that should be displayed in a UI.
  • In order to separate the data from the presentation layer, "ui:title" seems like a more appropriate way to express the title of a field in a UI.
  • For i18n, the "title" in the schema may be in one language (native to the developer, for example), while there may be multiple UI schemas with different "ui:title" languages, based on the UI user's preference.
  • For backward compatibility, perhaps "ui:title" should be the standard, with fallback to "title" if "ui:title" isn't defined.

PS - I would also suggest that the same could be said for "ui:description" with fallback to "description".

All 3 comments

It's also strange because

title is preferred over ui:title for ObjectFieldTemplate

ui:title is preferred over title for ArrayField and SchemaField

We need to harmonize this behavior to at least make it consistent.

Just a few thoughts on this:

  • While "title" is defined as a valid JSON Schema keyword (https://json-schema.org/understanding-json-schema/reference/generic.html), my interpretation is that it's meant to describe the schema, combined with "description", not necessarily something that should be displayed in a UI.
  • In order to separate the data from the presentation layer, "ui:title" seems like a more appropriate way to express the title of a field in a UI.
  • For i18n, the "title" in the schema may be in one language (native to the developer, for example), while there may be multiple UI schemas with different "ui:title" languages, based on the UI user's preference.
  • For backward compatibility, perhaps "ui:title" should be the standard, with fallback to "title" if "ui:title" isn't defined.

PS - I would also suggest that the same could be said for "ui:description" with fallback to "description".

PLEASE YES. It's weird, title has no effect sometimes and its not even showing even with the title in jsonschema. Only label is shown. Gona open an issue on this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anttivikman picture anttivikman  路  3Comments

ClockerZadq picture ClockerZadq  路  3Comments

jabaren picture jabaren  路  3Comments

j-zimnowoda picture j-zimnowoda  路  3Comments

norim13 picture norim13  路  3Comments