oooas icon indicating copy to clipboard operation
oooas copied to clipboard

Unable to set required property scopes as empty Map

Open marcovtwout opened this issue 3 years ago • 1 comments

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.

marcovtwout avatar Feb 24 '22 11:02 marcovtwout

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.

https://github.com/goldspecdigital/oooas/blob/b5c48ce12eb15261e7eeaff6b477cbff36b56cbf/src/Objects/OAuthFlow.php#L127-L136

matthew-inamdar avatar Mar 21 '22 13:03 matthew-inamdar