flasgger/flasgger

How does flasgger handle multiple URLs with flask-restful?

Aberta

#174 aberto em 28 de dez. de 2017

 (10 comentários) (0 reação) (0 responsável)Python (500 forks)batch import
bughacktoberfesthelp wanted

Métricas do repositório

Stars
 (3.435 estrelas)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

I'm using flask-restful and have a resource with two URLs, like this:

    api.add_resource(Job, '/job/<int:job_id>', '/job')

where job_id is used only by the GET method.

In the resources code I have:

class Job(Resources):
    def get(self, job_id):
        """
        Retrieve a job from its ID
        ---
        tags:
          - Jobs
        parameters:
        - name: job_id
          in: path
          description: ID of the job
          required: true
        responses:
          200:
            description: Job found
          404:
            description: Job not found
        """

the expected result is a swagger spec with only one URL path for the GET operation, but flasgger generates a swwager spec with two URL paths for the GET one for /job/{job_id} and another one for /job.

Is it possible to separate specifications by path or method in this case?

Guia do colaborador