LionWeb-io / specification

Specifications of the LionWeb initiative
http://lionweb.io/specification/
6 stars 0 forks source link

Define language for validations as derived model #176

Open enikao opened 1 year ago

enikao commented 1 year ago

Checking a model for consistency and other errors is one of the most common operations on models. It might also be expensive: if we wanted to assure globally unique names, we had to check all named things in our model on every name change. The basic structure of validation is very similar in most systems: any issue has a severity level, refers to a node, might relate to a feature, and provides an error message.

As an example, we might define concepts for Error, Warning, and Info.

My specific validator implementation would create instances of Error and Info, but also include a custom compiler-based validation language that defines GeneratorWarning and CompilerWarning as specializations of Warning. A client that only knows about this validation base language can process both of the specialized warnings in a generic fashion. Another, compiler-aware client might display GeneratorWarnings differently than CompilerWarnings.

dslmeinte commented 1 year ago

Is this a language for reporting violations of constraints (/validations), or one for defining those constraints? I think we need both. The definition language is a lot of work: basically something like KernelF. The reporting language can be much smaller.

enikao commented 1 year ago

Is this a language for reporting violations of constraints (/validations), or one for defining those constraints?

It's the reporting language that would be passed to the API (#173). I added an example to the description.

ftomassetti commented 1 year ago

Would this mean defining a class Issue very similar to this one https://github.com/Strumenta/kolasu/blob/cf9663f9c9488bf885359cba1f498cc27f35d20e/core/src/main/kotlin/com/strumenta/kolasu/validation/Validation.kt#L19?

dslmeinte commented 1 year ago

Quite likely :D

ftomassetti commented 1 year ago

I think that in most cases issues may refer to nodes but there are exceptions, in particular if we want to report issues emerged during parsing or unserializing. In that case we may refer to a position in text or a JSON element, if the error is so bad to prevent building a proper node

dslmeinte commented 1 year ago

I think that we need many quite different kinds of issue types, to take into account what you can point to as the problem. The correctness proposal as well as Jos' implementation of the validators also plays into this.

enikao commented 6 months ago

First draft: https://github.com/LionWeb-io/lionweb-mps/pull/89