Skip to content

Typegen fail in batch. #41

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

Open
jaynnn opened this issue Mar 22, 2024 · 1 comment
Open

Typegen fail in batch. #41

jaynnn opened this issue Mar 22, 2024 · 1 comment

Comments

@jaynnn
Copy link

jaynnn commented Mar 22, 2024

The exact same code can be run in git bash, but an error will be reported in batch:
json_typegen config/global_config.json -o code_template/rust/global_config.rs -n GlobalConfig --options "{ derives: 'Default, Debug, Clone, PartialEq, Serialize, Deserialize, Resource' }"
error:
The argument to 'derives' has to be a string literal, but remaining input was ''Default, Debug, Clone, PartialEq, Serialize, Deserialize, Resource' }'
That really confuse me.

@evestera
Copy link
Owner

I think the issue here is that the option parsing only supports double quoted string literals ("I am a string") and not single quoted strings ('I am a string') for option values, so the invocation should be
json_typegen config/global_config.json -o code_template/rust/global_config.rs -n GlobalConfig --options '{ derives: "Default, Debug, Clone, PartialEq, Serialize, Deserialize, Resource" }'

I might have a look at supporting single quoted string literals, but it might take a while before I get to that.

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

No branches or pull requests

2 participants