Skip to content

Work around nullability annotations mismatches - #130

Open
brianrourkeboll wants to merge 2 commits into
testcontainers:mainfrom
brianrourkeboll:nullability-workaround
Open

brianrourkeboll wants to merge 2 commits into
testcontainers:mainfrom
brianrourkeboll:nullability-workaround

Conversation

@brianrourkeboll

Copy link
Copy Markdown

Workaround for #129.

If and when the nullable annotations are fixed, the two explicit disablings should be removed.

@HofmeisterAn HofmeisterAn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the issue and the PR. The model classes are generated by tools/specgen, and the bug is there. It only marks pointers and omitempty fields as nullable, but Go also writes nil maps and slices as null.

I think it's better to fix the generator than to turn the switches off in the library, because that would hide the wrong annotations. It would also make them correct at compile time for consumers.

@brianrourkeboll

Copy link
Copy Markdown
Author

I think it's better to fix the generator than to turn the switches off in the library

Yes, if we can make the annotations accurate, that would be best. And once they are accurate, we would want to turn these switches on, as in the first commit here (they're off by default for backwards compatibility).

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.

2 participants