Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: Undefined array key "" produces an Uncaught TypeError #766

Open
l-you opened this issue Oct 19, 2023 · 0 comments
Open

Warning: Undefined array key "" produces an Uncaught TypeError #766

l-you opened this issue Oct 19, 2023 · 0 comments
Labels

Comments

@l-you
Copy link

l-you commented Oct 19, 2023

Jane version(s) affected: 7.5.4

Description
Following error raised after Warning: Undefined array key "" warning.

Fatal error: Uncaught TypeError: Jane\Component\OpenApi3\Generator\Parameter\NonBodyParameterGenerator::convertParameterType(): Return value must be of type array, null returned in /vendor/jane-php/open-api-3/Generator/Parameter/NonBodyParameterGenerator.php:197

How to reproduce
Use following config for generator.

<?php

declare(strict_types=1);

return [
    'openapi-file' => 'https://api.checkbox.in.ua/api/openapi.json',
    'namespace' => 'Vendor\Library\Generated',
    'directory' => __DIR__ . '/generated/checkbox_ua',
];

Possible Solution
I modified code in convertParameterType function as following and it fixed an error.

   $convertArray = [
            'string' => ['string'],
            'number' => ['float'],
            'boolean' => ['bool'],
            'integer' => ['int'],
            'array' => ['array'],
            'file' => ['string', 'resource', '\\' . StreamInterface::class],
        ];
   $convertArray = [
          'string' => ['string'],
          'number' => ['float'],
          'boolean' => ['bool'],
          'integer' => ['int'],
          'array' => ['array'],
          'file' => ['string', 'resource', '\\' . StreamInterface::class],
           ''=>['string']

      ];
@l-you l-you added the bug label Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant