Aidbox / Issues

Issue tracker for Aidbox FHIR backend by Health Samurai
7 stars 0 forks source link

[BUG] Can't set isUnique restriction to attribute on an entity using NodeJS SDK #527

Closed ArmellaJuan closed 1 year ago

ArmellaJuan commented 1 year ago

Describe the bug When using NodeSDK I can't create an entity with a unique attribute.

Severity Major

Steps to reproduce the behavior:

  1. Create an AidboxApp with the next entity:
const Entity = {
  attrs: {
    adtRecordId: {
      type: 'id',
      unique: true
    }
  }
};

or

const Entity = {
  attrs: {
    adtRecordId: {
      type: 'id',
      isUnique: true
    }
  }
};

Expected behavior It should create an entity with an adtRecordId attribute that has the isUnique: true restriction.

Screenshots I receive this error when I try to do that: (Used the same request via POSTMAN on the [PUT] /APP endpoint with the same schema)

image
{
    "resourceType": "OperationOutcome",
    "id": "invalid",
    "text": {
        "status": "generated",
        "div": "Cannot save manifest because of errors: [{:path [:entities :Entity :attrs :adtRecordId :isUnique], :message \"extra property\"}]"
    },
    "issue": [
        {
            "severity": "fatal",
            "code": "invalid",
            "diagnostics": "Cannot save manifest because of errors: [{:path [:entities :Entity :attrs :adtRecordId :isUnique], :message \"extra property\"}]"
        }
    ]
}

Also the error in the app console: image

Versions:

Additional context I can do this via the REST API setting isUnique: true in the entity but when I reload the app the entity is overwritten and the attribute no longer has that restriction.

VarvaraSemenova commented 1 year ago

Hi, thank you for reporting the issue. Bug is confirmed, estimated fix delivery time is Aug, 9

krevedkokun commented 1 year ago

@ArmellaJuan, hi. We fixed your issue, it's available on :edge. Please pull new version and let us know if it's working for you.

ArmellaJuan commented 1 year ago

Cool after switching to that image seems working:

      type: 'id',
      isUnique: true
    },

And in devbox:

Screen Shot 2022-08-09 at 10 10 22 AM

Thanks!