René's URL Explorer Experiment


Title: improve UnionProperty behavior for anyOf/oneOf, lists of types, and nullable enums by eli-bl · Pull Request #1121 · openapi-generators/openapi-python-client · GitHub

Open Graph Title: improve UnionProperty behavior for anyOf/oneOf, lists of types, and nullable enums by eli-bl · Pull Request #1121 · openapi-generators/openapi-python-client

X Title: improve UnionProperty behavior for anyOf/oneOf, lists of types, and nullable enums by eli-bl · Pull Request #1121 · openapi-generators/openapi-python-client

Description: Fixes #1120. There are two related changes here: First, when processing the anyOf/oneOf items in a union, check whether each item will generate a named Python class (i.e. is it an enum or a model). If exactly one of them will, then we should not use a synthetic name like xyz_type_1; instead just use the original name xyz. (If more than one of them will, then we do need to add name suffixes; if none of them will, then it doesn't really matter since none of the synthetic names will show up in Python code anyway). That fixes the case described in the issue where nullable object/enum classes got an unnecessary "Type1" suffix. It's a breaking change, but, I think, a desirable one— I don't think anyone prefers to have "Type1" added in those cases, and depending on that would be a bad idea anyway since it's an obscure implementation detail. So I haven't gated it behind a config option. Second, if we're creating a union and type has been explicitly specified— these were the cases where a bunch of spurious -Type1, -Type2Type1, etc. were being created, because of faulty logic that assumed every explicit type had to be added separately to the union. I believe the correct behavior is: If the union is just because there are multiple types, then go ahead and add a Property for each one. If there is a type or types, but there is also anyOf or oneOf, then we don't need to add anything, because the schemas in the anyOf/oneOf list already describe what kind of values there can be. (We could add a check to make sure the types aren't contradictory— for instance, if type is ["string", "number"] but the anyOf variants are objects— but that's out of scope here.) The second issue was also the reason for the weird behavior of nullable with enums in 3.0, because we are handling nullable by converting the type into a union.

Open Graph Description: Fixes #1120. There are two related changes here: First, when processing the anyOf/oneOf items in a union, check whether each item will generate a named Python class (i.e. is it an enum or a model)....

X Description: Fixes #1120. There are two related changes here: First, when processing the anyOf/oneOf items in a union, check whether each item will generate a named Python class (i.e. is it an enum or a model)....

Opengraph URL: https://github.com/openapi-generators/openapi-python-client/pull/1121

X: @github

direct link

Domain: patch-diff.githubusercontent.com

