Skip to content

[BUG] [php-nextgen] Nullable mixed type is not allowed  #20354

Description

@lucajung

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

The generated client has an optional mixed type. Mixed already contains null values.
PHP Fatal error: Type mixed cannot be marked as nullable since mixed already includes null

/**
 * Operation setValue
 *
 * @param  mixed|null $body body (optional)
 * 
 * @throws ApiException
 * @return ApiResult
 */
public function setValue(?mixed $body = null): ApiResult
{
  list($response) = $this->setValueWithHttpInfo($body);
  return $response;
}
openapi-generator version

7.10.0

OpenAPI declaration
"/api/value": {
    "post": {
        "tags": [
            "Value"
        ],
        "operationId": "SetValue",
        "parameters": [],
        "requestBody": {
            "content": {
                "application/json": {
                    "schema": {}
                }
            }
        },
        "responses": {
            "200": {
                "description": "OK",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ApiResponse"
                        }
                    },
                }
            },
            "401": {
                "description": "Unauthorized"
            },
            "403": {
                "description": "Forbidden"
            }
        },
        "security": [
            {
                "apiKey": [
                    "Key"
                ],
            }
        ]
    }
},
Generation Details
  • x
Steps to reproduce

Create the PHP API client with optional POST body

Related issues/PRs
  • x
Suggest a fix

Remove the ? if the type is mixed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions