marshmallow-code / flask-smorest

DB agnostic framework to build auto-documented REST APIs with Flask and marshmallow
https://flask-smorest.readthedocs.io
MIT License
651 stars 72 forks source link

Documenting webhooks #553

Open ddorian opened 12 months ago

ddorian commented 12 months ago

This is a draft to ask for opinion. @lafrech

codecov[bot] commented 12 months ago

Codecov Report

Patch coverage: 37.50% and project coverage change: -0.56% :warning:

Comparison is base (d57a6fb) 99.88% compared to head (bfdff3d) 99.32%. Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #553 +/- ## ========================================== - Coverage 99.88% 99.32% -0.56% ========================================== Files 14 14 Lines 885 892 +7 Branches 192 192 ========================================== + Hits 884 886 +2 - Misses 0 5 +5 Partials 1 1 ``` | [Files Changed](https://app.codecov.io/gh/marshmallow-code/flask-smorest/pull/553?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=marshmallow-code) | Coverage Δ | | |---|---|---| | [flask\_smorest/\_\_init\_\_.py](https://app.codecov.io/gh/marshmallow-code/flask-smorest/pull/553?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=marshmallow-code#diff-Zmxhc2tfc21vcmVzdC9fX2luaXRfXy5weQ==) | `87.80% <37.50%> (-12.20%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

ddorian commented 11 months ago

@lafrech

What about an api like:


class SchemaClass(marshmallow.Schema):
    """Doc used as request description"""
    pass

class Blueprint2(flask_smorest.Blueprint):
    def register_webhook(SchemaClass, optional[tags, description, response, etc]):
        self.webhooks.append(webhook)

class Api2(flask_smorest.Api):
    def register_blueprint():
        super()
        # register webhooks
        for webhook in blp.webhooks:
             self.add_webhook_to_doc(class, tags, etc)
lafrech commented 6 months ago

Thanks for contributing and sorry about the delay.

I don't use webhooks myself and I don't when I'll have the time to look into this seriously.

Let's keep this open and anyone interested in the feature is welcome to join.