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

Allow a more convenient method of working with "x-" specifications #121

Open
googoogajoob opened this issue Aug 15, 2021 · 2 comments · May be fixed by #169
Open

Allow a more convenient method of working with "x-" specifications #121

googoogajoob opened this issue Aug 15, 2021 · 2 comments · May be fixed by #169
Labels
enhancement New feature or request

Comments

@googoogajoob
Copy link
Contributor

First Point: Excellent project. I've written an OpenApi loader myself. Yours is much better.

Second Point: The openapi specification of keywords allows for the possibility of extending them with the "x-" syntax: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions

In a project I am working on we have made use of this feature. When using cebe/php-openapi I've run into a problem.

  • openapi requires the use of the "x-" syntax
  • php interprets "x-" not as a variable (or something similar) but sees the "-" as an operation. Particularly with the function isset()
  • cebe/php-openapi relies on the native php convention variable/(class attribute names)
  • When using isset() to determine if a keyword has been specified PHP reports an error. I have been able to work around this problem by using getSerializableData(). However it would be nice and more convenient if one could access openapi variables (keywords) which use a "-" as part of their name.
@cebe cebe added the enhancement New feature or request label Oct 13, 2021
@cebe cebe added this to the 1.6.0 milestone Oct 13, 2021
@cebe cebe removed this from the 1.6.0 milestone Feb 9, 2022
@Herrick19
Copy link

Sorry to jump in this discussion, but I feel like this is an "unneeded" feature request...

PHP support this syntax to access properties with "-" in variable names:

$Operation->{'x-foo-bar'}

and it works well, I have no issue at all accessing extension having a "-" in their name...

Hope this helps

@fxedel
Copy link

fxedel commented Oct 11, 2022

Is this already fixed by #113? E.g. $info->getExtensions()['x-extra-var']

@fxedel fxedel linked a pull request Oct 11, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants