Learn R Programming

clinDataReview (version 1.6.2)

JSONSchToRd: Get R Documentation from a JSON schema.

Description

Note: this function doesn't support the full JSON schema specification, currently only the functionalities required by the templates of the package are implemented.

Usage

JSONSchToRd(JSONSch, title = NULL)

Value

Character vector with R documentation for the specified JSON schema.

Arguments

JSONSch

List with JSON schema, as returned by fromJSON.

title

(optional) String with title. This will combined with the JSON schema 'title' tag if this is specified. is not available.

Supported JSON schema tags

  • 'title' is used as Rd section header

  • 'description' is included in the text

  • parameters are extracted from the following 'properties' tag:

    • 'type': object type

    • 'doc': documentation for the parameter (custom JSON schema tag). This can contain any Roxygen tags, e.g.: \link[package]{function}.

    • 'pattern' (optional): required value for the parameter

    • 'items' (optional): JSON schema for the different elements of an 'object'

    • 'minItems'/'maxItems' (optional): minimum/maximum number of elements in an 'array'

    • 'enum' (optional): set of possible values

    • 'const' (optional): fixed value for the parameter (a.k.a 'constant')

    If a parameter is required, it should be listed in the 'required' tag of the schema (outside of the 'properties' tag).

Author

Laure Cougnaud