znsio / specmatic

Turn your contracts into executable specifications. Contract Driven Development - Collaboratively Design & Independently Deploy MicroServices & MicroFrontends.
https://specmatic.io
MIT License
275 stars 51 forks source link

Fill-in-the-blanks partials #1254

Closed joelrosario closed 1 month ago

joelrosario commented 1 month ago

What:

Implemented support for the following syntax:

{
  "partial": {
    "http-request": {
      "method": "POST",
      "path": "/findAvailableProducts?type=$(TYPE:string)"
    },
    "http-response": {
      "status": 200,
      "response": [
        { "type": "$(TYPE)" }
      ]
    }
  }
}

Note how we have declared only the type key in the response, made possible because this is setup as a partial example.

Why:

This make test data management much simpler. Declare just what you want in the example. Specmatic will fill-in-the-blanks.

Checklist: