diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 23c5b5e98b..be3ef4f243 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -39,7 +39,8 @@ "ms-vscode.powershell", "rebornix.ruby", "visualstudioexptteam.vscodeintellicode", - "streetsidesoftware.code-spell-checker" + "streetsidesoftware.code-spell-checker", + "sswg.swift-lang" ], "remoteUser": "vscode", "features": { @@ -50,8 +51,9 @@ "java": "latest", "ruby": "latest", "rust": "latest", - "powershell": "latest" + "powershell": "latest", + "swift": "latest" }, "postCreateCommand": - "git config pull.rebase false && git config push.default simple && git config remote.origin.prune true && git config commit.gpgsign true && git config tag.gpgsign true && git config core.safecrlf false && gh repo clone microsoft/kiota-samples samples" + "git config pull.rebase false && git config push.default simple && git config remote.origin.prune true && git config commit.gpgsign true && git config tag.gpgsign true && git config core.safecrlf false && [ ! -d ./samples ] && gh repo clone microsoft/kiota-samples samples" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e7bc60a0a..13419ac3ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added support for enum options descriptions (C#/Go/Java/TypeScript). [#90](https://github.com/microsoft/kiota/issues/90) +- Added support for file parameters types. [#221](https://github.com/microsoft/kiota/issues/221) ### Changed diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 55b54f0bb8..1f0340a2b2 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -591,6 +591,7 @@ private static CodeType GetPrimitiveType(OpenApiSchema typeSchema, string childT var format = typeSchema?.Format ?? typeSchema?.Items?.Format; var primitiveTypeName = (typeName?.ToLowerInvariant(), format?.ToLowerInvariant()) switch { ("string", "base64url") => "binary", + ("file", _) => "binary", ("string", "duration") => "TimeSpan", ("string", "time") => "TimeOnly", ("string", "date") => "DateOnly", diff --git a/src/Kiota.Builder/Refiners/CSharpReservedTypesProvider.cs b/src/Kiota.Builder/Refiners/CSharpReservedTypesProvider.cs index d2e0dee868..8f8c5f59ea 100644 --- a/src/Kiota.Builder/Refiners/CSharpReservedTypesProvider.cs +++ b/src/Kiota.Builder/Refiners/CSharpReservedTypesProvider.cs @@ -6,6 +6,9 @@ public class CSharpReservedTypesProvider : IReservedNamesProvider { private readonly Lazy> _reservedNames = new(() => new(StringComparer.OrdinalIgnoreCase) { + "file", //system.io static types + "directory", + "path", "task", }); public HashSet ReservedNames => _reservedNames.Value; diff --git a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs index b4cf2b2524..e38284df5e 100644 --- a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs +++ b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs @@ -1568,6 +1568,7 @@ public void InheritedTypeWithInlineSchemaWorks() { [InlineData("boolean", "", "boolean")] [InlineData("", "byte", "binary")] [InlineData("", "binary", "binary")] + [InlineData("file", null, "binary")] [Theory] public void MapsPrimitiveFormats(string type, string format, string expected){ var document = new OpenApiDocument() {