dist/@ajsf/core/esm2015/lib/shared/json-schema.functions.js
/**
 * 'isInputRequired' function
 *
 * Checks a JSON Schema to see if an item is required
 *
 * //   schema - the schema to check
 * //  { string } schemaPointer - the pointer to the item to check
 * // { boolean } - true if the item is required, false if not
 */
'isInputRequired' function
Checks a JSON Schema to see if an item is required

the schema to check
{ string } schemaPointer - the pointer to the item to check
{ boolean } - true if the item is required, false if not
' isInputRequired ' function Checks a JSON Schema to see if an item is required the schema to check { string } schemaPointer - the pointer to the item to check { boolean } - true if the item is required false if not
function isInputRequired(schema, schemaPointer) {
    if (!isObject(schema)) {
        console.error('isInputRequired error: Input schema must be an object.');
        return false;
    }
    const listPointerArray = JsonPointer.parse(schemaPointer);
    if (isArray(listPointerArray)) {
        if (!listPointerArray.length) {
            return schema.required === true;
        }
        const keyName = listPointerArray.pop();
        const nextToLastKey = listPointerArray[listPointerArray.length - 1];
        if (['properties', 'additionalProperties', 'patternProperties', 'items', 'additionalItems']
            .includes(nextToLastKey)) {
            listPointerArray.pop();
        }
        const parentSchema = JsonPointer.get(schema, listPointerArray) || {};
        if (isArray(parentSchema.required)) {
            return parentSchema.required.includes(keyName);
        }
        if (parentSchema.type === 'array') {
            return hasOwn(parentSchema, 'minItems') &&
                isNumber(keyName) &&
                +parentSchema.minItems > +keyName;
        }
    }
    return false;
}
function isInputRequired ( schema , schemaPointer ) { if ( ! isObject ( schema ) ) { console . error ( 'isInputRequired error: Input schema must be an object.' ) ; return false ; } const listPointerArray = JsonPointer . parse ( schemaPointer ) ; if ( isArray ( listPointerArray ) ) { if ( ! listPointerArray . length ) { return schema . required === true ; } const keyName = listPointerArray . pop ( ) ; const nextToLastKey = listPointerArray [ listPointerArray . length - 1 ] ; if ( [ 'properties' , 'additionalProperties' , 'patternProperties' , 'items' , 'additionalItems' ] . includes ( nextToLastKey ) ) { listPointerArray . pop ( ) ; } const parentSchema = JsonPointer . get ( schema , listPointerArray ) || { } ; if ( isArray ( parentSchema . required ) ) { return parentSchema . required . includes ( keyName ) ; } if ( parentSchema . type === 'array' ) { return hasOwn ( parentSchema , 'minItems' ) && isNumber ( keyName ) && + parentSchema . minItems > + keyName ; } } return false ; }
'isInputRequired' function
 Checks a JSON Schema to see if an item is required
' isInputRequired ' function Checks a JSON Schema to see if an item is required