Open marezelej opened 4 years ago
@vyuldashev could this be solved by providing custom __unserialize()
and __wakeup()
methods for each object?
@matthew-inamdar I guess so. Probably in BaseObject would be enough.
Method __get_state should be added too.
I added by extending SecurityRequirement class and got same problem with GoldSpecDigital\ObjectOrientedOAS\Utilities\Extensions class.
@marezelej Did you get this working? I’m running into the same problems.
@andrewminion-luminfire yes... I ovewritten OpenApi class using composer. There, changed security method signature to allow passing an array as security configuration. Composer.json override: OpenApi.php override: openapi.php security configuration:
It is not the best solution but worked for me.
Thanks @marezelej!
https://github.com/goldspecdigital/oooas/pull/56 should fix this
Solution based on https://github.com/symplify/vendor-patches:
install symplify/vendor-patches
update config/openapi.php
'security' => [
[
'BearerToken' => []
],
],
copy vendor/goldspecdigital/oooas/src/OpenApi.php
to vendor/goldspecdigital/oooas/src/OpenApi.php.old
and update security
method in vendor/goldspecdigital/oooas/src/OpenApi.php
* @param array $security
* @return static
*/
public function security($security): self
{
$instance = clone $this;
$instance->security = [$security] ?: null;
return $instance;
}
run vendor/bin/vendor-patches generate
run composer update
check php artisan optimize
When configuring global security it is not posible to use config:cache command as it breaks with the "Your configuration files are not serializable." exception. At config/openapi.php:
'security' => [ GoldSpecDigital\ObjectOrientedOAS\Objects\SecurityRequirement::create()->securityScheme('oauth2'), ],
Exception:I solved the issue using an array for the security specification, but had to override the GoldSpecDigital\ObjectOrientedOAS\OpenApi class.