Skip to content

Ensure doc, auth_required, and input will run ensure_async#289

Merged
greyli merged 2 commits intoapiflask:mainfrom
jiashuChen:main
May 17, 2022
Merged

Ensure doc, auth_required, and input will run ensure_async#289
greyli merged 2 commits intoapiflask:mainfrom
jiashuChen:main

Conversation

@jiashuChen
Copy link
Copy Markdown
Contributor

@jiashuChen jiashuChen commented May 15, 2022

NOTE: Important to test this with flask >= 2.0

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code docstring.
  • Add an entry in CHANGES.md summarizing the change and linking to the issue and your username.
  • Add *Version changed* or *Version added* note in any relevant docs and docstring.
  • Run pytest and tox, no tests failed.

@netlify
Copy link
Copy Markdown

netlify bot commented May 15, 2022

Deploy Preview for apiflask ready!

Name Link
🔨 Latest commit a8f042b
🔍 Latest deploy log https://app.netlify.com/sites/apiflask/deploys/628396bfe550be0008112fc8
😎 Deploy Preview https://deploy-preview-289--apiflask.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

f._spec['args'].append((schema, location))
return use_args(schema, location=location, **kwargs)(f)

@wraps(f)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please move the code to a separate function to prevent repetition and call it for each decorator (see the example implementation in APIFairy).

skip_flask1(app)

@app.get('/')
@app.doc(summary="Test Root Endpoint")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use single quotes in all places.

setup.py Outdated
'dotenv': ['python-dotenv'],
'yaml': ['pyyaml'],
'async': ['asgiref >= 3.2'],
'async': ['asgiref >= 3.2', 'flask[async]>=2.0.0'],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's no need to pin the Flask version. If the user wants to use the async feature, they will use Flask 2.

@greyli greyli added the bug Something isn't working label May 16, 2022
@jiashuChen jiashuChen requested a review from greyli May 16, 2022 12:22
@jiashuChen
Copy link
Copy Markdown
Contributor Author

Hi @greyli,

thank you for the review feedbacks, I've updated the pull request accordingly.

Regards,
Jiashu

@greyli greyli changed the title Ensure doc and input decorator will run ensure_async Ensure doc, auth_required, and input decorator will run ensure_async May 17, 2022
@greyli greyli changed the title Ensure doc, auth_required, and input decorator will run ensure_async Ensure doc, auth_required, and input will run ensure_async May 17, 2022
@greyli greyli merged commit 3104509 into apiflask:main May 17, 2022
@greyli
Copy link
Copy Markdown
Member

greyli commented May 17, 2022

Merged, thanks! I will update the double quotes in the tests later.

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 this pull request may close these issues.

doc and Input decorators do not ensure_sync for async flask handlers

2 participants