File tree Expand file tree Collapse file tree 2 files changed +16
-8
lines changed
Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 1313on :
1414 release :
1515 types : [ published ]
16+ workflow_dispatch :
17+ push :
18+ branches : [ fix-empty-options-usecase-in-docsgen ]
1619
1720jobs :
1821 generate-and-push-docs :
Original file line number Diff line number Diff line change @@ -36,13 +36,6 @@ private static string ParseConfigNode(YamlNode node)
3636 if ( testClassName . Contains ( "Legacy" ) )
3737 testClassName = testClassName . Replace ( "Legacy" , "" ) ;
3838
39- var yamlStream = new YamlStream ( ) ;
40- var yamlDocument = new YamlDocument ( codegenObj [ "options" ] ) ;
41- yamlStream . Documents . Add ( yamlDocument ) ;
42- using var optionsWriter = new StringWriter ( ) ;
43- yamlStream . Save ( optionsWriter , false ) ;
44- var optionsStr = optionsWriter . ToString ( ) . Trim ( ) . TrimEnd ( '.' ) ;
45-
4639 return $ """
4740 <details>
4841 <summary>{ projectName . Replace ( "Example" , "" ) } </summary>
@@ -51,9 +44,21 @@ private static string ParseConfigNode(YamlNode node)
5144 ### [Schema]({ item [ "schema" ] [ 0 ] } ) | [Queries]({ item [ "queries" ] [ 0 ] } ) | [End2End Test](end2end/{ testProject } /{ testClassName } .cs)
5245 ### Config
5346 ```yaml
54- { optionsStr } ```
47+ { StringifyOptions ( codegenObj ) } ```
5548
5649 </details>
5750 """ ;
5851 }
52+
53+ private static string StringifyOptions ( YamlMappingNode codegenObj )
54+ {
55+ if ( ! codegenObj . Children . ContainsKey ( new YamlScalarNode ( "options" ) ) )
56+ return string . Empty ;
57+
58+ var yamlStream = new YamlStream ( ) ;
59+ yamlStream . Documents . Add ( new YamlDocument ( codegenObj [ "options" ] ) ) ;
60+ using var writer = new StringWriter ( ) ;
61+ yamlStream . Save ( writer , false ) ;
62+ return writer . ToString ( ) . Trim ( ) . TrimEnd ( '.' ) ;
63+ }
5964}
You can’t perform that action at this time.
0 commit comments