René's URL Explorer Experiment


Title: `allOf` code generation does not work with types from other packages · Issue #655 · oapi-codegen/oapi-codegen · GitHub

Open Graph Title: `allOf` code generation does not work with types from other packages · Issue #655 · oapi-codegen/oapi-codegen

X Title: `allOf` code generation does not work with types from other packages · Issue #655 · oapi-codegen/oapi-codegen

Description: I have some standardized error struct which is used for all parts of my API, and put it into a separate package to make it easily reuasble components: schemas: Error: type: object properties: message: type: string details: type: array it...

Open Graph Description: I have some standardized error struct which is used for all parts of my API, and put it into a separate package to make it easily reuasble components: schemas: Error: type: object properties: messa...

X Description: I have some standardized error struct which is used for all parts of my API, and put it into a separate package to make it easily reuasble components: schemas: Error: type: object properties: messa...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`allOf` code generation does not work with types from other packages","articleBody":"I have some standardized error struct which is used for all parts of my API, and put it into a separate package to make it easily reuasble\r\n```yaml\r\ncomponents:\r\n  schemas:\r\n    Error:\r\n      type: object\r\n      properties:\r\n        message:\r\n          type: string\r\n        details:\r\n          type: array\r\n          items:\r\n            $ref: \"#/components/schemas/ErrorDetail\"\r\n    ErrorDetail:\r\n      type: object\r\n      properties:\r\n        message:\r\n          type: string\r\n        target:\r\n          type: string\r\n```\r\n\r\nThis all works fine, but in some scenarios I'd like to have an example error message. So I use `allOf` to merge this struct with additional details:\r\n```yaml\r\nallOf:\r\n  - $ref: \"#/components/schemas/Error\" # I imported the errors.yaml in this components/schema to make errors.Error available.\r\n  - type: object\r\n    properties:\r\n      message:\r\n        example: \"File non-existing.txt not found\"\r\n```\r\n\r\nThis results in the follow code:\r\n```go\r\ntype FileNotFound struct {\r\n\t// Optional list of additional error details.\r\n\tDetails *[]ErrorDetail `json:\"details,omitempty\"`\r\n\tMessage interface{}    `json:\"message\"`\r\n}\r\n```\r\n\r\nThe problem is that `ErrorDetail` is not defined (it is defined in another package containing the generated code of errors.yaml). Error itself is working as the code generator created this line\r\n```go\r\ntype Error = externalRef0.Error\r\n```\r\n\r\n# Workaround\r\nImport ErrorDetail in the yaml file as well:\r\n```yaml\r\n    ErrorDetail:\r\n      # This is needed for workaround a code generation bug\r\n      $ref: \"./errors.yaml#/components/schemas/ErrorDetail\"\r\n```\r\nand it generates\r\n```go\r\ntype ErrorDetail = externalRef0.ErrorDetail\r\n```\r\n\r\nUnfortunately, linter detect that the ErrorDetail object is not used/referenced, so it issues a warning (in my IDE)","author":{"url":"https://github.com/veger","@type":"Person","name":"veger"},"datePublished":"2022-07-04T09:01:10.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/655/oapi-codegen/issues/655"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:f35e20ff-ad85-9d7e-214a-c6543d59b68a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD6DE:383777:34D73A2:490C654:6A4F2DFD
html-safe-noncecfdeca871017f9d48d29c2cf5336b18333bcbd458e3b65ea8de84d9db572d0a7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENkRFOjM4Mzc3NzozNEQ3M0EyOjQ5MEM2NTQ6NkE0RjJERkQiLCJ2aXNpdG9yX2lkIjoiNDc1ODM4MDU2Mzc4MTMzMjQ3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac48fc7719f8bd84de62a33a307916505a279efc88dd8c102d848cb199dc734a9c
hovercard-subject-tagissue:1292854702
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/655/issue_layout
twitter:imagehttps://opengraph.githubassets.com/cdaab1deac77a52bd843a1d7944f38d24646de2248197065e7c0c7f7976d3338/oapi-codegen/oapi-codegen/issues/655
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/cdaab1deac77a52bd843a1d7944f38d24646de2248197065e7c0c7f7976d3338/oapi-codegen/oapi-codegen/issues/655
og:image:altI have some standardized error struct which is used for all parts of my API, and put it into a separate package to make it easily reuasble components: schemas: Error: type: object properties: messa...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameveger
hostnamegithub.com
expected-hostnamegithub.com
Noneb92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9
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
release2b8f23afb982271f1b22258a94aede67a6b77760
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/oapi-codegen/oapi-codegen/issues/655#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Foapi-codegen%2Foapi-codegen%2Fissues%2F655
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
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
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
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/enterprise/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://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Foapi-codegen%2Foapi-codegen%2Fissues%2F655
Sign up https://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/655
Reloadhttps://github.com/oapi-codegen/oapi-codegen/issues/655
Reloadhttps://github.com/oapi-codegen/oapi-codegen/issues/655
Please reload this pagehttps://github.com/oapi-codegen/oapi-codegen/issues/655
oapi-codegen https://github.com/oapi-codegen
oapi-codegenhttps://github.com/oapi-codegen/oapi-codegen
Please reload this pagehttps://github.com/oapi-codegen/oapi-codegen/issues/655
Notifications https://github.com/login?return_to=%2Foapi-codegen%2Foapi-codegen
Fork 1k https://github.com/login?return_to=%2Foapi-codegen%2Foapi-codegen
Star 8.4k https://github.com/login?return_to=%2Foapi-codegen%2Foapi-codegen
Code https://github.com/oapi-codegen/oapi-codegen
Issues 293 https://github.com/oapi-codegen/oapi-codegen/issues
Pull requests 74 https://github.com/oapi-codegen/oapi-codegen/pulls
Discussions https://github.com/oapi-codegen/oapi-codegen/discussions
Actions https://github.com/oapi-codegen/oapi-codegen/actions
Projects https://github.com/oapi-codegen/oapi-codegen/projects
Security and quality 3 https://github.com/oapi-codegen/oapi-codegen/security
Insights https://github.com/oapi-codegen/oapi-codegen/pulse
Code https://github.com/oapi-codegen/oapi-codegen
Issues https://github.com/oapi-codegen/oapi-codegen/issues
Pull requests https://github.com/oapi-codegen/oapi-codegen/pulls
Discussions https://github.com/oapi-codegen/oapi-codegen/discussions
Actions https://github.com/oapi-codegen/oapi-codegen/actions
Projects https://github.com/oapi-codegen/oapi-codegen/projects
Security and quality https://github.com/oapi-codegen/oapi-codegen/security
Insights https://github.com/oapi-codegen/oapi-codegen/pulse
allOf code generation does not work with types from other packageshttps://github.com/oapi-codegen/oapi-codegen/issues/655#top
https://github.com/veger
vegerhttps://github.com/veger
on Jul 4, 2022https://github.com/oapi-codegen/oapi-codegen/issues/655#issue-1292854702
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.