This function is called when the "Validate it!" button is clicked.
It calls Swagger Parser, passing it all the options selected on the form.
498825
function parseSwagger () {
  try {
    // Clear any previous results
    editors.clearResults();

    // Get all the parameters
    swaggerParser = swaggerParser || new SwaggerParser();
    var options = form.getOptions();
    var method = form.method.button.val();
    var api = form.getAPI();

    // Call Swagger Parser
    swaggerParser[method](api, options)
      .then(function () {
        // Show the results
        var results = swaggerParser.$refs.values();
        Object.keys(results).forEach(function (key) {
          editors.showResult(key, results[key]);
        });
      })
      .catch(function (err) {
        editors.showError(ono(err));
        analytics.trackError(err);
      });

    // Track the operation
    counters[method]++;
    analytics.trackEvent("button", "click", method, counters[method]);
  }
  catch (err) {
    editors.showError(ono(err));
    analytics.trackError(err);
  }
}
1269585
function Validatinator(validationInformation, validationErrorMessages) {
    if (! (this instanceof Validatinator)) {
        throw new Error("Whoops!  Validatinator must be called with the new keyword!");
    }

    // Users may want to add validation information later on so we will allow them to create an instance of Validatinator without passing
    // any validation information.
    this.validationInformation = (validationInformation !== undefined) ? this.utils.convertFieldValidationsToArray(validationInformation) : {};
    this.errors = {};

    // Current form & field we are validating against.
    this.currentForm;
    this.currentField;

    // Give our validations prototype object the properties needed to access the parent and utils methods.
    this.validations.parent = this;
    this.messages.parent = this;
    this.validations.utils = this.utils;
    this.messages.utils = this.utils;

    // Overwrite and create new validationErrorMessages if the user provided any.
    if (validationErrorMessages !== undefined) {
        this.messages.overwriteAndAddNewMessages(validationErrorMessages);
    }
}
128085
private static void validateFormatForViewAction(Format format) throws ApiException {
		switch (format) {
		case JSON:
		case JSONP:
		case XML:
		case HTML:
			return;
		default:
			throw new ApiException(ApiException.Type.BAD_FORMAT, "The format OTHER should not be used with views and actions.");
		}
	}
1296884
static Swagger validate( File jsonFile ) throws Exception {

		// Validate with the Swagger parser
		SwaggerDeserializationResult res = new SwaggerParser().readWithInfo( jsonFile.getAbsolutePath(), null, true );
		if( ! res.getMessages().isEmpty()) {
			for( String s : res.getMessages())
				System.out.println( s );

			throw new Exception( "Errors were found in a Swagger definition: " + jsonFile.getAbsolutePath());
		}

		return res.getSwagger();
	}
349060
function () {
            this._hasFocus = false;
            this._updateState();
            if (this._cfg.formatError && this._cfg.validationEvent === 'onBlur') {// show
                // errortip on blur used for debug purposes
                this._validationPopupShow();
            } else { // dispose of error tip
                this._validationPopupHide();
                if (this._cfg.directOnBlurValidation) {
                    if (this._cfg.bind) {
                        var bind = this._cfg.bind.value;
                        if (bind) {
                            var dataholder = bind.inside;
                            var name = bind.to;
                            var groups = this._cfg.validationGroups;
                            aria.utils.Data.validateValue(dataholder, name, null, groups, 'onblur');
                        }
                    }
                }
            }
            this._updateValue(true);
            // _updateValue can change the value in the data model, which could make the widget be disposed
            // (for example during a refresh of a section bound to that part of the data model)
            // That's why we are checking if this._cfg is defined here:
            var onblur = this._cfg ? this._cfg.onblur : null;
            if (onblur) {
                this.evalCallback(onblur);
            }
        }
1230992
function callValidate() {
    /* jshint validthis: true */
    var validate = compilation.validate;
    var result = validate.apply(this, arguments);
    callValidate.errors = validate.errors;
    return result;
  }
