Skip to content

Commit

Permalink
Merge branch 'main' into feature/typescript/composed-types
Browse files Browse the repository at this point in the history
  • Loading branch information
koros committed May 3, 2024
2 parents 1aa3a62 + 9d44f68 commit bc9b323
Show file tree
Hide file tree
Showing 19 changed files with 168 additions and 58 deletions.
30 changes: 17 additions & 13 deletions .azure-pipelines/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,6 @@ extends:
baselineFile: $(Build.SourcesDirectory)/guardian/SDL/common/.gdnbaselines
suppression:
suppressionFile: $(Build.SourcesDirectory)/guardian/SDL/common/.gdnsuppress
variables:
- group: kiota-vscode-extension-publish
dependsOn:
- github_release
steps:
Expand All @@ -586,18 +584,24 @@ extends:
- pwsh: npm i -g @vscode/vsce
- pwsh: $(Build.SourcesDirectory)/scripts/get-prerelease-version.ps1 -currentBranch $(Build.SourceBranch) -previewBranch ${{ parameters.previewBranch }}
displayName: "Set version suffix"
- pwsh: |
Get-ChildItem -Path $(Pipeline.Workspace) -Filter *.vsix -Recurse | ForEach-Object {
Write-Host "Publishing $_.FullName"
if ($Env:isPrerelease -eq "true") {
Write-Host "Publishing $_.FullName as a pre-release"
vsce publish --pat "$(vs-marketplace-token)" --packagePath $_.FullName --pre-release
}
else {
Write-Host "Publishing $_.FullName as a release"
vsce publish --pat "$(vs-marketplace-token)" --packagePath $_.FullName
- task: AzureCLI@2
inputs:
azureSubscription: "kiota-vscode-marketplace-publish"
scriptType: "pscore"
scriptLocation: 'inlineScript'
inlineScript: |
$aadToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
Get-ChildItem -Path $(Pipeline.Workspace) -Filter *.vsix -Recurse | ForEach-Object {
Write-Host "Publishing $_.FullName"
if ($Env:isPrerelease -eq "true") {
Write-Host "Publishing $_.FullName as a pre-release"
vsce publish --pat "$aadToken" --packagePath $_.FullName --pre-release
}
else {
Write-Host "Publishing $_.FullName as a release"
vsce publish --pat "$aadToken" --packagePath $_.FullName
}
}
}
env:
isPrerelease: $(isPrerelease)
- deployment: github_release
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ jobs:
- name: Publish ${{ matrix.os }}
run: dotnet publish ./src/kiota/kiota.csproj -c Release -p:PublishSingleFile=true -o ./${{ matrix.os }}

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}
path: ./${{ matrix.os }}

# Mac and Linux
- name: Isolate the binary
if: runner.os != 'Windows'
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

### Changed

- Aligns naming of sliced OpenAPI description generated by `plugin add` should be named `<plugin-name>-openapi.json|yml`
- Fixed RPC server to respect the `KIOTA_CONFIG_PREVIEW` flag.

## [1.14.0] - 2024-05-02

### Added

