Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #3926
"glyphicons.com" did not exist on "main"
Closed
Open
Issue created Sep 20, 2019 by Administrator@rootContributor

[BUG][php-symfony] phpLegacySupport=false does not seem to generate strongly typed code

Created by: rbaarsma

Bug Report Checklist

Description

When using the option phpLegacySupport=false, I expect type hinting to be generated in all files, but sadly it isn't. From a quick look at https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java#L346 I deduced that there should be type hinting when legacy support is disabled. Haven't looked very deeply.

openapi-generator version

Latest docker, used this command:

docker run --rm \
  -v ${PWD}:/local openapitools/openapi-generator-cli generate \
  -i /local/doc/swagger.yml \
  -g php-symfony \
  -o /local/src/Swagger
  --additional-properties phpLegacySupport=false
OpenAPI declaration file content or url
swagger: '2.0'
info:
  title: Test
paths:
  /esbm/nesting:
    get:
      tags:
      - esbmodel
      summary: Get nestings
      parameters:
      - in: query
        name: limit
        type: integer
        required: false
      - in: query
        name: q
        type: string
        required: false
      responses:
        '200':
          description: successful operation
          schema:
            type: object
            properties:
              total:
                type: integer
              data:
                type: array
                items:
                  $ref: '#/definitions/Nesting'
      security:
      - esb_auth: []

definitions:
  Nesting:
    type: object
    properties:
      id:
        type: string
        readOnly: true
      _created_at:
        type: string
        format: date-time
      _updated_at:
        type: string
        format: date-time
      name:
        type: string
      job_number:
        type: string
      sequence_number:
        type: integer

##### Command line used for generation

(see above under "openapi-generator version")

##### Steps to reproduce

simply run the command with the given swagger definition. Generates nicely, but no type hinting.

##### Related issues/PRs

none found

##### Suggest a fix

typehint all function arguments and return types. Properly use ex. `?string` when types are nullable. 

Best is to also generate `declare(strict_types=1);` on every file.
Assignee
Assign to
Time tracking