René's URL Explorer Experiment


Title: Merging schema's with undefined properties doesn't work · Issue #1883 · oapi-codegen/oapi-codegen · GitHub

Open Graph Title: Merging schema's with undefined properties doesn't work · Issue #1883 · oapi-codegen/oapi-codegen

X Title: Merging schema's with undefined properties doesn't work · Issue #1883 · oapi-codegen/oapi-codegen

Description: oapi-codegen isn't able to merge schema's which have incompatible properties, even if the properties aren't defined (!). If a property needs to be overwritten, or should be defined at a later moment depending on context, it's common to u...

Open Graph Description: oapi-codegen isn't able to merge schema's which have incompatible properties, even if the properties aren't defined (!). If a property needs to be overwritten, or should be defined at a later momen...

X Description: oapi-codegen isn't able to merge schema's which have incompatible properties, even if the properties aren't defined (!). If a property needs to be overwritten, or should be defined at a...

Opengraph URL: https://github.com/oapi-codegen/oapi-codegen/issues/1883

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Merging schema's with undefined properties doesn't work","articleBody":"oapi-codegen isn't able to merge schema's which have incompatible properties, even if the properties aren't defined (!).\r\n\r\n\r\nIf a property needs to be overwritten, or should be defined at a later moment depending on context, it's common to use `allOf` + `readOnly: true`. Example:\r\n\r\n```yaml\r\nallOf:\r\n - $ref '#/components/myField'\r\nreadOnly: true\r\n```\r\n\r\n\r\n## Reproduce\r\n\r\nIn this example, I defined `identityId`, which is shared across payloads, but should /sometimes/ be set to readOnly. \r\n\r\n### `config.yaml`\r\n```yaml\r\npackage: identities\r\ngenerate:\r\n  client: true\r\n  echo-server: true\r\n  strict-server: true\r\n  embedded-spec: false\r\n  models: true\r\noutput: ./identities/identities.gen.go\r\n```\r\n\r\n### `identities.yaml`\r\n```\r\nopenapi: 3.0.0\r\ninfo:\r\n  title: test\r\n  version: 0.0.0\r\npaths:\r\n  /identities/{identityId}:\r\n    get:\r\n      operationId: getIdentity\r\n      parameters:\r\n        - $ref: '#/components/parameters/PathIdentityId'\r\n      responses:\r\n        '200':\r\n          description: get identity\r\n          content:\r\n            application/json:\r\n              schema:\r\n                $ref: '#/components/schemas/Identity'\r\n    post:\r\n      operationId: updateIdentity\r\n      requestBody:\r\n        required: true\r\n        content:\r\n          application/json:\r\n            schema:\r\n              allOf:\r\n                - $ref: '#/components/schemas/Identity'\r\n                - type: object\r\n                  properties:\r\n                    identity_id: # setting identityId to readOnly, so it can't be changed/upserted.\r\n                      readOnly: true\r\n      parameters:\r\n        - $ref: '#/components/parameters/PathIdentityId'\r\n      responses:\r\n        '200':\r\n          description: get identity\r\n          content:\r\n            application/json:\r\n              schema:\r\n                $ref: '#/components/schemas/Identity'\r\ncomponents:\r\n  parameters:\r\n    PathIdentityId:\r\n      in: path\r\n      name: identityId\r\n      schema:\r\n        $ref: '#/components/schemas/IdentityId'\r\n      required: true\r\n  schemas:\r\n    IdentityId:\r\n      description: unique id of an identity\r\n      type: string\r\n      pattern: ^[ 0-9a-zA-Z- ]+$\r\n      minLength: 1\r\n      maxLength: 64\r\n      example: 89e0ec57-4a7c-41a0-9433-970ba7709733\r\n    Identity:\r\n      type: object\r\n      required:\r\n        - identity_id\r\n        - name\r\n      properties:\r\n        identity_id:\r\n          $ref: '#/components/schemas/IdentityId'\r\n        name:\r\n          type: string\r\n```\r\n\r\n### cmd\r\n\r\n\r\n`go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.4.1 --config=./config/rest-gen/identities.yml ./internal/rest/identities/identities.yaml`\r\n\r\nthrows the following error:\r\n\r\n```\r\nerror generating code: error generating type definitions: error generating Go types for component schemas: error converting Schema User to Go type: error generating Go schema for property 'identity_id': error merging schemas: error merging schemas for AllOf: merging two schemas with different ReadOnly\r\nexit status 1\r\n```\r\n\r\n\r\nLooking at the code, it seems that the reader is defaulting to `false`, and has no way to differentiate later if the property was _set_ to `false`, or defaulted to `false`.\r\nhttps://github.com/oapi-codegen/oapi-codegen/blob/main/pkg/codegen/merge_schemas.go#L176-L178","author":{"url":"https://github.com/thumbnail","@type":"Person","name":"thumbnail"},"datePublished":"2025-01-15T08:02:32Z","url":"https://github.com/oapi-codegen/oapi-codegen/issues/1883"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:e83a65cd-eb71-a9cc-f9bf-ec4567ce60d2
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAE48:D23AD:272310:33FCC7:6AF9CC9F
html-safe-nonce0e5e04968a4004d8b5f3723d56340640f2649d656e5961702754b43242620350
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTQ4OkQyM0FEOjI3MjMxMDozM0ZDQzc6NkFGOUNDOUYiLCJ2aXNpdG9yX2lkIjoiMjY0NzUxNDYyNDgxNTEzNjMxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac5d829b71dd2e1dc2d74a04aaa1f64c1fad5f8785ac7820d710af29409bf34155
hovercard-subject-tagissue:2789094111
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/oapi-codegen/oapi-codegen/1883/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e074504ebea54228f5d3472f0143279c6615b62fa98d3b1ed3f69673b8b44b6e/oapi-codegen/oapi-codegen/issues/1883
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e074504ebea54228f5d3472f0143279c6615b62fa98d3b1ed3f69673b8b44b6e/oapi-codegen/oapi-codegen/issues/1883
og:image:altoapi-codegen isn't able to merge schema's which have incompatible properties, even if the properties aren't defined (!). If a property needs to be overwritten, or should be defined at a later momen...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamethumbnail
hostnamegithub.com
expected-hostnamegithub.com
None612d3e6ffd693e7ea8d9fcf452370995872baef31d825b1fedef704cd3d24ac7
turbo-cache-controlno-preview
go-importgithub.com/oapi-codegen/oapi-codegen git https://github.com/oapi-codegen/oapi-codegen.git
octolytics-dimension-user_id142752710
octolytics-dimension-user_loginoapi-codegen
octolytics-dimension-repository_id173009358
octolytics-dimension-repository_nwooapi-codegen/oapi-codegen
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id173009358
octolytics-dimension-repository_network_root_nwooapi-codegen/oapi-codegen
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
release072e34035c13c31543fba9f025cbbbda4210dae4
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/oapi-codegen/oapi-codegen/issues/1883#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Foapi-codegen%2Foapi-codegen%2Fissues%2F1883
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Foapi-codegen%2Foapi-codegen%2Fissues%2F1883
Sign uphttps://github.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=oapi-codegen%2Foapi-codegen
Reloadhttps://github.com/oapi-codegen/oapi-codegen/issues/1883
Reloadhttps://github.com/oapi-codegen/oapi-codegen/issues/1883
Reloadhttps://github.com/oapi-codegen/oapi-codegen/issues/1883
oapi-codegenhttps://github.com/oapi-codegen
oapi-codegenhttps://github.com/oapi-codegen/oapi-codegen
Codehttps://github.com/oapi-codegen/oapi-codegen
Issues228 (228)https://github.com/oapi-codegen/oapi-codegen/issues
Pull requests70 (70)https://github.com/oapi-codegen/oapi-codegen/pulls
Discussionshttps://github.com/oapi-codegen/oapi-codegen/discussions
Actionshttps://github.com/oapi-codegen/oapi-codegen/actions
Projectshttps://github.com/oapi-codegen/oapi-codegen/projects
Security and quality11 (11)https://github.com/oapi-codegen/oapi-codegen/security
Insightshttps://github.com/oapi-codegen/oapi-codegen/pulse
https://github.com/oapi-codegen/oapi-codegen
New issuehttps://github.com/login?return_to=https://github.com/oapi-codegen/oapi-codegen/issues/1883
New issuehttps://github.com/login?return_to=https://github.com/oapi-codegen/oapi-codegen/issues/1883
Merging schema's with undefined properties doesn't workhttps://github.com/oapi-codegen/oapi-codegen/issues/1883#top
https://github.com/thumbnail
thumbnailhttps://github.com/thumbnail
on Jan 15, 2025https://github.com/oapi-codegen/oapi-codegen/issues/1883#issue-2789094111
https://github.com/oapi-codegen/oapi-codegen/blob/main/pkg/codegen/merge_schemas.go#L176-L178https://github.com/oapi-codegen/oapi-codegen/blob/main/pkg/codegen/merge_schemas.go#L176-L178
https://github.com/lukacat10
lukacat10https://github.com/lukacat10
on Feb 15, 2025https://github.com/oapi-codegen/oapi-codegen/issues/1883#issuecomment-2660892821
https://github.com/lukacat10/kin-openapi/tree/nullable-fieldshttps://github.com/lukacat10/kin-openapi/tree/nullable-fields
https://github.com/lukacat10/oapi-codegen/tree/nullable-fieldshttps://github.com/lukacat10/oapi-codegen/tree/nullable-fields
https://github.com/emoses
emoseshttps://github.com/emoses
on Apr 23, 2025https://github.com/oapi-codegen/oapi-codegen/issues/1883#issuecomment-2824930370
https://github.com/mromaszewicz
mromaszewiczhttps://github.com/mromaszewicz
on Jul 14, 2026https://github.com/oapi-codegen/oapi-codegen/issues/1883#issuecomment-4965413460
mromaszewiczhttps://github.com/mromaszewicz
completedhttps://github.com/oapi-codegen/oapi-codegen/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jul 14, 2026https://github.com/oapi-codegen/oapi-codegen/issues/1883#event-27943402408
Sign up for freehttps://github.com/signup?return_to=https://github.com/oapi-codegen/oapi-codegen/issues/1883
Sign in to commenthttps://github.com/login?return_to=https://github.com/oapi-codegen/oapi-codegen/issues/1883
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.