Esempio n. 1
0
        /// <summary>
        /// Adds a validator to the library.  This will override any existing validators for the same key.
        /// </summary>
        /// <param name="validator">The validator to add.</param>
        public static void RegisterFormat(IFormatValidator validator)
        {
            if (validator == null)
            {
                throw new ArgumentNullException(nameof(validator));
            }

            _lookup[validator.Format] = validator;
        }
Esempio n. 2
0
        /// <summary>
        /// Add a `format` keyword to the schema.
        /// </summary>
        public static JsonSchema Format(this JsonSchema schema, IFormatValidator format)
        {
            schema.Add(new FormatKeyword(format.Format));

            return(schema);
        }