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

Option JSON structures as native PHP types #37

Open
paulotruta opened this issue Jun 16, 2021 · 1 comment
Open

Option JSON structures as native PHP types #37

paulotruta opened this issue Jun 16, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@paulotruta
Copy link
Member

Def thinking the way we're decoding these options into json arrays we should perhaps think about mapping these to real types... not sure what would be best as we could manually do it for the PHP side which would be sufficient but it's also from the go side right pushing them in.. opinions?

Originally posted by @inverse in #34 (comment)

@paulotruta
Copy link
Member Author

Yeah, agree about decoding into native types, as we can potentially validate the data even before it gets into the controller.

Validation is happening on the Go side thanks to Marshall and Unmarshall requirement of having to define these json structures as go types.

I also agree that we can use pure PHP for this, and gain a few neat features such as data types and expected values validation, a better structured codebase and thus cleaner code, and way less confusion on the controller side.

My suggestion is that we create the types and a class for serializing and deserializing these types from and to json. Then we replace the current option calls in the codebase with the native types ones which return known structures to PHP. Will be fun 😉

I see a good potential improvement here. Let's open a new issue based on this as the scope of doing it is probably gonna touch more parts of the codebase.

Originally posted by @paulotruta in #34 (comment)

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

No branches or pull requests

1 participant