Comments (2)
We need to support a the "common" array serialization formats.
Current support as of this comment
export type QueryArrayFormat = "brackets" | "comma" | "repeat"
Defaults must be updated when adding a new one:
I think the main one we are missing is indexed
which is like brackets
but includes the index like ?foo[0]=a&foo[1]=b
. This is the default used by axios (and possibly Ruby's HTTP gem and others).
Note that the "standard" format is generally agreed to be repeat
since this is what URLSearchParams
does (and does not mangle the name or value in the query string), but all formats are "non-standard".
All formats have drawbacks, but client libs are recommended to implement repeat
. Critically, repeat
has an ambiguity since a single element array containing the empty string foo=
could be interpreted as either foo=['']
or foo=[]
. This library will interpret this as []
which is often the intended behavior and more useful than ['']
. Client libraries should disallow passing ['']
to array params to prevent silently changing the intention of the caller.
A reference implementation for a compatible serializer may be found at https://github.com/seamapi/javascript-http/blob/main/src/lib/params-serializer.ts
from nextlove.
This library will interpret this as []
There may be a bug where this lib is actually parsing foo=
as [undefined]
or ['']
. We need some tests around these edge cases. It should parse foo=
as []
.
from nextlove.
Related Issues (20)
- Support Cloudflare DurableObjects (e.g. `req.cf.durableObject`)
- Add command to generate Zod schemas for routes
- Generated route types not compatible with @typescript-eslint/ban-types
- Nextlove Edge Support MVP Steps HOT 1
- Add flag to disallow unknown object keys in response when `shouldValidateResponses` is enabled
- Add flag to only allow primitive types in Zod schemas
- Regression: cannot build with tsup starting with version 2.1.0 HOT 1
- move nextjs-middleware-wrappers and nextjs-exception-middleware to nextlove
- Validate array entries in query parameters
- Postman Collection Generation
- Support Custom Metadata in RouteSpec definitions for OpenAPI
- OpenAPI spec missing get when post is defined
- Cannot run middleware after auth middleware
- Nextlove should support `.optional()` on formData
- Support `multipart/form-data` (currently only `application/x-www-form-urlencoded` is supported)
- Parse .describe as markdown with yaml front matter HOT 3
- Generated OpenAPI spec is missing `api_key` from the security schemes
- approuter support HOT 1
- `api_key` is not included when using `key_or_session_or_token`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nextlove.