Esempio n. 1
0
 public SchemaReader(
     DistinctTypeQueue distinctTypeQueue,
     DistinctTypeReader distinctTypeReader,
     ControllerReader controllerReader,
     TypeProvider typeProvider)
 {
     this.DistinctTypeQueue  = distinctTypeQueue;
     this.DistinctTypeReader = distinctTypeReader;
     this.ControllerReader   = controllerReader;
     this.TypeProvider       = typeProvider;
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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)));
            }
        }
Esempio n. 4
0
 public TypeReferenceReader(TypeChecker typeChecker, DistinctTypeQueue distinctTypeQueue) =>
 (this.TypeChecker, this.DistinctTypeQueue) = (typeChecker, distinctTypeQueue);