metadatacenter / cedar-model-validation-library

Library for validating all CEDAR model artifacts
Other
1 stars 2 forks source link

Unable to Post Standalone Attribute-Value Field to CEDAR #152

Open yancao77 opened 5 months ago

yancao77 commented 5 months ago

I can't post a standalone attribute-value field to CEDAR. Here is the attribute-value field that I generated.

{
    "items": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "@context": {
            "bibo": "http://purl.org/ontology/bibo/",
            "oslc": "http://open-services.net/ns/core#",
            "oslc:modifiedBy": {
                "@type": "@id"
            },
            "pav": "http://purl.org/pav/",
            "pav:createdBy": {
                "@type": "@id"
            },
            "pav:createdOn": {
                "@type": "xsd:dateTime"
            },
            "pav:lastUpdatedOn": {
                "@type": "xsd:dateTime"
            },
            "schema": "http://schema.org/",
            "schema:description": {
                "@type": "xsd:string"
            },
            "schema:name": {
                "@type": "xsd:string"
            },
            "skos": "http://www.w3.org/2004/02/skos/core#",
            "skos:altLabel": {
                "@type": "xsd:string"
            },
            "skos:prefLabel": {
                "@type": "xsd:string"
            },
            "xsd": "http://www.w3.org/2001/XMLSchema#"
        },
        "@id": null,
        "@type": "https://schema.metadatacenter.org/core/TemplateField",
        "_ui": {
            "inputType": "attribute-value"
        },
        "additionalProperties": false,
        "bibo:status": "bibo:draft",
        "description": "Data Characteristics Table in Key-Value Pairs is generated by CEDAR CLI",
        "oslc:modifiedBy": null,
        "pav:createdBy": null,
        "pav:createdOn": null,
        "pav:lastUpdatedOn": null,
        "pav:version": "0.0.1",
        "schema:description": "Enter the name of the characteristic being described in the first (key) field, and the value for that characteristic in the second (value) field. Note this is a repeating field and so can support multiple key-value pairs.",
        "schema:name": "Data Characteristics Table in Key-Value Pairs",
        "schema:schemaVersion": "1.6.0",
        "title": "Data Characteristics Table in Key-Value Pairs field schema",
        "type": "string"
    },
    "minItems": 0,
    "type": "array"
}

However, I received the following error when I tried to post it to CEDAR:

{
  "status": "BAD_REQUEST",
  "errorType": null,
  "errorKey": "templateFieldNotCreated",
  "errorReasonKey": null,
  "message": "The request body must include a non-empty '/schema:name' field",
  "parameters": {},
  "objects": {},
  "entities": {},
  "suggestedAction": "none",
  "originalException": null,
  "sourceException": null,
  "operation": null
}
martinjoconnor commented 5 months ago

The validator (which is defined in the cedar-model-validation-library repo) does not support standalone attribute-value field validation.

It could easily be modified to support it.

However, the server is expecting a schema:name and schema:description and provenance fields at the top level of all artifacts.

Not immediately clear what the level of effort needed to update this behaviour to handle standalone attribute-value fields, which do not have these fields at the top level