This is a repo containing a basic REST API project to get started with CADL.
Option 1: Via Node
- Install node 14.x or node 16.x. CADL is NOT compatible with version of node below 14.x
- Install package globally
npm install -g @cadl-lang/compiler
Option 2: Via docker
See docs for full docker documentations.
- Install docker
- For all the following steps replace the
cadl
ecutable from the command with the following line
docker run -v "${pwd}:/wd" --workdir="/wd" -t azsdkengsys.azurecr.io/cadl
Install the following extensions:
prettier
: Provide auto formatting for cadl languagecadl
: cadl extension, will provide error reporting and syntax highlighting for cadl files. To install that extension run
cadl code install
- Install cadl libraries for this project
cadl install
- Compile
cadl compile .
-
Produced
openapi.json
in./cadl-output
folder -
Dev with
--watch
to rebuild on changes (Not working when using docker.)
cadl compile . --watch
-
Edit
main.cadl
. Hello world sample is laying there -
Optional (Needs docker): Run swagger ui on output openapi =>
./swager-ui.sh
(Linux/MacOS) or./swagger-ui.ps1
(Windows)
Action | Command |
---|---|
Help | cadl --help |
Compile once | cadl compile . |
Compile in watch mode | cadl compile . --watch |
Format cadl code | cadl format **/*.cadl |
Install dependencies | cadl install |
Install dependencies | cadl install |
Install VSCode extension | cadl code install |
Init a new project | cadl init [tempalateUrl] |