Skip to content

fix: prevent panic when parsing custom string types in OpenAPI v3 - #2115

Merged
sdghchj merged 1 commit into
swaggo:v2from
nesty156:fix-custom-string
Jan 12, 2026
Merged

sdghchj merged 1 commit into
swaggo:v2from
nesty156:fix-custom-string

Conversation

@nesty156

Copy link
Copy Markdown

Describe the PR
Prevent panic when parsing custom string types with form tags in OpenAPI v3

Relation issue
Fixing #2114 and probably #2078

@shindonghwi shindonghwi left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks good! Adding nil checks for schema and schema.Spec before accessing Extensions prevents the panic.

One minor suggestion: It might be worth adding a unit test to cover this edge case (custom string types with form tags), to prevent regression in the future.

btw, just a small suggestion about the test - no big deal if you skip it

@nesty156

Copy link
Copy Markdown
Author

One minor suggestion: It might be worth adding a unit test to cover this edge case (custom string types with form tags), to prevent regression in the future.

Thank you. I tried write unit test but it didn't catch this issue. I also had to use older version of v2 (the rc4) because todays v2 breaks other stuff in my generation 😀

That said, I will not add tests because it didn't work for me :/

@sdghchj
sdghchj merged commit da349d1 into swaggo:v2 Jan 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

⌂ 换网址