Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

Swagger-server response the POST content instead of mock data #32

Open
davidtran opened this issue Sep 12, 2016 · 1 comment
Open

Swagger-server response the POST content instead of mock data #32

davidtran opened this issue Sep 12, 2016 · 1 comment

Comments

@davidtran
Copy link

davidtran commented Sep 12, 2016

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 ?

@davidtran davidtran changed the title The "timing" property ("2016-09-14T13:00:00") appears to be the REST resource's name Swagger-server response the POST content instead of mock data Sep 12, 2016
@JamesMessinger
Copy link
Owner

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).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants