|
|
@ -66,7 +66,8 @@ public static class JsonSchemaExtensions |
|
|
|
if (modelType != meta.ElementMetadata!.ModelType.UnderlyingSystemType) |
|
|
|
{ |
|
|
|
schema.Add("type", "array"); |
|
|
|
//schema.Add("items", meta.ElementMetadata!.ModelType.GetMetadataForType(serviceProvider));
|
|
|
|
schema.TryAdd("multiple", true); |
|
|
|
schema.TryAdd("url", "url"); |
|
|
|
schema.Add("items", meta.ElementMetadata.GetSchema(serviceProvider, meta)); |
|
|
|
} |
|
|
|
} |
|
|
@ -184,7 +185,12 @@ public static class JsonSchemaExtensions |
|
|
|
var actionContext = new ActionContext { HttpContext = serviceProvider.GetRequiredService<IHttpContextAccessor>().HttpContext! }; |
|
|
|
var provider = new EmptyModelMetadataProvider(); |
|
|
|
var modelValidationContextBase = new ModelValidationContextBase(actionContext, meta, new EmptyModelMetadataProvider()); |
|
|
|
if (pm.IsRequired && !pm.IsNullableValueType && !pm.UnderlyingOrModelType.IsValueType && !pm.Attributes.Attributes.Any(o => o.GetType() == typeof(RequiredAttribute))) |
|
|
|
if (pm.IsRequired && |
|
|
|
!pm.IsNullableValueType && |
|
|
|
!pm.UnderlyingOrModelType.IsValueType && |
|
|
|
!pm.IsEnumerableType && |
|
|
|
!pm.Attributes.Attributes.Any(o => o.GetType() == typeof(RequiredAttribute)) |
|
|
|
) |
|
|
|
{ |
|
|
|
var message = string.Format(CultureInfo.InvariantCulture, localizer.GetString(nameof(RequiredAttribute)).Value, title); |
|
|
|
rules.Add(new Dictionary<string, object> { { "required", true }, { "message", message } }); |
|
|
@ -234,7 +240,6 @@ public static class JsonSchemaExtensions |
|
|
|
else if (attribute is RequiredAttribute) |
|
|
|
{ |
|
|
|
rule.Add("required", true); |
|
|
|
//message = string.Format(CultureInfo.InvariantCulture, localizer.GetString(nameof(RequiredAttribute)).Value, title);
|
|
|
|
} |
|
|
|
else if (attribute is CompareAttribute compare)//??
|
|
|
|
{ |
|
|
|