Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support top level class block #10

Closed
tpluscode opened this issue Jun 25, 2019 · 3 comments
Closed

Support top level class block #10

tpluscode opened this issue Jun 25, 2019 · 3 comments
Assignees

Comments

@tpluscode
Copy link
Member

Intro

To test resources, we need to be able to distinguish their shapes. Hydra and SIREN both come with a term Class, which we could use a common denominator for a "type of resource".

DSL snippet

With Class http://schema.org/Person {
}

Details

Note that the class id does not have to be a URI. Any string should be acceptable. No whitespace for now

Generated JSON

This should translate to a root level Class step

{
  "steps": [{
    "type": "Class",
    "classId": "http://schema.org/Person"
  }]
}
mchlrch referenced this issue in hypermedia-app/api-testing-dsl Jun 28, 2019
@mchlrch
Copy link
Collaborator

mchlrch commented Jun 28, 2019

On the DSL side, I used the default STRING terminal rule from Xtext for the name/id instead of defining a custom terminal rule:

With Class "http://schema.org/Person" {
}

generates ..

{
	"steps": [
		{
			"type": "Class",
			"classId": "http://schema.org/Person",
			"children": [
			]
		}
	]
}

@tpluscode
Copy link
Member Author

On the DSL side, I used the default STRING terminal rule from Xtext for the name/id instead of defining a custom terminal rule:

I don't understand what that means :)

@mchlrch
Copy link
Collaborator

mchlrch commented Jun 29, 2019

Xtext ships some commonly used terminals [1] and our language is using these [2]. This is pragmatic and we can change once we need/want to.

The effect of using STRING for the name/id is that the name/id is in double-quotes and just a string without constraints on the content. This is maybe not what we want in the long run but good to get started. It allows us to play with both simple and URI identifiers. For URI identifiers, we would otherwise need to define a custom terminal instead. Once we need identifiers that are cross-referenceable, we will come back to this.

1: https://github.com/eclipse/xtext-core/blob/master/org.eclipse.xtext/src/org/eclipse/xtext/common/Terminals.xtext
2: https://github.com/zazuko/api-testing-dsl/blob/master/com.zazuko.apitesting.dsl/com.zazuko.apitesting.dsl/src/com/zazuko/apitesting/dsl/ApiTestingDsl.xtext#L1

@tpluscode tpluscode transferred this issue from hypermedia-app/api-testing-dsl Jul 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants