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
83 changes: 56 additions & 27 deletions docs/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,80 @@ This document describes the steps to setup development tools and run Bicep types

## Directory Structure

`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.
`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.

`src`: Source code for autorest, type generation script, and the type loader

`swagger/specification`: Swagger API Specification for Microsoft Graph resources

`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)


## Running Generation Locally

### Pre-requisites

1. NPM version 22.0 or later

### Initial Setup

1. Clone this repo
1. Check out submodules:

```sh
git submodule update --init --recursive
```
1. Build the `bicep-types` dependency:
```sh
pushd bicep-types/src/bicep-types
npm ci
npm run build
popd
```
1. Build the autorest extension code:
```sh
cd src/autorest.bicep
npm ci
npm run build
```
1. Change to the generator directory, and install dependencies:

### Configuration setup

#### Update the YML config files, if necessary

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.

```sh
cd ../swagger-generation/configs
```

Create new yml files (following the existing naming convention and a new semantic version) under the `beta` and `v1.0` folders.
Edit the new yml files, with new types, properties and/or property annotation changes.

#### Configure which versions need generation

1. Update extensionConfig

From the root folder `/msgraph-bicep-types`:

```sh
cd ../generator
npm ci
notepad src/extensionConfigs/extensionConfig.json
```

### Running
- To run generation for Microsoft Graph resources:
Update the version numbers and save the file.

1. Add the new swagger version file names (to be generated in the next step).
From the root folder `/msgraph-bicep-types`:

```sh
npm run generate -- --specs-dir ..\..\swagger\ --single-path microsoftgraph
notepad swagger/specification/microsoftgraph/preview/readme.md
```
The types should be available in [/generated](./generated)

- To see other available generation parameters, including debugging options:
```sh
npm run generate -- --help
Edit the YML `input-file` sections to append the latest versions for beta and v1.0. Something like:

```yml
input-file:
- microsoftgraph/preview/beta/0.1.8-preview.json
- microsoftgraph/preview/beta/0.1.9-preview.json <-- appending new version

input-file:
- microsoftgraph/preview/v1.0/0.1.8-preview.json
- microsoftgraph/preview/v1.0/0.1.9-preview.json <-- appending new version
```

## Adding New Types
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)
### Generate the new types

From the root folder `/msgraph-bicep-types` run the following PowerShell script

```sh
.\scripts\UpdateGeneratedTypes.ps1
```

