-
Notifications
You must be signed in to change notification settings - Fork 217
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 attribute to variants #188
Comments
@4n70w4 thanks for the feature request. I think I can see the value in this, wondering if you think this attachment field should support strictly JSON or any value (like a blob). Reason being, I don't want to get into validating user input as JSON, but perhaps I dont need to. Whatever the user saves as the value could be returned as an attachment. What are your thoughts? |
@markphelps yes you're right, may be do payload in any format. |
Hi @markphelps, we are currently working on this feature and wanted to get some input about how the field should be represented in the UI. As per the comments above, we've implemented But we feel that the field would be better served as Additionally, if you have other general thoughts about this feature then do let us know. Thanks. Draft PR: #685 |
Thanks for taking this on and for the PR @amayvs ! I agree I think JSON would be better than storing binary. Yes for the UI I was thinking we would have a textarea that is optional, and perhaps verify that it is proper JSON before submitting. We'd likely want to do that validation on the server side as well before accepting the JSON and perhaps put a limit to the number of bytes that can be stored? |
Hi @markphelps, What would you recommend the default limit to the number of bytes? I am planning to add a new config, |
@kevin-ip honestly I think we can just hardcode the max of the 10kb of json is quite a lot for a single field I think I was thinking something like this which I guess does make sense to be in the variant validator const MAX_VARIANT_ATTACHMENT_SIZE = 10000
bytes, err := json.Marshal(req.Attachment)
if err != nil { ... }
if len(bytes) > MAX_VARIANT_ATTACHMENT_SIZE {
return errs.InvalidFieldError("attachment", "max json payload size is 10kb")
} or something similar? That way we don't have to modify the validator itself to pass in the context or add a new config property |
Case: I have 10 000 (and increasing) variants for one flag. In my code i wan't manualy write code for each variant key. I want get variant contain json with variant data. Example variant json:
And in my code write one code when handle json from variant instead if/else/switch for each variant.
The text was updated successfully, but these errors were encountered: