Uploaded image for project: 'Realm Core'
  1. Realm Core
  2. RCORE-474

Don't bleed non-idiomatic terminology into SDKs

      Errors thrown when opening a Realm (using Realm JS) with an invalid schema contains types and terminology which is not used anywhere in the RealmJS documentation.

      For example, when accidentally defining a schema with a list with optional elements of some object type:

      const Realm = require("realm");
      new Realm({
        schema: [{
          name: "SomeClass",
          properties: {
            someList: { type: "list", objectType: "SomeClass", optional: true },
          },
        }],
      });
      

      The following error [is thrown](
      https://github.com/realm/realm-object-store/blob/master/src/object_schema.cpp#L167):

      Error: Schema validation failed due to the following errors:
      - Property 'SomeClass.someList' of type 'array' cannot be nullable.
      

      It uses words like "array" and "nullable", which is not a part of the Realm JS terminology. This is potentially very confusing for a newcomer trying to write a schemas and getting errors in the process.

      I created this issue on the realm-object-store repository because I believe it should support some sort of mapping of these terms on a per-SDK level. An alternative solution would be to check for these conditions in Realm JS, before parsing a potentially invalid schema to object store, but that duplicates logic across multiple code-bases and that also didn't seem ideal.

            Assignee:
            Unassigned Unassigned
            Reporter:
            nikola.irinchev@mongodb.com Nikola Irinchev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: