public SchemaGeneratorHandler Add(SchemaGeneratorHandler handler)
        {
            var tail = this;
            while (tail.Next != null) tail = tail.Next;
            tail.Next = handler;

            return this;
        }
        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));
        }
Example #3
0
 protected void AddHandler(SchemaGeneratorHandler handler)
 {
     _handlers.Add(handler);
 }