395482
function handleFieldValidated( isValid, msg ) {
		var input = this.getInputElement();
		if ( input )
			isValid ? input.removeAttribute( 'aria-invalid' ) : input.setAttribute( 'aria-invalid', true );

		if ( !isValid ) {
			if ( this.select )
				this.select();
			else
				this.focus();
		}

		msg && alert( msg );

		this.fire( 'validated', { valid: isValid, msg: msg } );
	}
506145
function( ajaxOptions, cache, el, fieldName, e ) {

      var self = this;

      $( this.tmp.parent ).addClass('validetta-pending');

      // cache xhr
      this.xhr[ fieldName ] = $.ajax( ajaxOptions )
        .done( function( result ) {
          if( typeof result !== 'object' ) result = JSON.parse( result );
          cache.state = 'resolved';
          cache.result = result;
          if ( cache.event === 'submit' ) {
            self.handler = false;
            $( self.form ).trigger('submit');
          }
          else if( result.valid === false ) {
            self.addErrorClass( self.tmp.parent );
            self.window.open.call( self, el, result.message );
          } else {
            self.addValidClass( self.tmp.parent );
          }
        } )
        .fail( function( jqXHR, textStatus ) {
          if ( textStatus !== 'abort' ) { // Dont throw error if request is aborted
            var _msg = 'Ajax request failed for field ('+ fieldName +') : '+ jqXHR.status +' '+ jqXHR.statusText;
            cache.state = 'rejected';
            cache.result = { valid : false, message : _msg };
            throw new Error( _msg );
          }
        } )
        .always( function( result ) { $( self.tmp.parent ).removeClass('validetta-pending'); } );

      this.handler = 'pending';
    }
850260
function(options) {
    options = options || {};

    if (options.defaultModelRendering !== 'model') {
      options.defaultModelRendering = 'schema';
    }

    if (!options.highlightSizeThreshold) {
      options.highlightSizeThreshold = 100000;
    }

    // Allow dom_id to be overridden
    if (options.dom_id) {
      this.dom_id = options.dom_id;
      delete options.dom_id;
    }

    if (!options.supportedSubmitMethods){
      options.supportedSubmitMethods = [
        'get',
        'put',
        'post',
        'delete',
        'head',
        'options',
        'patch'
      ];
    }

    if (typeof options.oauth2RedirectUrl === 'string') {
      window.oAuthRedirectUrl = options.redirectUrl;
    }

    // Create an empty div which contains the dom_id
    if (! $('#' + this.dom_id).length){
      $('body').append('<div id="' + this.dom_id + '"></div>') ;
    }

    this.options = options;

    // set marked options
    marked.setOptions({gfm: true});

    // Set the callbacks
    var that = this;
    this.options.success = function() { return that.render(); };
    this.options.progress = function(d) { return that.showMessage(d); };
    this.options.failure = function(d) { return that.onLoadFailure(d); };

    // Create view to handle the header inputs
    this.headerView = new SwaggerUi.Views.HeaderView({el: $('#header')});

    // Event handler for when the baseUrl/apiKey is entered by user
    this.headerView.on('update-swagger-ui', function(data) {
      return that.updateSwaggerUi(data);
    });

    // JSon Editor custom theming
     JSONEditor.defaults.iconlibs.swagger = JSONEditor.AbstractIconLib.extend({
      mapping: {
        collapse: 'collapse',
        expand: 'expand'
        },
      icon_prefix: 'swagger-'
      });

  }
451555
function(method, formOpts, callback) {
   
      var options = null;
      if(YAHOO.lang.isObject(formOpts) && YAHOO.lang.isArray(formOpts.fields) ) {
         options = formOpts;
      }
      // create the form directly from the method params
      else {
         options = inputEx.RPC.formForMethod(method);
      	// Add user options from formOpts
         YAHOO.lang.augmentObject(options, formOpts, true);
      }
   
      // Add buttons to launch the service
      options.type = "form";
      if(!options.buttons) {
         options.buttons = [
            {type: 'submit', value: method.name, onClick: function(e) {
               YAHOO.util.Event.stopEvent(e);
               form.showMask();
               method(form.getValue(), {
                  success: function(results) {
                     form.hideMask();
                     if(YAHOO.lang.isObject(callback) && YAHOO.lang.isFunction(callback.success)) {
               		   callback.success.call(callback.scope || this, results);
               		}
                  },
                  failure: function() {
                     form.hideMask();
                  }
               });
					return false; // do NOT send the browser submit event
            }}
         ];
      }
   
      var form = inputEx(options);
   
      return form;
   }
