Get validation schemas name.

@param  string  $scenario

@return array
9023
protected function getValidationSchemasName($scenario)
    {
        $on     = 'on' . ucfirst($scenario);
        $extend = 'extend' . ucfirst($scenario);

        return [$on, $extend];
    }
376780
public function getValidation($field = null)
    {

        $validation = array();
        $schema = $this->getModelSchema();

        if ($field != null)
            $schema = array($field => $schema[$field]);

        foreach ( $schema as $key => $value ) {
            if (!isset($value['validation']))
                throw new Exception('Validation missing for key: '.$field);
            $validation[$key] = $value['validation'];
        }

        if ($field != null)
            return $validation[$field];

        return $validation;
    }
566089
public static function getAllSchemas()
    {
        // registry schema
        $registrySchemaFilename = dirname(__FILE__).'/Validators/schemas/registry.json';
        $registry = [
            (object) [
                'id' => 'registry',
                'schema' => 'https://specs.frictionlessdata.io/schemas/registry.json',
                'schema_path' => 'registry.json',
            ],
        ];
        // schemas from the registry (currently contains only the datapackage scheams)
        $schemaIds = [];
        if (file_exists($registrySchemaFilename)) {
            foreach (json_decode(file_get_contents($registrySchemaFilename)) as $schema) {
                $schemaIds[] = $schema->id;
                $registry[] = $schema;
            }
            // resource schemas - currently not in the registry
            foreach (['data-resource', 'tabular-data-resource'] as $id) {
                if (!in_array($id, $schemaIds)) {
                    $registry[] = (object) [
                        'id' => $id,
                        'schema' => "https://specs.frictionlessdata.io/schemas/{$id}.json",
                        'schema_path' => "{$id}.json",
                    ];
                }
            }
        }
        // custom registered schemas
        foreach (static::$registeredSchemas as $profile => $schema) {
            $registry[] = (object) [
                'id' => $profile,
                'schema_filename' => $schema['filename'],
            ];
        }

        return $registry;
    }
967034
protected function getSchemaForMessage($message)
    {
        // Form schema messages treat simple strings as plain text, so nest for html messages
        $value = $message['message'];
        if ($message['messageCast'] === ValidationResult::CAST_HTML) {
            $value = ['html' => $message];
        }
        return [
            'value' => $value,
            'type' => $message['messageType'],
            'field' => empty($message['fieldName']) ? null : $message['fieldName'],
        ];
    }
267139
protected function _getQuotedSchema($schema = null)
    {
        if ($schema === null) {
            return null;
        }
        return $this->_adapter->quoteIdentifier($schema, true) . '.';
    }
1275886
public function getSchemaDataDefaults()
    {
        return [
            'name' => $this->getName(),
            'id' => $this->ID(),
            'type' => $this->getInputType(),
            'schemaType' => $this->getSchemaDataType(),
            'component' => $this->getSchemaComponent(),
            'holderId' => $this->HolderID(),
            'title' => $this->obj('Title')->getSchemaValue(),
            'source' => null,
            'extraClass' => $this->extraClass(),
            'description' => $this->obj('Description')->getSchemaValue(),
            'rightTitle' => $this->obj('RightTitle')->getSchemaValue(),
            'leftTitle' => $this->obj('LeftTitle')->getSchemaValue(),
            'readOnly' => $this->isReadonly(),
            'disabled' => $this->isDisabled(),
            'customValidationMessage' => $this->getCustomValidationMessage(),
            'validation' => $this->getSchemaValidation(),
            'attributes' => [],
            'autoFocus' => $this->isAutofocus(),
            'data' => [],
        ];
    }
17248
public function getSchemaString($ctx=null) 
    {
      $str = "";
      if (!$ctx)
          $ctx = $this->schema->fields;

      foreach ($ctx as $f)
          $str.=$f. ",";

      return $str;
    }
195820
public function rulesAddScenario(array $rules, $scenario)
    {
        foreach ($rules as $key => $rule) {
            $rules[$key]['on'] = $scenario;
        }

        return $rules;
    }
1214707
protected function getValidatedStrategyFromConfig():string
    {
        $strategy = config('sharp.extensions.assets.strategy', 'raw');

        if(!is_string($strategy)) {
            throw new SharpInvalidAssetRenderStrategy('The asset strategy defined at sharp.extensions.assets.strategy is not a string');
        }

        if(!in_array($strategy, $this->renderStrategies)) {
            throw new SharpInvalidAssetRenderStrategy("The asset strategy [$strategy] is not raw, asset, or mix");
        }

        return $strategy;
    }
