Class OpenApiImporter
Turns the operations of an OpenAPI 3 document (JSON or YAML) into HttpApiToolDefinitions: one tool per operation, named after its operationId, described by its summary, with its path, query and header parameters and its JSON body as the tool's arguments (references to shared schemas resolved), so an existing service becomes tools in one step.
public static class OpenApiImporter
- Inheritance
-
OpenApiImporter
- Inherited Members
Examples
IReadOnlyList<HttpApiToolDefinition> operations = OpenApiImporter.Import(File.ReadAllText("crm.yaml"));
foreach (HttpApiToolDefinition operation in operations.Where(o => o.IsReadOnly))
{
registry.Register(new HttpApiTool(operation));
}
Methods
- Import(string, string)
Reads the operations of an OpenAPI 3 document as HTTP tool definitions.