- Suppress CS1591 when generating CSharp code and documentation is not available
- Added file name suffix escaping in Go to avoid generating files with reserved suffixes. [#4407](https://github.com/microsoft/kiota/issues/4407)
- Added `KIOTA_OFFLINE_ENABLED` environment variable to disable checking for updates before each command. [#4556](https://github.com/microsoft/kiota/issues/4556)
Expand All @@ -24,7 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixes request builder disambiguation when child nodes had different prefixes for different paths with same parameters.[#4448](https://github.com/microsoft/kiota/issues/4448)
- Do not generate CS8603 warnings when enabling backing store in CSharp generation.
- Fixed excluding operation. [#4399](https://github.com/microsoft/kiota/issues/4399)
- Fided a bug where absolute path would be used for workspace for local descriptions. [#4582](https://github.com/microsoft/kiota/issues/4582) [#4581](https://github.com/microsoft/kiota/issues/4581)
- Fixed a bug where absolute path would be used for workspace for local descriptions. [#4582](https://github.com/microsoft/kiota/issues/4582) [#4581](https://github.com/microsoft/kiota/issues/4581)
- Fixed plugin generation of `ApiManifest` type to not include the `x-ms-kiota-hash` in the generated plugin. [#4561](https://github.com/microsoft/kiota/issues/4561)

## [1.13.0] - 2024-04-04
Expand Down Expand Up @@ -1315,3 +1324,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Initial GitHub release

4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "7.0.0",
"version": "8.0.0",
"rollForward": "latestMajor",
"allowPrerelease": false
}
}
}
8 changes: 4 additions & 4 deletions it/typescript/package-lock.json

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

2 changes: 1 addition & 1 deletion it/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"prettier": "./.prettierrc.json",
"devDependencies": {
"@es-exec/esbuild-plugin-start": "^0.0.5",
"@types/node": "^20.12.7",
"@types/node": "^20.12.8",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.8.0",
"esbuild": "^0.20.2",
Expand Down
6 changes: 3 additions & 3 deletions specs/cli/plugin-add.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ 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 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.
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 `{plugin-name}-openapi.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 when providing `--type apimanifest`, will be named `{plugin-name}-apimanifest.json` and saved in the chosen output directory.
Expand Down Expand Up @@ -92,7 +92,7 @@ _The resulting OpenAI plugin named `openai-plugins.json` will look like this:_
},
"api": {
"type": "openapi",
"url": "./generated/plugins/github/sliced-github.json"
"url": "./generated/plugins/github/github-openapi.json"
},
"logo_url": "https://example.com/logo.png",
"contact_email": "[email protected]",
Expand Down Expand Up @@ -179,7 +179,7 @@ _The resulting API Manifest named `apimanifest.json` in the `./kiota` folder (co
└─github
└─github-apimanifest.json # Specific API Manifest
└─openai-plugins.json #OpenAI Plugin
└─sliced-github.json # Sliced and augmented OpenAPI document
└─github-openapi.json # Sliced and augmented OpenAPI document
```

[def]: https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html
4 changes: 2 additions & 2 deletions specs/cli/plugin-edit.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ _The resulting OpenAI plugin named `openai-plugins.json` will look like this:_
},
"api": {
"type": "openapi",
"url": "./sliced-github.json"
"url": "./github-openapi.json"
},
"logo_url": "https://example.com/logo.png",
"contact_email": "[email protected]",
Expand Down Expand Up @@ -143,7 +143,7 @@ _The resulting API Manifest named `apimanifest.json` in the `./kiota` folder (co
└─github
└─github-apimanifest.json # Specific API Manifest
└─openai-plugins.json #OpenAI Plugin
└─sliced-github.json # Sliced and augmented OpenAPI document
└─github-openapi.json # Sliced and augmented OpenAPI document
```

[def]: https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html
2 changes: 1 addition & 1 deletion specs/cli/plugin-remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The command also has one optional parameter, the ability to remove the all gener
```bash
kiota plugin remove --plugin-name "GitHub" --clean-output
```
_The resulting `github-apimanifest.json`, `openai-plugins.json` and `sliced-github.json` files will be deleted._
_The resulting `github-apimanifest.json`, `openai-plugins.json` and `github-openapi.json` files will be deleted._

The resulting `workspace.json` file will look like this:

Expand Down
7 changes: 3 additions & 4 deletions src/Kiota.Builder/Kiota.Builder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Title>Microsoft.OpenApi.Kiota.Builder</Title>
<PackageId>Microsoft.OpenApi.Kiota.Builder</PackageId>
<PackageOutputPath>./nupkg</PackageOutputPath>
<VersionPrefix>1.14.0</VersionPrefix>
<VersionPrefix>1.15.0</VersionPrefix>
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
<PackageReleaseNotes>
https://github.com/microsoft/kiota/releases
Expand Down Expand Up @@ -50,13 +50,12 @@
<PackageReference Include="Microsoft.Plugins.Manifest" Version="0.0.6-preview" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="YamlDotNet" Version="15.1.2" />
<ProjectReference Include="..\Kiota.Generated\KiotaGenerated.csproj" OutputItemType="Analyzer"
ReferenceOutputAssembly="false" />
<ProjectReference Include="..\Kiota.Generated\KiotaGenerated.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="*.g.cs" />
</ItemGroup>
<ItemGroup>
<None Include="../../README.md" Pack="true" PackagePath="" />
</ItemGroup>
</Project>
</Project>
7 changes: 4 additions & 3 deletions src/Kiota.Builder/Plugins/PluginsGenerationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ public PluginsGenerationService(OpenApiDocument document, OpenApiUrlTreeNode ope
}
private static readonly OpenAPIRuntimeComparer _openAPIRuntimeComparer = new();
private const string ManifestFileNameSuffix = ".json";
private const string DescriptionRelativePath = "openapi.yml";
private const string DescriptionPathSuffix = "openapi.yml";
public async Task GenerateManifestAsync(CancellationToken cancellationToken = default)
{
// write the description
var descriptionFullPath = Path.Combine(Configuration.OutputPath, DescriptionRelativePath);
var descriptionRelativePath = $"{Configuration.ClientClassName.ToLowerInvariant()}-{DescriptionPathSuffix}";
var descriptionFullPath = Path.Combine(Configuration.OutputPath, descriptionRelativePath);
var directory = Path.GetDirectoryName(descriptionFullPath);
if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
Directory.CreateDirectory(directory);
Expand All @@ -64,7 +65,7 @@ public async Task GenerateManifestAsync(CancellationToken cancellationToken = de
switch (pluginType)
{
case PluginType.Microsoft:
var pluginDocument = GetManifestDocument(DescriptionRelativePath);
var pluginDocument = GetManifestDocument(descriptionRelativePath);
pluginDocument.Write(writer);
break;
case PluginType.APIManifest:
Expand Down
3 changes: 2 additions & 1 deletion src/kiota/KiotaHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
namespace kiota;
public static partial class KiotaHost
{
internal static readonly Lazy<bool> IsConfigPreviewEnabled = new(() => bool.TryParse(Environment.GetEnvironmentVariable("KIOTA_CONFIG_PREVIEW"), out var isPreviewEnabled) && isPreviewEnabled);
internal const string KiotaPreviewEnvironmentVariable = "KIOTA_CONFIG_PREVIEW";
internal static readonly Lazy<bool> IsConfigPreviewEnabled = new(() => bool.TryParse(Environment.GetEnvironmentVariable(KiotaPreviewEnvironmentVariable), out var isPreviewEnabled) && isPreviewEnabled);
public static RootCommand GetRootCommand()
{
var rootCommand = new RootCommand();
Expand Down
1 change: 1 addition & 0 deletions src/kiota/Rpc/IServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ internal interface IServer
Task<ManifestResult> GetManifestDetailsAsync(string manifestPath, string apiIdentifier, bool clearCache, CancellationToken cancellationToken);
Task<List<LogEntry>> GenerateAsync(string openAPIFilePath, string outputPath, GenerationLanguage language, string[] includePatterns, string[] excludePatterns, string clientClassName, string clientNamespaceName, bool usesBackingStore, bool cleanOutput, bool clearCache, bool excludeBackwardCompatible, string[] disabledValidationRules, string[] serializers, string[] deserializers, string[] structuredMimeTypes, bool includeAdditionalData, CancellationToken cancellationToken);
Task<LanguagesInformation> InfoForDescriptionAsync(string descriptionPath, bool clearCache, CancellationToken cancellationToken);
Task<List<LogEntry>> GeneratePluginAsync(string openAPIFilePath, string outputPath, PluginType[] pluginTypes, string[] includePatterns, string[] excludePatterns, string clientClassName, bool cleanOutput, bool clearCache, string[] disabledValidationRules, CancellationToken cancellationToken);
}
Loading

0 comments on commit bc9b323

Please sign in to comment.