Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
McpStringParameterAttribute.cs
1using System;
3
5{
9 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.ReturnValue |
10 AttributeTargets.Property | AttributeTargets.Field,
11 Inherited = true, AllowMultiple = false)]
13 {
20 : base(Title, Description)
21 {
22 this.MinLength = null;
23 this.MaxLength = null;
24 }
25
33 int MaxLength)
34 : base(Title, Description)
35 {
36 this.MinLength = null;
37 this.MaxLength = MaxLength;
38 }
39
48 int MinLength, int MaxLength)
49 : base(Title, Description)
50 {
51 this.MinLength = MinLength;
52 this.MaxLength = MaxLength;
53 }
54
58 public int? MinLength { get; }
59
63 public int? MaxLength { get; }
64
69 public override void Annotate(Dictionary<string, object?> Schema)
70 {
71 base.Annotate(Schema);
72
73 if (this.MinLength.HasValue)
74 Schema["minLength"] = this.MinLength.Value;
75
76 if (this.MaxLength.HasValue)
77 Schema["maxLength"] = this.MaxLength.Value;
78 }
79
84 public override void GetHtmlInputAttributes(Dictionary<string, string> Attributes)
85 {
86 if (this.MinLength.HasValue)
87 Attributes["minlength"] = this.MinLength.ToString();
88
89 if (this.MaxLength.HasValue)
90 Attributes["maxlength"] = this.MaxLength.ToString();
91 }
92 }
93}
override void Annotate(Dictionary< string, object?> Schema)
Annotates a schema object with information in the attribute.
McpStringParameterAttribute(string? Title, string? Description)
Provides meta-data about a string-valued parameter.
McpStringParameterAttribute(string? Title, string? Description, int MaxLength)
Provides meta-data about a string-valued parameter.
McpStringParameterAttribute(string? Title, string? Description, int MinLength, int MaxLength)
Provides meta-data about a string-valued parameter.
override void GetHtmlInputAttributes(Dictionary< string, string > Attributes)
Gets HTML input attributes for the parameter, if any.