Skip to content

Commit c5c2a7b

Browse files
fix: support quickstart format of writing config
1 parent 693b32d commit c5c2a7b

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

docs/ExamplesDocGen/Program.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,29 @@ private static string ParseConfigNode(YamlNode node)
3636
if (testClassName.Contains("Legacy"))
3737
testClassName = testClassName.Replace("Legacy", "");
3838

39+
var optionsStr = StringifyOptions(codegenObj);
40+
3941
return $"""
4042
<details>
4143
<summary>{projectName.Replace("Example", "")}</summary>
4244
4345
## Engine `{item["engine"]}`: [{projectName}]({outputDirectory})
44-
### [Schema]({item["schema"][0]}) | [Queries]({item["queries"][0]}) | [End2End Test](end2end/{testProject}/{testClassName}.cs)
46+
### [Schema]({GetYamlFirstValue(item["schema"])}) | [Queries]({GetYamlFirstValue(item["queries"])}) | [End2End Test](end2end/{testProject}/{testClassName}.cs)
4547
### Config
4648
```yaml
47-
{StringifyOptions(codegenObj)}```
49+
{optionsStr}```
4850
4951
</details>
5052
""";
5153
}
5254

55+
private static string GetYamlFirstValue(YamlNode node)
56+
{
57+
return node is YamlSequenceNode sequence
58+
? sequence[0].ToString()
59+
: node.ToString();
60+
}
61+
5362
private static string StringifyOptions(YamlMappingNode codegenObj)
5463
{
5564
if (!codegenObj.Children.ContainsKey(new YamlScalarNode("options")))

0 commit comments

Comments
 (0)