INNER CODE UNIT · JavaScript

validateInput

Arenukvern/mcp_flutter · jaspr_web_example/web/intentcall_webmcp.generated.js:128

  function validateInput(schema, args) {
    if (!schema || schema.type !== 'object') return null;
    args = args && typeof args === 'object' && !Array.isArray(args) ? args : {};
    var properties = schema.properties || {};
    if (schema.additionalProperties === false) {
      for (var key in args) {
        if (Object.prototype.hasOwnProperty.call(args, key) &&
            !Object.prototype.hasOwnProperty.call(properties, key)) {
          return validationError('Unknown property "' + key + '".');
        }
      }
    }
    var required = schema.required;
    if (required && required.length) {
      for (var r = 0; r < required.length; r += 1) {
        var reqKey = required[r];
        if (!Object.prototype.hasOwnProperty.call(args, reqKey) ||
            args[reqKey] === undefined || args[reqKey] === null) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…