Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow function names for end points to be camelCased #96

Closed
wants to merge 2 commits into from

Conversation

Rovanion
Copy link

@Rovanion Rovanion commented Jun 1, 2018

I have no idea what the rammifications of this change is in the larger scope of this code base and its user. All I really know is that this change to flask_apispec enables it to publish swagger documentation for my project, which uses camelCased function names.

I have no idea what the rammifications of this change is in the larger scope of this code base and its user. All I really know is that this change to flask_apispec enables it to publish swagger documentation for my project, which uses camelCased function names.
@codecov-io
Copy link

codecov-io commented Jun 1, 2018

Codecov Report

Merging #96 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #96   +/-   ##
=======================================
  Coverage   97.61%   97.61%           
=======================================
  Files           8        8           
  Lines         335      335           
=======================================
  Hits          327      327           
  Misses          8        8
Impacted Files Coverage Δ
flask_apispec/apidoc.py 96.92% <100%> (ø) ⬆️
flask_apispec/__init__.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d11506...f211cca. Read the comment docs.

@rth
Copy link
Contributor

rth commented Jun 1, 2018

All I really know is that this change to flask_apispec enables it to publish swagger documentation for my project, which uses camelCased function names.

Do you get an error without it?

@Rovanion
Copy link
Author

Rovanion commented Jun 1, 2018

Yes, a KeyError. Specifically:

mounting server.main:app on /
Traceback (most recent call last):
  File "./server/main.py", line 51, in <module>
    app = start()
  File "./server/main.py", line 46, in start
    docs.register(getPineapple)
  File "/usr/local/lib/python3.6/site-packages/flask_apispec/extension.py", line 119, in register
    resource_class_args, resource_class_kwargs)
  File "/usr/local/lib/python3.6/site-packages/flask_apispec/extension.py", line 66, in _defer
    bound()
  File "/usr/local/lib/python3.6/site-packages/flask_apispec/extension.py", line 134, in _register
    paths = self.view_converter.convert(target, endpoint, blueprint)
  File "/usr/local/lib/python3.6/site-packages/flask_apispec/apidoc.py", line 27, in convert
    rules = self.app.url_map._rules_by_endpoint[endpoint]
KeyError: 'getpineapple'

@Rovanion
Copy link
Author

Is there anything I can do to help this PR along?

I'm currently working with a version of flask-apispec taken directly from my fork, and for some reasons that I found detailed in some other issue on this repo swagger-ui doesn't work just based on the source code of flask-apispec, one also needs to bring in some external dependencies and package it up for publication on pypi.

@Rovanion
Copy link
Author

I've published flask-apispec-rovanion 0.6.1 to pypi in the meantime: https://pypi.org/project/flask-apispec-rovanion/

It contains the needed static contents to deliver the swagger ui as well as the fix in this PR. The whole process was as follows:

git clone ...
virtualenv -p python3 env
source  env/bin/activate
pip install -r dev-requirements.txt
invoke install
editor setup.cfg # Change package name.
editor flask_apispec/__init__.py # Change version number.
python setup.py sdist upload

@Rovanion
Copy link
Author

The code published on pypi can now be found on https://github.com/rovanion/flask-apispec/tree/master. This PR has been superseded by #100.

@Rovanion Rovanion closed this Jun 19, 2018
@rth
Copy link
Contributor

rth commented Jun 19, 2018

You are aware that one can install with pip directly from Github? e.g.

pip install git+https://github.com/Rovanion/flask-apispec.git

or even faster without requiring git,

pip install https://github.com/Rovanion/flask-apispec/archive/master.zip

The pace of development for this project is indeed a bit slow, and PRs take a while to get reviewed / merged. I didn't review this PR, because it's a bit outside of my field of expertise.

Advertising for a Github fork with the added functionality sounds reasonable, pushing a release to PyPi under a different name for a PR that takes a while to merge might be a bit too much though. Particualrly if you start the PR description with,

I have no idea what the rammifications of this change is in the larger scope of this code base and its user.

People will end up on that page after searching for flask-apispec on Google, in the readme nothing suggest that this is not the official release of flask-apispec and unless you intend to maintain it in the foreseeable future, this release will get outdated at some point (when there are new official releases) which will create more confusion...

@Rovanion
Copy link
Author

Yes, I started out using a git+https-link in my requirements list since that was the path of least resistence. But those were missing the static components needed to show the swagger UI, since that isn't part of the source code distribution but is fetched separately through a python task.

I ended up building and publishing to pypi in order to get those components deployed in a reproducible manner. I only did this in order to have a way to have both the modifications I've made in this PR along with Swagger UI in the same deployment without having to manually edit each deployment.

I'm sorry if I've overstepped some boundary in doing so. I did it only so that I could have a complete flask-apispec in my own builds, but then thought that posterity may like to know how I ended up solving the issue. I know that I myself hate when I find a forum post describing exactly the issue I'm having, but then it ends with "fixed it".

I only intend to keep the pypi deployment it around as long as is required. I know that everyone has their own share of life to deal with and saw this as a temporary way to solve my issue while not being a pain in the neck for the maintainers of flask-apispec.

So to reiterate: I'm not intent on a hostile takeover. I was merely trying to solve the immediate pain of having to manually edit container images daily without nagging on the maintainers of flask-apispec. Though I do now realize that this act in itself may seem quite passive aggressive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants