diff --git a/src/Microsoft.Tye.Core/ApplicationFactory.cs b/src/Microsoft.Tye.Core/ApplicationFactory.cs index be2c11a3..2a09bc3a 100644 --- a/src/Microsoft.Tye.Core/ApplicationFactory.cs +++ b/src/Microsoft.Tye.Core/ApplicationFactory.cs @@ -265,7 +265,7 @@ namespace Microsoft.Tye { Host = configRule.Host, Path = configRule.Path, - Service = configRule.Service, + Service = configRule.Service!, // validated elsewhere }; ingress.Rules.Add(rule); } diff --git a/src/Microsoft.Tye.Core/ConfigModel/ConfigIngressRule.cs b/src/Microsoft.Tye.Core/ConfigModel/ConfigIngressRule.cs index 4a94f462..521cce32 100644 --- a/src/Microsoft.Tye.Core/ConfigModel/ConfigIngressRule.cs +++ b/src/Microsoft.Tye.Core/ConfigModel/ConfigIngressRule.cs @@ -2,12 +2,16 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.ComponentModel.DataAnnotations; + namespace Microsoft.Tye.ConfigModel { public class ConfigIngressRule { public string? Path { get; set; } public string? Host { get; set; } + + [Required] public string? Service { get; set; } } } diff --git a/src/Microsoft.Tye.Core/IngressRuleBuilder.cs b/src/Microsoft.Tye.Core/IngressRuleBuilder.cs index 3151673d..5b6a11e7 100644 --- a/src/Microsoft.Tye.Core/IngressRuleBuilder.cs +++ b/src/Microsoft.Tye.Core/IngressRuleBuilder.cs @@ -8,6 +8,6 @@ namespace Microsoft.Tye { public string? Path { get; set; } public string? Host { get; set; } - public string? Service { get; set; } + public string Service { get; set; } = default!; } }