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

openapi.parameters in yaml extractor not work #5484

Closed
jorissae opened this issue Mar 22, 2023 · 1 comment
Closed

openapi.parameters in yaml extractor not work #5484

jorissae opened this issue Mar 22, 2023 · 1 comment
Labels

Comments

@jorissae
Copy link
Contributor

API Platform version(s) affected: 3.1.*

Description

The new key openApi which replace the openApiContext use a Parameter Object but the openapi.parameter array is not converted in Parameter[] when I use yaml

How to reproduce

use openapi.parameter on any yaml resource:

        openapi:
          parameters:
            username:
              name: username
              in: path
              example: "foo"
            customerAlias:
              name: customerAlias
              in: path
              example: 111112

image

Suggestion

add array to parameter converter in YamlResourceExtractor (like XmlResourceExtractor)

<?php
$parameters = [];
if(\array_key_exists('parameters', $resource['openapi'])) {
    foreach ($resource['openapi']['parameters'] as $parameter) {
        $parameters[] = new Parameter($parameter['name'], $parameter['in'], $parameter['description'] ?? '', $parameter['required'] ?? false, $parameter['deprecated'] ?? false, $parameter['allowEmptyValue'] ?? false, $parameter['schema'] ?? [], $parameter['style'] ?? null, $parameter['explode'] ?? false, $parameter['allowReserved '] ?? false, $parameter['example'] ?? null, isset($parameter['examples']) ? new \ArrayObject($parameter['examples']) : null, isset($parameter['content']) ? new \ArrayObject($parameter['content']) : null);
    }
    $resource['openapi']['parameters'] = $parameters;
}
@stale
Copy link

stale bot commented May 21, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 21, 2023
@stale stale bot closed this as completed May 28, 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