Skip to content

Commit

Permalink
Merge pull request #4 from microsoftgraph/zengin/customMetadataPath
Browse files Browse the repository at this point in the history
[Snippet Generation] Add custom metadata support
  • Loading branch information
zengin authored Dec 3, 2020
2 parents 33df778 + 9cb48c4 commit aeeac95
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ApiDoctor.Console/CommandLineOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -632,5 +632,8 @@ class GenerateSnippetsOptions : BasicCheckOptions

[Option("lang", HelpText = "The programming languages for snippet generation(comma separated list)", Required = true)]
public string Languages { get; set; }

[Option("custom-metadata-path", HelpText = "Path to custom metadata that snippet generation can consume", Required = false)]
public string CustomMetadataPath { get; set; }
}
}
12 changes: 10 additions & 2 deletions ApiDoctor.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1922,8 +1922,16 @@ private static async Task<bool> GenerateSnippetsAsync(GenerateSnippetsOptions op

WriteHttpSnippetsIntoFile(snippetsPath, methods, issues);

GenerateSnippets(options.SnippetGeneratorPath, // executable path
"--SnippetsPath", snippetsPath, "--Languages", options.Languages); // args
if (string.IsNullOrWhiteSpace(options.CustomMetadataPath))
{
GenerateSnippets(options.SnippetGeneratorPath, // executable path
"--SnippetsPath", snippetsPath, "--Languages", options.Languages); // args
}
else
{
GenerateSnippets(options.SnippetGeneratorPath, // executable path
"--SnippetsPath", snippetsPath, "--Languages", options.Languages, "--CustomMetadataPath", options.CustomMetadataPath); // args
}

var languages = options.Languages.Split(',');
foreach (var method in methods)
Expand Down

0 comments on commit aeeac95

Please sign in to comment.