swagger-api / swagger-api/swagger-codegen

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

Open
#7,455 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

General: Question Server: PHP
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated PHP Lumen controller and its body-parameter validation shown in the issue, then trace back to the Lumen server stub template that produces it. Compare the validation with the Swagger 2.0 request-body rules and update the behavior so the body parameter name is ignored; confirm generation and request validation no longer require that name.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, php
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.