JSONSchToRd: Get R Documentation from a JSON schema.

View source: R/reporting-templates.R

JSONSchToRdR Documentation

Get R Documentation from a JSON schema.


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


JSONSchToRd(JSONSch, title = NULL)



List with JSON schema, as returned by fromJSON.


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


Character vector with R documentation for the specified JSON schema.

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).


Laure Cougnaud

clinDataReview documentation built on June 22, 2024, 10:03 a.m.