Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

fix configuration validation #1043

Merged
merged 1 commit into from
May 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Microsoft.Tye.Core/ConfigModel/ConfigApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ public void Validate()

foreach (var envVar in service.Configuration)
{
context = new ValidationContext(service);
if (!Validator.TryValidateObject(service, context, results, validateAllProperties: true))
context = new ValidationContext(envVar);
if (!Validator.TryValidateObject(envVar, context, results, validateAllProperties: true))
{
throw new TyeYamlException(
$"Environment variable '{envVar.Name}' of service '{service.Name}' validation failed." + Environment.NewLine +
Expand All @@ -129,8 +129,8 @@ public void Validate()

foreach (var volume in service.Volumes)
{
context = new ValidationContext(service);
if (!Validator.TryValidateObject(service, context, results, validateAllProperties: true))
context = new ValidationContext(volume);
if (!Validator.TryValidateObject(volume, context, results, validateAllProperties: true))
{
throw new TyeYamlException(
$"Volume '{volume.Source}' of service '{service.Name}' validation failed." + Environment.NewLine +
Expand Down