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

unclear what --json does when running ftl config set #3408

Open
mistermoe opened this issue Nov 15, 2024 · 2 comments
Open

unclear what --json does when running ftl config set #3408

mistermoe opened this issue Nov 15, 2024 · 2 comments
Labels
triage Issue needs triaging

Comments

@mistermoe
Copy link
Member

Repro

❯ ftl config set --json echo.default '{ "name": "beepboop"  }'
ftl: error: unknown: JSON validation failed: default has wrong type, expected String found map[string]interface {}
❯ ftl config set --json echo.default "{\"name\": \"beepboop\"}"
ftl: error: unknown: JSON validation failed: default has wrong type, expected String found map[string]interface {}
❯ ftl config set --db --json echo.default '"{\"name\": \"beepboop\"}"'

Note

Finally! But yuck

❯ ftl config get echo.default
"{\"name\": \"beepboop\"}"
❯ ftl config set --db echo.default '{"name": 3}'
❯ ftl config get echo.default
"{\"name\": 3}"
@github-actions github-actions bot added the triage Issue needs triaging label Nov 15, 2024
@ftl-robot ftl-robot mentioned this issue Nov 15, 2024
@alecthomas
Copy link
Collaborator

The error is correct, but could perhaps be clearer... --json is for specifying strongly typed values, the FTL type is String and you're trying to put a map into it.

@matt2e
Copy link
Collaborator

matt2e commented Nov 18, 2024

--json has tripped a number of people up I think at this point. I wonder if we assume the input is a json string, and then have a fallback of if the expected type is string and it could not be parsed by json then we just use the input string as is...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Issue needs triaging
Projects
None yet
Development

No branches or pull requests

3 participants