Skip to content
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

0.22.2 break code generated by swagger #160

Closed
cedric-appdirect opened this issue Nov 30, 2023 · 3 comments
Closed

0.22.2 break code generated by swagger #160

cedric-appdirect opened this issue Nov 30, 2023 · 3 comments

Comments

@cedric-appdirect
Copy link

When using swagger with JSON object that have a minimum value of 0, you end up with a structure that contain a pointer to your value (which can be zero and valid). When using 0.22.2, this result in an error as the test case below will reproduce.

func TestValues_RequiredValidZero(t *testing.T) {
	var err error

	m := struct {
		Percent *int64
	}{
		Percent: new(int64),
	}

	err = Required("percent", "body", m.Percent)
	assert.NoError(t, err)
}

I am suspecting line 170 in value.go introduced by this recent commit 348543c#diff-a9025362efd5a648c10a6bf6ad93e8a7f729eb991a8fb0dd589928d0018921a2R170 from @jiuker . I don't have enough context to propose a correction, but let me know how I can help.

I would think this is a rather important problem to fix as any swagger generated code that pick this new version will get broken.

@jiuker
Copy link
Contributor

jiuker commented Nov 30, 2023

#159

@cedric-appdirect
Copy link
Author

Indeed, that's a duplicate. You could include the test case in the repo after merging #159 .

@fredbi
Copy link
Member

fredbi commented Dec 4, 2023

fixed by reverting this commit in v0.22.3

@fredbi fredbi closed this as completed Dec 4, 2023
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

No branches or pull requests

3 participants