Skip to content

Commit

Permalink
test: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
XVincentX committed Nov 19, 2019
1 parent b6aedf0 commit 2ba9889
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Prism has values for path/query params bolded and in color [#743](https://github.com/stoplightio/prism/pull/743)
- The CLI now displays a timestamp for all the logged operations [#779](https://github.com/stoplightio/prism/pull/779)
- Prism has now support for OpenAPI 3.0 callbacks [#716](https://github.com/stoplightio/prism/pull/716)
- Prism body validator will now show allowed enum parameters in error messages [#828](https://github.com/stoplightio/prism/pull/828)

## Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ exports[`convertAjvErrors() message field is missing converts properly 1`] = `
Array [
Object {
"code": "required",
"message": "undefined",
"message": "",
"path": Array [
"b",
],
Expand Down
2 changes: 1 addition & 1 deletion packages/http/src/validator/validators/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const convertAjvErrors = (errors: Ajv.ErrorObject[] | undefined | null, s
return {
path: error.dataPath.split('.').slice(1),
code: error.keyword || '',
message: `${error.message}${allowedParameters}` || '',
message: `${error.message || ''}${allowedParameters || ''}`,
severity,
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ HTTP/1.1 422 Unprocessable Entity
content-type: application/problem+json
Connection: keep-alive

{"type":"https://stoplight.io/prism/errors#UNPROCESSABLE_ENTITY","title":"Invalid request body payload","status":422,"detail":"Your request is not valid and no HTTP validation response was found in the spec, so Prism is generating this error for you.","validation":[{"location":["body"],"severity":"Error","code":"required","message":"should have required property 'id'"},{"location":["body","status"],"severity":"Error","code":"enum","message":"should be equal to one of the allowed values"}]}
{"type":"https://stoplight.io/prism/errors#UNPROCESSABLE_ENTITY","title":"Invalid request body payload","status":422,"detail":"Your request is not valid and no HTTP validation response was found in the spec, so Prism is generating this error for you.","validation":[{"location":["body"],"severity":"Error","code":"required","message":"should have required property 'id'"},{"location":["body","status"],"severity":"Error","code":"enum","message":"should be equal to one of the allowed values: open, close"}]}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ HTTP/1.1 422 Unprocessable Entity
content-type: application/problem+json
Connection: keep-alive

{"type":"https://stoplight.io/prism/errors#UNPROCESSABLE_ENTITY","title":"Invalid request body payload","status":422,"detail":"Your request is not valid and no HTTP validation response was found in the spec, so Prism is generating this error for you.","validation":[{"location":["body"],"severity":"Error","code":"required","message":"should have required property 'id'"},{"location":["body","status"],"severity":"Error","code":"enum","message":"should be equal to one of the allowed values"}]}
{"type":"https://stoplight.io/prism/errors#UNPROCESSABLE_ENTITY","title":"Invalid request body payload","status":422,"detail":"Your request is not valid and no HTTP validation response was found in the spec, so Prism is generating this error for you.","validation":[{"location":["body"],"severity":"Error","code":"required","message":"should have required property 'id'"},{"location":["body","status"],"severity":"Error","code":"enum","message":"should be equal to one of the allowed values: open, close"}]}
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ HTTP/1.1 422 Unprocessable Entity
content-type: application/problem+json
Connection: keep-alive

{"type":"https://stoplight.io/prism/errors#UNPROCESSABLE_ENTITY","title":"Invalid request body payload","status":422,"detail":"Your request is not valid and no HTTP validation response was found in the spec, so Prism is generating this error for you.","validation":[{"location":["body"],"severity":"Error","code":"required","message":"should have required property 'id'"},{"location":["body","status"],"severity":"Error","code":"enum","message":"should be equal to one of the allowed values"}]}
{"type":"https://stoplight.io/prism/errors#UNPROCESSABLE_ENTITY","title":"Invalid request body payload","status":422,"detail":"Your request is not valid and no HTTP validation response was found in the spec, so Prism is generating this error for you.","validation":[{"location":["body"],"severity":"Error","code":"required","message":"should have required property 'id'"},{"location":["body","status"],"severity":"Error","code":"enum","message":"should be equal to one of the allowed values: open, close"}]}
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ HTTP/1.1 422 Unprocessable Entity
content-type: application/problem+json
Connection: keep-alive

{"type":"https://stoplight.io/prism/errors#UNPROCESSABLE_ENTITY","title":"Invalid request body payload","status":422,"detail":"Your request is not valid and no HTTP validation response was found in the spec, so Prism is generating this error for you.","validation":[{"location":["body"],"severity":"Error","code":"required","message":"should have required property 'id'"},{"location":["body","status"],"severity":"Error","code":"enum","message":"should be equal to one of the allowed values"}]}
{"type":"https://stoplight.io/prism/errors#UNPROCESSABLE_ENTITY","title":"Invalid request body payload","status":422,"detail":"Your request is not valid and no HTTP validation response was found in the spec, so Prism is generating this error for you.","validation":[{"location":["body"],"severity":"Error","code":"required","message":"should have required property 'id'"},{"location":["body","status"],"severity":"Error","code":"enum","message":"should be equal to one of the allowed values: open, close"}]}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ curl -i http://localhost:4010/path
====expect====
HTTP/1.1 500 Internal Server Error

{"type":"https://stoplight.io/prism/errors#VIOLATIONS","title":"Request/Response not valid","status":500,"detail":"Your request/response is not valid and the --errors flag is set, so Prism is generating this error for you.","validation":[{"location":["response","body"],"severity":"Error","code":"enum","message":"should be equal to one of the allowed values"}]}
{"type":"https://stoplight.io/prism/errors#VIOLATIONS","title":"Request/Response not valid","status":500,"detail":"Your request/response is not valid and the --errors flag is set, so Prism is generating this error for you.","validation":[{"location":["response","body"],"severity":"Error","code":"enum","message":"should be equal to one of the allowed values: placed, approved, delivered"}]}

0 comments on commit 2ba9889

Please sign in to comment.