Пример #1
0
 /// <param name="id">It identifies a schema resource with its canonical URI.</param>
 /// <param name="anchor">When writing schema documents with the intention to provide re-usable schemas,
 ///     it may be preferable to use a plain name fragment that is not tied to any particular structural location.
 ///     This allows a subschema to be relocated without requiring JSON Pointer references to be updated.</param>
 /// <param name="constraints">The list of constraints that apply to this schema resource.</param>
 /// <param name="title">The title of this schema resource.</param>
 /// <param name="description">The description of this schema resource.</param>
 /// <param name="comment">The comment from schema authors to readers or maintainers of the schema.</param>
 /// <param name="deprecated">Indicates if the JSON schema resource is deprecated.</param>
 /// <param name="readOnly">Indicates if the JSON schema resource is read-only.</param>
 /// <param name="writeOnly">Indicates if the JSON schema resource is write-only.</param>
 /// <param name="recursiveAnchor">Indicates if recursive references to this schema resource should be evaluated dynamically.
 ///     See the JSON schema <a href="https://json-schema.org/draft/2019-09/json-schema-core.html#recursive-example">spec</a>
 ///     for more information.</param>
 /// <param name="default">The default value for this schema resource if one is not specified.</param>
 /// <param name="examples">The array of JSON examples.</param>
 /// <param name="definitions">The validations that can be referred to later using a <see cref="RecursiveAnchor"/>.</param>
 protected JsonSchemaResource(
     Uri?id,
     string?anchor,
     IEnumerable <JsonSchemaConstraint>?constraints,
     string?title,
     string?description,
     string?comment,
     bool?deprecated,
     bool?readOnly,
     bool?writeOnly,
     bool?recursiveAnchor,
     JsonSchemaConstant? @default,
     IEnumerable <JsonSchemaConstant>?examples,
     IDictionary <string, JsonSchemaSubSchema>?definitions)
 {
     Id               = id;
     Anchor           = anchor;
     this.constraints = new JsonSchemaConstraints(constraints);
     Title            = title;
     Description      = description;
     Comment          = comment;
     Deprecated       = deprecated;
     ReadOnly         = readOnly;
     WriteOnly        = writeOnly;
     RecursiveAnchor  = recursiveAnchor;
     Default          = @default;
     Examples         = examples?.AsMutableList();
     Definitions      = definitions;
 }
 protected virtual void VisitConstraints(JsonSchemaConstraints constraints)
 {
     foreach (var constraint in constraints)
     {
         Visit(constraint);
     }
 }
Пример #3
0
        protected override void VisitConstraints(JsonSchemaConstraints constraints)
        {
            var newConstraints = constraints.NewConstraints;

            if (newConstraints != null)
            {
                foreach (var constraint in newConstraints)
                {
                    Visit(constraint);
                }
            }
        }
Пример #4
0
 protected JsonSchemaResource()
 {
     constraints = new JsonSchemaConstraints();
 }
 internal Enumerator(JsonSchemaConstraints parent)
 {
     this.parent = parent;
     current     = null;
     index       = 0;
 }