Skip to content

No "security" same as empty "security" #33

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

Closed
jdomenechb opened this issue Aug 31, 2019 · 1 comment · Fixed by #38
Closed

No "security" same as empty "security" #33

jdomenechb opened this issue Aug 31, 2019 · 1 comment · Fixed by #38
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jdomenechb
Copy link

I have an example of contract that has the following structure (summerized to highlight the relevant):

# [...]
paths:
  /path/one:
    post:
      # [...]
      security: []

  /path/two:
    post:
      # [...]
      # No security entry defined there

components:
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

security:
  - Bearer: []

Theoreticaly, I expect:

  • In /path/one:
    • __isset() in the Operation object returns true, and __get() returns empty array.
  • In /path/two:
    • __isset() in the Operation object returns false, and __get() returns either empty array or null.
    • Alternativelly, I also might expect __isset() to return false, but __get() return the default security defined at contract root level. I consider this possibility as it is a solution similar like how references work in the scope of this library.

However, the problem is that what I actually get in both paths, is __isset() = true and __get() = empty array. As I get the same result in both, there is no way to determine that /path/one does not have at all security (and therefore, could be called directly), and that /path/two has default security.

@cebe cebe added the bug Something isn't working label Sep 3, 2019
@cebe cebe added this to the 1.2.1 milestone Sep 3, 2019
@cebe cebe self-assigned this Oct 24, 2019
@cebe cebe closed this as completed in #38 Oct 24, 2019
@cebe
Copy link
Owner

cebe commented Oct 24, 2019

Fixed, thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants