Skip to content

Commit 51f128a

Browse files
authored
Merge pull request #1367 from microsoftgraph/dev
refresh main
2 parents ebf8ae7 + 9beead9 commit 51f128a

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.azure-pipelines/generation-pipeline.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ variables:
159159
cleanOpenAPIFileBetaOutputPath: '$(Build.SourcesDirectory)/msgraph-metadata/openapi/beta/'
160160
cleanMetadataFileV1OutputPath: '$(Build.SourcesDirectory)/msgraph-metadata/clean_v10_metadata/'
161161
cleanMetadataFileBetaOutputPath: '$(Build.SourcesDirectory)/msgraph-metadata/clean_beta_metadata/'
162+
metadataTypeSpecAnnotationsSource: '$(Build.SourcesDirectory)/msgraph-metadata/additions/'
162163
cleanMetadataFolderBeta: 'clean_beta_metadata'
163164
cleanMetadataFolderV1: 'clean_v10_metadata'
164165
cleanOpenAPIFolderBeta: 'clean_beta_openapi'
@@ -218,6 +219,7 @@ stages:
218219
cleanMetadataFile: $(cleanMetadataFileV1)
219220
cleanMetadataFolder: $(cleanMetadataFolderV1)
220221
cleanMetadataFileWithAnnotations: $(cleanMetadataFileWithAnnotationsV1)
222+
metadataTypeSpecAnnotationsSource: $(metadataTypeSpecAnnotationsSource)
221223

222224
# Same description as stage_v1_metadata
223225
- stage: stage_beta_metadata
@@ -236,6 +238,7 @@ stages:
236238
cleanMetadataFile: $(cleanMetadataFileBeta)
237239
cleanMetadataFolder: $(cleanMetadataFolderBeta)
238240
cleanMetadataFileWithAnnotations: $(cleanMetadataFileWithAnnotationsBeta)
241+
metadataTypeSpecAnnotationsSource: $(metadataTypeSpecAnnotationsSource)
239242

240243
- stage: stage_v1_openapi
241244
dependsOn: stage_v1_metadata

.azure-pipelines/generation-templates/capture-metadata.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ parameters:
2222
- name: 'cleanMetadataFileWithAnnotations'
2323
type: string
2424
default: $(cleanMetadataFileWithAnnotationsV1)
25+
- name: 'metadataTypeSpecAnnotationsSource'
26+
type: string
27+
default: $(metadataTypeSpecAnnotationsSource)
28+
- name: 'metadataTypeSpecAnnotationsOutputDir'
29+
type: string
30+
default: 'tsp-output'
31+
- name: metadataAnnotationsCopyScriptPath
32+
type: string
33+
default: '/../scripts/copy-annotations-to-csdl.ps1'
2534

2635
steps:
2736

@@ -39,6 +48,23 @@ steps:
3948
- template: checkout-metadata.yml
4049
- template: set-user-config.yml
4150

51+
# required for TypeSpec
52+
- task: UseNode@1
53+
inputs:
54+
version: '22.x'
55+
checkLatest: true
56+
57+
- pwsh: 'npm install -g @typespec/compiler typescript'
58+
displayName: 'install TypeSpec and TypeScript globally'
59+
60+
- pwsh: 'npm ci'
61+
displayName: 'install TypeSpec dependencies'
62+
workingDirectory: '$(metadataTypeSpecAnnotationsSource)'
63+
64+
- pwsh: 'tsp compile .'
65+
displayName: 'compile TypeSpec annotations'
66+
workingDirectory: '$(metadataTypeSpecAnnotationsSource)'
67+
4268
# Results in a raw metadata file written to microsoftgraph/msgraph-metadata if there are changes.
4369
# An error will cancel this step if there are no changes.
4470
- pwsh: '$(scriptsDirectory)/download-diff-metadata.ps1'
@@ -70,6 +96,12 @@ steps:
7096
endpointVersion: ${{ parameters.endpoint }}
7197
displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata'
7298

99+
- pwsh: '. $(metadataTypeSpecAnnotationsSource)/$Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$($Env:Endpoint.Replace(''.'', ''''))_metadata/cleanMetadataWithDescriptions${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"'
100+
env:
101+
ScriptPath: ${{ parameters.metadataAnnotationsCopyScriptPath }}
102+
Endpoint: ${{ parameters.endpoint }}
103+
displayName: 'copy TypeSpec annotations to cleaned metadata'
104+
73105
## Only run if the previous step was successful
74106
- pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1'
75107
env:
@@ -85,6 +117,12 @@ steps:
85117
OutputMetadataFileName: 'cleanMetadataWithDescriptionsAndAnnotations'
86118
displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata and keep capability annotations'
87119

120+
- pwsh: '. $(metadataTypeSpecAnnotationsSource)/$Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$($Env:Endpoint.Replace(''.'', ''''))_metadata/cleanMetadataWithDescriptionsAndAnnotations${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"'
121+
env:
122+
ScriptPath: ${{ parameters.metadataAnnotationsCopyScriptPath }}
123+
Endpoint: ${{ parameters.endpoint }}
124+
displayName: 'copy TypeSpec annotations to cleaned metadata'
125+
88126
## Only run if the previous step was successful
89127
- pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1'
90128
env:
@@ -101,6 +139,13 @@ steps:
101139
OutputMetadataFileName: 'cleanMetadataWithDescriptionsAndAnnotationsAndErrors'
102140
displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata and keep capability annotations and include error information'
103141

142+
- pwsh: '. $(metadataTypeSpecAnnotationsSource)/$Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$($Env:Endpoint.Replace(''.'', ''''))_metadata/cleanMetadataWithDescriptionsAndAnnotationsAndErrors${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"'
143+
env:
144+
ScriptPath: ${{ parameters.metadataAnnotationsCopyScriptPath }}
145+
Endpoint: ${{ parameters.endpoint }}
146+
displayName: 'copy TypeSpec annotations to cleaned metadata'
147+
148+
104149
# publish metadata as an artifact
105150
- task: CopyFiles@2
106151
inputs:

0 commit comments

Comments
 (0)