Comments (8)
Version 22.3.1 fixes this.
pip install --upgrade sanic-ext
from sanic-ext.
Thanks @ahopkins, working fine now
from sanic-ext.
Could you provide a code snippet that this issue can be reproduced with? I am unable to reproduce this error with this one (sanic-ext
gets enabled automatically):
from sanic import Sanic, text
app = Sanic("my_app")
@app.get("/ping")
async def ping(request):
return text("pong")
app.run(host="0.0.0.0", port=8000)
In addition, could you please let us know what versions you're seeing this with? You can see the versions here:
P.D.: This looks like it's an issue with the way we're getting an object's typehints in the OpenAPI extension (which would mean this is a sanic-ext
issue), but I'm not sure what your objects/classes look like, so a small code snippet will help us figure that out ;)
from sanic-ext.
I am looking into this now using:
Trying to figure out the minimal example that causes this though.
from sanic-ext.
Reproduced with a dynamic path:
from sanic import Sanic, text
app = Sanic("my_app")
@app.get("/ping/<ping>")
async def ping(request):
return text("pong")
app.run(dev=True)
from sanic-ext.
This is a fairly small change it appears.
cls = value if isclass(value) else value.__class__
to
cls = value if callable(value) else value.__class__
from sanic-ext.
The issue seems to not exist on Python 3.10+. But, using callable
should be okay in either case.
from sanic-ext.
Thanks for letting me know!
from sanic-ext.
Related Issues (20)
- [Feature Request] Response Compression
- [Bug] Can't use `pydantic>=2.0` model in OpenAPI definition HOT 1
- [Bug] Can't document/exclude websocket routes with OpenAPI decorator
- [Bug] Subheader "parameter" missing in sanic extensions document
- [Bug] Can't apply openapi decorators to blueprintss' routes
- [Bug]TypeError: listener() got an unexpected keyword argument 'priority' HOT 1
- [Bug] Documentation: dead link to the setting
- Query params validation is completely broken HOT 2
- Question regarding licensing info
- [Bug] Doubly defined objects in the output specification #260 HOT 2
- [Bug] The tags in OpenAPI yaml are not effective
- [Bug] Pydantic query validation with extra data not defined in model raise's KeyError HOT 4
- add project to nix packages
- Add support for scalar.com OpenAPI documentation
- [Bug] Sanic validation extension failed to validate aliased pydantic model field
- [Feature Request] Allow custom localization in `validate` function
- [Bug] Removing handlers in Background Logger extension removes only one handler.
- Question regarding `x-tagGroups` support
- [Bug] pydantic validation exception when validating unknown query strings HOT 2
- [Bug] `validate` should check passed in model type
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sanic-ext.