drdrej / rest-api-mock

simple rest api mock
MIT License
0 stars 1 forks source link

Support to build json like dsl for endpoints/mocks #3

Open drdrej opened 8 years ago

drdrej commented 8 years ago

example mock.json

{
  "test-case" : {
    "name": "xyz",
    "description": "dasdadasda",

    "state" : {
       // use this initial state for this test-case.
    }
  },

  "mocks" : [
    {
      "endpoint": {
        "method": "get",
        "path": "/item/5",

        // path://id == 5
        "pattern": "/item/:id",

        "match": [
          {
            "not": {
              "query://param1": {
                "is": "x"
              }
            }
          },
          {
            "query://param2": {
              "is": "y"
            }
          }
        ]
      },

      "log": true,
      "response": "call://response-1.js"
    }
  ]
}
drdrej commented 8 years ago

will use ajv? maybe.