jmcarp / jmcarp/flask-apispec

TypeError: "O is undefined" with url parameters

Open
#210 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
652
Forks
151
PR merge metrics
No merged PRs in 30d

Description

I'm using flask-apispec with flask-restful
Example of view

```
from flask_restful import Resource, Api
from apispec import APISpec
from apispec.ext.marshmallow import MarshmallowPlugin
from flask_apispec.extension import FlaskApiSpec

api = Api(app)

app.config.update({
'APISPEC_SPEC': APISpec(
authorizations=authorizations,
title='pets',
version='v1',
plugins=[MarshmallowPlugin()],
openapi_version="3.0.3",
),
'APISPEC_SWAGGER_URL': '/swagger/',
})

class ListView(MethodResource):
def get(self, type_id, list_id):
#some code

api.add_resource(ListView, '/api/types//lists//')
docs = FlaskApiSpec(app)
docs.register(ListView)

```

and when I open Swagger UI i get
![image](https://user-images.githubusercontent.com/1565987/99885318-9f777c80-2c3c-11eb-862e-4ff8b3295a9a.png)
![image](https://user-images.githubusercontent.com/1565987/99885324-aa321180-2c3c-11eb-806a-fd49a39e8d0b.png)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Flask-RESTful example in the issue and reproduce the Swagger UI failure for the route containing type_id and list_id. Trace how flask-apispec registers ListView and generates the OpenAPI path parameters; done means the documented route loads in Swagger UI without the “O is undefined” error.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.