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

Unable to set required property scopes as empty Map #54

Open
marcovtwout opened this issue Feb 24, 2022 · 1 comment
Open

Unable to set required property scopes as empty Map #54

marcovtwout opened this issue Feb 24, 2022 · 1 comment

Comments

@marcovtwout
Copy link

marcovtwout commented Feb 24, 2022

According to https://swagger.io/specification/#oauth-flow-object, the attribute "scopes" is required (when type=oauth2) and may be an empty map (in yaml: {}).

image

However, there seems to be no way to set an empty map through https://github.com/goldspecdigital/oooas/blob/master/src/Objects/OAuthFlow.php#L106
You can pass an empty array, but that will translate to [] instead of {} in JSON.

Without this property, official schema validation fails. When passing an empty array, $openApi->validate() fails.

@matthew-inamdar
Copy link
Member

If we set scopes to (object)[] if it's null then that should do the trick. Keeping this issue open until I get a PR ready.

protected function generate(): array
{
return Arr::filter([
'authorizationUrl' => $this->authorizationUrl,
'tokenUrl' => $this->tokenUrl,
'refreshUrl' => $this->refreshUrl,
'scopes' => $this->scopes,
]);
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants