Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(array-pointer): support array pointer for ref #2073

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

Open
zdunecki wants to merge 1 commit into oapi-codegen:main
base: main
Choose a base branch
Loading
from zdunecki:fix/array-pointer

Conversation

Copy link

@zdunecki zdunecki commented Sep 2, 2025
edited
Loading

Hi,

There's a fix for this case:

components:
 schemas:
 response.Placeholder:
 x-go-embedding: true
 type: object
 allOf:
 - $ref: "#/components/schemas/Response"
 - type: object
 properties:
 hello:
 type: string
 past_7_days_histogram:
 type: array
 x-go-type-skip-optional-pointer: true
 nullable: true
 items:
 allOf:
 - $ref: '#/components/schemas/DateHistogram'
 DateHistogram:
 type: object
 properties:
 key:
 type: string
 key_as_string:
 type: string
 nullable: true
 doc_count:
 type: integer

I would expect it will produce in Go code like that:

type ResponsePlaceholder struct {
	Hello *string `json:"hello,omitempty"`
	Past7DaysHistogram []*DateHistogram `json:"past_7_days_histogram"`
}

The key is - []*DateHistogram.

Currently, it's not possible to declare type: array with an external $ref and a pointer(*). I tried multiple ways and still get []DateHistogram.

This PR should fix that.

Best,

@zdunecki zdunecki requested a review from a team as a code owner September 2, 2025 17:00
Copy link

Kusari Inspector

Kusari Analysis Results:

Proceed with these changes

✅ No Flagged Issues Detected
All values appear to be within acceptable risk parameters.

No pinned version dependency changes, code issues or exposed secrets detected!

@kusari-inspector rerun - Trigger a re-analysis of this PR
@kusari-inspector feedback [your message] - Send feedback to our AI and team
See Kusari's documentation for setup and configuration.
Commit: ada15fd, performed at: 2025年09月02日T17:00:51Z

Found this helpful? Give it a 👍 or 👎 reaction!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /