Skip to content

mdornseif/json-schema-remove-readonly-from-data

Repository files navigation

NPM License NPM Version Last Commit

json-schema-remove-readonly-from-data

Removes readOnly fields from data as defined by a json-schema. Often needed before sending Data to the Server.

Uses information from a JSON-Schema to process the data.

    >>> import {removeReadonly} from 'json-schema-remove-readonly-from-data'

    >>> SCHEMA = { 'type': 'object',
    ...            'properties': {
    ...                'ro': {'type': 'string', 'readOnly': True},
    ...                'rw': {'type': 'boolean'}}}

    >>> removeReadonly(SCHEMA, {rw: 'TST10001', ro: True})
    {
      "rw": "TST10001"
    }

See also: