private SigoSchema ParseIdentifier() { switch (t.Raw) { case "true": { var ret = new ValueSchema(true); Next(); return(ret); } case "false": { var ret = new ValueSchema(false); Next(); return(ret); } case "null": case "NaN": case "Infinity": throw new InvalidOperationException($"'{t.Raw}' is not supported"); default: var key = t.Raw; Next(); return(new ReferenceSchema(key)); } }
/// <summary> /// Initializes a new instance of the <see cref="MappingKey"/> class. /// </summary> /// <param name="key">The key.</param> /// <param name="path">The path.</param> /// <param name="schema">The schema.</param> public MappingKey(string key, AttributePath path, ValueSchema schema) : this(key) { if (path != null) { this.Path = path; } this.Schema = schema; if (this.Schema.IsBlock) { this.InitialAnalysis = this.Schema.IsListOrSet ? AttributeContent.BlockList : AttributeContent.BlockObject; } else if (this.Schema.IsListOrSet) { this.InitialAnalysis = AttributeContent.Sequence; } else if (this.Schema.IsScalar) { this.InitialAnalysis = AttributeContent.Value; } else if (this.Schema.Type == SchemaValueType.TypeMap) { this.InitialAnalysis = AttributeContent.Mapping; } else { this.InitialAnalysis = AttributeContent.None; } }
/// <summary> /// Converts current not to JSON according to the avro specification. /// </summary> /// <param name="writer">The writer.</param> /// <param name="seenSchemas">The seen schemas.</param> internal override void ToJsonSafe(JsonTextWriter writer, HashSet <NamedSchema> seenSchemas) { writer.WriteStartObject(); writer.WriteProperty("type", "map"); writer.WritePropertyName("values"); ValueSchema.ToJson(writer, seenSchemas); writer.WriteEndObject(); }