To date, I have been using pyswagger to execute API operations where I know the parameters that are specified, their types, which are required, etc. For example:
response = client.request (self.op['addEmployee'] (employee={'firstName': 'David', 'lastName': 'Pumpkins'}}
But now I want to programatically and generically generate these parameters, based on the definitions in the Swagger spec. And since Pyswagger has already interpreted the Swagger, I don't want to have to do it myself.
So in the above example, I would like to fetch the operation by ID:
op = self.op['addEmployee']
Then find somewhere in this operation object the guides needed for me to create the employee object. I would need to know that this operation takes one parameter, called 'employee', which is required. And that that object has two required parameters, both strings, called 'firstName' and 'lastName'. And also an optional age parameter, which is an integer, with an allowed range of 0 to 128. And also an optional group parameter, a string property with a default of 'none'.
With this information, I could build an employee object, which I could then pass to the operation execution:
response = op (employee=myEmployee)
Does pyswagger have any facility like this?
Thanks.
To date, I have been using pyswagger to execute API operations where I know the parameters that are specified, their types, which are required, etc. For example:
But now I want to programatically and generically generate these parameters, based on the definitions in the Swagger spec. And since Pyswagger has already interpreted the Swagger, I don't want to have to do it myself.
So in the above example, I would like to fetch the operation by ID:
op = self.op['addEmployee']
Then find somewhere in this operation object the guides needed for me to create the employee object. I would need to know that this operation takes one parameter, called 'employee', which is required. And that that object has two required parameters, both strings, called 'firstName' and 'lastName'. And also an optional age parameter, which is an integer, with an allowed range of 0 to 128. And also an optional group parameter, a string property with a default of 'none'.
With this information, I could build an employee object, which I could then pass to the operation execution:
Does pyswagger have any facility like this?
Thanks.