private static SchemaOptions GetTypeFlags(Type type, SchemaOptions options) { if (type.IsValueType) { options = options.AsValueType(true); } if (type.IsSealed) { options = options.AsSealed(true); } foreach (var attribute in type.GetCustomAttributes()) { switch (attribute) { case ImmutableAttribute _: options = options.AsImmutable(true); if (type.IsClass) { options = options.PreserveObjectReferences(true); } break; } } return(options); }
public SchemaDef(Type type, SchemaOptions options, ImmutableSortedSet <FieldDef> fields) { Options = options; Type = type; Fields = fields; }