Comments (16)
Before addressing the proposed solution, I just want to be clear about how the code generator works.
From the point of view of the generator api, technically -&-
applies an "optional param" which is up to the operation to decide how that optional param is encoded. it could be a query param, but also be header or multiform data, etc.
The operation function only demands the required parameters as part of the function arguments (Name name) (Namespace namespace)
and gives you the ability to supply optional parameters, hiding from you how they are included in the actual request.
Required parameters could also end up as query parameters for example
loginUser
:: Accept accept -- ^ request accept ('MimeType')
-> Username -- ^ "username" - The user name for login
-> Password -- ^ "password" - The password for login in clear text
-> OpenAPIPetstoreRequest LoginUser MimeNoContent Text accept
loginUser _ (Username username) (Password password) =
_mkRequest "GET" ["/user/login"]
`addQuery` toQuery ("username", Just username)
`addQuery` toQuery ("password", Just password)
So, we could introduce a change like you propose only for HasOptionalParam
, (that is mostly what kubernetes uses), but that leaves any required query params unaddressed.
Alternatively we could come up with a method that works for required params too, however the required parameters are harder to change since they're tied to concrete types in the generated code.
Another option which would be to let the user modify the request object instead of the operation arguments, to tell it how those query params get plus+encoded, this would be a less-typed solution but more general.
A lot of this depends on how typed the fix needs to be. even for your example UnescapePlusSigns
needs to have the appropriate instances to typecheck with the HasOptionalParam
class.
I'll think about it and play around with some code to see the best way to provide a solution to this.
The only place i know of where plus-encoding is not allowed is in labels and selectors currently, but that seems like an important piece, so i'm not sure if its a better default to not plus-encode or default to plus-encode.
(if you're really stuck, you can always have more than one config object KubernetesClientConfig
and use different configs or create a temporary modified config, depending on the request, but i realize that's not ideal.)
from haskell.
Thanks for the quick response!
FWIW, I have read that while there isn't good universal agreement about how plus signs in URLs should be treated, the W3C URI spec says the following:
Within the query string, the plus sign is reserved as shorthand notation for a space. Therefore, real plus signs must be encoded.
Other guidance I've seen for API designers is in line with this as well. Therefore, I'd suggest defaulting to plus-encode and treating the places where Kubernetes APIs violate this rule as the exceptional cases. Hopefully such cases are rare and limited to things like labels and selectors (I'm not aware of any others either).
from haskell.
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle stale
- Mark this issue or PR as rotten with
/lifecycle rotten
- Close this issue or PR with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
from haskell.
/remove-lifecycle stale
from haskell.
Is this related to #67 , which has been fixed by PR #92 ?
from haskell.
Yes @hughjfchen, I referenced the relevant commit (541fb76) in the initial post. I'd say "fixed" is a strong word :P
from haskell.
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle stale
- Mark this issue or PR as rotten with
/lifecycle rotten
- Close this issue or PR with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
from haskell.
/remove-lifecycle stale
from haskell.
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle stale
- Close this issue with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
from haskell.
/remove-lifecycle stale
from haskell.
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle stale
- Close this issue with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
from haskell.
/remove-lifecycle stale
from haskell.
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle stale
- Close this issue with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
from haskell.
/remove-lifecycle stale
from haskell.
Related Issues (20)
- client update may be broken HOT 7
- Error with DateTime Format
- Should we make a release? HOT 10
- Proposal: Default to openssl HOT 18
- InternalException - certificate unknown with `mkKubeClientConfig` HOT 4
- Examples HOT 7
- Clean up outside collaborators HOT 2
- Incorrectly generated query strings (that rely on + not being urlencoded) HOT 21
- in-cluster config builder does not work properly in an ipv6 cluster HOT 14
- Sometimes k8s gives back Null and the client dies HOT 2
- Update to newer LTS? HOT 8
- Issue with (-&-) optional argument operator and Command optional argument for exec HOT 18
- Issue with kubernetes-client dependency on time on Hackage HOT 9
- does not compile HOT 3
- Strategic JSON patch no longer supported? HOT 3
- Wrong return type in deleteNamespacedPersistentVolumeClaim HOT 6
- ssl error when specify master address as IP address in config file HOT 15
- kubernetes-client seems broken in both stack and nix-env. Any tips on installation? HOT 2
- Version on hackage is old HOT 6
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 haskell.