Schema
Chimera supports schema files as input to define mock API routes and auto-generate data.
Directoryproject/
- schema.json
Run chimera with schema.json
chimera-cli --path schema.json http -X
This runs chimera-cli
as a mock http
server at port 8080
using schema.json
Sample schema.json
File
Section titled “Sample schema.json File”{ "routes": [ { "path":"api/v2/data", "no_of_entries": 2, "schema": { "id": "id", "created_on": "date", "mssg": "lorem" }, "null_percentage": 5 }, { "path":"products", "no_of_entries": 3, "schema": { "id": "id", "rsnd": "integer", "name": "name", "probability": "boolean", "date": "datetime", "desc": "lorem" }, "null_percentage": 0 } ]}
Here
path
: The API endpointno_of_entries
: It is the no. of objects in the response of the endpointnull_percentage
: It is the percent ofnull
values that will be present in the responseschema
: It is the schema for the response of that endpoint
Supported Placeholders for Schema
Section titled “Supported Placeholders for Schema”Placeholder | Description | ||
---|---|---|---|
name | Random name | ||
id | Random number | ||
integer | Random number | ||
date | Date in DD-MM-YYYY format | ||
datetime | Date in DD-MM-YYYYTHH:MM:SS format | ||
lorem | Random text | ||
string | Random word | ||
boolean | Random boolean value |