Skip to content

Latest commit

 

History

History
34 lines (19 loc) · 1.77 KB

JavaScript.md

File metadata and controls

34 lines (19 loc) · 1.77 KB

JavaScript

There are special use-cases that each language supports; this document pertains to JavaScript models.

Rendering complete models to a specific module system

In some cases you might need to render the complete models to a specific module system such as ESM and CJS.

Check out this example for a live demonstration how to generate the complete JavaScript models to use ESM module system.

Check out this example for a live demonstration how to generate the complete JavaScript models to use CJS module system.

Generate un/marshal functions for classes

Sometimes you want to use the models for data transfers, and while most cases would work out of the box, custom serializer functionality is needed for the advanced cases. If you generated the data models based on a JSON Schema document and you want the serialized data to validate against the schema, this functionality is REQUIRED.

Here, this can be done by including the preset JS_COMMON_PRESET using the option marshalling.

Check out this example out for a live demonstration.

Generate example data function

Generate example instance of the data model including the preset JS_COMMON_PRESET using the option example.

Check out this example out for a live demonstration.