Example #1
0
        private static string Merge(Type mergeIn, string jsonSchema, Uri id = null, bool left = true)
        {
            var schema = new JSchemaGenerator
            {
                SchemaIdGenerationHandling =
                    id == null ? SchemaIdGenerationHandling.FullTypeName : SchemaIdGenerationHandling.None,
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            }.Generate(mergeIn);

            if (!string.IsNullOrWhiteSpace(jsonSchema))
            {
                return(left
                    ? Merge(schema, JSchema.Parse(jsonSchema)).ToString()
                    : Merge(JSchema.Parse(jsonSchema), schema).ToString());
            }

            return(schema.ToString());
        }