Skip to content

Commit b7cf7d6

Browse files
committed
quick update to Plan.ToYaml() to use YamlHelpers.Serialize and synapse.cli to expose more data in verbose=true
1 parent ca70604 commit b7cf7d6

2 files changed

Lines changed: 12 additions & 15 deletions

File tree

Synapse.Core/Classes/Plan.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,9 @@ ActionItem IActionContainer.ActionGroup
6565
public string Signature { get; set; }
6666

6767

68-
public string ToYaml()
68+
public string ToYaml(bool emitDefaultValues = false)
6969
{
70-
string yaml = string.Empty;
71-
using( StringWriter s = new StringWriter() )
72-
{
73-
Serializer serializer = new Serializer();
74-
serializer.Serialize( s, this );
75-
yaml = s.ToString();
76-
}
77-
return yaml;
70+
return Utilities.YamlHelpers.Serialize( this, emitDefaultValues: emitDefaultValues ); ;
7871
}
7972

8073
public void ToYaml(TextWriter tw)

Synapse.cli/Program.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,14 @@ static void CreateSamplePlan(string handlerCsvList, string outPath, bool verbose
176176
{
177177
a.Description = $"Resolved Handler from [{hr.RuntimeType}].";
178178
a.Handler.Type = handlerType;
179-
a.Handler.Config = new ParameterInfo();
180-
a.Handler.Config.Values = hr.GetConfigInstance();
181-
a.Parameters = new ParameterInfo();
182-
a.Parameters.Values = hr.GetParametersInstance();
179+
a.Handler.Config = new ParameterInfo
180+
{
181+
Values = hr.GetConfigInstance()
182+
};
183+
a.Parameters = new ParameterInfo
184+
{
185+
Values = hr.GetParametersInstance()
186+
};
183187
}
184188
else
185189
{
@@ -191,12 +195,12 @@ static void CreateSamplePlan(string handlerCsvList, string outPath, bool verbose
191195

192196
if( !string.IsNullOrWhiteSpace( outPath ) )
193197
{
194-
File.WriteAllText( outPath, p.ToYaml() );
198+
File.WriteAllText( outPath, p.ToYaml( verbose ) );
195199
Console.WriteLine( $"Created sample Plan at [{outPath}]." );
196200
}
197201
else
198202
{
199-
Console.WriteLine( p.ToYaml() );
203+
Console.WriteLine( p.ToYaml( verbose ) );
200204
}
201205
}
202206

0 commit comments

Comments
 (0)