Exemplo n.º 1
0
        private string BuildPropertyCommon(PropertyInfo prop, IEnumerable <CustomAttributeData> customAttributes)
        {
            var name = TypeBuilderHelper.GetPropertyName(prop);

            var res = "\"" + name + "\": { \"type\": " + SchemaTypeMapper.GetAttribute(prop.PropertyType);

            res += HandleRequiredAttribute(prop, customAttributes);

            res += HandleValidationAttributes(customAttributes);
            return(res);
        }
Exemplo n.º 2
0
        protected string GetNestedArraySchemaPrimitiveType(int pad, Type elementType)
        {
            var arraySchema = "{\r\n".Indent(pad) +
                              "  \"type\": \"array\",\r\n".Indent(pad) +
                              "  \"items\": \r\n".Indent(pad) +
                              "  {\r\n".Indent(pad) +
                              ("    \"type\": " + SchemaTypeMapper.GetAttribute(elementType) + "\r\n").Indent(pad) +
                              "  }\r\n".Indent(pad) +
                              "}\r\n".Indent(pad);

            return(arraySchema);
        }