Manifest
Stub manifest documentation
# data/users.yaml
version: v1.1 # 1
type: Rule # 2
rules: # 3
- when: path.userId == 2 # 3.1
request: # 3.2
path: /users/{userId} # 3.2.1
method: GET # 3.2.2
relative: true # 3.2.3
response: # 3.3
status: 200 # 3.3.1
headers: # 3.3.2
content-type: application/json
body: # 3.3.3
id: ${path.userId}
name: ${tables.name}
file: myfile.txt # 3.3.4
delay: 333 # 3.3.5
tables: # 3.3.6
- name: name
key: path.userId
values:
1: Foo
callback: println('Hello') # 3.4Description:
version- version of manifesttype- for type of object declarationrules- block for rules groupingwhen- conditional statementrequest- request setuppath- endpoint pathmethod- endpoint methodrelative- relative to current folder path(calculates from stubs folder)
response- this block was added to change a declaration solution related to foldersstatus- http status of responseheaders- response headersbody- response bodyfile- response body from the file contentsdelay- responsible for network latency simulationtables- source of data for templating (For more info, please follow next link)
callback- post action hook
More info about each field could be found in next.
Relative request declaration
relative parameter allows you to declare endpoints relative to the content root.
For example: If you create a file in the following user/groups folder, set relative to true and create the following manifest:
Next endpoint will be generated user/groups/report/1.
Default values of Stub
version
v1.3
type
Stub
request.path
/
request.method
GET
request.relative
true
Different styles of manifest
The following declaration styles are allowed
First
Second
Third
Fourth
More info
RecipesTemplateLast updated