Allow a more convenient method of working with "x-" specifications
- Dominant language
- PHP
- Stars
- 500
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the OpenAPI extension specification linked in the issue and the library's existing getSerializableData() behavior. Trace how keyword attributes are exposed and how isset() is used for them. Done means callers can conveniently access extension names containing hyphens without the reported PHP error, with the existing serialization workaround still understood.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, php
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100