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

feat: handle root security requirements on root DSL #101

Merged
merged 8 commits into from
Nov 3, 2024

Conversation

anthony-legay
Copy link
Contributor

@anthony-legay anthony-legay commented Oct 17, 2024

I didn't find how to add security requirements at the root Open API definition as the spec expect it.

I extracted a SecurityDsl in order to reuse it in the RootDsl and the OperationDsl as security requirements can be defined at root level and at operation level.

I also added the possibility to make AND/OR security requirements combinations (as documented here).

security: # A OR B
  - A
  - B
security: # A AND B
  - A
    B
security: # (A AND B) OR (C AND D)
  - A
    B
  - C
    D

Fixes #106

@anthony-legay anthony-legay marked this pull request as draft October 17, 2024 20:18
@anthony-legay anthony-legay force-pushed the feat/root-security-requirements branch from d456b6d to 17df020 Compare October 17, 2024 20:25
@anthony-legay anthony-legay marked this pull request as ready for review October 17, 2024 20:48
@anthony-legay anthony-legay force-pushed the feat/root-security-requirements branch from edf6910 to 4a37ddd Compare October 24, 2024 14:26
Copy link
Owner

@utybo utybo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just minor comments, could you also have a look at the CI failure?

I'll take care of updating the docs once this is merged :)

@anthony-legay
Copy link
Contributor Author

Thanks! Just minor comments, could you also have a look at the CI failure?

I'll take care of updating the docs once this is merged :)

Hi ! sorry for the delay.
The failure seemed to be due to missing license header on the new file.
Can you approve the workflow run to see if this works now please ?
Thanks!

@utybo
Copy link
Owner

utybo commented Oct 30, 2024

Can you approve the workflow run to see if this works now please ?

Done! You can also run gradle check locally, IIRC the CI does the same checks. You might need to run gradle apiDump to generate some files (apologies for the lack of docs on how to contribute, I need to write some 😅)

@anthony-legay
Copy link
Contributor Author

Can you approve the workflow run to see if this works now please ?

Done! You can also run gradle check locally, IIRC the CI does the same checks. You might need to run gradle apiDump to generate some files (apologies for the lack of docs on how to contribute, I need to write some 😅)

No problem ! awesome work you did here already.
I added the missing docs on the new classes and methods and ran apiDump task.
Everything looks fine but prisma related tasks fail on my machine because of a certificate issue.

Copy link

codecov bot commented Oct 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.73%. Comparing base (1307dac) to head (6cc5bfe).
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #101      +/-   ##
============================================
+ Coverage     89.64%   89.73%   +0.08%     
  Complexity       24       24              
============================================
  Files           202      203       +1     
  Lines          4568     4587      +19     
  Branches        441      442       +1     
============================================
+ Hits           4095     4116      +21     
+ Misses          310      308       -2     
  Partials        163      163              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@anthony-legay anthony-legay force-pushed the feat/root-security-requirements branch from 269552d to 59bf2b8 Compare November 1, 2024 09:26
@utybo
Copy link
Owner

utybo commented Nov 1, 2024

Ah, didn't know the "long method" check was enabled in tests as well. You can go ahead and @Suppress it.

@anthony-legay
Copy link
Contributor Author

Ah, didn't know the "long method" check was enabled in tests as well. You can go ahead and @Suppress it.

I added the annotation. I don't know why I didn't get it when running locally though. Maybe because it failed fast due the certificate error.

Copy link
Owner

@utybo utybo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot for your contribution! I'll update the docs in a follow-up PR.

@utybo utybo merged commit 72d90e2 into utybo:main Nov 3, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenAPI DSL does not support root security declarations
2 participants