Skip to content

Setup for SDK Customization

This page provides instructions on setting up customization for TypeSpec to include client-specific customizations in the generated code.

Ensure that your package.json includes a link to the customization library, typespec-client-generator-core:

{
"name": "clients",
"dependencies": {
"@typespec/compiler": "latest",
"@typespec/http": "latest",
"@typespec/rest": "latest",
"@azure-tools/typespec-azure-core": "latest",
"@azure-tools/typespec-client-generator-core": "latest"
},
"private": true
}

Customization should be implemented in a file named client.tsp, which should be used alongside with the main.tsp.

client.tsp
import "./main.tsp";
import "@azure-tools/typespec-client-generator-core";
using Azure.ClientGenerator.Core;
// Add your customizations here

After you’ve created your customization file, use the command tsp compile client.tsp to generate output that includes your customizations:

Terminal window
tsp compile client.tsp