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

Enhaced support for struct serialization and de-serialization #6745

Open
asterkin opened this issue Jun 18, 2024 · 2 comments
Open

Enhaced support for struct serialization and de-serialization #6745

asterkin opened this issue Jun 18, 2024 · 2 comments
Labels
✨ enhancement New feature or request needs-discussion Further discussion is needed prior to impl 🎨 sdk SDK

Comments

@asterkin
Copy link

Use Case

Here are regular needs I encountered in my development practice:

  1. struct.toJson() - required for storage and, sometimes I/O (when struct Json needs to be enclosed in some outer Json) operations; Workaround Json.parse(Jsonstringify(...)) is expensive and does not always work.
  2. struct.fromJson(...) with proper support for standard types like DateTime, Enums, etc. Json.stringify() will convert these fields to strings, but fromJson() will fail.
  3. struct.toFieldArray(), struct.fromFieldArray() - useful for tests and generic CVS
  4. As a pre-condition forth and back conversion between Enums and strings - TypeScript supports it.

Proposed Solution

You may find a sample implementation here: https://github.com/asterkin/endor.w/tree/main/structx

Implementation Notes

No response

Component

SDK

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
  • If this issue is labeled needs-discussion, it means the spec has not been finalized yet. Please reach out on the #dev channel in the Wing Discord.
@asterkin asterkin added needs-discussion Further discussion is needed prior to impl ✨ enhancement New feature or request labels Jun 18, 2024
@Chriscbr
Copy link
Contributor

Great suggestions

struct.toFieldArray(), struct.fromFieldArray() - useful for tests and generic CVS

@asterkin What would these do?

@asterkin
Copy link
Author

@Chriscbr I added you to my bluezone.endor.w GitHub repository. Here fromFieldArray is used for implementing Cucumber-like BDD tests. I do not have a practical example of toFieldArray(), but any serialization to a CVS-like file could use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request needs-discussion Further discussion is needed prior to impl 🎨 sdk SDK
Projects
Status: 🤝 Backlog - handoff to owners
Development

No branches or pull requests

3 participants