-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add @:json via tink_json #7
Conversation
Ok, this doesn't work as easy as I had hoped :) TypeCrawler continues crawling the type, resulting in "not implemented" warnings where you might for example want to encode an enum via tink_json. |
Closing this in favour of:
|
Can you please open an issue for this though? ^^ |
|
||
#if tink_json | ||
switch f.meta.getValues(':json') { | ||
case [[]]: f.expr = macro tink.Json.parse(this.params.get(prefix)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, why does it check for a two-dimension array here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it is Array<Array<Expr>>
https://github.com/haxetink/tink_macro/blob/92f60cbe4f991787ddc8ce5c3ceea9e630a1d8a9/src/tink/macro/Metadatas.hx#L17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In short, @:json(12) @:json(true, false) @:json
will result in [[12], [true, false], []]
so to speak (except that it's expressions, rather than constants).
Would something like this be ok? It makes things easier in tink_web to encode or decode parameters which are json encoded.