OpenAPITools / OpenAPITools/openapi-generator

[REQ] PHP Client/Server class property types

Open
#5,349 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: PHP Enhancement: Feature Server: PHP
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

Currently, PHP 7.4 has support for typed properties (see this RFC: https://wiki.php.net/rfc/typed_properties_v2). I think we should support this behind a feature flag.

Describe the solution you'd like

Add types to class properties, as we have them already as method arguments.

Additional context

This could be added for the following generators:

  • clients
    • php (Guzzle)
  • servers
    • PHP Laravel
    • PHP Lumen
    • PHP Slim
    • PHP Symfony
    • PHP Zend Expressive (with Path Handler)

I could create this functionality for the Symfony Server if this is wanted, for the others I would hope others could contribute to this.

As an example, the current model output for the PHP Symfony server is:
Screenshot 2020-02-17 at 16 37 37

What it could become afterward:
Screenshot 2020-02-17 at 16 37 53

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

Review the PHP client and server generators listed in the issue, along with how method argument types and feature flags are currently handled. Done means typed class properties can be generated behind a feature flag for the requested PHP generators, including Guzzle, Laravel, Lumen, Slim, Symfony, and Zend Expressive.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.