Skip to content

Request - Improve array to foreign logic and dictionary viewer #457

Description

@edsu7

Summary of request

  1. Support element uniqueness check WITHIN array
  2. Improve description of array elements mapping to foreign key

Details

As an example I have the following schema:

{
  "name": "my-dictionary",
  "version": "1.0",
  "schemas": [
    {
      "name": "donor",
      "description": "Core donor record",
      "fields": [
        {
          "name": "donor_id",
          "valueType": "string",
          "description": "Unique identifier for the donor",
          "restrictions": {
            "required": true,
            "regex": "^DO-[0-9]{3,}$"
          }
        }
      ],
    "restrictions": {
      "uniqueKey": ["donor_id"]
    }
    },
    {
      "name": "fam",
      "description": "Core donor record",
      "fields": [
        {
          "name": "donor_ids",
          "valueType": "string",
          "isArray": true,
          "delimiter": "|",
          "description": "Unique identifier for the donor",
          "restrictions": {
            "required": true,
            "regex": "^DO-[0-9]{3,}$"
          }
        }
      ],
      "restrictions": {
        "foreignKey": [
          {
            "schema": "donor",
            "mappings": [
              {
                "local": "donor_ids",
                "foreign": "donor_id"
              }
            ]
          }
        ]
      }
    }
  ]
}

Where in fam, multiple donor_ids (in an array) can reference donor_id in donor

  1. There's no syntax to check element uniqueness in array.
    e.g. ["A","A","B"]
  2. Lectern viewer description could be more descriptive and also references the wrong field:
Image

Desired solution

Re 2.
Example text:

Arrays of `donor_id` as defined in the donor schema. .
Each array element must reference an existing: donor_id in the donor schema. 
Array elements must be unique.

Additional context

Diagram viewer looks good

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions