You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Trying to use Bebop as your primary serializer when working over HTTP / REST is very painful right now. There aren’t any convenient means to easily create test data for a defined type.
With JSON you have the ability to both define values and structure, but there is no real type information. In Javascript a JSON object you manually create to mirror a type in a Bebop schema still can’t be used to encode without first manually changing runtime types to be correct ones (which requires knowledge of those types!)
Describe the solution you'd like
Aggregate kinds such as unions, structs, and messages should generate with methods that both convert JSON to their underlying type and produce a JSON encoded version.
With these two methods a user can use any data mocking framework they want to test their implementations.
Additionally, bebopc should add two new flags, —to-json and —from-json
These flags would allow for the compiler itself to generate and validate test data.
bebopc —files point.bop —root-type Point —to-json << encoded.bin > decoded.json
Describe alternatives you've considered
I some standalone mocking tool which I actually got somewhat working but wasn’t portable and would have been easier if generated code already had easy methods of marshaling JSON.
** Other thoughts **
Possibly —json becomes a generation target that produces a valid JSON Schema which can be used to check JSON that is crafted by humans.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Trying to use Bebop as your primary serializer when working over HTTP / REST is very painful right now. There aren’t any convenient means to easily create test data for a defined type.
With JSON you have the ability to both define values and structure, but there is no real type information. In Javascript a JSON object you manually create to mirror a type in a Bebop schema still can’t be used to encode without first manually changing runtime types to be correct ones (which requires knowledge of those types!)
Describe the solution you'd like
Aggregate kinds such as unions, structs, and messages should generate with methods that both convert JSON to their underlying type and produce a JSON encoded version.
With these two methods a user can use any data mocking framework they want to test their implementations.
Additionally, bebopc should add two new flags,
—to-json
and—from-json
These flags would allow for the compiler itself to generate and validate test data.
or
Describe alternatives you've considered
I some standalone mocking tool which I actually got somewhat working but wasn’t portable and would have been easier if generated code already had easy methods of marshaling JSON.
** Other thoughts **
Possibly
—json
becomes a generation target that produces a valid JSON Schema which can be used to check JSON that is crafted by humans.The text was updated successfully, but these errors were encountered: