@autorest/openapi-to-cadl
Version:
Autorest plugin to scaffold a Typespec definition from an OpenAPI document
25 lines (22 loc) • 1.06 kB
text/typescript
import { getSession } from "../autorest-session";
import { formatFile } from "../utils/format";
export async function emitCadlConfig(filePath: string): Promise<void> {
const content = `
emit:
- "@azure-tools/typespec-autorest":
# Uncomment this line and add "@azure-tools/typespec-python" to your package.json to generate Python code
# "@azure-tools/typespec-python":
# "basic-setup-py": true
# "package-version":
# "package-name":
# "output-path":
# Uncomment this line and add "@azure-tools/typespec-java" to your package.json to generate Java code
# "@azure-tools/typespec-java": true
# Uncomment this line and add "@azure-tools/typespec-csharp" to your package.json to generate C# code
# "@azure-tools/typespec-csharp": true
# Uncomment this line and add "@azure-tools/typespec-ts" to your package.json to generate Typescript code
# "@azure-tools/typespec-ts": true
`;
const session = getSession();
session.writeFile({ filename: filePath, content: await formatFile(content, filePath) });
}