Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ updates:
schedule:
interval: daily
open-pull-requests-limit: 10

- package-ecosystem: npm
directory: "/additions"
schedule:
interval: daily
open-pull-requests-limit: 10
36 changes: 36 additions & 0 deletions .github/workflows/validate-typespec-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: validate typespec changes

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: additions
steps:
- uses: actions/checkout@v4

- name: Setup NodeJs
uses: actions/setup-node@v4
with:
node-version: '22.x'

- name: Install typescript and typespec globally
run: npm i -g typescript @typespec/compiler

- name: Install dependencies
run: npm ci

- name: build typespec
run: tsp compile .

- uses: actions/upload-artifact@v4
if: always()
with:
name: CSDLs
path: tsp-output/*.csdl
9 changes: 9 additions & 0 deletions additions/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# MacOS
.DS_Store

# Default TypeSpec output
tsp-output/
dist/

# Dependency directories
node_modules/
21 changes: 21 additions & 0 deletions additions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# TypeSpec annotations additions

This TypeSpec project allows you to define additional annotations to inject in the CSDL files. It's an alternative to the XLST in `/transform`.
The copy scripts (in `/scripts/copy-annotations-to-csdl.ps1`) ONLY considers annotations, and DOES NOT perform any deduplication other than the ones enforced by XML keys.

## Requirements

- Node 22.x or above
- TypeScript `npm i -g typescript`
- TypeSpec compiler `npm i -g @typespec/compiler`
- dependencies installed `npm ci`
- vscode (or equivalent) `sudo winget install Microsoft.VisualStudioCode`

## Getting started

1. Make changes to the TypeSpec (.tsp) file
1. Run the compilation `tsp compile . --watch`
1. Run the copy scripts `.\scripts\copy-annotations-to-csdl.ps1 -sourceCsdlDirectoryPath $pwd\additions\tsp-output -targetCsdlPath $pwd\clean_v10_metadata\cleanMetadataWithDescriptionsAndAnnotationsAndErrorsv1.0.xml`
1. Diff the changes to ensure this is what you expect

> Note: Do not commit any changes to the target CSDL as those are generated weekly.
21 changes: 21 additions & 0 deletions additions/main.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import "@microsoft/typespec-msgraph";

using MsGraph;

@publicNamespace("microsoft.graph")
@container("GraphService")
namespace microsoft.graph {

@entity()
model OrgContact extends SharedModels.entity {
displayName: string | null
}
@graphRoute("contacts/{id}")
interface OrgContactsById extends Resource<OrgContact> {
@select GetResource is GraphOps.GetResource;
}
@graphRoute("contacts")
interface OrgContacts extends Collection<OrgContact> {
@orderBy("displayName") @filter("*") @search @count @select @top GetCollection is GraphOps.GetPagedCollection;
}
}
Loading
Loading