Skip to content

VISX: Add string support to UID #2501

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

Merged
merged 2 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion adapters/visx/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ var invalidParams = []string{
`2`,
`{"size":12345678}`,
`{"size":""}`,
`{"uid": "1"}`,
`{"uid": "-1"}`,
`{"uid": "232af"}`,
`{"uid": "af213"}`,
`{"uid": "af"}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpicks:

  1. Can we add an int that comes with a char in here?
43   var invalidParams = []string{
44       `null`,
45       `nil`,
46       ``,
47       `[]`,
48       `true`,
49       `2`,
50       `{"size":12345678}`,
51       `{"size":""}`,
52       `{"uid": "-1"}`,
53       `{"uid": "232af"}`,
   +     `{"uid": 232af}`,
54       `{"uid": "af213"}`,
55       `{"uid": "af"}`,
56       `{"size": true}`,
57       `{"uid": true, "size":"1234567"}`,
58   }
  1. And also add a string unit tests on the validParams side?
35   var validParams = []string{
36       `{"uid":13245}`,
   +     `{"uid":"13245"}`,
37       `{"uid":13245, "size": [10,5]}`,
38       `{"uid":13245, "other_optional": true}`,
39   }

Copy link
Contributor Author

@deubaka deubaka Jan 3, 2023

Choose a reason for hiding this comment

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

Hi @guscarreon,

Thanks for the feedback.

On #1, I'm not sure if it's still necessary given that case would be an invalid JSON altogether, and parsing should fail already, without reaching schema validation.

As for #2, make sense, just to make sure it's covered as well.

`{"size": true}`,
`{"uid": true, "size":"1234567"}`,
}
3 changes: 2 additions & 1 deletion static/bidder-params/visx.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "object",
"properties": {
"uid": {
"type": "integer",
"type": ["integer", "string"],
Copy link
Contributor

Choose a reason for hiding this comment

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

@deubaka can we reflect this change in the bid-param section of the docs please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, thanks! We've added the corresponding updates in this PR, prebid/prebid.github.io#4273.

"pattern": "^\\d+$",
"description": "An ID which identifies this placement of the impression"
},
"size": {
Expand Down