Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question from sanmoy27 #17

Open
supamii opened this issue Aug 8, 2016 · 8 comments
Open

question from sanmoy27 #17

supamii opened this issue Aug 8, 2016 · 8 comments
Labels

Comments

@supamii
Copy link
Owner

supamii commented Aug 8, 2016

@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

@sanmoy27
Copy link
Contributor

sanmoy27 commented Aug 8, 2016

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

@supamii
Copy link
Owner Author

supamii commented Aug 8, 2016

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.

@supamii
Copy link
Owner Author

supamii commented Aug 8, 2016

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?

@sanmoy27
Copy link
Contributor

sanmoy27 commented Aug 8, 2016

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

@sanmoy27
Copy link
Contributor

sanmoy27 commented Aug 8, 2016

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

@sanmoy27
Copy link
Contributor

sanmoy27 commented Aug 9, 2016

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);
        }
    });

}

};

@sanmoy27
Copy link
Contributor

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

@sanmoy27
Copy link
Contributor

latest version of swagger will resolve the above issue

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

No branches or pull requests

2 participants