You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/DEVELOPMENT.md
+56-27Lines changed: 56 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,51 +2,80 @@ This document describes the steps to setup development tools and run Bicep types
2
2
3
3
## Directory Structure
4
4
5
-
`generated`: Generated artifacts, including types and index. See [/generated/index.md](./generated/index.md) for a searchable list of all the available types. You can view individual type definitions by clicking on api versions.
5
+
`generated`: Generated artifacts, including types and index. See [/generated/index.md](../generated/index.md) for a searchable list of all the available types. You can view individual type definitions by clicking on api versions.
6
6
7
7
`src`: Source code for autorest, type generation script, and the type loader
8
8
9
9
`swagger/specification`: Swagger API Specification for Microsoft Graph resources
10
10
11
+
`msgraph-metadata`: A submodule that links to the microsoftgraph/msgraph-metadata repo, which contains all the latest sanitized versions of the metadata (including descriptions, annotations and errors)
12
+
13
+
11
14
## Running Generation Locally
15
+
16
+
### Pre-requisites
17
+
18
+
1. NPM version 22.0 or later
19
+
12
20
### Initial Setup
21
+
13
22
1. Clone this repo
14
23
1. Check out submodules:
24
+
15
25
```sh
16
26
git submodule update --init --recursive
17
27
```
18
-
1. Build the `bicep-types` dependency:
19
-
```sh
20
-
pushd bicep-types/src/bicep-types
21
-
npm ci
22
-
npm run build
23
-
popd
24
-
```
25
-
1. Build the autorest extension code:
26
-
```sh
27
-
cd src/autorest.bicep
28
-
npm ci
29
-
npm run build
30
-
```
31
-
1. Change to the generator directory, and install dependencies:
28
+
29
+
### Configuration setup
30
+
31
+
#### Update the YML config files, if necessary
32
+
33
+
If you are adding new types or changing property annotations like `readOnly` or `required`, you'll need to update the yml config that controls what is generated.
34
+
35
+
```sh
36
+
cd ../swagger-generation/configs
37
+
```
38
+
39
+
Create new yml files (following the existing naming convention and a new semantic version) under the `beta` and `v1.0` folders.
40
+
Edit the new yml files, with new types, properties and/or property annotation changes.
41
+
42
+
#### Configure which versions need generation
43
+
44
+
1. Update extensionConfig
45
+
46
+
From the root folder `/msgraph-bicep-types`:
47
+
32
48
```sh
33
-
cd ../generator
34
-
npm ci
49
+
notepad src/extensionConfigs/extensionConfig.json
35
50
```
36
51
37
-
### Running
38
-
- To run generation for Microsoft Graph resources:
52
+
Update the version numbers and save the file.
53
+
54
+
1. Add the new swagger version file names (to be generated in the next step).
55
+
From the root folder `/msgraph-bicep-types`:
56
+
39
57
```sh
40
-
npm run generate -- --specs-dir ..\..\swagger\ --single-path microsoftgraph
The types should be available in [/generated](./generated)
43
60
44
-
- To see other available generation parameters, including debugging options:
45
-
```sh
46
-
npm run generate -- --help
61
+
Edit the YML `input-file` sections to append the latest versions for beta and v1.0. Something like:
62
+
63
+
```yml
64
+
input-file:
65
+
- microsoftgraph/preview/beta/0.1.8-preview.json
66
+
- microsoftgraph/preview/beta/0.1.9-preview.json <-- appending new version
67
+
68
+
input-file:
69
+
- microsoftgraph/preview/v1.0/0.1.8-preview.json
70
+
- microsoftgraph/preview/v1.0/0.1.9-preview.json <-- appending new version
47
71
```
48
72
49
-
## Adding New Types
50
-
1. Update the entities and properties in [config-beta.yml](src\swagger-generation\config-beta.yml) and [config-v1.0.yml](src\swagger-generation\config-beta.yml)
73
+
### Generate the new types
74
+
75
+
From the root folder `/msgraph-bicep-types` run the following PowerShell script
76
+
77
+
```sh
78
+
.\scripts\UpdateGeneratedTypes.ps1
79
+
```
51
80
52
-
1. Follow steps in [Running Generation Locally](#running-generation-locally), and new types will be available in [/generated](./generated)
81
+
After running the scripts the new types will be available in [/generated](./generated) folder.
0 commit comments