Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR]: Deserialize args object as a dictionary, not a struct #205

Closed
mieubrisse opened this issue Mar 15, 2023 · 3 comments · Fixed by #376
Closed

[FR]: Deserialize args object as a dictionary, not a struct #205

mieubrisse opened this issue Mar 15, 2023 · 3 comments · Fixed by #376
Assignees

Comments

@mieubrisse
Copy link
Member

Background and motivation

I'm building the quickstart, and the args object is a top-level struct, but nested objects are dictionaries. This is very confusing.

Current behavior

args object is a struct

Desired behavior

args object, and all its nested objects, are dictionaries

How important is this feature or improvement to you?

Nice to have, this feature would make using Kurtosis more enjoyable.

@mieubrisse
Copy link
Member Author

This turns out to be especially important for checking if the user set an optional value.

if args.some_value == None:

throws an interpretation error on some_value not existing.

@victorcolombo
Copy link
Contributor

This is a great point, IMO we should deliver this before we announce Kurtosis given that is a pretty brutal breaking change.

@victorcolombo victorcolombo self-assigned this Mar 27, 2023
@mieubrisse
Copy link
Member Author

@victorcolombo areas to ensure things are changed:

victorcolombo added a commit that referenced this issue Mar 30, 2023
## Description:
Despite args being passed to a Starlark scripts as a serialized JSON
string, we parsed it to a struct. From now on, instead, the serialized
JSON string will be parsed into a dictionary. For example:

<!-- Describe this change, how it works, and the motivation behind it.
-->
```python
def run(plan, args):
    args.value
```

is now

```python
def run(plan, args):
    args["value"]
```

## Is this change user facing?
YES
<!-- If yes, please add the "user facing" label to the PR -->
<!-- If yes, don't forget to include docs changes where relevant -->

## References (if applicable):
<!-- Add relevant Github Issues, Discord threads, or other helpful
information. -->
Closes #205
Closes #253
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants