Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connexion class based handling

I'm using the connexion framework for flask. I'd like to group several related functions into a class and I'm wondering whether methods of a class can be used for operationId instead of functions.

Something like

class Job:

    def get():
        "something"

    def post():
        "something"

in the describing yaml file:

 paths:
    /hello:
        post:
            operationId: myapp.api.Job.post
like image 235
Akhil Batra Avatar asked Feb 19 '17 10:02

Akhil Batra


1 Answers

You can use the methods if they are available as staticmethods on the class:

class Job:

    @staticmethod
    def get():
        "something"

    @staticmethod
    def post():
        "something"
like image 138
Sebastian Wozny Avatar answered Oct 13 '22 17:10

Sebastian Wozny