public PactSchemaService(PactOptions options) { this._options = options; this._jsonOptions = new JsonSerializerOptions { Converters = { new UnionConverterFactory() }, PropertyNamingPolicy = JsonNamingPolicy.CamelCase, IgnoreNullValues = true }; var typeProvider = this._options.TypeProvider ?? new TypeProvider(); var typeChecker = new TypeChecker(typeProvider); var distinctTypeQueue = new DistinctTypeQueue(); var typeReferenceReader = new TypeReferenceReader(typeChecker, distinctTypeQueue); var distinctTypeReader = new DistinctTypeReader(typeChecker, typeReferenceReader); var methodReader = new MethodReader(typeChecker, typeReferenceReader); var controllerReader = new ControllerReader(methodReader); this._schemaReader = new SchemaReader(distinctTypeQueue, distinctTypeReader, controllerReader, typeProvider); }
public void ReadTypes() { var typeProvider = new TypeProvider(); var typeChecker = new TypeChecker(typeProvider); var distinctTypeQueue = new DistinctTypeQueue(); var typeReferenceReader = new TypeReferenceReader(typeChecker, distinctTypeQueue); var distinctTypeReader = new DistinctTypeReader(typeChecker, typeReferenceReader); var types = new[] { // typeof(Registry<>), typeof(Hexarc.Pact.Protocol.Types.Type) }; foreach (var t in types) { Console.WriteLine(ObjectDumper.Dump(typeReferenceReader.Read(t.ToContextualType(), NamingConvention.CamelCase))); } while (distinctTypeQueue.TryDequeue(out var t)) { Console.WriteLine(ObjectDumper.Dump(distinctTypeReader.Read(t.ToContextualType(), default))); } }