Skip to content

Commit

Permalink
Merge branch 'shem/fix_local_imports' of https://github.com/microsoft…
Browse files Browse the repository at this point in the history
…/kiota into shem/fix_local_imports
  • Loading branch information
shemogumbe committed Nov 9, 2024
2 parents c2ad01d + f140aef commit ab3ecaa
Show file tree
Hide file tree
Showing 15 changed files with 200 additions and 175 deletions.
3 changes: 3 additions & 0 deletions .azure-pipelines/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ extends:
- pwsh: $(Build.SourcesDirectory)/scripts/get-prerelease-version.ps1 -currentBranch $(Build.SourceBranch) -previewBranch ${{ parameters.previewBranch }} -excludeHeadingDash
displayName: "Set version suffix"

- pwsh: $(Build.SourcesDirectory)/scripts/enable-shims-for-packaging.ps1
displayName: "Add PackAsToolShimRuntimeIdentifiers attributes for tool packaging"

- pwsh: $(Build.SourcesDirectory)/scripts/update-version-suffix-for-source-generator.ps1 -versionSuffix "$(versionSuffix)"
displayName: "Set version suffix in csproj for generators"

Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

### Changed

## [1.20.0] - 2024-11-07

### Added

### Changed

- Fixed python generation client serailization failure str being quoted as "str"
- Fixed Issue with primitive values being stringified in python python. [#5417](https://github.com/microsoft/kiota/issues/5417)

- Fixed an issue where multipart request content would be ignored if other unstructured content was present in the description. [#5638](https://github.com/microsoft/kiota/issues/5638)
- Fixed an issue where when generating Go code the deserializer for unions was using `CodeClass` as a filter and not `CodeInterface`. [#4844](https://github.com/microsoft/kiota/issues/4844)
- Fixes mapping of `int16` format to the `integer` type rather than `double` when the type is `integer` or `number` [#5611](https://github.com/microsoft/kiota/issues/5611)
Expand All @@ -23,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed a bug where the type name for inherited inline models would be incorrect. [#5610](https://github.com/microsoft/kiota/issues/5610)
- Fixes typing inconsistencies in generated code and libraries in Python [kiota-python#333](https://github.com/microsoft/kiota-python/issues/333)
- Fixes generation of superfluous fields for Models with discriminator due to refiners adding the same properties to the same model [#4178](https://github.com/microsoft/kiota/issues/4178).
- Fixes unsigned shim binary when installed as dotnet tool [#5650](https://github.com/microsoft/kiota/issues/5650).

## [1.19.1] - 2024-10-11

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

- Initial GitHub release

14 changes: 7 additions & 7 deletions it/csharp/dotnet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.13.1" />
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.13.2" />
<PackageReference Include="Microsoft.Kiota.Authentication.Azure" Version="1.13.2" />
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.13.2" />
<PackageReference Include="Microsoft.Kiota.Serialization.Form" Version="1.13.2" />
<PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.13.2" />
<PackageReference Include="Microsoft.kiota.Serialization.Multipart" Version="1.13.2" />
<PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="1.13.2" />
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.14.0" />
<PackageReference Include="Microsoft.Kiota.Authentication.Azure" Version="1.14.0" />
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.14.0" />
<PackageReference Include="Microsoft.Kiota.Serialization.Form" Version="1.14.0" />
<PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.14.0" />
<PackageReference Include="Microsoft.kiota.Serialization.Multipart" Version="1.14.0" />
<PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="1.14.0" />

<Compile Remove="basic\**" />
</ItemGroup>
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 @@ -14,7 +14,7 @@ docutils==0.21.2 ; python_version >= '3.7'

exceptiongroup==1.1.1 ; python_version < '3.11'

flit==3.9.0
flit==3.10.1

flit-core==3.10.1 ; python_version >= '3.6'

Expand Down Expand Up @@ -72,7 +72,7 @@ aiosignal==1.3.1 ; python_version >= '3.7'

anyio==4.6.2.post1 ; python_version >= '3.7'

async-timeout==5.0.0 ; python_version >= '3.6'
async-timeout==5.0.1 ; python_version >= '3.6'

attrs==24.2.0 ; python_version >= '3.7'

Expand Down
175 changes: 82 additions & 93 deletions it/typescript/package-lock.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions it/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"devDependencies": {
"@es-exec/esbuild-plugin-start": "^0.0.5",
"@stylistic/eslint-plugin-ts": "^2.10.1",
"@types/node": "^22.8.7",
"@typescript-eslint/eslint-plugin": "^8.12.2",
"@typescript-eslint/parser": "^8.12.2",
"@types/node": "^22.9.0",
"@typescript-eslint/eslint-plugin": "^8.13.0",
"@typescript-eslint/parser": "^8.13.0",
"esbuild": "^0.24.0",
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -32,13 +32,13 @@
},
"dependencies": {
"@azure/identity": "^4.5.0",
"@microsoft/kiota-abstractions": "^1.0.0-preview.72",
"@microsoft/kiota-authentication-azure": "^1.0.0-preview.72",
"@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.72",
"@microsoft/kiota-serialization-form": "^1.0.0-preview.72",
"@microsoft/kiota-serialization-json": "^1.0.0-preview.72",
"@microsoft/kiota-serialization-multipart": "^1.0.0-preview.72",
"@microsoft/kiota-serialization-text": "^1.0.0-preview.72",
"@microsoft/kiota-abstractions": "^1.0.0-preview.74",
"@microsoft/kiota-authentication-azure": "^1.0.0-preview.74",
"@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.74",
"@microsoft/kiota-serialization-form": "^1.0.0-preview.74",
"@microsoft/kiota-serialization-json": "^1.0.0-preview.74",
"@microsoft/kiota-serialization-multipart": "^1.0.0-preview.74",
"@microsoft/kiota-serialization-text": "^1.0.0-preview.74",
"express": "^5.0.1",
"node-fetch": "^2.7.0"
}
Expand Down
13 changes: 13 additions & 0 deletions scripts/enable-shims-for-packaging.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This script enables the shims for packaging the project as a tool
$csprojPath = Join-Path $PSScriptRoot "../src/kiota/kiota.csproj"

$xml = [Xml] (Get-Content $csprojPath)

$shimIdentifiers = $xml.CreateElement("PackAsToolShimRuntimeIdentifiers")
$shimIdentifiers.InnerText = "win-x64;win-x86;osx-x64"

$rootPropertyGroup = $xml.Project.PropertyGroup[0]
$rootPropertyGroup.AppendChild($shimIdentifiers)

#save xml to csproj
$xml.Save($csprojPath)
16 changes: 8 additions & 8 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.20.0</VersionPrefix>
<VersionPrefix>1.21.0</VersionPrefix>
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
<PackageReleaseNotes>
https://github.com/microsoft/kiota/releases
Expand All @@ -38,16 +38,16 @@
<PackageReference Include="AsyncKeyedLock" Version="7.0.2" />
<PackageReference Include="DotNet.Glob" Version="3.1.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.13.2" />
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.13.2" />
<PackageReference Include="Microsoft.Kiota.Serialization.Form" Version="1.13.2" />
<PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.13.2" />
<PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="1.13.2" />
<PackageReference Include="Microsoft.kiota.Serialization.Multipart" Version="1.13.2" />
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.14.0" />
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.14.0" />
<PackageReference Include="Microsoft.Kiota.Serialization.Form" Version="1.14.0" />
<PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.14.0" />
<PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="1.14.0" />
<PackageReference Include="Microsoft.kiota.Serialization.Multipart" Version="1.14.0" />
<PackageReference Include="Microsoft.OpenApi" Version="1.6.22" />
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="0.5.5-preview" />
<PackageReference Include="Microsoft.OpenApi.Readers" Version="1.6.22" />
<PackageReference Include="Microsoft.Plugins.Manifest" Version="1.0.0-preview4" />
<PackageReference Include="Microsoft.Plugins.Manifest" Version="1.0.0-rc1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
3 changes: 1 addition & 2 deletions src/Kiota.Builder/Refiners/TypeScriptRefiner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,6 @@ currentInterface.StartBlock is InterfaceDeclaration interfaceDeclaration &&
}
CrawlTree(currentElement, AliasUsingsWithSameSymbol);
}
private const string GuidPackageName = "guid-typescript";
private const string AbstractionsPackageName = "@microsoft/kiota-abstractions";
// A helper method to check if a parameter is a multipart body
private static bool IsMultipartBody(CodeParameter p) =>
Expand Down Expand Up @@ -840,7 +839,7 @@ private static void CorrectMethodType(CodeMethod currentMethod)
{"Guid", (string.Empty, new CodeUsing {
Name = "Guid",
Declaration = new CodeType {
Name = GuidPackageName,
Name = AbstractionsPackageName,
IsExternal = true,
},
IsErasable = true, // the import is used only for the type, not for the value
Expand Down
5 changes: 4 additions & 1 deletion src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ private void WriteRequestsMetadataConstant(CodeConstant codeElement, LanguageWri
var isEnum = executorMethod.ReturnType is CodeType codeType && codeType.TypeDefinition is CodeEnum;
var returnTypeWithoutCollectionSymbol = GetReturnTypeWithoutCollectionSymbol(executorMethod, returnType);
var isPrimitive = IsPrimitiveType(returnTypeWithoutCollectionSymbol);
var isPrimitiveAlias = GetPrimitiveAlias(returnTypeWithoutCollectionSymbol) is not null;
writer.StartBlock($"{executorMethod.Name.ToFirstCharacterLowerCase()}: {{");
var urlTemplateValue = executorMethod.HasUrlTemplateOverride ? $"\"{executorMethod.UrlTemplateOverride}\"" : uriTemplateConstant.Name.ToFirstCharacterUpperCase();
writer.WriteLine($"uriTemplate: {urlTemplateValue},");
Expand All @@ -118,7 +119,7 @@ private void WriteRequestsMetadataConstant(CodeConstant codeElement, LanguageWri
}
writer.CloseBlock("},");
}
writer.WriteLine($"adapterMethodName: \"{GetSendRequestMethodName(isVoid, isStream, executorMethod.ReturnType.IsCollection, isPrimitive, isEnum)}\",");
writer.WriteLine($"adapterMethodName: \"{GetSendRequestMethodName(isVoid, isStream, executorMethod.ReturnType.IsCollection, isPrimitive || isPrimitiveAlias, isEnum)}\",");
if (isEnum)
{
string enumObjectName = string.Empty;
Expand Down Expand Up @@ -169,6 +170,8 @@ private string GetTypeFactory(bool isVoid, bool isStream, CodeMethod codeElement
if (isVoid) return string.Empty;
var typeName = conventions.TranslateType(codeElement.ReturnType);
if (isStream || IsPrimitiveType(typeName)) return $" \"{typeName}\"";
if (GetPrimitiveAlias(typeName) is { } alias && !string.IsNullOrEmpty(alias))
return $" \"{alias}\"";
return $" {GetFactoryMethodName(codeElement.ReturnType, codeElement, writer)}";
}
private string GetReturnTypeWithoutCollectionSymbol(CodeMethod codeElement, string fullTypeName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ public static string TranslateTypescriptType(CodeTypeBase type)
{
TYPE_INTEGER or TYPE_INT or TYPE_INT64 or TYPE_FLOAT or TYPE_DOUBLE or TYPE_BYTE or TYPE_SBYTE or TYPE_DECIMAL => TYPE_NUMBER,
TYPE_BINARY or TYPE_BASE64 or TYPE_BASE64URL => TYPE_STRING,
TYPE_GUID => TYPE_GUID,
TYPE_STRING or TYPE_OBJECT or TYPE_BOOLEAN or TYPE_VOID or TYPE_LOWERCASE_STRING or TYPE_LOWERCASE_OBJECT or TYPE_LOWERCASE_BOOLEAN or TYPE_LOWERCASE_VOID => type.Name.ToFirstCharacterLowerCase(),
null => TYPE_OBJECT,
_ when type is CodeComposedTypeBase composedType => composedType.Name.ToFirstCharacterUpperCase(),
Expand Down Expand Up @@ -225,6 +224,15 @@ TYPE_LOWERCASE_BOOLEAN or
};
}

public static string? GetPrimitiveAlias(string typeName)
{
return typeName switch
{
TYPE_GUID => TYPE_LOWERCASE_STRING,
_ => null
};
}

public static bool IsPrimitiveType(CodeType codeType, CodeComposedTypeBase codeComposedTypeBase) => IsPrimitiveType(codeType, codeComposedTypeBase, true);

public static bool IsPrimitiveType(CodeType codeType, CodeComposedTypeBase codeComposedTypeBase, bool includeCollectionInformation) => IsPrimitiveType(GetTypescriptTypeString(codeType, codeComposedTypeBase, includeCollectionInformation));
Expand Down
2 changes: 1 addition & 1 deletion src/kiota/kiota.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Title>Microsoft.OpenApi.Kiota</Title>
<PackageId>Microsoft.OpenApi.Kiota</PackageId>
<PackageOutputPath>./nupkg</PackageOutputPath>
<VersionPrefix>1.20.0</VersionPrefix>
<VersionPrefix>1.21.0</VersionPrefix>
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
<PackageReleaseNotes>
https://github.com/microsoft/kiota/releases
Expand Down
2 changes: 2 additions & 0 deletions vscode/microsoft-kiota/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ All notable changes to this project will be documented in this file.

### Changed

## [1.20.000000001] - 2024-11-07

## [1.19.100000001] - 2024-10-03

## [1.19.24092002] - 2024-09-20
Expand Down
Loading

0 comments on commit ab3ecaa

Please sign in to comment.