Skip to content

Type Resource as a union of Protocols #2526

@vytas7

Description

@vytas7

We could type Resource as a union of Protocols similar to what was done for middleware in #2390.

One caveat is that we would reasonably introduce only the protocols for the most common HTTP verbs such as GET, HEAD, DELETE, POST, PATCH, PUT, etc. These protocols would only cover non-suffixed responders, but maybe that's reasonable too? Since suffixes were introduced to be able to define additional resources in the same class, not having only suffixed responders.

Furthermore, we would probably need to publish the resource types as part of the public interface (falcon.typing) for the users that want to properly annotate middleware methods.

So maybe we could first evaluate community feedback on making the App types generic in 4.2 before proceeding to this. 🤔

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions