Hydra grammar

The Hydra subgrammar extends the core grammar by adding terms specific to the Hydra specification.

Hydra scenarios are text files with .hydra extension.

Supported steps

Helper statements

Raw Xtext grammar

grammar app.hypermedia.testing.dsl.Hydra with app.hypermedia.testing.dsl.Core

import "http://testing.hypermedia.app/dsl/core"
generate hydra "http://testing.hypermedia.app/dsl/hydra"

HydraScenario:
    (namespaces+=NamespaceDeclaration)*
    (entrypoint=EntrypointStep)?
    (defaultHeaders=ScenarioHeadersBlock)?
    (steps+=TopLevelStep)*;

@Override
TopLevelStep:
    super |
    OperationBlock;

@Override
RepresentationStep:
	super |
	OperationBlock |
	RdfTypeStatement |
	IdentifierStatement
;

@Override
Identifier:
    UriName |
    PrefixedName
;

RdfTypeStatement:
    ExpectModifier 'Type' id=Identifier
;

IdentifierStatement: 
    ExpectModifier 'Id' id=Identifier
;

NamespaceDeclaration:
    'PREFIX' prefix=PrefixDeclaration namespace=URI
;

PrefixDeclaration: value=PREFIX;
UriName: value=URI;
PrefixedName: value=QNAME;

OperationBlock:
    modifier=Modifier 'Operation' name=Identifier ('{'
        (invocations+=InvocationBlock)*
    '}')?
;

InvocationBlock:
    'Invoke' (request=RequestBlock '=>')? response=ResponseBlock
;

terminal URI:
    '<' ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\'|'>'|'<') )* '>'
;
terminal PREFIX: ID ':';
terminal QNAME: PREFIX (INT | ID | '/' | '%' | '-')+;
Last Updated: 7/28/2019, 4:42:22 PM