Skip to content

Commit d74b38c

Browse files
authored
[codex] Generate SDK snippets from OpenAPI examples (#265)
* feat(docs): generate SDK snippets from OpenAPI examples * fix(docs): restore legacy target compatibility for snippets * fix(docs): harden snippet generation for multi-target builds * fix(ci): remove duplicate webhook source entry
1 parent b4c7692 commit d74b38c

File tree

9 files changed

+1157
-6
lines changed

9 files changed

+1157
-6
lines changed

src/libs/AutoSDK.CLI/Commands/GenerateCommand.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,20 @@ await GrpcProjectScaffolder.ScaffoldAsync(
464464
}
465465
}
466466

467+
if (specFormat == SpecFormat.OpenApi)
468+
{
469+
var document = yaml.GetOpenApiDocument(settings);
470+
var schemas = document.GetSchemas(settings);
471+
var operations = document.GetOperations(settings, settings, schemas);
472+
var snippetManifest = Sources.SnippetManifest(operations, data.Methods.ToArray());
473+
if (!snippetManifest.IsEmpty)
474+
{
475+
await File.WriteAllTextAsync(
476+
Path.Combine(output, snippetManifest.Name),
477+
snippetManifest.Text).ConfigureAwait(false);
478+
}
479+
}
480+
467481
if (grpcInputs.Length > 0)
468482
{
469483
await ScaffoldMixedModeGrpcInputsAsync(

0 commit comments

Comments
 (0)