From 84c43a034148a488f3094a4b7dc645c76e51020d Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Wed, 22 Apr 2020 17:18:35 -0700 Subject: [PATCH] Treat IngressRuleBuilder.Service as non-null --- src/Microsoft.Tye.Core/ApplicationFactory.cs | 2 +- src/Microsoft.Tye.Core/ConfigModel/ConfigIngressRule.cs | 4 ++++ src/Microsoft.Tye.Core/IngressRuleBuilder.cs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) 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!; } }