Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when removing an Element class URI #921

Open
beepsoft opened this issue Jun 7, 2023 · 1 comment
Open

Error when removing an Element class URI #921

beepsoft opened this issue Jun 7, 2023 · 1 comment

Comments

@beepsoft
Copy link

beepsoft commented Jun 7, 2023

I am editing an Element and added two class URI-s to the Element.

When I try to remove one of them and save the element and error happens

screencast-cedar.metadatacenter.org-2023.06.07-09_50_52.webm

Here's the specific error I received:

{
    "errorKey": "invalidData",
    "objects": {
        "validationReport": {
            "validates": "false",
            "warnings": [],
            "errors": [
                {
                    "message": "array is too short: must have at least 2 elements but instance has 1 elements",
                    "location": "/required",
                    "additionalInfo": {
                        "schemaFile": "#",
                        "schemaPointer": "/definitions/templateElementRequiredContent"
                    }
                },
                {
                    "message": "object has missing required properties (['@id'])",
                    "location": "/properties",
                    "additionalInfo": {
                        "schemaFile": "#",
                        "schemaPointer": "/definitions/templateElementPropertiesFieldContent"
                    }
                }
            ]
        }
    },
    "errorMessage": "array is too short: must have at least 2 elements but instance has 1 elements\nobject has missing required properties (['@id'])\n",
    "parameters": {},
    "errorReasonKey": "validationError",
    "status": "BAD_REQUEST",
    "statusCode": 400
}

Here is the Element JSON Schema:

{
  "@id": "https://repo.metadatacenter.org/template-elements/2b615909-fc16-4a19-aad9-b822be800866",
  "@type": "https://schema.metadatacenter.org/core/TemplateElement",
  "@context": {
    "xsd": "http://www.w3.org/2001/XMLSchema#",
    "pav": "http://purl.org/pav/",
    "bibo": "http://purl.org/ontology/bibo/",
    "oslc": "http://open-services.net/ns/core#",
    "schema": "http://schema.org/",
    "schema:name": {
      "@type": "xsd:string"
    },
    "schema:description": {
      "@type": "xsd:string"
    },
    "pav:createdOn": {
      "@type": "xsd:dateTime"
    },
    "pav:createdBy": {
      "@type": "@id"
    },
    "pav:lastUpdatedOn": {
      "@type": "xsd:dateTime"
    },
    "oslc:modifiedBy": {
      "@type": "@id"
    }
  },
  "type": "object",
  "title": "Elementwithuri element schema",
  "description": "Elementwithuri element schema generated by the CEDAR Template Editor 2.6.19",
  "_ui": {
    "order": [
      "someField"
    ],
    "propertyLabels": {
      "someField": "someField"
    },
    "propertyDescriptions": {
      "someField": "Help Text"
    }
  },
  "properties": {
    "@context": {
      "type": "object",
      "properties": {
        "someField": {
          "enum": [
            "https://schema.metadatacenter.org/properties/8903d187-8963-4c17-aace-17396f9b0c8a"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "someField"
      ]
    },
    "@type": {
      "oneOf": [
        {
          "type": "string",
          "format": "uri",
          "enum": [
            "http://data.bioontology.org/ontologies/OGSF/classes/http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FOGI.owl%23Author"
          ]
        },
        {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "format": "uri",
            "enum": [
              "http://data.bioontology.org/ontologies/OGSF/classes/http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FOGI.owl%23Author"
            ]
          },
          "uniqueItems": true
        }
      ]
    },
    "someField": {
      "@type": "https://schema.metadatacenter.org/core/TemplateField",
      "@context": {
        "xsd": "http://www.w3.org/2001/XMLSchema#",
        "pav": "http://purl.org/pav/",
        "bibo": "http://purl.org/ontology/bibo/",
        "oslc": "http://open-services.net/ns/core#",
        "schema": "http://schema.org/",
        "skos": "http://www.w3.org/2004/02/skos/core#",
        "schema:name": {
          "@type": "xsd:string"
        },
        "schema:description": {
          "@type": "xsd:string"
        },
        "skos:prefLabel": {
          "@type": "xsd:string"
        },
        "skos:altLabel": {
          "@type": "xsd:string"
        },
        "pav:createdOn": {
          "@type": "xsd:dateTime"
        },
        "pav:createdBy": {
          "@type": "@id"
        },
        "pav:lastUpdatedOn": {
          "@type": "xsd:dateTime"
        },
        "oslc:modifiedBy": {
          "@type": "@id"
        }
      },
      "type": "object",
      "title": "someField field schema",
      "description": "someField field schema generated by the CEDAR Template Editor 2.6.19",
      "_ui": {
        "inputType": "textfield"
      },
      "_valueConstraints": {
        "requiredValue": false
      },
      "properties": {
        "@type": {
          "oneOf": [
            {
              "type": "string",
              "format": "uri"
            },
            {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "format": "uri"
              },
              "uniqueItems": true
            }
          ]
        },
        "@value": {
          "type": [
            "string",
            "null"
          ]
        },
        "rdfs:label": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "@value"
      ],
      "schema:name": "someField",
      "schema:description": "Help Text",
      "pav:createdOn": "2023-06-07T00:49:58-07:00",
      "pav:createdBy": "https://metadatacenter.org/users/6d752aff-64a9-4c82-81fc-250538cb88ed",
      "pav:lastUpdatedOn": "2023-06-07T00:49:58-07:00",
      "oslc:modifiedBy": "https://metadatacenter.org/users/6d752aff-64a9-4c82-81fc-250538cb88ed",
      "schema:schemaVersion": "1.6.0",
      "additionalProperties": false,
      "skos:prefLabel": "Some field",
      "@id": "https://repo.metadatacenter.org/template-fields/97a291ae-6c85-4d97-974f-1ec9fc08ebca",
      "$schema": "http://json-schema.org/draft-04/schema#"
    },
    "@value": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "schema:name": "elementWithUri",
  "schema:description": "",
  "required": [
    "@value"
  ],
  "pav:createdOn": "2023-06-07T00:49:24-07:00",
  "pav:createdBy": "https://metadatacenter.org/users/6d752aff-64a9-4c82-81fc-250538cb88ed",
  "pav:lastUpdatedOn": "2023-06-07T00:49:58-07:00",
  "oslc:modifiedBy": "https://metadatacenter.org/users/6d752aff-64a9-4c82-81fc-250538cb88ed",
  "schema:schemaVersion": "1.6.0",
  "additionalProperties": false,
  "pav:version": "0.0.1",
  "bibo:status": "bibo:draft",
  "schema:identifier": "elementWithUri",
  "$schema": "http://json-schema.org/draft-04/schema#"
}
@martinjoconnor
Copy link
Member

Thanks for this report. We are making some updates to the Medata Editor in the next few weeks and will try to tackle this.

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

No branches or pull requests

3 participants