Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Unique key constrain in json(How can)
Unique key constrain in json [message #1003677] Mon, 21 January 2013 19:06 Go to next message
Mr Manner is currently offline Mr Manner
Messages: 26
Registered: January 2013
Junior Member
I have a grammer to parse/validate json. The root json object can contain a set of allowed keys.
Basic setup:

Object:
	'{' 
		(members+=Member)?
		(',' members+=Member)*
	'}';

Member:
	GenericMember | VersionMember | LoggingMember;

VersionMember:
	'\"version\"' ':' version=STRING;

LoggingMember:
	'\"file\"' ':' version=STRING; 

GenericMember:
	key=STRING ':' value=Value;


How can I ensure that there is only one VersioMember or LoggingMember is allowed.
Re: Unique key constrain in json [message #1003680 is a reply to message #1003677] Mon, 21 January 2013 19:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6388
Registered: July 2009
Senior Member
ID write a simple check (yoursdljavavalidator)

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de
Re: Unique key constrain in json [message #1007005 is a reply to message #1003680] Sun, 03 February 2013 19:04 Go to previous message
Frank Tagne is currently offline Frank Tagne
Messages: 7
Registered: August 2012
Junior Member
You can also use ScopeProvider to propose only the current allowed Member Type after that user has filled 1st Member.

[Updated on: Sun, 03 February 2013 19:05]

Report message to a moderator

Previous Topic:Standalone Java Application
Next Topic:How to build multiple entities in one rule?
Goto Forum:
  


Current Time: Sat Oct 25 04:32:02 GMT 2014

Powered by FUDForum. Page generated in 0.02682 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software