You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/community/faq.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,20 +23,20 @@ These cover a wide range of popular Python frameworks. The architecture allows a
23
23
#### **Q: What versions of Python and Pydantic are required?**
24
24
**A:** FastOpenAPI requires **Python 3.10 or above**. It uses **Pydantic v2** for data modeling and validation. Pydantic v2 outputs OpenAPI 3.1-compatible schemas. Ensure that your environment meets these requirements. (Pydantic v2 comes installed with FastOpenAPI by default.)
25
25
26
-
#### **Q: How do I handle authentication or API keys in documentation?**
27
-
**A:**Authentication (like JWT, OAuth2, API keys) isn't built into FastOpenAPI (since it’s framework-specific typically). However, you can document authentication requirements in your OpenAPI schema. For instance, you might manually add a security scheme to the generated schema (see Advanced Usage for an example). If using an auth token header, one approach is to accept a `token: str` parameter in your endpoint and document it via `response_errors` or just mention it in the description. Actual enforcement of auth is up to your application (e.g., using middleware or decorators from your framework). FastOpenAPI’s role would just be documenting the expected auth mechanism.
26
+
#### **Q: How do I handle authentication or API keys in documentation?**
27
+
**A:** FastOpenAPI provides built-in security support inspired by FastAPI (but not an exact copy of its API). You can use `Security(dependency_func)`for dependency-based authentication, `SecurityScopes` for OAuth2 scopes, and pre-defined security schemes (`SecuritySchemeType.BEARER_JWT`, `SecuritySchemeType.API_KEY`, etc.) that are automatically reflected in the OpenAPI schema. See the **Security** section of the guide for examples.
28
28
29
29
#### **Q: The docs UI (Swagger/ReDoc) isn't showing up or `/docs` returns 404. What did I do wrong?**
30
30
**A:** Make sure you initialized the router with your app (`router = FrameworkRouter(app=app)`). If you forget to pass the `app`, the routes won't be registered. Also ensure your app is running and listening on the correct host/port. If running behind a proxy or under a sub-path, you might need to adjust where you look for `/docs`. By default, FastOpenAPI uses root paths for docs. If your app is mounted under a prefix, the docs might be at `/<prefix>/docs`.
31
31
32
32
#### **Q: My framework already has some docs or schema generator. Can I use FastOpenAPI alongside it?**
33
33
**A:** If your framework has its own docs generator (like Flask-RESTx or others), it's not recommended to use two documentation generators simultaneously—they might conflict or produce duplicate routes. FastOpenAPI is meant to be a standalone solution. If you choose FastOpenAPI, disable or avoid other documentation plugins for that app to prevent collisions on routes like `/docs`. If you have a specific use case to merge them, you'd likely need to do something custom.
34
34
35
-
#### **Q: Does FastOpenAPI support dependency injection or other FastAPI features (background tasks, middleware injection, etc.)?**
36
-
**A:** FastOpenAPI’s focus is on routing and documentation. It does not provide FastAPI’s dependency injection system or some of its more advanced features. You should use the mechanisms provided by the underlying framework for things like dependency injection (for example, using Flask’s `g` or app context, or Starlette’s dependency functions if you manually incorporate them). FastOpenAPI will call your route function like a normal function with extracted parameters; it doesn't have a hook for dependency injection the way FastAPI does.
35
+
#### **Q: Does FastOpenAPI support dependency injection or other FastAPI features (background tasks, middleware injection, etc.)?**
36
+
**A:**Yes, FastOpenAPI provides a FastAPI-like dependency injection system (inspired by FastAPI, but not a complete replica). You can use `Depends(func)` for regular dependencies, `Security(func, scopes=[...])`for security dependencies, and `SecurityScopes`for scope injection. The DI system supports recursive resolution, request-scoped caching, circular dependency detection, async dependencies, and generator (yield) dependencies with cleanup. Background tasks and middleware injection are not provided — use your framework's built-in mechanisms for those.
37
37
38
38
#### **Q: How stable is FastOpenAPI for production use?**
39
-
**A:** FastOpenAPI is still in **early development (pre-1.0)**. It's being actively improved, and while many core features are in place, you should pin a version in production to avoid unexpected breaking changes on upgrade. Many users have found it useful (there's active interest on GitHub and community forums), but because it's young, there may be edge-case bugs. It's recommended to write tests around critical API functionality in your project to catch any integration issues. That said, the core of using Pydantic for validation is robust, and generating docs is read-only for your app, so the risk is manageable if you test your API.
39
+
**A:** FastOpenAPI is currently in **beta (1.0.0b1)**. Core features (routing, validation, DI, security, OpenAPI generation) are in place and actively tested across 8 frameworks. You should pin a version in production to avoid unexpected breaking changes on upgrade. It's recommended to write tests around critical API functionality in your project to catch any integration issues. The core of using Pydantic for validation is robust, and generating docs is read-only for your app, so the risk is manageable if you test your API.
40
40
41
41
#### **Q: How can I contribute or report an issue?**
42
42
**A:** We welcome contributions! Check out the **Contributing** section of this documentation for guidelines. You can open issues on the GitHub repository for bugs, feature requests, or questions. If you have code to contribute, please fork the repo and open a Pull Request. Improving documentation, adding examples, and writing tests are also great ways to help.
0 commit comments