Skip to content

[Discussion] Should Diagnostic#collectLeaves merge some parent diagnostics with children ? #49

@vhemery

Description

@vhemery

Hello folks,

I am encountering a use case where Diagnostic json objects returned by Diagnostic#collectLeaves method have a "-1" uri fragment.

This is due to this validation method :
org.eclipse.emf.ecore.util.EObjectValidator.validate_DataValueConforms(EObject, EAttribute, DiagnosticChain, Map<Object, Object>)
which creates a Diagnostic hierarchy like :

  1. root Diagnostic
  2. child Diagnostic on EObject : "The feature '...' of '...' contains a bad value"
  3. grand-child Diagnostic on the value (without model element, but with an EDataType instead) : "The value '...' must be one of {'...'}"

The #collectLeaves method, as currently implemented, only returns the grand-child Diagnostic, without the associated model EObject.
Nevertheless the relevant information is actually not the grand-child Diagnostic, but rather the concatenation of child Diagnostic and grand-child Diagnostic.
In Theia, since the Problems view can not display an arborescence of Diagnostics like in RCP, I was wondering which was the best course of action for this issue.

Should we :

  • A. Modify the Diagnostics hierarchy directly in the model server to merge such diagnostics and having only relevant leave Diagnostics ? (in org.eclipse.emfcloud.modelserver.emf.common.DefaultModelValidator.validate(String))
  • B. Leave the Diagnostics hierarchy as is and modify the Diagnostic#collectLeaves method to merge leave Diangostics information with the information from their relevant parent Diagnostic ?
  • C. Seek for another way to display Diagnostics, without the Problems view, or with heavy modifications to the Problems view ?

For the moment, I'll patch my application with the A approach, as it is the more easily overrideable one. But I think the B approach would probably be the one making more sense in a general context...

[Edit : the grand-child Diagnostic actually has an EObject, which is not a model element but the EDatatype which makes things worse]

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmodelserverEMF.cloud Model Server Theia

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions