Skip to content

[BUG] [php-nextgen] Invalid syntax with nullable union return types #22817

@kocsismate

Description

@kocsismate

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • 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

I bumped into an issue when using the php-nextgen generator where an operation has multiple response schemas and at least one of the response code doesn't have a schema defined.

openapi-generator version

7.19.0

OpenAPI declaration file content or url

https://gist.github.com/kocsismate/ba40e007a12c9a17cee7cb162b624b2c

Generation Details
docker run --rm \
    --volume "$scriptPath:/local" \
    --user "$(id -u):$(id -g)" \
    openapitools/openapi-generator-cli:v7.19.0 generate \
    --config /local/openApiConfig.json \
    --output /local

The openApiConfig.json is the following:

{
  "invokerPackage": "Api\\Client",
  "artifactVersion": "1.0.0",
  "composerPackageName": "api/client",
  "packageName": "api/client",
  "inputSpec": "https://gist.githubusercontent.com/kocsismate/ba40e007a12c9a17cee7cb162b624b2c/raw/994c4e2f4d92566a3b4f00b5fe57406fc7ad739e/schema.json",
  "validateSpec": false,
  "generatorName": "php-nextgen"
}
Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/pull/22322/changes#r2728382066

Suggest a fix

Always use the full union type syntax, rather than the ? shorthand.

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