Class AvroSchema
An immutable Avro schema. Use Parse(string, AvroSchemaParseOptions?) to read schema JSON, or construct the concrete schema types directly.
public abstract class AvroSchema
- Inheritance
-
AvroSchema
- Derived
- Inherited Members
Remarks
Equals(object) is reference equality, by design: two schemas with the same Parsing Canonical Form can still differ in docs, aliases, defaults and properties, which matter for resolution and code generation. HasSameCanonicalForm(AvroSchema) compares encodings.
Properties
- Boolean
Gets the
booleanschema.
- Bytes
Gets the
bytesschema.
- CanonicalForm
Gets the Parsing Canonical Form of this schema, as defined by the specification. Two schemas with the same canonical form read and write the same binary data.
- Double
Gets the
doubleschema.
- Fingerprint64
Gets the CRC-64-AVRO (Rabin) fingerprint of the CanonicalForm.
- Float
Gets the
floatschema.
- Int
Gets the
intschema.
- LogicalType
Gets the logical type annotating this schema, or null.
- Long
Gets the
longschema.
- Null
Gets the
nullschema.
- Properties
Gets the attributes that are not defined by the specification for this kind of schema (custom metadata, and the attributes of an unknown or invalid logical type).
- String
Gets the
stringschema.
- Type
Gets the schema type.
Methods
- HasSameCanonicalForm(AvroSchema)
Gets whether
otherhas this schema's Parsing Canonical Form, and so the same binary encoding: data written with one reads as the other without resolution. Repeated calls with the same instance are one reference comparison.
- Parse(ReadOnlySpan<byte>, AvroSchemaParseOptions?)
Parses a schema from UTF-8 encoded JSON.
- Parse(string, AvroSchemaParseOptions?)
Parses a schema from JSON text.
- ParseAsync(Stream, AvroSchemaParseOptions?, CancellationToken)
Reads and parses a schema from a stream of UTF-8 encoded JSON.
- ToJson(bool)
Writes the full schema JSON, including documentation, aliases, defaults and custom properties. The compact form is the text Apache Avro Java's
Schema.toString()gives for the same schema: the same attribute order, and numbers in defaults and properties printed as Java prints them.
- ToJson(IEnumerable<NamedSchema>, bool)
Writes the schema JSON with the named types in
referencedSchemaswritten by name instead of defined: the form a schema registry stores for a schema with references to other subjects, like Java'sSchema.toString(referencedSchemas, pretty). Types are matched by full name.
- ToString()
Returns the full schema JSON.
- WriteTo(Utf8JsonWriter)
Writes the full schema JSON to
writer.