658896
public function schema($request)
    {
        $formName = $request->param('FormName');
        if ($formName !== 'fileHistoryForm') {
            return parent::schema($request);
        }

        // Get schema for history form
        // @todo Eventually all form scaffolding will be based on context rather than record ID
        // See https://github.com/silverstripe/silverstripe-framework/issues/6362
        $itemID = $request->param('ItemID');
        $version = $request->param('OtherItemID');
        $form = $this->getFileHistoryForm([
            'RecordID' => $itemID,
            'RecordVersion' => $version,
        ]);

        // Respond with this schema
        $response = $this->getResponse();
        $response->addHeader('Content-Type', 'application/json');
        $schemaID = $this->getRequest()->getURL();
        return $this->getSchemaResponse($schemaID, $form);
    }
567749
public function validateSchema($schema = self::STRICT_SCHEMA)
    {
        $content = file_get_contents($this->path);
        $data = json_decode($content);

        if (null === $data && 'null' !== $content) {
            self::validateSyntax($content, $this->path);
        }

        $schemaFile = __DIR__ . '/../../../res/composer-schema.json';
        $schemaData = json_decode(file_get_contents($schemaFile));

        if ($schema === self::LAX_SCHEMA) {
            $schemaData->additionalProperties = true;
            $schemaData->required = array();
        }

        $validator = new Validator();
        $validator->check($data, $schemaData);

        // TODO add more validation like check version constraints and such, perhaps build that into the arrayloader?

        if (!$validator->isValid()) {
            $errors = array();
            foreach ((array) $validator->getErrors() as $error) {
                $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
            }
            throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
        }

        return true;
    }
554868
private static function get_scenario_key( $event ) {
		$scenario_key = '';
		if ( $file = self::get_event_file( $event, $line ) ) {
			$scenario_grandparent = Utils\basename( dirname( dirname( $file ) ) );
			$scenario_key = $scenario_grandparent . ' ' . Utils\basename( $file ) . ':' . $line;
		}
		return $scenario_key;
	}
1365299
protected function getSchemaFileName($folder, $schema)
    {
        $file = null;

        foreach (['yml', 'yaml'] as $ext) {
            $fileCheck = $folder.'/'.$schema.'.'.$ext;
            if (is_readable($fileCheck)) {
                $file = $fileCheck;
                break;
            }
        }

        if (is_null($file)) {
            throw new SchemaParserException(sprintf('Cannot find schema for "%s" in "%s"', $schema, $folder));
        }

        return $file;
    }
1283597
public static function schemaRegex(): string
    {
        static $regex;

        if (!$regex) {
            $curlyBrR = (new InNamespaceRegex('{', '}'))->capture('param');

            $squareBrR = (new InNamespaceRegex('[', ']'))->recursive()->capture('segment');

            $regex = "(?:{$curlyBrR}(?'paramOptional'\\?)?)|(?:{$squareBrR})";
        }

        return $regex;
    }
984974
function validate($schemaFileName, &$errors = []) {
		parent::validate($schemaFileName, $errors);
		$errors = array_filter($errors, function($message) {
			/** @var string $message */
			// 2015-11-15
			// Не отключаем валидацию составного файла полностью,
			// а лишь убираем их диагностического отчёта сообщения о сбоях в наших полях.
			return
				// 2015-11-15
				// «Element 'dfSample': This element is not expected. Line: 55»
				// https://github.com/mage2pro/core/tree/57607cc23405c3dcde50999d063b2a7f49499260/Config/etc/system_file.xsd#L207
				!df_contains($message, 'Element \'df')
				// 2015-12-29
				// https://github.com/mage2pro/core/tree/57607cc23405c3dcde50999d063b2a7f49499260/Config/etc/system_file.xsd#L70
				// «Element 'field', attribute 'dfItemFormElement': The attribute 'dfItemFormElement' is not allowed.»
				&& !df_contains($message, 'attribute \'df')
			;
		});
		return !$errors;
	}
731894
private function matchScenario($scenarios): bool
    {
        if (Assert::stringNotEmpty($scenarios)) {
            $scenarios = explode(',', $scenarios);
        }

        $scenarios = array_map('trim', $scenarios);

        return Assert::oneOf($this->scenario, $scenarios);
    }
11496
public function isScenarioMatch(ScenarioInterface $scenario)
    {
        if ('/' === $this->filterString[0] && 1 === preg_match($this->filterString, $scenario->getTitle())) {
            return true;
        } elseif (false !== mb_strpos($scenario->getTitle(), $this->filterString, 0, 'utf8')) {
            return true;
        }

        return false;
    }