Last active
March 18, 2016 00:19
-
-
Save marbemac/ab1cad6cb1e4c85e63e5 to your computer and use it in GitHub Desktop.
A barebones swagger example, that includes the StopLight extension to instruct Prism to validate and add a response header to all requests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"host": "myapi.com", | |
"schemes": ["http"], | |
"info": {}, | |
"paths": {}, | |
"definitions": {}, | |
"x-stoplight": { | |
"beforeScript": "function(ctx, request) {}", | |
"afterScript": "function(ctx, request, response) { // messages contain any warnings or errors var messages = response.validate(); var isValid = response.valid.get(); // Set a header here, so that your testing tools can throw errors appropriately if (isValid) { response.header.set('Validation', 'Passed'); } else { response.header.set('Validation', 'Failed'); } }", | |
"mock": { | |
"enabled": false, | |
"dynamic": false | |
}, | |
"functions": {} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment