ULB-Darmstadt / shacl-form

HTML5 web component for editing/viewing RDF data that conform to SHACL shapes
https://ulb-darmstadt.github.io/shacl-form/
MIT License
24 stars 4 forks source link

Green checkmark even when invalid? #5

Closed benjaminaaron closed 8 months ago

benjaminaaron commented 8 months ago

I was wondering why the green checkmark shows up on the left side of a field, even so the input is invalid? In this example, I am only getting the invalid-message upon clicking Submit. The green checkmark makes me think, the value is alright. A red cross or turning the whole field red would make more sense to me?

Screenshot 2023-12-23 at 21 56 46

And it seems the invalid-info is already present before clicking submit, because when hovering over the little arrows, it does already show this message:

Screenshot 2023-12-23 at 21 58 50

benjaminaaron commented 8 months ago

In your Basic usage example I console-logged event.detail?.valid and it is actually true for invalid values. That doesn't seem right 🤔

s-tittel commented 8 months ago

Thanks for reporting. There are two separate validators at work here:

  1. The browser validating the input field according the the HTML element attribute type=number. The messages in your screenshot are the result of that.
  2. The rdf validator library that I use to validate the actual RDF data graph against the SHACL shape definitions, and this is where the green checkmark comes from.

There was a bug in my node shape definitions, which is now fixed. According to the spec, my node shape was missing this triple:

example:ArchitectureModelDataset a rdfs:Class .

RDF validation should now be working as expected.

benjaminaaron commented 8 months ago

It does work now as expected indeed, thanks!

Now I can't trigger the browser validation warning popup (from the screenshot) anymore though. I was hoping that would come up when I press Submit with warnings (which are now shown 👍) present. But instead the Submit-click takes me to the wrong field. Which also makes sense as a behaviour.

s-tittel commented 8 months ago

@benjaminaaron , please check version 1.3.5, I have reversed the validation order, so that browser validation executes before rdf graph validation.

benjaminaaron commented 8 months ago

Awesome, thanks, works great!