docs: api: document w (width) and h (height) query params as required#48663
Merged
vvoland merged 2 commits intomoby:masterfrom Oct 15, 2024
Merged
docs: api: document w (width) and h (height) query params as required#48663vvoland merged 2 commits intomoby:masterfrom
vvoland merged 2 commits intomoby:masterfrom
Conversation
Query parameters default to being _optional_ in swagger, but for these
endpoints, they were required. Omitting these parameters (or passing an
empty value) produces a 400 (bad request);
docker run -d --name foo nginx:alpine
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/containers/foo/resize'
{"message":"strconv.Atoi: parsing \"\": invalid syntax"}
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/containers/foo/resize?w='
{"message":"strconv.Atoi: parsing \"\": invalid syntax"}
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/containers/foo/resize?w=&h='
{"message":"strconv.Atoi: parsing \"\": invalid syntax"}
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/containers/foo/resize?w=100&h='
{"message":"strconv.Atoi: parsing \"\": invalid syntax"}
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/containers/foo/resize?w=100&h=100'
This patch amends the swagger to reflect that these parameters are required.
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Query parameters default to being _optional_ in swagger, but for these
endpoints, they were required. Omitting these parameters (or passing an
empty value) produces a 400 (bad request);
docker run -d --name foo nginx:alpine
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/containers/foo/resize'
{"message":"strconv.Atoi: parsing \"\": invalid syntax"}
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/containers/foo/resize?w='
{"message":"strconv.Atoi: parsing \"\": invalid syntax"}
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/containers/foo/resize?w=&h='
{"message":"strconv.Atoi: parsing \"\": invalid syntax"}
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/containers/foo/resize?w=100&h='
{"message":"strconv.Atoi: parsing \"\": invalid syntax"}
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/containers/foo/resize?w=100&h=100'
This patch updates the swagger to reflect that these parameters are required.
Signed-off-by: Sebastiaan van Stijn <[email protected]>
vvoland
approved these changes
Oct 15, 2024
Member
Author
Thanks! I was a bit on the fence initially, because in most cases, query-parameters are optional. We also (currently at least) accept But as the API already rejected these (whether by design or not), and thus nobody would already be able to depend on this, I decided to officiate it. I have some patches in my local fork to improve some of these errors (first step was to improve test-coverage, but I need to look at making it work for Windows, which apparently has different behavior between |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Query parameters default to being optional in swagger, but for these
endpoints, they were required. Omitting these parameters (or passing an
empty value) produces a 400 (bad request);
This patch updates the swagger to reflect that these parameters are required.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)