Skip to content

Commit

Permalink
Merge branch 'feature/plugins' into andrueastman/manifestLibUpdates
Browse files Browse the repository at this point in the history
  • Loading branch information
andrueastman authored Apr 18, 2024
2 parents 0fe8875 + bbf9f45 commit 91325a6
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 74 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Changed URI template generation to reuse templates when required templates are absent across operations.
- Updated reserved name providers for Java and Php so that "object" can be escaped.

## [1.13.0] - 2024-04-04

Expand Down
2 changes: 1 addition & 1 deletion it/csharp/dotnet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.11.0" />
<PackageReference Include="Azure.Identity" Version="1.11.1" />
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.8.1" />
<PackageReference Include="Microsoft.Kiota.Authentication.Azure" Version="1.1.4" />
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.3.8" />
Expand Down
2 changes: 1 addition & 1 deletion it/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<kiota-java.version>1.1.3</kiota-java.version>
<kiota-java.version>1.1.4</kiota-java.version>
</properties>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions it/python/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ yapf==0.40.2

zipp==3.18.1 ; python_version >= '3.7'

aiohttp==3.9.3 ; python_version >= '3.6'
aiohttp==3.9.5 ; python_version >= '3.6'

aiosignal==1.3.1 ; python_version >= '3.7'

Expand Down Expand Up @@ -104,7 +104,7 @@ microsoft-kiota-authentication-azure==1.0.0

microsoft-kiota-http==1.3.1

microsoft-kiota-serialization-json==1.1.0
microsoft-kiota-serialization-json==1.2.0

microsoft-kiota-serialization-text==1.0.0

Expand Down
88 changes: 44 additions & 44 deletions it/typescript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions it/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"devDependencies": {
"@es-exec/esbuild-plugin-start": "^0.0.5",
"@types/node": "^20.12.7",
"@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^7.6.0",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"esbuild": "^0.20.2",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
Expand Down
26 changes: 13 additions & 13 deletions specs/cli/plugin-add.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ Every time a plugin is added, a copy of the OpenAPI document file will be stored

An [API Manifest][def] file named `apimanifest.json` will be generated (if non existing) or updated (if already existing) in the root folder `./kiota` next to `workspace.json`. API Manifest represents a snapshot of API dependencies and permissions required to access those APIs. This file will represent a concatenated surface of all APIs used across plugins and clients. Both files, `apimanifest.json` and `workspace.json` will be used to generate the code files. A new hash composed of the Kiota version, the OpenAPI document location and the properties of the manifest will be generated and would trigger an update to the [API Manifest][def].

Developers can generate `openai` and `apimanifest` type of plugins. By generating `openai` or `apimanifest`, two outputs will be generated: a\) the plugin type you have chosen that will be named `{plugin-name}-{type}.json` and b\) a sliced OpenAPI document with only the endpoints that matches `--include-path` and `--exclude-path`, if provided.
Developers can generate `openai` and `apimanifest` type of plugins. By generating `openai` or `apimanifest`, two outputs will be generated: a\) the plugin type you have chosen and b\) a sliced OpenAPI document named `sliced-{plugin-name}.json|yaml` with only the endpoints that matches `--include-path` and `--exclude-path`, if provided.
> [!NOTE]
> In one's solution, there might be two different [API Manifests][def]. The `apimanifest.json` in the `./kiota` folder represents a single artifact surface of all APIs and it will always be generated. The second one, specific to each plugin, will be named `{plugin-name}-apimanifest.json` and saved in the chosen output directory when `apimanifest` value is used as the plugin type.
> In one's solution, there might be two different [API Manifests][def]. The `apimanifest.json` in the `./kiota` folder represents a single artifact surface of all APIs and it will always be generated. The second one, specific to each plugin when providing `--type apimanifest`, will be named `{plugin-name}-apimanifest.json` and saved in the chosen output directory.
Once the `workspace.json` file is generated and the OpenAPI document file is saved locally, the generation will be executed and the plugin and the sliced OpenAPI document will become available.