1. Follow steps in [Running Generation Locally](#running-generation-locally), and new types will be available in [/generated](./generated)
After running the scripts the new types will be available in [/generated](./generated) folder.
30 changes: 18 additions & 12 deletions generated/index.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,46 @@
{
"resources": {
"Microsoft.Graph/groups@beta": {
"$ref": "microsoftgraph/microsoft.graph/beta/0.1.8-preview/types.json#/17"
"$ref": "microsoftgraph/microsoft.graph/beta/0.1.9-preview/types.json#/18"
},
"Microsoft.Graph/applications@beta": {
"$ref": "microsoftgraph/microsoft.graph/beta/0.1.8-preview/types.json#/73"
"$ref": "microsoftgraph/microsoft.graph/beta/0.1.9-preview/types.json#/74"
},
"Microsoft.Graph/servicePrincipals@beta": {
"$ref": "microsoftgraph/microsoft.graph/beta/0.1.8-preview/types.json#/91"
"$ref": "microsoftgraph/microsoft.graph/beta/0.1.9-preview/types.json#/92"
},
"Microsoft.Graph/applications/federatedIdentityCredentials@beta": {
"$ref": "microsoftgraph/microsoft.graph/beta/0.1.8-preview/types.json#/96"
"$ref": "microsoftgraph/microsoft.graph/beta/0.1.9-preview/types.json#/97"
},
"Microsoft.Graph/oauth2PermissionGrants@beta": {
"$ref": "microsoftgraph/microsoft.graph/beta/0.1.8-preview/types.json#/100"
"$ref": "microsoftgraph/microsoft.graph/beta/0.1.9-preview/types.json#/101"
},
"Microsoft.Graph/appRoleAssignedTo@beta": {
"$ref": "microsoftgraph/microsoft.graph/beta/0.1.8-preview/types.json#/104"
"$ref": "microsoftgraph/microsoft.graph/beta/0.1.9-preview/types.json#/105"
},
"Microsoft.Graph/users@beta": {
"$ref": "microsoftgraph/microsoft.graph/beta/0.1.9-preview/types.json#/110"
},
"Microsoft.Graph/[email protected]": {
"$ref": "microsoftgraph/microsoft.graph/v1.0/0.1.8-preview/types.json#/13"
"$ref": "microsoftgraph/microsoft.graph/v1.0/0.1.9-preview/types.json#/13"
},
"Microsoft.Graph/[email protected]": {
"$ref": "microsoftgraph/microsoft.graph/v1.0/0.1.8-preview/types.json#/70"
"$ref": "microsoftgraph/microsoft.graph/v1.0/0.1.9-preview/types.json#/70"
},
"Microsoft.Graph/[email protected]": {
"$ref": "microsoftgraph/microsoft.graph/v1.0/0.1.8-preview/types.json#/88"
"$ref": "microsoftgraph/microsoft.graph/v1.0/0.1.9-preview/types.json#/88"
},
"Microsoft.Graph/applications/[email protected]": {
"$ref": "microsoftgraph/microsoft.graph/v1.0/0.1.8-preview/types.json#/93"
"$ref": "microsoftgraph/microsoft.graph/v1.0/0.1.9-preview/types.json#/93"
},
"Microsoft.Graph/[email protected]": {
"$ref": "microsoftgraph/microsoft.graph/v1.0/0.1.8-preview/types.json#/97"
"$ref": "microsoftgraph/microsoft.graph/v1.0/0.1.9-preview/types.json#/97"
},
"Microsoft.Graph/[email protected]": {
"$ref": "microsoftgraph/microsoft.graph/v1.0/0.1.8-preview/types.json#/101"
"$ref": "microsoftgraph/microsoft.graph/v1.0/0.1.9-preview/types.json#/101"
},
"Microsoft.Graph/[email protected]": {
"$ref": "microsoftgraph/microsoft.graph/v1.0/0.1.9-preview/types.json#/106"
}
},
"resourceFunctions": {}
Expand Down
28 changes: 16 additions & 12 deletions generated/index.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
# Bicep Types
## microsoft.graph
### microsoft.graph/applications
* **Link**: [beta](microsoftgraph/microsoft.graph/beta/0.1.8-preview/types.md#resource-microsoftgraphapplicationsbeta)
* **Link**: [v1.0](microsoftgraph/microsoft.graph/v1.0/0.1.8-preview/types.md#resource-microsoftgraphapplicationsv10)
* **Link**: [beta](microsoftgraph/microsoft.graph/beta/0.1.9-preview/types.md#resource-microsoftgraphapplicationsbeta)
* **Link**: [v1.0](microsoftgraph/microsoft.graph/v1.0/0.1.9-preview/types.md#resource-microsoftgraphapplicationsv10)

### microsoft.graph/applications/federatedidentitycredentials
* **Link**: [beta](microsoftgraph/microsoft.graph/beta/0.1.8-preview/types.md#resource-microsoftgraphapplicationsfederatedidentitycredentialsbeta)
* **Link**: [v1.0](microsoftgraph/microsoft.graph/v1.0/0.1.8-preview/types.md#resource-microsoftgraphapplicationsfederatedidentitycredentialsv10)
* **Link**: [beta](microsoftgraph/microsoft.graph/beta/0.1.9-preview/types.md#resource-microsoftgraphapplicationsfederatedidentitycredentialsbeta)
* **Link**: [v1.0](microsoftgraph/microsoft.graph/v1.0/0.1.9-preview/types.md#resource-microsoftgraphapplicationsfederatedidentitycredentialsv10)

### microsoft.graph/approleassignedto
* **Link**: [beta](microsoftgraph/microsoft.graph/beta/0.1.8-preview/types.md#resource-microsoftgraphapproleassignedtobeta)
* **Link**: [v1.0](microsoftgraph/microsoft.graph/v1.0/0.1.8-preview/types.md#resource-microsoftgraphapproleassignedtov10)
* **Link**: [beta](microsoftgraph/microsoft.graph/beta/0.1.9-preview/types.md#resource-microsoftgraphapproleassignedtobeta)
* **Link**: [v1.0](microsoftgraph/microsoft.graph/v1.0/0.1.9-preview/types.md#resource-microsoftgraphapproleassignedtov10)

### microsoft.graph/groups
* **Link**: [beta](microsoftgraph/microsoft.graph/beta/0.1.8-preview/types.md#resource-microsoftgraphgroupsbeta)
* **Link**: [v1.0](microsoftgraph/microsoft.graph/v1.0/0.1.8-preview/types.md#resource-microsoftgraphgroupsv10)
* **Link**: [beta](microsoftgraph/microsoft.graph/beta/0.1.9-preview/types.md#resource-microsoftgraphgroupsbeta)
* **Link**: [v1.0](microsoftgraph/microsoft.graph/v1.0/0.1.9-preview/types.md#resource-microsoftgraphgroupsv10)

### microsoft.graph/oauth2permissiongrants
* **Link**: [beta](microsoftgraph/microsoft.graph/beta/0.1.8-preview/types.md#resource-microsoftgraphoauth2permissiongrantsbeta)
* **Link**: [v1.0](microsoftgraph/microsoft.graph/v1.0/0.1.8-preview/types.md#resource-microsoftgraphoauth2permissiongrantsv10)
* **Link**: [beta](microsoftgraph/microsoft.graph/beta/0.1.9-preview/types.md#resource-microsoftgraphoauth2permissiongrantsbeta)
* **Link**: [v1.0](microsoftgraph/microsoft.graph/v1.0/0.1.9-preview/types.md#resource-microsoftgraphoauth2permissiongrantsv10)

### microsoft.graph/serviceprincipals
* **Link**: [beta](microsoftgraph/microsoft.graph/beta/0.1.8-preview/types.md#resource-microsoftgraphserviceprincipalsbeta)
* **Link**: [v1.0](microsoftgraph/microsoft.graph/v1.0/0.1.8-preview/types.md#resource-microsoftgraphserviceprincipalsv10)
* **Link**: [beta](microsoftgraph/microsoft.graph/beta/0.1.9-preview/types.md#resource-microsoftgraphserviceprincipalsbeta)
* **Link**: [v1.0](microsoftgraph/microsoft.graph/v1.0/0.1.9-preview/types.md#resource-microsoftgraphserviceprincipalsv10)

### microsoft.graph/users
* **Link**: [beta](microsoftgraph/microsoft.graph/beta/0.1.9-preview/types.md#resource-microsoftgraphusersbeta)
* **Link**: [v1.0](microsoftgraph/microsoft.graph/v1.0/0.1.9-preview/types.md#resource-microsoftgraphusersv10)

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"resources": {
"Microsoft.Graph/groups@beta": {
"$ref": "types.json#/18"
},
"Microsoft.Graph/applications@beta": {
"$ref": "types.json#/74"
},
"Microsoft.Graph/servicePrincipals@beta": {
"$ref": "types.json#/92"
},
"Microsoft.Graph/applications/federatedIdentityCredentials@beta": {
"$ref": "types.json#/97"
},
"Microsoft.Graph/oauth2PermissionGrants@beta": {
"$ref": "types.json#/101"
},
"Microsoft.Graph/appRoleAssignedTo@beta": {
"$ref": "types.json#/105"
},
"Microsoft.Graph/users@beta": {
"$ref": "types.json#/110"
}
},
"resourceFunctions": {},
"settings": {
"name": "MicrosoftGraphBeta",
"version": "0.1.9-preview",
"isSingleton": false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Bicep Types
## microsoft.graph
### microsoft.graph/applications
* **Link**: [beta](types.md#resource-microsoftgraphapplicationsbeta)

### microsoft.graph/applications/federatedidentitycredentials
* **Link**: [beta](types.md#resource-microsoftgraphapplicationsfederatedidentitycredentialsbeta)

### microsoft.graph/approleassignedto
* **Link**: [beta](types.md#resource-microsoftgraphapproleassignedtobeta)

### microsoft.graph/groups
* **Link**: [beta](types.md#resource-microsoftgraphgroupsbeta)

### microsoft.graph/oauth2permissiongrants
* **Link**: [beta](types.md#resource-microsoftgraphoauth2permissiongrantsbeta)

### microsoft.graph/serviceprincipals
* **Link**: [beta](types.md#resource-microsoftgraphserviceprincipalsbeta)

### microsoft.graph/users
* **Link**: [beta](types.md#resource-microsoftgraphusersbeta)

Loading
Loading