Skip to content

Commit

Permalink
Updated the documentation on validating external examples
Browse files Browse the repository at this point in the history
  • Loading branch information
joelrosario committed Oct 7, 2024
1 parent eb74a8c commit 89e3f78
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions documentation/external_examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,7 @@ External Examples

## Validate External Examples

All examples in a specification can be easily validated using the command `java -jar specmatic.jar examples validate --contract-file <path to openapi file>`

This command validates examples that can be run (either as test or stub), including:

1. external examples in the `_examples` directory of the specification
2. inline request and response examples having matching names
3. inline requests where the response has no body
4. inline responses where the request has no body
All examples in a specification can be easily validated using the command `java -jar specmatic.jar examples validate --contract-file <path to openapi file>`.

It will exit with return code `1` if any example is not in sync.

Expand Down Expand Up @@ -115,3 +108,5 @@ Let's try this out.
- Check the exit code. On MacOS or *nix, run `echo $?`. On Windows, run `echo %errorlevel%`. You'll see the exit code of `1`.

Now add a name to the request in the above example, and try running the command again. This time the validation will succeed.

You will find other helpful parameters for this command by running `java -jar specmatic.jar examples validate --help`.

0 comments on commit 89e3f78

Please sign in to comment.