-
Notifications
You must be signed in to change notification settings - Fork 229
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
Expose API Handler #333
Expose API Handler #333
Conversation
eyurtsev
commented
Dec 15, 2023
•
edited
Loading
edited
- Exposes the underlying API handler, so that developers can use it directly.
- Document more of the API handler methods.
- Adds an optional server_config to each endpoint on the API handler to provide developers with maximal flexibility in terms of specifying configuration dynamically.
@@ -381,7 +381,14 @@ def _add_callbacks( | |||
config["callbacks"].extend(callbacks) | |||
|
|||
|
|||
class _APIHandler: | |||
_MODEL_REGISTRY = {} |
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.
what is this used for?
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.
Even though I wrote the code I was wondering the same today :)
I'll try update the doc-string later -- it was needed to fix up some behavior associated with fast api / open api specs and having the same pydantic model appear multiple times causing the open api docs to crash, so instead this helps to look up an existing model if it was already seen (instead of creating a duplicate)
|
||
chain = RunnableLambda(add_one) | ||
|
||
api_handler = APIHandler(chain, "/simple") |
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.
Is there a more realistic scenario we can show this with?
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.
Yeah probably should!
I think another example though -- this example has complexity coming from the doc-generation itself.
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 we name the example to make it more clear then it's about doc generation? I feel like people may not understand why this example exists / what it does that's special