Exemple #1
0
        /// <summary>
        /// Add a `const` keyword to the schema.
        /// </summary>
        public static JsonSchema Const(this JsonSchema schema, JsonValue value)
        {
            schema.Add(new ConstKeyword(value));

            return(schema);
        }
        /// <summary>
        /// Add a `readOnly` keyword to the schema.
        /// </summary>
        public static JsonSchema ReadOnly(this JsonSchema schema, bool isReadOnly)
        {
            schema.Add(new ReadOnlyKeyword(isReadOnly));

            return(schema);
        }
        /// <summary>
        /// Add a `$ref` keyword to the schema.
        /// </summary>
        public static JsonSchema Ref(this JsonSchema schema, string reference)
        {
            schema.Add(new RefKeyword(reference));

            return(schema);
        }
        /// <summary>
        /// Add a `multipleOf` keyword to the schema.
        /// </summary>
        public static JsonSchema MultipleOf(this JsonSchema schema, double divisor)
        {
            schema.Add(new MultipleOfKeyword(divisor));

            return(schema);
        }
        /// <summary>
        /// Add a `pattern` keyword to the schema.
        /// </summary>
        public static JsonSchema Pattern(this JsonSchema schema, Regex pattern)
        {
            schema.Add(new PatternKeyword(pattern));

            return(schema);
        }
        /// <summary>
        /// Add a `minContains` keyword to the schema.
        /// </summary>
        public static JsonSchema MinContains(this JsonSchema schema, uint count)
        {
            schema.Add(new MinContainsKeyword(count));

            return(schema);
        }
        /// <summary>
        /// Add a `minLength` keyword to the schema.
        /// </summary>
        public static JsonSchema MinLength(this JsonSchema schema, uint length)
        {
            schema.Add(new MinLengthKeyword(length));

            return(schema);
        }
        /// <summary>
        /// Add a `descriptions` keyword to the schema.
        /// </summary>
        public static JsonSchema Description(this JsonSchema schema, string description)
        {
            schema.Add(new DescriptionKeyword(description));

            return(schema);
        }
        /// <summary>
        /// Add an `additionalProperties` keyword to the schema.
        /// </summary>
        public static JsonSchema AdditionalProperties(this JsonSchema schema, JsonSchema otherSchema)
        {
            schema.Add(new AdditionalPropertiesKeyword(otherSchema));

            return(schema);
        }
        /// <summary>
        /// Add a `default` keyword to the schema.
        /// </summary>
        public static JsonSchema Default(this JsonSchema schema, JsonValue value)
        {
            schema.Add(new DefaultKeyword(value));

            return(schema);
        }
        /// <summary>
        /// Add an `additionalItems` keyword to the schema.
        /// </summary>
        public static JsonSchema AdditionalItems(this JsonSchema schema, JsonSchema additionalItems)
        {
            schema.Add(new AdditionalItemsKeyword(additionalItems));

            return(schema);
        }
        /// <summary>
        /// Add a `contentSchema` keyword to the schema.
        /// </summary>
        public static JsonSchema ContentSchema(this JsonSchema schema, JsonSchema match)
        {
            schema.Add(new ContentSchemaKeyword(match));

            return(schema);
        }
        /// <summary>
        /// Add a `contentMediaType` keyword to the schema.
        /// </summary>
        public static JsonSchema ContentMediaType(this JsonSchema schema, string mediaType)
        {
            schema.Add(new ContentMediaTypeKeyword(mediaType));

            return(schema);
        }
        /// <summary>
        /// Add a `contentEncoding` keyword to the schema.
        /// </summary>
        public static JsonSchema ContentEncoding(this JsonSchema schema, string encoding)
        {
            schema.Add(new ContentEncodingKeyword(encoding));

            return(schema);
        }
        /// <summary>
        /// Add an `if` keyword to the schema.
        /// </summary>
        public static JsonSchema If(this JsonSchema schema, JsonSchema ifSchema)
        {
            schema.Add(new IfKeyword(ifSchema));

            return(schema);
        }
        /// <summary>
        /// Add an `else` keyword to the schema.
        /// </summary>
        public static JsonSchema Else(this JsonSchema schema, JsonSchema elseSchema)
        {
            schema.Add(new ElseKeyword(elseSchema));

            return(schema);
        }
        /// <summary>
        /// Add a `maxItems` keyword to the schema.
        /// </summary>
        public static JsonSchema MaxItems(this JsonSchema schema, uint count)
        {
            schema.Add(new MaxItemsKeyword(count));

            return(schema);
        }
        /// <summary>
        /// Add an `enum` keyword to the schema.
        /// </summary>
        public static JsonSchema Enum(this JsonSchema schema, params JsonValue[] values)
        {
            schema.Add(new EnumKeyword(values));

            return(schema);
        }
        /// <summary>
        /// Add a `minimum` keyword to the schema.
        /// </summary>
        public static JsonSchema Minimum(this JsonSchema schema, double minimum)
        {
            schema.Add(new MinimumKeyword(minimum));

            return(schema);
        }
        /// <summary>
        /// Add an `examples` keyword to the schema.
        /// </summary>
        public static JsonSchema Examples(this JsonSchema schema, params JsonValue[] value)
        {
            schema.Add(new ExamplesKeyword(value));

            return(schema);
        }
        /// <summary>
        /// Add a `minProperties` keyword to the schema.
        /// </summary>
        public static JsonSchema MinProperties(this JsonSchema schema, uint count)
        {
            schema.Add(new MinPropertiesKeyword(count));

            return(schema);
        }
        /// <summary>
        /// Add an `exclusiveMaximum` keyword to the schema.
        /// </summary>
        public static JsonSchema ExclusiveMaximum(this JsonSchema schema, double maximum)
        {
            schema.Add(new ExclusiveMaximumKeyword(maximum));

            return(schema);
        }
        /// <summary>
        /// Add a `not` keyword to the schema.
        /// </summary>
        public static JsonSchema Not(this JsonSchema schema, JsonSchema notSchema)
        {
            schema.Add(new NotKeyword(notSchema));

            return(schema);
        }
        /// <summary>
        /// Add an `exclusiveMinimum` keyword for draft-04 to the schema.
        /// </summary>
        public static JsonSchema ExclusiveMinimumDraft04(this JsonSchema schema, bool isExclusive)
        {
            schema.Add(new ExclusiveMinimumDraft04Keyword(isExclusive));

            return(schema);
        }
        /// <summary>
        /// Add a `propertyNames` keyword to the schema.
        /// </summary>
        public static JsonSchema PropertyNames(this JsonSchema schema, JsonSchema otherSchema)
        {
            schema.Add(new PropertyNamesKeyword(otherSchema));

            return(schema);
        }
        /// <summary>
        /// Add a `format` keyword to the schema.
        /// </summary>
        public static JsonSchema Format(this JsonSchema schema, StringFormat format)
        {
            schema.Add(new FormatKeyword(format));

            return(schema);
        }
        /// <summary>
        /// Add a `$recursiveAnchor` keyword to the schema.  The only supported value is `true`.
        /// </summary>
        public static JsonSchema RecursiveAnchor(this JsonSchema schema, bool value)
        {
            schema.Add(new RecursiveAnchorKeyword(value));

            return(schema);
        }
        /// <summary>
        /// Add an `id` keyword for draft-04 to the schema.
        /// </summary>
        public static JsonSchema IdDraft04(this JsonSchema schema, string id)
        {
            schema.Add(new IdKeywordDraft04(id));

            return(schema);
        }
        /// <summary>
        /// Add a `$ref` keyword that points to the root (`#`) to the schema.
        /// </summary>
        public static JsonSchema RefRoot(this JsonSchema schema)
        {
            schema.Add(new RefKeyword("#"));

            return(schema);
        }
Exemple #30
0
        /// <summary>
        /// Add a `writeOnly` keyword to the schema.
        /// </summary>
        public static JsonSchema WriteOnly(this JsonSchema schema, bool isWriteOnly)
        {
            schema.Add(new WriteOnlyKeyword(isWriteOnly));

            return(schema);
        }