nexus icon indicating copy to clipboard operation
nexus copied to clipboard

Validation errors upon saving an edited resources should present the validation report

Open samuel-kerrien opened this issue 2 months ago • 0 comments

  Delta: 1.10.0-M8
  Fusion: v1.10.0-M2-fix-resource-download
  Environment: staging

  Platform Information:
  Operating System: Mac OS 10.15.7
  Browser: Chrome 124.0.0.0

How to reproduce the issue

  • Open this resource
  • edit the name property by adding a character
  • press save, you get a validation error. ok that validation error is a bug but the important point is that the message presented to the user that results from a validation error is very generic and pretty much useful to figure out what is wrong.
Screenshot 2024-04-30 at 10.25.24.png

However, if you go into the network tab, you can find out the actual validation report that is the useful part to know what part of the validation failed. Specifically:

  • the request that generates the error: https://staging.nise.bbp.epfl.ch/nexus/v1/resources/bbp/atlasdatasetrelease/_/https:%2F%2Fbbp.epfl.ch%2Fneurosciencegraph%2Fdata%2F56f57d4f-ca64-40cc-938c-5017ef4f4091?indexing=sync&rev=26

The relevant output I see in the network tab:

{
    "@context": [
        "https://bluebrain.github.io/nexus/contexts/shacl-20170720.json",
        "https://bluebrain.github.io/nexus/contexts/error.json"
    ],
    "@type": "InvalidResource",
    "reason": "Resource 'https://bbp.epfl.ch/neurosciencegraph/data/56f57d4f-ca64-40cc-938c-5017ef4f4091' failed to validate against the constraints defined in schema 'https://neuroshapes.org/dash/cellcompositionvolume?rev=122'",
    "details": {
        "@type": "sh:ValidationReport",
        "conforms": false,
        "result": {
            "@type": "sh:ValidationResult",
            "focusNode": "https://bbp.epfl.ch/neurosciencegraph/data/56f57d4f-ca64-40cc-938c-5017ef4f4091",
            "resultMessage": "Value must have all of the following shapes: _:2cda69afe6d9c03b141d4a9c9fc2896e, _:5dc1b5185de1a5e4319b8bcb29d81d68",
            "resultSeverity": "sh:Violation",
            "sourceConstraintComponent": "sh:AndConstraintComponent",
            "sourceShape": "https://neuroshapes.org/dash/cellcompositionvolume/shapes/CellCompositionVolumeShape",
            "value": "https://bbp.epfl.ch/neurosciencegraph/data/56f57d4f-ca64-40cc-938c-5017ef4f4091"
        },
        "targetedNodes": 2
    },
    "expanded": {
        "@id": "https://bbp.epfl.ch/neurosciencegraph/data/56f57d4f-ca64-40cc-938c-5017ef4f4091",
        "@type": [
            "https://bbp.epfl.ch/ontologies/core/bmo/CellCompositionVolume",
            "schema:Dataset",
            "https://bbp.epfl.ch/ontologies/core/bmo/AtlasDatasetRelease"
        ],
        "https://neuroshapes.org/atlasRelease": {
            "@id": "https://bbp.epfl.ch/neurosciencegraph/data/brainatlasrelease/c96c71a8-4c0d-4bc1-8a1a-141d9ed6693d",
            "@type": [
                "https://neuroshapes.org/BrainAtlasRelease",
                "https://neuroshapes.org/AtlasRelease",
                "prov:Entity"
            ],
            "rev": 43
        },
        "https://neuroshapes.org/atlasSpatialReferenceSystem": {
            "@id": "https://bbp.epfl.ch/neurosciencegraph/data/allen_ccfv3_spatial_reference_system",
            "@type": [
                "https://neuroshapes.org/AtlasSpatialReferenceSystem",
                "https://neuroshapes.org/BrainAtlasSpatialReferenceSystem"
            ]
        },
        "https://neuroshapes.org/brainLocation": {
            "https://neuroshapes.org/atlasSpatialReferenceSystem": {
                "@id": "https://bbp.epfl.ch/neurosciencegraph/data/allen_ccfv3_spatial_reference_system",
                "@type": [
                    "https://neuroshapes.org/AtlasSpatialReferenceSystem",
                    "https://neuroshapes.org/BrainAtlasSpatialReferenceSystem"
                ]
            },
            "https://neuroshapes.org/brainRegion": {
                "@id": "http://api.brain-map.org/api/v2/data/Structure/997",
                "rdfs:label": "root"
            }
        },
        "https://neuroshapes.org/contribution": [
            {
                "@type": "https://neuroshapes.org/Contribution",
                "prov:agent": {
                    "@id": "https://staging.nise.bbp.epfl.ch/nexus/v1/realms/bbp/users/lcristel",
                    "@type": [
                        "prov:Agent",
                        "schema:Person"
                    ]
                },
                "prov:hadRole": {
                    "@id": "https://neuroshapes.org/BrainAtlasPipelineExecutionRole",
                    "rdfs:label": "Brain Atlas Pipeline Executor role"
                }
            },
            {
                "@type": "https://neuroshapes.org/Contribution",
                "prov:agent": {
                    "@id": "https://www.grid.ac/institutes/grid.5333.6",
                    "@type": [
                        "schema:Organization",
                        "prov:Agent"
                    ]
                }
            }
        ],
        "https://neuroshapes.org/derivation": {
            "@type": "prov:Derivation",
            "prov:entity": {
                "@id": "https://bbp.epfl.ch/neurosciencegraph/data/brainatlasrelease/c96c71a8-4c0d-4bc1-8a1a-141d9ed6693d",
                "@type": "prov:Entity"
            }
        },
        "https://neuroshapes.org/subject": {
            "@type": "https://neuroshapes.org/Subject",
            "https://neuroshapes.org/species": {
                "@id": "http://purl.obolibrary.org/obo/NCBITaxon_10090",
                "rdfs:label": "Mus musculus"
            }
        },
        "schema:about": [
            {
                "@id": "https://neuroshapes.org/Neuron"
            },
            {
                "@id": "https://neuroshapes.org/Glia"
            }
        ],
        "schema:distribution": {
            "@type": "schema:DataDownload",
            "https://neuroshapes.org/digest": {
                "schema:algorithm": "SHA-256",
                "schema:value": "0244917afdd01fcadd02bf6eeb82687fc2ce8a482c1c7edabad2d2574a5345a4"
            },
            "prov:atLocation": {
                "@type": "prov:Location",
                "https://neuroshapes.org/location": "file:///gpfs/bbp.cscs.ch/data/project/nexustest/nexus-staging/bbp/atlasdatasetrelease/9/c/6/3/b/2/c/6/cellCompositionVolume_payload_staging.json",
                "https://neuroshapes.org/store": {
                    "@id": "https://bbp.epfl.ch/neurosciencegraph/data/e36cc443-84bf-46d6-83ba-70c17c1a6bef",
                    "@type": "https://bbp.epfl.ch/ontologies/core/bmo/RemoteDiskStorage",
                    "rev": 1
                }
            },
            "schema:contentSize": {
                "schema:unitCode": "bytes",
                "schema:value": 87273
            },
            "schema:contentUrl": {
                "@id": "https://staging.nise.bbp.epfl.ch/nexus/v1/files/bbp/atlasdatasetrelease/https%3A%2F%2Fstaging.nise.bbp.epfl.ch%2Fnexus%2Fv1%2Fresources%2Fbbp%2Fatlasdatasetrelease%2F_%2F7fd46cd9-6a5c-447f-9b43-3b4a1aa24849"
            },
            "schema:encodingFormat": "application/json",
            "schema:name": "cellCompositionVolume_payload_staging.json"
        },
        "schema:name": "Cell Composition Volume from Blue Brain Atlas "
    }
}

This response could be presented in the expanded form of the message, even if only as plain JSON it's already way more useful that having to dig it up in the network tab.

Icing on the cake, presenting a validation specific output that provides links to the relevant schema so the user can navigate to it without losing the vlaidation report currently on screen (e.g. opening a new tab).

samuel-kerrien avatar Apr 30 '24 08:04 samuel-kerrien