René's URL Explorer Experiment


Title: Use Pydantic discriminator so we can easily parse webhooks · Issue #21 · VapiAI/server-sdk-python · GitHub

Open Graph Title: Use Pydantic discriminator so we can easily parse webhooks · Issue #21 · VapiAI/server-sdk-python

X Title: Use Pydantic discriminator so we can easily parse webhooks · Issue #21 · VapiAI/server-sdk-python

Description: Hi! We use the Vapi SDK for both the client but also for type checking in our webhooks we received. Currently, we have to do some reflection with Pydantic to more easily/programatically parse the events. However, Pydantic supports discri...

Open Graph Description: Hi! We use the Vapi SDK for both the client but also for type checking in our webhooks we received. Currently, we have to do some reflection with Pydantic to more easily/programatically parse the e...

X Description: Hi! We use the Vapi SDK for both the client but also for type checking in our webhooks we received. Currently, we have to do some reflection with Pydantic to more easily/programatically parse the e...

Opengraph URL: https://github.com/VapiAI/server-sdk-python/issues/21

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Use Pydantic discriminator so we can easily parse webhooks","articleBody":"Hi!\n\nWe use the Vapi SDK for both the client but also for type checking in our webhooks we received. Currently, we have to do some reflection with Pydantic to more easily/programatically parse the events.\n\nHowever, Pydantic supports discriminators https://docs.pydantic.dev/latest/concepts/fields/#discriminator where a field can determine the model type. It would be really nice to be able to do something like:\n\n```\n@router.post(\"/vapi/events\")\nasync def webhook_vapi_events(request: Request):\n    # make sure the data coming in is from vapi\n    if not authorize_vapi_webhook_request(request):\n        logger.warning(\"Invalid secret supplied via webhook\")\n        return JSONResponse(status_code=401, content={\"status\": \"error\", \"message\": \"Invalid secret\"})\n\n    # continue processing\n    json_data = await request.json()\n\n    # parse our event\n    event_type = VapiEvent.model_validate(json_data)\n\n    # pydantic automatically maps/casts to the model\n    # event_type: ServerMessageStatusUpdate in the case of `status-update`\n    ...\n```\n\nCurrently, we have to have a mapping from `type` to each model like so:\n```\n    message = json_data.get(\"message\")\n    if not message:\n        logger.warning(\"No message found in request\")\n        return {\"status\": \"missing-message\"}\n\n    raw_type = message.get(\"type\")\n    if not raw_type:\n        logger.warning(\"No message type found in request\")\n        return {\"status\": \"missing-message-type\"}\n\n    # we have to manually parse models\n    event = mapping[raw_type]\n    \n```\n\nWhere `mapping` is a generated via reflection from `ServerMessageStatusUpdate` etc based on the `type` field which used to be a default string but currently uses literals.\n\nAre there any future plans to support discriminators in the future to more easily parse these? I believe you use `fern` to generate your SDK and they do support this: https://buildwithfern.com/learn/api-definitions/ferndef/types#discriminated-unions\n","author":{"url":"https://github.com/emhagman","@type":"Person","name":"emhagman"},"datePublished":"2026-01-23T18:48:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/21/server-sdk-python/issues/21"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:9ae6c350-3ad1-aeda-9a08-2387906f6d06
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC280:3A3C79:1354E88:1BACDA1:697A3B0B
html-safe-nonced80a9fea76de2f19fb673ebeed08211a1f9f050cb5e5ac01608bedfd348b8e96
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjgwOjNBM0M3OToxMzU0RTg4OjFCQUNEQTE6Njk3QTNCMEIiLCJ2aXNpdG9yX2lkIjoiODM1OTI2MjA3NTA3ODk4MjQxMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac0990770ef5f126af573813a2484e764373ac497f40bee793ab1932590a78f6ce
hovercard-subject-tagissue:3848719586
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/VapiAI/server-sdk-python/21/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e73147a7ee35c597ba47b32b5753ffe3ef3b7a291dde8fb98d40af7daba7aac7/VapiAI/server-sdk-python/issues/21
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e73147a7ee35c597ba47b32b5753ffe3ef3b7a291dde8fb98d40af7daba7aac7/VapiAI/server-sdk-python/issues/21
og:image:altHi! We use the Vapi SDK for both the client but also for type checking in our webhooks we received. Currently, we have to do some reflection with Pydantic to more easily/programatically parse the e...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameemhagman
hostnamegithub.com
expected-hostnamegithub.com
Noneaf6de804ceb83ad30bb9b348cdeaccaa30cdcb566762d5e74e21e2bad88885d0
turbo-cache-controlno-preview
go-importgithub.com/VapiAI/server-sdk-python git https://github.com/VapiAI/server-sdk-python.git
octolytics-dimension-user_id144965430
octolytics-dimension-user_loginVapiAI
octolytics-dimension-repository_id858207722
octolytics-dimension-repository_nwoVapiAI/server-sdk-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id858207722
octolytics-dimension-repository_network_root_nwoVapiAI/server-sdk-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2d980605f0959039ddebcbcf522b072508302977
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/issues/21#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2FVapiAI%2Fserver-sdk-python%2Fissues%2F21
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2FVapiAI%2Fserver-sdk-python%2Fissues%2F21
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=VapiAI%2Fserver-sdk-python
Reloadhttps://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/issues/21
Reloadhttps://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/issues/21
Reloadhttps://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/issues/21
VapiAI https://patch-diff.githubusercontent.com/VapiAI
server-sdk-pythonhttps://patch-diff.githubusercontent.com/VapiAI/server-sdk-python
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2FVapiAI%2Fserver-sdk-python
Fork 18 https://patch-diff.githubusercontent.com/login?return_to=%2FVapiAI%2Fserver-sdk-python
Star 39 https://patch-diff.githubusercontent.com/login?return_to=%2FVapiAI%2Fserver-sdk-python
Code https://patch-diff.githubusercontent.com/VapiAI/server-sdk-python
Issues 8 https://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/issues
Pull requests 0 https://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/pulls
Actions https://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/actions
Projects 0 https://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/projects
Security 0 https://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/security
Insights https://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/pulse
Code https://patch-diff.githubusercontent.com/VapiAI/server-sdk-python
Issues https://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/issues
Pull requests https://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/pulls
Actions https://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/actions
Projects https://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/projects
Security https://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/security
Insights https://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/VapiAI/server-sdk-python/issues/21
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/VapiAI/server-sdk-python/issues/21
Use Pydantic discriminator so we can easily parse webhookshttps://patch-diff.githubusercontent.com/VapiAI/server-sdk-python/issues/21#top
https://github.com/emhagman
https://github.com/emhagman
emhagmanhttps://github.com/emhagman
on Jan 23, 2026https://github.com/VapiAI/server-sdk-python/issues/21#issue-3848719586
https://docs.pydantic.dev/latest/concepts/fields/#discriminatorhttps://docs.pydantic.dev/latest/concepts/fields/#discriminator
https://buildwithfern.com/learn/api-definitions/ferndef/types#discriminated-unionshttps://buildwithfern.com/learn/api-definitions/ferndef/types#discriminated-unions
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.