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: openapi config override #1002

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

VishnuSanal
Copy link
Contributor

Description

This PR fixes #961

Summary

This PR does add openapi config override feat

PR Checklist

Please ensure that:

  • The PR contains a descriptive title
  • The PR contains a descriptive summary of the changes
  • You build and test your changes before submitting a PR.
  • You have added relevant documentation
  • You have added relevant tests. We prefer integration tests wherever possible

Pre-Commit Instructions:

Copy link

vercel bot commented Oct 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
robyn ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2024 4:51am

@VishnuSanal
Copy link
Contributor Author

VishnuSanal commented Oct 28, 2024

how does this work with subrouters? The user would already have all endpoints in the openapi.json, I presume. it currently handles them.

@VishnuSanal VishnuSanal marked this pull request as ready for review October 28, 2024 05:07
Copy link

codspeed-hq bot commented Oct 28, 2024

CodSpeed Performance Report

Merging #1002 will degrade performances by 11.29%

Comparing VishnuSanal:openapi-override (6c4a1c1) with main (deea29a)

Summary

❌ 4 regressions
✅ 141 untouched benchmarks

🆕 1 new benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main VishnuSanal:openapi-override Change
test_add_request_header 300.8 µs 338.8 µs -11.21%
test_add_response_header 301 µs 339.4 µs -11.29%
test_allow_cors 322.8 µs 362 µs -10.83%
test_lifecycle_handlers 332.5 µs 371.2 µs -10.42%
🆕 test_custom_openapi_spec N/A 467.4 µs N/A

@sansyrox
Copy link
Member

how does this work with subrouters? The user would already have all endpoints in the openapi.json, I presume. it currently handles them.

@VishnuSanal , yes. Subrouters should not have the ability to override openapi

robyn/openapi.py Outdated Show resolved Hide resolved
robyn/openapi.py Outdated Show resolved Hide resolved
Copy link
Member

@sansyrox sansyrox left a comment

Choose a reason for hiding this comment

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

Have some suggestions @VishnuSanal

robyn/openapi.py Outdated Show resolved Hide resolved
robyn/openapi.py Outdated Show resolved Hide resolved
Comment on lines 55 to 59
if openapi_file_path:
openapi.set_json_spec(self.directory_path + "/" + openapi_file_path)
elif os.path.isfile(self.directory_path + "/openapi.json"):
openapi.set_json_spec(self.directory_path + "/openapi.json")

Copy link
Member

Choose a reason for hiding this comment

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

@VishnuSanal , could you explain the logic here? What is this supposed to do?

It should just be a file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this should invoke the override function if the path param is set or if the file i9s present in the pre-defnked path

robyn/__init__.py Show resolved Hide resolved
robyn/openapi.py Outdated Show resolved Hide resolved
robyn/__init__.py Outdated Show resolved Hide resolved
Co-authored-by: Sanskar Jethi <[email protected]>
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.

feat: override openapi json
2 participants