Does model server support EMF constraint validation #61
Replies: 13 comments
-
Hi @HBank, so your approach is correct and obviously the error definition worked ;-) . |
Beta Was this translation helpful? Give feedback.
-
[hansbank] Hi @eneufeld , |
Beta Was this translation helpful? Give feedback.
-
Hi @HBank yes this is the approach I would have in mind. Best |
Beta Was this translation helpful? Give feedback.
-
[Jonas Helming] Hi, I believe @simongraband is currently working on something like this. Would be great to align the two of you in terms of solution and contribution! |
Beta Was this translation helpful? Give feedback.
-
[simongraband] Yes this is correct. @HBank are you planning on making a contribution on this? If yes, please let me know so we dont do the same work twice :). I think that your approach is exactly what is needed here. If you want to discuss the approach more into detail or if you have any questions about what i am working on right now, feel free to contact me. |
Beta Was this translation helpful? Give feedback.
-
[hansbank] Hi @simongraband , |
Beta Was this translation helpful? Give feedback.
-
[simongraband] Hi @HBank, so i am working on my Master Thesis on 'model validation in graphical cloud based editors'. Is discussed this again yesterday, and the current plan is indeed to add another endpoint called validate, which validates the model considering all of the constraints in the metamodel. |
Beta Was this translation helpful? Give feedback.
-
[hansbank] Hi @simongraband(simongraband) , I found your thesis at the site of TUM, and it looks very thorough (gründlich!). Are there any plans to contribute (pieces of it) to model server? |
Beta Was this translation helpful? Give feedback.
-
[simongraband] Hey @HBank(hbank), there is a PR on the modelserver repo open with my changes. It needs some more improvements, but i hope i will have the time to do it this week. Also this PR will introduce a framework, that eases the usage of the validation endpoints. Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
[hansbank] Sounds good! Thank you |
Beta Was this translation helpful? Give feedback.
-
[Vincent HEMERY] @simongraband(simongraband) , can you clarify for me, on this PR, what you meant by 'live validation' ? |
Beta Was this translation helpful? Give feedback.
-
[simongraband] Hey @vhemery(vhemery), |
Beta Was this translation helpful? Give feedback.
-
[Vincent HEMERY] Thanks @simongraband(simongraband) . |
Beta Was this translation helpful? Give feedback.
-
Hi,
This is a question about how to add custom validation to a model that reside in Model server. This is what I did:
created an EMF model (following this blog: https://eclipsesource.com/blogs/tutorials/emf-tutorial/)
introduced a constraint on a certain field, in a similar way as described in this blog https://eclipsesource.com/blogs/2014/08/26/emf-validation-for-datatype-constraints/. This blog is from 2014, but hopes it is still valid
The constraint I defined is that one of the fields has a minimal length of 2. In the generated XyzValidate.java class, I see the generated code for the constraint:
In case I create an instance via Eclipse Modeling Framework, I see the error coming.
Next, I have taken model server from https://github.com/eclipse-emfcloud/emfcloud-modelserver, and launch it using a ModelServerLauncher that knows about my packages (like CoffeeModelServerLauncher from the coffee-editor, https://github.com/eclipsesource/coffee-editor/blob/master/backend/plugins/com.eclipsesource.coffee.modelserver/src/main/com/eclipsesource/coffee/modelserver/CoffeeModelServerLauncher.java)
Then I used Postman to GET/PATCH/POST models to/from model server. This works fine. Now I want to see my constraint being validated so I pass invalid data (with PATCH / POST). However, no error is reported.
So my question is now: Given the above scenario, should model server report an error?
And if this is not the right approach for defining constraints, is there another approach to add my own constraints on the model?
original thread by hansbank
Beta Was this translation helpful? Give feedback.
All reactions