route-pattern/:user_id/:repository/pull/:id/checks(.:format)
route-controllerpull_requests
route-actionchecks
fetch-noncev2:e9209fd8-16d5-8f72-ec6b-6d8b415bc21f
current-catalog-service-hash87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a
request-idC2B0:2C674:2097B:2D34A:69810355
html-safe-nonce885cb7ca2541dcdeb6dcce1ee4f1f3613e23874de9a4eb9fa9753d12e812546f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMkIwOjJDNjc0OjIwOTdCOjJEMzRBOjY5ODEwMzU1IiwidmlzaXRvcl9pZCI6IjQ5NDU1MzM4NzUzNjAxNzA4MzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmace854dde541c594478135afb6f9df3ae4d8b52bca24e17bcc16438a75f523f01f
hovercard-subject-tagpull_request:2069840157
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/checks
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/openapi-generators/openapi-python-client/pull/1121/checks
twitter:imagehttps://avatars.githubusercontent.com/u/170372326?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/170372326?s=400&v=4
og:image:altFixes #1120. There are two related changes here: First, when processing the anyOf/oneOf items in a union, check whether each item will generate a named Python class (i.e. is it an enum or a model)....
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None39fe8101494cbb823c09b619b68c80cd4d05ab7279997038dbe06bb91608abe1
turbo-cache-controlno-preview
go-importgithub.com/openapi-generators/openapi-python-client git https://github.com/openapi-generators/openapi-python-client.git
octolytics-dimension-user_id84925606
octolytics-dimension-user_loginopenapi-generators
octolytics-dimension-repository_id240776275
octolytics-dimension-repository_nwoopenapi-generators/openapi-python-client
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id240776275
octolytics-dimension-repository_network_root_nwoopenapi-generators/openapi-python-client
turbo-body-classeslogged-out env-production page-responsive full-width full-width-p-0
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
released5b34a4e4898b066c629879feb4b184bc471d6a7
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pull/1121/checks#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fopenapi-generators%2Fopenapi-python-client%2Fpull%2F1121%2Fchecks
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%2Fopenapi-generators%2Fopenapi-python-client%2Fpull%2F1121%2Fchecks
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%2Fpull_requests%2Fshow%2Fchecks&source=header-repo&source_repo=openapi-generators%2Fopenapi-python-client
Reloadhttps://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pull/1121/checks
Reloadhttps://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pull/1121/checks
Reloadhttps://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pull/1121/checks
openapi-generators https://patch-diff.githubusercontent.com/openapi-generators
openapi-python-clienthttps://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client
Please reload this pagehttps://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pull/1121/checks
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fopenapi-generators%2Fopenapi-python-client
Fork 264 https://patch-diff.githubusercontent.com/login?return_to=%2Fopenapi-generators%2Fopenapi-python-client
Star 1.9k https://patch-diff.githubusercontent.com/login?return_to=%2Fopenapi-generators%2Fopenapi-python-client
Code https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client
Issues 77 https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/issues
Pull requests 14 https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pulls
Discussions https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/discussions
Actions https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions
Security 2 https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/security
Insights https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pulse
Code https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client
Issues https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/issues
Pull requests https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pulls
Discussions https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/discussions
Actions https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions
Security https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/security
Insights https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pulse
Sign up for GitHub https://patch-diff.githubusercontent.com/signup?return_to=%2Fopenapi-generators%2Fopenapi-python-client%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://patch-diff.githubusercontent.com/login?return_to=%2Fopenapi-generators%2Fopenapi-python-client%2Fissues%2Fnew%2Fchoose
eli-blhttps://patch-diff.githubusercontent.com/eli-bl
openapi-generators:mainhttps://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/tree/main
eli-bl:issue1120-nullable-enumhttps://patch-diff.githubusercontent.com/eli-bl/openapi-python-client/tree/issue1120-nullable-enum
Conversation 1 https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pull/1121
Commits 7 https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pull/1121/commits
Checks 19 https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pull/1121/checks
Files changed https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pull/1121/files
Please reload this pagehttps://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pull/1121/checks
Please reload this pagehttps://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pull/1121/checks
improve UnionProperty behavior for anyOf/oneOf, lists of types, and nullable enums https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pull/1121/checks#top
Please reload this pagehttps://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pull/1121/checks
Require changes to be documented https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/pull/1121/checks?check_run_id=34061727011
Run Checks on: pull_request https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249
test (3.9, ubuntu-latest) https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061727896?pr=1121
test (3.9, macos-latest) https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061728183?pr=1121
test (3.9, windows-latest) https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061728298?pr=1121
test (3.10, ubuntu-latest) https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061728409?pr=1121
test (3.10, macos-latest) https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061728534?pr=1121
test (3.10, windows-latest) https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061728649?pr=1121
test (3.11, ubuntu-latest) https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061728800?pr=1121
test (3.11, macos-latest) https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061728926?pr=1121
test (3.11, windows-latest) https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061729034?pr=1121
test (3.12, ubuntu-latest) https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061729145?pr=1121
test (3.12, macos-latest) https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061729256?pr=1121
test (3.12, windows-latest) https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061729345?pr=1121
test (3.13, ubuntu-latest) https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061729466?pr=1121
test (3.13, macos-latest) https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061729681?pr=1121
test (3.13, windows-latest) https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061729825?pr=1121
Integration Tests (0.20.0) https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061727763?pr=1121
Integration Tests https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061728052?pr=1121
Combine & check coverage https://patch-diff.githubusercontent.com/openapi-generators/openapi-python-client/actions/runs/12208465249/job/34061790746?pr=1121
Learn more about checks retentionhttps://docs.github.com/rest/guides/getting-started-with-the-checks-api#retention-of-checks-data
create more change fileshttps://knope.tech/reference/concepts/changeset/
View more details on Knope Bot https://knope.tech
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.