Preserve order of environment variables in app.json -> env#205
Conversation
|
The build error seems entirely unrelated with this PR. Anybody to retrigger? |
|
Thanks for putting this together! It seems like there are cases where for a good user experience, ordering the questions is important. However, I'm not sure if it is a good idea to do this with a custom unmarshaller. An alternative would be to add an optional It looks like the GitHub action just had a temporary issue. I've restarted it. |
|
Hey, thanks for the answer! It's mostly my fault there's been radio silence here. I agree with the problem, though I think your current solution which involves writing a custom Unmarshaler seems to a bit lengthier than I expected and might be a pain to maintain. (I can guarantee you we’ll forget to refactor Also, there's a reason nearly no implementation tries to maintain map ordering from JSON, because it's not meant to be preserved. Software like Kubernetes solve this by making "envs" keys a "list", rather than a "dict", e.g.: envs:
- key: X
value: Y
- [...]Here’s what I will recommend, to see if you and @jamesward can agree:
If agreeable, let's pursue that. Also let's not forget that in this new model, we might need to define what happens if multiple env variables exist in the |
|
I’ll go with a simpler implementation proposed by @jamesward above. Thanks for the implementation @mmanciop. Next time, just feel free to propose the change without code. |
Since the default JSON unmarshalling maps keys in the
envobject of theapp.jsonfile, it is possible that the order of environment variables is not respected, which causes confusion in the end user when more than one value needs to be prompted. (While technically JSON keys in an object are supposed to be order insensitive, inconsistency in the end-user steps are nevertheless an issue.)This change introduces custom unmarshalling of
app.json -> envto preserve the order of prompted environment variables as specified in theapp.jsonfile.