Skip to content

PHP - pass array(key-value pair) as an argument instead of comma separated individual arguments  #641

@rajanmodi

Description

@rajanmodi
Description

Functions generated automatically in SDK should support array(key-value pair) as an argument.

Suppose there is search function with 66 arguments.
search($this->arg1 = null, $this->arg2 = null, ...., $this->arg66 = null)

When we need to make a call to this search function ,we need to provide all the arguments
$apiInstance->search($this->arg1 = 5, $this->arg2 = 10, $this->arg3 = 20,.....,$this->arg66 = 1)

What if I only want to pass only two arguments
$apiInstance->search($this->arg1 = 5,$this->arg31 = 95).
now this will assign 5 to arg1 and 95 to arg2. I need to assign value of 95 to arg31

I think solution will be generating function argument as an array with key-value pair for such cases .

Instead of keeping comma separated arguments, array should be there..

openapi-generator version
OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions