Skip to content

Add support for all array types in query, cookie and header#84

Merged
line-o merged 13 commits intoeeditiones:mainfrom
line-o:fix/82
Oct 15, 2025
Merged

Add support for all array types in query, cookie and header#84
line-o merged 13 commits intoeeditiones:mainfrom
line-o:fix/82

Conversation

@line-o
Copy link
Copy Markdown
Member

@line-o line-o commented Sep 19, 2025

Adds support for spaceDelimited, pipeDelimited and simple arrays.

This will cover all possible combinations for array parameters in query, cookie, and header

style in Comments
simple header Simple style parameters defined by [RFC6570] Section 3.2.2.
form query, cookie Form style parameters defined by [RFC6570] Section 3.2.8.
spaceDelimited query Space separated array values or object properties and values.
pipeDelimited query Pipe separated array values or object properties and values.
  • arrays with wrong types will now return with BAD_REQUEST with an actionable description
  • empty arrays without default value will consistently parse to null
  • move all array type testing to dedicated endpoints and testfile

fixes #82
fixes #85
fixes #86

@line-o
Copy link
Copy Markdown
Member Author

line-o commented Sep 19, 2025

@ahenket please have a look if this solution fits your needs.

@line-o
Copy link
Copy Markdown
Member Author

line-o commented Sep 19, 2025

I will have to add a test for a form array in a cookie

@line-o
Copy link
Copy Markdown
Member Author

line-o commented Sep 19, 2025

And a simple array in a header

- arrays with wrong types will now return with BAD_REQUEST with an actionable description
- empty arrays without default value will consistently parse to null
- move all array type testing to dedicated endpoints and testfile
@line-o line-o marked this pull request as ready for review October 12, 2025 07:27
fixes eeditiones#86

A request like `/my/api/endpoint?a=1&a=2` will now fail unless the query parameter `a` is declared an array.
This is done to support both API implementors and users to find problems easier which would otherwise go undetected. The first value of a would be used and the second one just discarded silently.
Error messages now have a concise wording using `(query|header|path)-parameter "{$parameter}"`
@line-o line-o requested review from windauer and wolfgangmm and removed request for DrRataplan and daliboris October 14, 2025 09:28
@line-o line-o merged commit 6a4c54d into eeditiones:main Oct 15, 2025
4 of 5 checks passed
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.11.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

1 participant