Ejemplo n.º 1
0
        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;
                }
            }
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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>());
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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>());
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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>());
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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>());
 }