For `openai` plugins, the mapping should follow [Hidi logic to generate OpenAI Plugin](https://github.com/microsoft/OpenAPI.NET/blob/vnext/src/Microsoft.OpenApi.Hidi/OpenApiService.cs#L748). Requiring fields default as the following:
For `openai` plugins, the generated plugin will be named `openai-plugins.json` and the mapping should follow [Hidi logic to generate OpenAI Plugin](https://github.com/microsoft/OpenAPI.NET/blob/vnext/src/Microsoft.OpenApi.Hidi/OpenApiService.cs#L748). Requiring fields default as the following:

| OpenAI field | Default value |
| -- | -- |
Expand All @@ -29,7 +29,7 @@ For `openai` plugins, the mapping should follow [Hidi logic to generate OpenAI P
| legal_info_url | Defaults to x-legal-info-url extension from the OpenAPI document. If the x-legal-info-url is not availabe, the legal_info_url will not be added in the plugin. |
| | |

For `apimanifest`, the mapping should follow the [OpenApi.ApiManifest lib map](https://github.com/microsoft/OpenApi.ApiManifest/blob/main/docs/OpenApiToApiManifestMapping.md). Requiring fields are as the following:
For `apimanifest`, the generated file will be named `{plugin-name}-apimanifest.json` and the mapping should follow the [OpenApi.ApiManifest lib map](https://github.com/microsoft/OpenApi.ApiManifest/blob/main/docs/OpenApiToApiManifestMapping.md). Requiring fields are as the following:

| API Manifest field | Default value |
| -- | -- |
Expand All @@ -46,7 +46,7 @@ For `apimanifest`, the mapping should follow the [OpenApi.ApiManifest lib map](h
| `--openapi \| -d` | Yes | https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json | The location of the OpenAPI document in JSON or YAML format to use to generate the plugin. Accepts a URL or a local directory. | No |
| `--include-path \| -i` | No | /repos/{owner}/{repo} | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | Yes, without its value |
| `--exclude-path \| -e` | No | /advisories | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | Yes, without its value |
| `--type \| -t` | Yes | openai | The target type of plugin for the generated output files. Accepts multiple values. Possible values are `openai` and `apimanifest`. Defaults to `apimanifest`| Yes |
| `--type \| -t` | Yes | openai | The target type of plugin for the generated output files. Accepts multiple values. Possible values are `openai` and `apimanifest`.| Yes |
| `--skip-generation \| --sg` | No | true | When specified, the generation would be skipped. Defaults to false. | Yes |
| `--output \| -o` | No | ./generated/plugins/github | The output directory or file path for the generated output files. This is relative to the location of `workspace.json`. Defaults to `./output`. | Yes, without its value |

Expand Down Expand Up @@ -78,7 +78,7 @@ _The resulting `workspace.json` file will look like this:_
}
```

_The resulting `github-openai.json` file will look like this:_
_The resulting OpenAI plugin named `openai-plugins.json` will look like this:_

```jsonc
{
Expand All @@ -92,15 +92,15 @@ _The resulting `github-openai.json` file will look like this:_
},
"api": {
"type": "openapi",
"url": "./generated/plugins/github/sliced-openapi-github.json"
"url": "./generated/plugins/github/sliced-github.json"
},
"logo_url": "https://example.com/logo.png",
"contact_email": "[email protected]",
"legal_info_url": "http://www.example.com/view-plugin-information"
}
```

_The resulting `github-apimanifest.json` file will look like this:_
_The resulting API Manifest named `github-apimanifest.json` will look like this:_

```jsonc
{
Expand Down Expand Up @@ -129,7 +129,7 @@ _The resulting `github-apimanifest.json` file will look like this:_
}
```

_The resulting `apimanifest.json` file (concatenated surface of all APIs dependencies) in the `./kiota` folder will look like this:_
_The resulting API Manifest named `apimanifest.json` in the `./kiota` folder (concatenated surface of all APIs dependencies across clients and plugins) will look like this:_

```jsonc
{
Expand Down Expand Up @@ -169,7 +169,7 @@ _The resulting `apimanifest.json` file (concatenated surface of all APIs depende
```bash
└─.kiota
└─workspace.json
└─apimanifest.json # Single artifact with all APIs dependencies info
└─apimanifest.json # Single artifact with all APIs dependencies info across clients and plugins
└─documents
└─github
└─GitHub.json # OpenAPI document
Expand All @@ -178,8 +178,8 @@ _The resulting `apimanifest.json` file (concatenated surface of all APIs depende
└─plugins
└─github
└─github-apimanifest.json # Specific API Manifest
└─github-openai.json #OpenAI Plugin
└─sliced-openapi-github.json # Sliced and augmented OpenAPI document
└─openai-plugins.json #OpenAI Plugin
└─sliced-github.json # Sliced and augmented OpenAPI document
```

[def]: https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html
[def]: https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html
Loading

0 comments on commit 91325a6

Please sign in to comment.