Skip to content

Cadl Style Guide #1341

@timotheeguerin

Description

@timotheeguerin

Write a style guide of what is the recommended way of naming things(camelCase,PascalCase, etc.)

Table of the different cadl types and the current pattern or where its still ambiguous

Type Naming Example
scalar camelCase scalar uuid extends string;
model PascalCase model Pet {}
model property camelCase model Pet {furColor: string}
enum PascalCase model Pet {furColor: string}
enum member camelCase enum Direction {up, down}
namespace PascalCase namespace Cadl.Rest
interface PascalCase interface Stores {}
operation camelCase op listPets(): Pet[];
operation params camelCase op getPet(petId: string): Pet;
unions PascalCase union Pet {cat: Cat, dog: Dog}
unions variants camelCase union Pet {cat: Cat, dog: Dog}
alias camelCase or PascalCase depending on context alias myString = string or alias MyPet = Pet
decorators camelCase @format, @resourceCollection
functions camelCase addedAfter
file name kebab-case my-lib.cadl

As a follow up we could provide a linter rule to validate those

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions