Question

Hi Swagger/Restler friends,

How can I allow users to make easy test for php function and classes?

I have a class as follow:

    class Author

{
    /**
     * @var string {@from body} {@min 3}{@max 100}
     * name of the Author {@required true}
     */
    public $name = 'Name';
    /**
     * @var string {@type email} {@from body}
     * email id of the Author
     */
    public $email = 'name@domain.com';
}

and I want to generate html documentation for a class that is as the follow:

class ComplexType {

/**
 * post 2 Authors
 *
 * @param Author $author1
 * @param Author $author2
 *
 * @return Author
 */
function post2Authors(Author $author1,Author $author2) {
    return $author1;
}
}

It gives me when I run index.html the following to input:

{
    "author1": "",
    "author2": ""
}

But I need to view json input as follow:

{
    "author1": 
      {
           "name": "",
           "email": ""
      },
    "author2": {
          "name": "",
          "email": ""
     }
}

thank you in advance

Was it helpful?

Solution

Default value serves as an easy starter for trying the API with Restler API Explorer.

Currently it does not offer model parsing when more than one body parameter is found thus we are stuck with

{
    "author1": "",
    "author2": ""
}

We are working on support for Swagger 1.2 spec and along with that we will be releasing the full model parsing for default value along with that soon

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top