766938
def main(source):
    
    if source is None:
        click.echo(
            "You need to supply a file or url to a schema to a swagger schema, for"
            "the validator to work."
        )
        return 1
    try:
        load(source)
        click.echo("Validation passed")
        return 0
    except ValidationError as e:
        raise click.ClickException(str(e))
1252964
public function passes()
    {
        $this->messages = new MessageBag();

        // We'll spin through each rule, validating the attributes attached to that
        // rule. Any error messages will be added to the containers with each of
        // the other error messages, returning true if we don't have messages.
        foreach ($this->rules as $attribute => $rules) {
            foreach ($rules as $rule) {
                $this->validate($attribute, $rule);
            }
        }

        // Here we will spin through all of the "after" hooks on this validator and
        // fire them off. This gives the callbacks a chance to perform all kinds
        // of other validation that needs to get wrapped up in this operation.
        foreach ($this->after as $after) {
            call_user_func($after);
        }

        return count($this->messages->all()) === 0;
    }
669233
private void startAsyncValidation(final String formValidationHandler, final String config) {

        CmsRpcAction<Map<String, CmsValidationResult>> action = new CmsRpcAction<Map<String, CmsValidationResult>>() {

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
             */
            @Override
            public void execute() {

                final Map<String, String> values = new HashMap<String, String>();
                for (I_CmsFormField field : m_fields) {
                    values.put(field.getId(), field.getModelValue());
                }
                start(0, false);
                CmsCoreProvider.getService().validate(formValidationHandler, m_validationQueries, values, config, this);
            }

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
             */
            @Override
            protected void onResponse(Map<String, CmsValidationResult> result) {

                stop(false);
                onReceiveValidationResults(result);
            }

        };
        action.execute();
    }
964394
function setSelectedMethod (methodName) {
  form.method.button.val(methodName.toLowerCase());

  methodName = methodName[0].toUpperCase() + methodName.substr(1);
  form.method.button.text(methodName + " it!");
  form.tabs.url.text(methodName + " a URL");
  form.tabs.text.text(methodName + " Text");
}
983409
def dispatch_request(self, *args, **kwargs):
        
        if self.validation:
            specs = {}
            attrs = flasgger.constants.OPTIONAL_FIELDS + [
                'parameters', 'definitions', 'responses',
                'summary', 'description'
            ]
            for attr in attrs:
                specs[attr] = getattr(self, attr)
            definitions = {}
            specs.update(convert_schemas(specs, definitions))
            specs['definitions'] = definitions
            flasgger.utils.validate(
                specs=specs, validation_function=self.validation_function)
        return super(SwaggerView, self).dispatch_request(*args, **kwargs)
1050308
function makeFormBodyParser(spec) {
  const opts = spec.validate.formOptions || {};
  if (typeof opts.limit === 'undefined') {
    opts.limit = spec.validate.maxBody;
  }
  return async function parseFormBody(ctx, next) {
    if (!ctx.request.is('urlencoded')) {
      return ctx.throw(400, 'expected x-www-form-urlencoded');
    }
    ctx.request.body = ctx.request.body || await parse.form(ctx, opts);
    await next();
  };
}
1335981
def run_validation(field_name, options)
      promise = Promise.new.resolve(nil)
      options.each_pair do |validation, args|
        # Call the specific validator, then merge the results back
        # into one large errors hash.
        klass = validation_class(validation, args)

        if klass
          # Chain on the promises
          promise = promise.then do
            klass.validate(self, field_name, args)
          end.then do |errs|
            errors.merge!(errs)
          end
        else
          fail "validation type #{validation} is not specified."
        end
      end

      promise
    end