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

[PHP][Lumen] body name parameter should be ignore #7455

Open
robertocastro opened this issue Jan 19, 2018 · 2 comments
Open

[PHP][Lumen] body name parameter should be ignore #7455

robertocastro opened this issue Jan 19, 2018 · 2 comments

Comments

@robertocastro
Copy link

Description

When I generate a Lumen server stub from swagger editor online, generated controller has param validation for body name. Documentation here
say that this name is ignored but Lumen Stub has check for body name parameter.

Swagger-codegen version

online swagger editor 2.2.3

Swagger declaration file content or url
paths:
  /visite:
    post:
      security:
        - api_key: []
      tags:
        - Visite
      summary: Ajouter une visite
      description: ''
      operationId: addVisite
      consumes:
      - application/json
      produces:
      - application/json
      parameters: 
      - name: body
        in: body
        description: Objet visite à ajouter
        required: true
        schema:
          $ref: '#/definitions/Visite'

Lumen stub has this check :

if (!isset($input['body'])) {
    throw new \InvalidArgumentException('Missing the required parameter $body when calling addVisite');
}
@wing328
Copy link
Contributor

wing328 commented Jan 29, 2018

@robertocastro did you document the body parameter as "required" in your spec? What about changing it to optional instead?

Ref: https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/lumen/api.mustache#L77-L81

@robertocastro
Copy link
Author

@wing328 it's not about optional or required but trying to implement 2.0 specs like here : https://swagger.io/docs/specification/2-0/describing-request-body/
Particularly this : "The payload name. It is required but ignored (it is used for documentation purposes only)."
I documented a body parameter called 'body' but 'body' parameter is never sent when executing request from swagger-ui so server side should not check this parameter.

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

No branches or pull requests

2 participants