swagger-server
swagger-server copied to clipboard
Swagger-server response the POST content instead of mock data
I create an endpoint: POST /api/search/trips. When I send a request to this endpoint, swagger-server shows this in the console:
swagger:middleware The "timing" property ("2016-09-14T13:00:00") appears to be the REST resource's name +0ms
swagger:middleware Saving data at /api/search/trips/2016-09-14T13%3A00%3A00 +0ms
swagger:middleware /api/search/trips/2016-09-13T09%3A00%3A00 successfully updated +1ms
And it takes the POST request's content to response for my request, although I already provided a mock data for this request.
Here is the content of my POST request:
{"origin":{"latitude":21.1155282,"longitude":-101.65414780000003},"originDescription":"Boulevard Adolfo López Mateos Oriente G, Las Bugambilias, Leon, Mexico","destination":{"latitude":48.1489574,"longitude":16.381546399999934},"destinationDescription":"Favoritenstraße G, Vienna, Austria","timing":"2016-09-14T13:00:00","currency":"EUR","locale":"en-US","targetDate":false}
How can I prevent this behavior ?
See the documentation for how the mock middleware determiens primary keys. In your case the timing
property meets the criteria for the primary key (I'm guessing because it's a required property).