Comments (5)
So to your point: "there's no distinction between [] and nil" - yes, that's my reading of RFC6570.
In the last 24 hours I’ve come to realize that this is both correct and also very unfortunate.
Thanks for bringing receipts and actually referencing the specifications too!
from swift-openapi-generator.
I'm also noticing that this is the last query param, then the URL ends with a dangling &
.
/foo?a=false&b=true&
from swift-openapi-generator.
Alternatively, we may want to go with the ?colors=
syntax, which means that there's no distinction between [""]
and []
which isn't great, but right now there's no distinction between []
and nil
which is worse, because at least in the case where the values in the array are defined by an enum, [""]
doesn't map to a real value anyway.
This would have the added advantage of being more conformant, and servers that look up the colors
key get a value, whereas if they try to access colors[]
they may not know that it maps to colors
.
from swift-openapi-generator.
I'm also noticing that this is the last query param, then the URL ends with a dangling
&
./foo?a=false&b=true&
Can you please file a separate issue for this? Should be easy to fix hopefully.
from swift-openapi-generator.
Please double check me on this, but from my reading of the specifications, omitting any keys for an empty array seems like the correct behavior.
OpenAPI 3.1 form exploded query items: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values
Delegates the rules to https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.8
Which adds the key only for items in the array. So if there are no items in the array, there are no keys in the URL.
Putting array=
has a different meaning, that'd mean a single element of an empty string, which has a different meaning and could fail e.g. enum validation.
So to your point: "there's no distinction between [] and nil" - yes, that's my reading of RFC6570.
from swift-openapi-generator.
Related Issues (20)
- Null property type with quotes not generated HOT 14
- Support for XML request body and response body HOT 8
- Support schemas.type: string, format: uri generates URL property not String HOT 3
- How to support OAuth2 Password flows? HOT 3
- allOf plus properties HOT 2
- OpenAPI shared components HOT 4
- bug/regression: latest yams results in incomplete generation of types HOT 10
- Logging and HTTPBody HOT 3
- Merging oneOf with many compatible enums of a single value HOT 10
- anyOf encoder does not include discriminator's `parameterName` leading to incorrect encoding HOT 2
- Is there a workaround to deal with slow compilation times for a very large openapi file? HOT 3
- Support for `multipart/mixed`? HOT 1
- When a delete path do not have responses content an error generated HOT 2
- Add ability to attach protocols to generated models HOT 9
- Protocol where each `Output` conforms to HOT 3
- Make the generator usable on very big specs HOT 3
- Old and new examples HOT 3
- visionOS can't use HOT 4
- How to convert the binary obtained from the server into a playable Data type? HOT 2
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 swift-openapi-generator.