ah-swagger-plugin
ah-swagger-plugin copied to clipboard
question from sanmoy27
@sanmoy27
In post call I have there is a field named field1 which is mandatory to be provided in the body,which is mentioned as inputs field1:{required: true} but in swagger this input field is going as query parameter. When I am mentioning it in model schema it is going in body as well as quey parameters. I want to mention only in body not as query parameters
Also I have put call in order to upload a file,I cannot change the content-type to applucation/binary instead of application/json and also the option to choose file is not appearing.Please help
Also I have put call in order to upload a file,I cannot change the content-type to applucation/binary instead of application/json and also the option to choose file is not appearing.Please help
I believe that uploads are fairly limited (buggy) with the version of swagger that is used. You'll just have to settle for POSTMAN/etc in the meanwhile.
When I am mentioning it in model schema it is going in body as well as quey parameters. I want to mention only in body not as query parameters
Can you provide a more detailed example of how exactly you are defining your parameters?
I dont have any query parameters,I just have body in my POST call { "field1":"string" } and my action is like this /api/analytics/jobs POST call In swagger it is appearing like /api/analytics/jobs?field=xyz
I just want.to pass this field only in body
Yes I know multipart form upload is buggy in swagger so for now is it possible to bring the choose file option field in swagger
exports.createTask = {
name: 'createTask',
description: 'It will create a Task and will return an id in reponse',
summary: 'It will create a Task and will return an id in reponse',
inputs: {
jobName: { required: true }
},
responseSchemas: {
// By default set this 200 property to provide a sample response in the form of a JSON schema
// object. Since schemas can get pretty bulky, consider requiring a file instead of having
// everything in-line. E.g. '200': require('myResponseSchema.js')
//
// It's also possible to automate schema generation with json-schema-generator with json-patch.
'200': {
description: 'Sample http 200 response',
schema: {
type: 'object',
properties: {
'jobName': {
type: 'string'
},
'jobId': {
type: 'string'
},
'createdTime': {
type: 'integer'
},
'isCron': {
type: 'boolean'
},
'jobState': {
type: 'string'
},
'isReadyToRun': {
type: 'boolean'
},
'cronTime': {
type: 'integer'
},
'scheduleStatus': {
type: 'string'
},
'scheduleAt': {
type: 'integer'
},
'counts': {
type: 'integer'
},
'startAt': {
type: 'integer'
},
'endAt': {
type: 'integer'
}
}
}
}
},
modelSchema: {
jobName: {
type: 'string'
}
},
run: function(api, data, next){
var apiKey = data.connection.rawConnection.req.headers['x-api-key'];
api.taskController.addTask(data.params.jobName,apiKey, function(error, success){
if(error)
next(error);
else {
data.response.success = success;
next(error, success);
}
});
}
};
In post call I have there is a field named field1 which is mandatory to be provided in the body,which is mentioned as inputs field1:{required: true} but in swagger this input field is going as query parameter. When I am mentioning it in model schema it is going in body as well as quey parameters. I want to mention only in body not as query parameters
latest version of swagger will resolve the above issue