internal void RegisterLocal(JsonSchema schema)
        {
            if (schema.Id != null && schema.Id.IsLocalSchemaId())
            {
                Log.Schema($"Registering \"{schema.Id}\"");
                lock (_contextLookup)
                {
                    _contextLookup[schema.Id] = schema;
                }
            }

            var anchor = schema.Get <AnchorKeyword>();

            if (anchor != null)
            {
                var anchorUri = $"{schema.DocumentPath}#{anchor.Value}";
                Log.Schema($"Registering \"{anchorUri}\"");
                lock (_contextLookup)
                {
                    _contextLookup[anchorUri] = schema;
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Gets the value for the `maxContains` keyword, if present.
 /// </summary>
 public static double?MaxContains(this JsonSchema schema)
 {
     return(schema.Get <MaxContainsKeyword>()?.Value);
 }
Beispiel #3
0
 /// <summary>
 /// Gets the value for the `contentSchema` keyword, if present.
 /// </summary>
 public static JsonSchema?ContentSchema(this JsonSchema schema)
 {
     return(schema.Get <ContentSchemaKeyword>()?.Value);
 }
Beispiel #4
0
 /// <summary>
 /// Gets the value for the `contentEncoding` keyword, if present.
 /// </summary>
 public static string?ContentEncoding(this JsonSchema schema)
 {
     return(schema.Get <ContentEncodingKeyword>()?.Value);
 }
Beispiel #5
0
 /// <summary>
 /// Gets the value for the `$comment` keyword, if present.
 /// </summary>
 public static string?Comment(this JsonSchema schema)
 {
     return(schema.Get <CommentKeyword>()?.Value);
 }
Beispiel #6
0
 /// <summary>
 /// Gets the value for the `uniqueItems` keyword, if present.
 /// </summary>
 public static Dictionary <SchemaVocabulary, bool>?Vocabulary(this JsonSchema schema)
 {
     return(schema.Get <VocabularyKeyword>());
 }
Beispiel #7
0
 /// <summary>
 /// Gets the value for the `unevaluatedProperties` keyword, if present.
 /// </summary>
 public static JsonSchema?UnevaluatedProperties(this JsonSchema schema)
 {
     return(schema.Get <UnevaluatedPropertiesKeyword>()?.Value);
 }
Beispiel #8
0
 /// <summary>
 /// Gets the value for the `then` keyword, if present.
 /// </summary>
 public static JsonSchema?Then(this JsonSchema schema)
 {
     return(schema.Get <ThenKeyword>()?.Value);
 }
Beispiel #9
0
 /// <summary>
 /// Gets the value for the `not` keyword, if present.
 /// </summary>
 public static JsonSchema?Not(this JsonSchema schema)
 {
     return(schema.Get <NotKeyword>()?.Value);
 }
Beispiel #10
0
 /// <summary>
 /// Gets the value for the `multipleOf` keyword, if present.
 /// </summary>
 public static double?MultipleOf(this JsonSchema schema)
 {
     return(schema.Get <MultipleOfKeyword>()?.Value);
 }
Beispiel #11
0
 /// <summary>
 /// Gets the value for the `minProperties` keyword, if present.
 /// </summary>
 public static double?MinProperties(this JsonSchema schema)
 {
     return(schema.Get <MinPropertiesKeyword>()?.Value);
 }
Beispiel #12
0
 /// <summary>
 /// Gets the value for the `minLength` keyword, if present.
 /// </summary>
 public static double?MinLength(this JsonSchema schema)
 {
     return(schema.Get <MinLengthKeyword>()?.Value);
 }
Beispiel #13
0
 /// <summary>
 /// Gets the value for the `minItems` keyword, if present.
 /// </summary>
 public static double?MinItems(this JsonSchema schema)
 {
     return(schema.Get <MinItemsKeyword>()?.Value);
 }
Beispiel #14
0
 /// <summary>
 /// Gets the value for the `additionalProperties` keyword, if present.
 /// </summary>
 public static JsonSchema?AdditionalProperties(this JsonSchema schema)
 {
     return(schema.Get <AdditionalPropertiesKeyword>()?.Value);
 }
Beispiel #15
0
 /// <summary>
 /// Gets the value for the `maximum` keyword, if present.
 /// </summary>
 public static double?Maximum(this JsonSchema schema)
 {
     return(schema.Get <MaximumKeyword>()?.Value);
 }
Beispiel #16
0
 /// <summary>
 /// Gets the value for the `anyOf` keyword, if present.
 /// </summary>
 public static List <JsonSchema>?AnyOf(this JsonSchema schema)
 {
     return(schema.Get <AnyOfKeyword>());
 }
Beispiel #17
0
 /// <summary>
 /// Gets the value for the `$schema` keyword, if present.
 /// </summary>
 public static string?Schema(this JsonSchema schema)
 {
     return(schema.Get <SchemaKeyword>()?.Value);
 }
Beispiel #18
0
 /// <summary>
 /// Gets the value for the `pattern` keyword, if present.
 /// </summary>
 public static Regex?Pattern(this JsonSchema schema)
 {
     return(schema.Get <PatternKeyword>()?.Value);
 }
Beispiel #19
0
 /// <summary>
 /// Gets the value for the `title` keyword, if present.
 /// </summary>
 public static string?Title(this JsonSchema schema)
 {
     return(schema.Get <TitleKeyword>()?.Value);
 }
Beispiel #20
0
 /// <summary>
 /// Gets the value for the `properties` keyword, if present.
 /// </summary>
 public static Dictionary <string, JsonSchema>?Properties(this JsonSchema schema)
 {
     return(schema.Get <PropertiesKeyword>());
 }
Beispiel #21
0
 /// <summary>
 /// Gets the value for the `uniqueItems` keyword, if present.
 /// </summary>
 public static bool UniqueItems(this JsonSchema schema)
 {
     return(schema.Get <UniqueItemsKeyword>()?.Value ?? false);
 }
Beispiel #22
0
 /// <summary>
 /// Gets the value for the `propertyNames` keyword, if present.
 /// </summary>
 public static JsonSchema?PropertyNames(this JsonSchema schema)
 {
     return(schema.Get <PropertyNamesKeyword>()?.Value);
 }
Beispiel #23
0
 /// <summary>
 /// Gets the value for the `writeOnly` keyword, if present.
 /// </summary>
 public static bool WriteOnly(this JsonSchema schema)
 {
     return(schema.Get <WriteOnlyKeyword>()?.Value ?? false);
 }
Beispiel #24
0
 /// <summary>
 /// Gets the value for the `$recursiveAnchor` keyword, if present.
 /// </summary>
 public static bool RecursiveAnchor(this JsonSchema schema)
 {
     return(schema.Get <RecursiveAnchorKeyword>()?.Value ?? false);
 }
Beispiel #25
0
 /// <summary>
 /// Gets the value for the `const` keyword, if present.
 /// </summary>
 public static JsonValue?Const(this JsonSchema schema)
 {
     return(schema.Get <ConstKeyword>()?.Value);
 }
Beispiel #26
0
 /// <summary>
 /// Gets the value for the `$ref` keyword, if present.
 /// </summary>
 public static string?Ref(this JsonSchema schema)
 {
     return(schema.Get <RefKeyword>()?.Reference);
 }
Beispiel #27
0
 /// <summary>
 /// Gets the value for the `contentMediaType` keyword, if present.
 /// </summary>
 public static string?ContentMediaType(this JsonSchema schema)
 {
     return(schema.Get <ContentMediaTypeKeyword>()?.Value);
 }
Beispiel #28
0
 /// <summary>
 /// Gets the resolved schema for the `$ref` keyword, if present.
 /// </summary>
 public static JsonSchema?RefResolved(this JsonSchema schema)
 {
     return(schema.Get <RefKeyword>()?.Resolved);
 }
Beispiel #29
0
 /// <summary>
 /// Gets the value for the `default` keyword, if present.
 /// </summary>
 public static JsonValue?Default(this JsonSchema schema)
 {
     return(schema.Get <DefaultKeyword>()?.Value);
 }
Beispiel #30
0
 /// <summary>
 /// Gets the value for the `required` keyword, if present.
 /// </summary>
 public static List <string>?Required(this JsonSchema schema)
 {
     return(schema.Get <RequiredKeyword>());
 }