Swagger POST Json Body Parameter Schema YAML
<p>i'm working on a RESTful API using swagger-api and swagger-editor for routes.
I can't figure out why the JSON i am sending through body, never reaches my controller.
here is my YAML </p>

<pre><code>  schemes:
  - http
  - https

produces: [application/json, multipart/form-data, application/x-www-form-urlencoded]

paths:
 /projects:
    x-swagger-router-controller: project
    post:
      description: create a new project
      operationId: postProjects
      consumes:
        - application/json
      parameters:
        - name: param1
          in: body
          description: description
          required: false
          schema:
            $ref: "#/definitions/Project" 
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/Project" 
        default:
          description: Error
          schema: 
            $ref: "#/definitions/ErrorResponse"

definitions:
  Project:
    properties:
      name:
       type: string
    required:
      - name
</code></pre>

<p>an example of the post request i'm sending.</p>

<pre><code>curl -v -X POST -H "Content-Type: application/json" -d '{"name":"test"}' http://127.0.0.1:10010/projects
</code></pre>

<p>and the response</p>

<pre><code>{"message":"Request validation failed: Parameter (param1) failed schema validation","code":"SCHEMA_VALIDATION_FAILED","failedValidation":true,"results":{"errors":[{"code":"OBJECT_MISSING_REQUIRED_PROPERTY","message":"Missing required property: name","path":[]}],"warnings":[]},"path":["paths","/projects","post","parameters","0"],"paramName":"param1"}
</code></pre>

<p>If i set the parameter "name" as not required, i just received an empty response like this
    { param1: 
       { path: [ 'paths', '/projects', 'post', 'parameters', '0' ],
         schema: 
          { name: 'param1',
            in: 'body',
            description: 'description',
            required: false,
            schema: [Object] },
         originalValue: {},
         value: {} } }
I have no clue why since other format such as header, path or formdata works fine.
I always receive an empty object. <code>req.swagger.params</code> has no value.
I tried several schema but even the simplest is not working.
i can tell from the header that 'content-type': 'application/json'.
So the content type is set, the schema validates a simple string argument named "name". Everything should be ok. but still not.</p>