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 response schema #932

Merged
merged 11 commits into from
Aug 21, 2024

Conversation

VishnuSanal
Copy link
Contributor

Description

This PR fixes #930

Summary

This PR adds response schema to openapi docs

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 Aug 19, 2024

@VishnuSanal is attempting to deploy a commit to the sparckles Team on Vercel.

A member of the Team first needs to authorize it.

@VishnuSanal VishnuSanal changed the title feat: openapi response schema feat: [WIP] openapi response schema Aug 19, 2024
Copy link

codspeed-hq bot commented Aug 19, 2024

CodSpeed Performance Report

Merging #932 will improve performances by ×2.7

Comparing VishnuSanal:openapi-response-schema (51b6f29) with main (e59c2ec)

Summary

⚡ 3 improvements
✅ 111 untouched benchmarks

Benchmarks breakdown

Benchmark main VishnuSanal:openapi-response-schema Change
test_add_openapi_path 15.9 ms 5.9 ms ×2.7
test_add_subrouter_paths 15.9 ms 5.9 ms ×2.7
test_json_handler 15.9 ms 5.9 ms ×2.7

@VishnuSanal VishnuSanal marked this pull request as ready for review August 19, 2024 14:36
@VishnuSanal VishnuSanal changed the title feat: [WIP] openapi response schema feat: openapi response schema Aug 19, 2024
@VishnuSanal
Copy link
Contributor Author

The schema will be defaulted to "any" for now; until typing is implemented. @sansyrox PTAL. I am not sure whether this was the expectation -- CMIIW.

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

Screenshot 2024-08-19 at 19 48 57

@VishnuSanal , there is also an issue in rendering of the docstrings in the application.

The above is an expected response.

But what happens is the one below

Screenshot 2024-08-19 at 19 50 13

@sansyrox
Copy link
Member

@VishnuSanal , could you fix it?

@VishnuSanal
Copy link
Contributor Author

@VishnuSanal , there is also an issue in rendering of the docstrings in the application.

what is the issue? the location where the description is shown? fastapi might be using a slightly different version of swagger; that must be the reason. should investigate. is this a major breaking feature? isn't it just about the aesthetics?

@VishnuSanal VishnuSanal requested a review from sansyrox August 20, 2024 03:33
@sansyrox
Copy link
Member

what is the issue? the location where the description is shown? fastapi might be using a slightly different version of swagger; that must be the reason. should investigate. is this a major breaking feature? isn't it just about the aesthetics?

The issue is that Robyn's docstrings are not legible. We are appending them to the wrong location! This is may be due to a different version of swagger but feels more like wrong openapi.json generation.

Hence, a blocking issue, which needs to be fixed before merging

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.

Need to fix the openapi docs generation

@sansyrox
Copy link
Member

The docstrings are being appended only to the summary. They should also be added to the description field.

@VishnuSanal
Copy link
Contributor Author

VishnuSanal commented Aug 20, 2024

done, PTAL. although unrelated, I have also removed openapi integration from future roadmap in the docs -- hope this is okay & need not create a new PR.

@VishnuSanal VishnuSanal force-pushed the openapi-response-schema branch from c0b14f9 to cf523a2 Compare August 20, 2024 14:46
@VishnuSanal VishnuSanal marked this pull request as draft August 20, 2024 16:19
@VishnuSanal VishnuSanal force-pushed the openapi-response-schema branch from 17be6a5 to ff8308d Compare August 20, 2024 16:51
@VishnuSanal VishnuSanal marked this pull request as ready for review August 20, 2024 17:29
@VishnuSanal VishnuSanal requested a review from sansyrox August 20, 2024 17:29
@sansyrox sansyrox force-pushed the openapi-response-schema branch from 9099335 to 41a4451 Compare August 20, 2024 22:28
Copy link

vercel bot commented Aug 20, 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 Aug 20, 2024 10:31pm

@sansyrox sansyrox merged commit e976138 into sparckles:main Aug 21, 2024
60 checks passed
@VishnuSanal VishnuSanal deleted the openapi-response-schema branch August 22, 2024 06:04
sansyrox added a commit that referenced this pull request Aug 23, 2024
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.

Response schema missing in openapi docs
2 participants