swagger-api / swagger-api/swagger-codegen

php-symfony doesn't set return model in doc-comment

Open
#12,498 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Hello!

I tried to create controllers interfaces and expect to see file like this https://github.com/swagger-api/swagger-codegen/blob/master/samples/server/petstore/php-symfony/SymfonyBundle-php/Api/PetApiInterface.php.

But after generation, i dont' see @return Swagger\Server\Model\Pet[]

/**
     * Operation findPetsByStatus
     *
     * Finds Pets by status
     *
     * @param  array $status  Status values that need to be considered for filter (required)
     * @param  int     &$responseCode    The HTTP Response Code
     * @param  array   $responseHeaders  Additional HTTP headers to return with the response ()
     *
     * @return array|object|null
     */
    public function findPetsByStatus(array $status, int &$responseCode, array &$responseHeaders): array|object|null;`

instead of:

/**
     * Operation findPetsByStatus
     *
     * Finds Pets by status
     *
     * @param  string[] $status  Status values that need to be considered for filter (required)
     * @param  integer $responseCode     The HTTP response code to return
     * @param  array   $responseHeaders  Additional HTTP headers to return with the response ()
     *
     * @return Swagger\Server\Model\Pet[]
     *
     */
    public function findPetsByStatus(array $status, &$responseCode, array &$responseHeaders);

Could you help me and say where is my mistake?

Swagger-codegen version

I tried to use v6.6.0 and latest version. Nothing happens.

Swagger declaration file content or url

I used content of file https://petstore.swagger.io/v2/swagger.json.

Command line used for generation
docker run --rm \
      -v /path/to/project:/local openapitools/openapi-generator-cli generate \
      -i /local/tmp/swagger.json \
      -g php-symfony \
      -o /local/tmp/swagger-generated
Steps to reproduce
docker run --rm \
      -v /path/to/project:/local openapitools/openapi-generator-cli generate \
      -i /local/tmp/swagger.json \
      -g php-symfony \
      -o /local/tmp/swagger-generated

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

Compare the generated php-symfony Api/PetApiInterface.php with the referenced petstore sample, starting by running the Docker generation command from the issue. Trace the template or generator input responsible for the method doc-comment, and consider the issue done when the generated findPetsByStatus declaration includes the expected Swagger\Server\Model\Pet[] return annotation.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.