-
-
Notifications
You must be signed in to change notification settings - Fork 74
Add FastAPI API property to Air application #580
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
base: main
Are you sure you want to change the base?
Conversation
Introduces an optional FastAPI app mounted at '/api' via the new 'fastapi_app' parameter and 'api' property in the Air class. Adds tests to verify API route mounting and response behavior.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| If no routes are attached to the app, it disables itself. | ||
| """ | ||
| ), | ||
| ] = FastAPI, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be: FastAPI()
|
|
||
| self.router.route_class = AirRoute | ||
| if fastapi_app is not None: | ||
| self.fastapi_app = fastapi_app() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be: = fastapi_app
| self.router.route_class = AirRoute | ||
| if fastapi_app is not None: | ||
| self.fastapi_app = fastapi_app() | ||
| self.mount("/api", self.fastapi_app) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"/app" should be customizable.
| ), | ||
| ] = None, | ||
| path_separator: Annotated[Literal["/", "-"], Doc("An optional path separator.")] = "-", | ||
| fastapi_app: Annotated[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to: api_sub_app
Issue(s)
#575
Description
Introduces an optional FastAPI app mounted at '/api' via the new 'fastapi_app' parameter and 'api' property in the Air class. Adds tests to verify API route mounting and response behavior.
This will make it easier for project creators to combine Air and FastAPI, since they are already one project. The
apiproperty can be prevented.Currently state, including lifespan, isn't shared. For reference, it is not easy for this feature to share state.
Pull request type
Please check the type of change your PR introduces:
Pull request tasks
The following have been completed for this task:
examplesfolderDemo or screenshot
Checklist
just testandjust qa, ensuring my code changes passes all existing tests