Skip to content

Draft: New plugin : JSON

François-Xavier Mordant requested to merge fxm-json into master

Short description of the MR

This new plugin enables users to export data in JSON format.
This fixes #440, as explained below.

Why such plugin ?

Mustache was chosen initially for for its pioneering role as a logic-less, minimalist, and easy-to-use template language. However, one may prefer another tool if they are already familiar with it or if it better fulfills their specific use cases. Ultimately, this may require the implementation of multiple templating system plugins to meet more needs.

However, since templating systems are frequently used in web development, it has been identified, after closer inspection, that all the projects support JSON as input.

Therefore, a JSON plugin appears to be a suitable design option as it allows users to select their preferred logic-free templating system and allows users to use JSON as a file format for other needs via PDI, while finaly reducing development costs by leveraging existing tools.

Features

Always provide a JSON valid format for multiple variables in the same file, at different times, and multiples files per data.
All scalar types, arrays, tuples, strings, and records are supported.
Also provides conditional writing.

On-going work (current limitations):

  • Adding support for reading variables.
    Currently, the JSON plugin doesn't support reading variables, only writing them. To cover more use cases, the JSON plugin should be able to read variables as well as write them.
  • Improve strings handling. Concatenate arrays of chars to have "var": "value" instead of "var": ["v", "a", ...].
  • Added full support for types that can be recursive, e.g. arrays of arrays, arrays within structures etc.
  • The ability to create an on-the-go structures for several variables to be produced in a single JSON object
  • Continuous integration: More test units coverage

List of things to check before making a MR

Before merging your code, please check the following:

  • you have added a line describing your changes to the Changelog;
  • you have added any new or changed yaml config format to the validation script;
  • you have added unit tests for any new or improved feature;
  • you have checked pdi/docs/CheckList.md
  • you have checked your code format:
    • you have checked that you respect all conventions specified in CONTRIBUTING.md;
    • you have checked that the indentation and formating conforms to the docs/formating.astyle;
    • you have documented with doxygen any new or changed function / class;
  • you have correctly updated the copyright headers:
    • your institution is in the copyright header of every file you (substantially) modified;
    • you have checked that the end-year of the copyright there is the current one;
  • you have updated the AUTHORS file:
    • you have added yourself to the AUTHORS file;
    • if this is a new contribution, you have added it to the AUTHORS file;
  • you have added everything to the user documentation:
    • any new CMake configuration option;
    • any change in the yaml config;
    • any change to the public or plugin API;
    • any other new or changed user-facing feature;
    • any change to the dependencies;
  • you have correctly linked your MR to one or more issues:
    • your MR solves an identified issue;
    • your commit contain the Fix #issue keyword to autoclose the issue when merged;
  • you have added to this file any other check that was missing.
Edited by François-Xavier Mordant

Merge request reports