コード例 #1
0
        public SchemaGeneratorHandler Add(SchemaGeneratorHandler handler)
        {
            var tail = this;
            while (tail.Next != null) tail = tail.Next;
            tail.Next = handler;

            return this;
        }
コード例 #2
0
        public SchemaGenerator(SchemaGeneratorOptions schemaGeneratorOptions, JsonSerializerSettings jsonSerializerSettings)
        {
            _jsonContractResolver = jsonSerializerSettings.ContractResolver ?? new DefaultContractResolver();

            // To manage complexity, implement as a chain of responsibility
            _chainOfHandlers = new KnownTypeHandler(schemaGeneratorOptions, this, jsonSerializerSettings)
                .Add(new ReferenceableTypeHandler(schemaGeneratorOptions, this, jsonSerializerSettings))
                .Add(new PolymorphicTypeHandler(schemaGeneratorOptions, this, jsonSerializerSettings))
                .Add(new JsonPrimitiveHandler(schemaGeneratorOptions, this, jsonSerializerSettings))
                .Add(new JsonArrayHandler(schemaGeneratorOptions, this, jsonSerializerSettings))
                .Add(new JsonDictionaryHandler(schemaGeneratorOptions, this, jsonSerializerSettings))
                .Add(new JsonObjectHandler(schemaGeneratorOptions, this, jsonSerializerSettings))
                .Add(new FallbackHandler(schemaGeneratorOptions, this, jsonSerializerSettings));
        }
コード例 #3
0
 protected void AddHandler(SchemaGeneratorHandler handler)
 {
     _handlers.Add(handler);
 }