jmcarp / jmcarp/flask-apispec

Camel case endpoint methods within blueprints are converted to lower case

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

Description

KeyError generated when a blueprint's endpoint method is defined with a camel case pattern.

E.g.

In views/pet.py
```
PetName = Blueprint('PetName', __name__, template_folder='templates')
@PetName.route('/petname', methods=['POST'])
@use_kwargs({'name': fields.Str()})
@marshal_with(PetNameSchema(many=False))
def petName():
...
```

In app.py
```
...
docs.register(petName, blueprint='PetName')
```
Registering the doc with blueprint results in `KeyError: 'PetName.petname'`

Changing the endpoint to lower case e.g. ```def petname()``` solves this.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reproduction in views/pet.py and app.py, then trace how docs.register resolves the blueprint endpoint. Confirm the failure with the camel-case petName() example and compare it with the lower-case version. Done means registration succeeds without the KeyError while preserving the camel-case endpoint method.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python
Domain
api, backend
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.