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
Currently this plugin uses class-transformer to handle serialization and deserialization of CloudFormation data.
This has a few problems at present:
The serialization breaks down in the face of unsupported JSON Schema Features
It ties the implementation to TypeScript's decorators which are soon to be completely deprecated, and results in a data model that might be foreign to a lot of JavaScript developers today (outside angular and nestjs)
Because of the above, it prevents JavaScript from working (though I'd personally always encourage TS over JS) (Support for JavaScript #8)
Instead of exposing every property via templating, use Ajv's typescript support to expose the data via standard JavaScript w/ typing support
For serialization, expose a toJSON that just stringifies enumerable properties (w/ validation) and mark CloudFormation's helpers as non-enumerable.
Hopefully the net result is something that provides a rich experience for end users, but greatly simplifies the generation/maintenance and makes code more standard TypeScript.
Happy to answer questions about implementation or contribute!
The text was updated successfully, but these errors were encountered:
RichiCoder1
changed the title
Switch to AJV for deserialization
Switch to AJV for deserialization and Simplify Implementation
Jul 27, 2022
Currently this plugin uses
class-transformer
to handle serialization and deserialization of CloudFormation data.This has a few problems at present:
I propose a simplification and breaking change in the plugin to instead:
toJSON
that just stringifies enumerable properties (w/ validation) and mark CloudFormation's helpers as non-enumerable.Hopefully the net result is something that provides a rich experience for end users, but greatly simplifies the generation/maintenance and makes code more standard TypeScript.
Happy to answer questions about implementation or contribute!
The text was updated successfully, but these errors were encountered: