node.js - Swagger Editor - declare request json body fields as formData, but send these as json -
i'm using latest swagger editor, , server api accepted json body requests, if declare parameter formdata docs developer. question: how can declare parameter formdata when try send json body request. tried swagger editor oldest version 2.9.6 , declare parameter formdata , declare "produces" , "consumes" "application/json" if try on editor works, if generate nodejs-server , try send content-type form-url-encoding, following screenshots:
if generate nodejs-server, not works:
how can declare parameter formdata when try send json body request.
you can't. api specification contract between client , server , supposed precisely define server behavior. if server expects json, specification must use in: body
parameters , not in: formdata
. if server works in 1 way , spec states way, it's useless.
if want use formdata
parameters in spec, change server accept form data , write spec accordingly.
Comments
Post a Comment