swagccg core API

Entry Point

swagccg.src.swagccg_m2m(confi_path)

renders swagger.json and confi.json to a client

Args:
confi_path: optional path to a configuration json file confi.json

Todo

be more granular on the used templates(i.e. addpath(), login() .. code:: matlab

% i.e. client_imports = client_imports_f(); client_point_of_execution = client_point_of_execution_f();

Todo

complete packaging

Todo

setup script

Todo

client setup script

Template

swagccg.src.client_imports_f()
swagccg.src.render_constructor_f()
swagccg.src.client_point_of_execution_f()
swagccg.src.create_methods_code_f()
swagccg.src.client_method_template_f()

IO

swagccg.src.utf8_write_to_file_f()
swagccg.src.save_fread_f()
swagccg.src.read_in_template_f()

utilities

swagccg.src.timestamp()
swagccg.src.convert_to_snake_case_f()
swagccg.src.mustache_scanner_f()

handling Swagger.json

swagccg.src.modify_swagger()
swagccg.src.loadjson_mod(fname, varargin)

parse a JSON (JavaScript Object Notation) file or string, modified to adjust and parse swagger API definition in a MatLab compatible way. Plese note that this function and there subfunction are not tested to work on non swagger files (i.e. not backwards compatible). Modified by Erkan Demiralay 2018/12/06

Call Signatures:
  • data = loadjson(fname, opt)
  • data = loadjson(fname, 'param1', value1, 'param2', value2, ...)
Authors:
Args:
fname: input file name, if fname contains “{}” or “[]”, fname
will be interpreted as a JSON string
opt: a struct to store parsing options, opt can be replaced by

a list of (‘param’,value) pairs - the param string is equivallent to a field in opt. opt can have the following fields (first in [.|.] is the default)

opt.SimplifyCell [0|1]: 1, loadjson will call cell2mat
for each element of the JSON data, and group arrays based on the cell2mat rules.
opt.FastArrayParser [1|0|int]: 1 use a speed-optimized array parser when loading an

array object. The fast array parser may collapse block arrays into a single large array similar to rules defined in cell2mat;

0 to use a legacy parser;

if set to a larger-than-1 value, this option will specify the minimum dimension to enable the fast array parser. For example, if the input is a 3D array, setting FastArrayParser to 1 will return a 3D array;

2 will return a cell array of 2D arrays;

3 will return to a 2D cell array of 1D vectors;

4 will return a 3D cell array.

opt.ShowProgress [0|1]: if set to 1, loadjson displays a progress bar.

Output:
dat: a cell array, where {…} blocks are converted into cell arrays,
and […] are converted to arrays
Examples:
dat = loadjson(‘{“obj”:{“string”:”value”,”array”:[1,2,3]}}’) dat = loadjson([‘examples’ filesep ‘example1.json’]) dat = loadjson([‘examples’ filesep ‘example1.json’],’SimplifyCell’,1)
License:
BSD License, see LICENSE files for details

Developement

swagccg.swagccg_m2m__init__()

Primary usage of swagccg_m2m__init__.m to identify the installation path. Later on this could act as storage for machine readable meta data (i.e. version, contact, docs).

swagccg.src.swagccg_m2m_package()
swagccg.src.swagccg_m2m_setup()
swagccg.src.swagccg_m2m_uninstall()
swagccg.src.a()
swagccg.src.d()