private static string HandleRequiredAttribute(PropertyInfo prop, IEnumerable <CustomAttributeData> customAttributes) { var res = string.Empty; if (customAttributes.Any(a => a.AttributeType == typeof(RequiredAttribute))) { res += ", \"required\": true"; } else if (TypeBuilderHelper.IsNullable(prop.PropertyType)) { res += ", \"required\": false"; } return(res); }
private static bool IsOptionalProperty(PropertyInfo prop, IEnumerable <CustomAttributeData> customAttributes) { return(customAttributes.All(a => a.AttributeType != typeof(RequiredAttribute)) && TypeBuilderHelper.IsNullable(prop.PropertyType)); }