From d63c85e976f02672265209e479d167ec5ba92946 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 14 Nov 2021 15:27:06 -0500 Subject: [PATCH 01/27] Model with dictionary property --- .../GenerateSample.cs | 27 +++++++++++++++- .../Kiota.Builder.IntegrationTests.csproj | 3 ++ .../ModelWithDictionary.yaml | 32 +++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 tests/Kiota.Builder.IntegrationTests/ModelWithDictionary.yaml diff --git a/tests/Kiota.Builder.IntegrationTests/GenerateSample.cs b/tests/Kiota.Builder.IntegrationTests/GenerateSample.cs index d4bd62daeb..919d80ff3c 100644 --- a/tests/Kiota.Builder.IntegrationTests/GenerateSample.cs +++ b/tests/Kiota.Builder.IntegrationTests/GenerateSample.cs @@ -22,11 +22,36 @@ public async Task GeneratesTodo(GenerationLanguage language, bool backingStore) var backingStoreSuffix = backingStore ? string.Empty : "BackingStore"; var configuration = new GenerationConfiguration { - Language = GenerationLanguage.CSharp, + Language = language, OpenAPIFilePath = "ToDoApi.yaml", OutputPath = $".\\Generated\\{language}{backingStoreSuffix}", UsesBackingStore = backingStore, }; await new KiotaBuilder(logger, configuration).GenerateSDK(new()); } + [InlineData(GenerationLanguage.CSharp, false)] + [InlineData(GenerationLanguage.Java, false)] + [InlineData(GenerationLanguage.TypeScript, false)] + [InlineData(GenerationLanguage.Go, false)] + [InlineData(GenerationLanguage.Ruby, false)] + [InlineData(GenerationLanguage.CSharp, true)] + [InlineData(GenerationLanguage.Java, true)] + [InlineData(GenerationLanguage.PHP, false)] + [InlineData(GenerationLanguage.TypeScript, true)] + [Theory] + public async Task GeneratesModelWithDictionary(GenerationLanguage language, bool backingStore) + { + var logger = LoggerFactory.Create((builder) => { + }).CreateLogger(); + + var backingStoreSuffix = backingStore ? "BackingStore" : string.Empty; + var configuration = new GenerationConfiguration + { + Language = language, + OpenAPIFilePath = "ModelWithDictionary.yaml", + OutputPath = $".\\Generated\\ModelWithDictionary\\{language}{backingStoreSuffix}", + UsesBackingStore = backingStore, + }; + await new KiotaBuilder(logger, configuration).GenerateSDK(new()); + } } diff --git a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj index f23cdc5e77..8a3b6c09f0 100644 --- a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj +++ b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj @@ -28,6 +28,9 @@ + + PreserveNewest + PreserveNewest diff --git a/tests/Kiota.Builder.IntegrationTests/ModelWithDictionary.yaml b/tests/Kiota.Builder.IntegrationTests/ModelWithDictionary.yaml new file mode 100644 index 0000000000..95be111ba4 --- /dev/null +++ b/tests/Kiota.Builder.IntegrationTests/ModelWithDictionary.yaml @@ -0,0 +1,32 @@ +openapi: 3.0.0 +info: + title: "Dictionary API" + version: "1.0.0" +servers: + - url: https://example.org/ +paths: + /resource: + get: + responses: + 200: + description: ok + content: + application/json: + schema: + $ref: "#/components/schemas/resource" +components: + schemas: + resource: + type: object + properties: + info: + type: string + # customSettings: Dictionary + customSettings: + type: object + patternProperties: + ".*": + type: string + + + From e701eaf6b6b7e832aae8eee3da145e35d08406d5 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 14 Nov 2021 17:24:51 -0500 Subject: [PATCH 02/27] Added some samples --- .../GenerateSample.cs | 2 +- .../Kiota.Builder.IntegrationTests.csproj | 3 + .../ModelWithDerivedTypes.yaml | 81 +++++++++++++++++++ .../ResponseWithMultipleReturnFormats.yaml | 38 +++++++++ 4 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 tests/Kiota.Builder.IntegrationTests/ModelWithDerivedTypes.yaml create mode 100644 tests/Kiota.Builder.IntegrationTests/ResponseWithMultipleReturnFormats.yaml diff --git a/tests/Kiota.Builder.IntegrationTests/GenerateSample.cs b/tests/Kiota.Builder.IntegrationTests/GenerateSample.cs index 919d80ff3c..d63fbadeb9 100644 --- a/tests/Kiota.Builder.IntegrationTests/GenerateSample.cs +++ b/tests/Kiota.Builder.IntegrationTests/GenerateSample.cs @@ -24,7 +24,7 @@ public async Task GeneratesTodo(GenerationLanguage language, bool backingStore) { Language = language, OpenAPIFilePath = "ToDoApi.yaml", - OutputPath = $".\\Generated\\{language}{backingStoreSuffix}", + OutputPath = $".\\Generated\\Todo\\{language}{backingStoreSuffix}", UsesBackingStore = backingStore, }; await new KiotaBuilder(logger, configuration).GenerateSDK(new()); diff --git a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj index 8a3b6c09f0..a1851e67db 100644 --- a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj +++ b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj @@ -28,6 +28,9 @@ + + PreserveNewest + PreserveNewest diff --git a/tests/Kiota.Builder.IntegrationTests/ModelWithDerivedTypes.yaml b/tests/Kiota.Builder.IntegrationTests/ModelWithDerivedTypes.yaml new file mode 100644 index 0000000000..75ffb99d84 --- /dev/null +++ b/tests/Kiota.Builder.IntegrationTests/ModelWithDerivedTypes.yaml @@ -0,0 +1,81 @@ +openapi: 3.0.0 +info: + title: "Derived Types API" + version: "1.0.0" +servers: + - url: https://example.org/ +paths: + /fruits: # this method will not downcast to OpenAPI v2 because oneOf is not supported + get: + responses: + 200: + description: ok + content: + application/json: + # The code generator will need to be clever and instead of generating a fruitResponse class + # with a property for each of the properties, it needs to detect that apple and orange derive from fruit. + # It can then declare the requestExecutors as returning the base type. + schema: + oneOf: + - $ref: "#/components/schemas/fruit" # Allowing the base class allows enables evolvabilty + - $ref: "#/components/schemas/apple" + - $ref: "#/components/schemas/orange" + /fruitsWithDiscriminator: + get: + responses: + 200: + description: ok + content: + application/json: + schema: + discriminator: + propertyName: fruitType # This only works if fruitType has the exact schema name + allOf: + - $ref: "#/components/schemas/fruit" # Allowing the base class allows enables evolvabilty + /fruitsWithDiscriminatorWithMapping: + get: + responses: + 200: + description: ok + content: + application/json: + schema: + discriminator: + propertyName: fruitType + mapping: # If mapping doesn't exist, then fallback to base type' + apple: '#/components/schemas/apple' + orange: '#/components/schemas/orange' + allOf: + - $ref: "#/components/schemas/fruit" # Allowing the base class allows enables evolvabilty + +components: + schemas: + fruit: + type: object + title: fruit # required temporarily due to a bug in Kiota codemodel + properties: + name: + type: string + fruitType: + type: string + apple: + allOf: + - $ref: '#/components/schemas/fruit' + type: object + title: apple + properties: + edible: + type: boolean + fruitType: + x-const: apple # the const keyword is only supported int OpenAPI 3.1 + orange: + allOf: + - $ref: '#/components/schemas/fruit' + type: object + title: orange + properties: + seedless: + type: boolean + fruitType: + x-const: orange + diff --git a/tests/Kiota.Builder.IntegrationTests/ResponseWithMultipleReturnFormats.yaml b/tests/Kiota.Builder.IntegrationTests/ResponseWithMultipleReturnFormats.yaml new file mode 100644 index 0000000000..dc69b9f184 --- /dev/null +++ b/tests/Kiota.Builder.IntegrationTests/ResponseWithMultipleReturnFormats.yaml @@ -0,0 +1,38 @@ +openapi: 3.0.0 +info: + title: "API that returns multiple response formats" + version: "1.0.0" +servers: + - url: https://example.org/ +paths: + /report: + get: + responses: + 200: + description: ok + content: + application/json: {} # Response is JSON but no schema is defined + text/csv: {} + /reportWithSchema: + get: + responses: + 200: + description: ok + content: + application/json: # Response is JSON but no schema is defined + schema: + $ref: "#/components/schemas/weatherReport" + text/csv: {} +components: + schemas: + weatherReport: + type: array + items: + type: object + properties: + date: + type: string + temperature: + type: string + conditions: + type: string From 752f0c3107fbba52603a056ca93b35fa03b8a153 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Wed, 1 Dec 2021 22:35:25 -0500 Subject: [PATCH 03/27] experiment with VS integration --- .../Kiota.ApiDescription.Client.props | 12 +++++++++++ .../Kiota.ApiDescription.Client.targets | 21 +++++++++++++++++++ .../Kiota.Builder.IntegrationTests.csproj | 3 +++ 3 files changed, 36 insertions(+) create mode 100644 src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.props create mode 100644 src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.targets diff --git a/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.props b/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.props new file mode 100644 index 0000000000..6f8f5488cf --- /dev/null +++ b/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.props @@ -0,0 +1,12 @@ + + + + + + KiotaCSharp + + + KiotaCSharp + + + diff --git a/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.targets b/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.targets new file mode 100644 index 0000000000..29ad334bb3 --- /dev/null +++ b/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.targets @@ -0,0 +1,21 @@ + + + + + + + + + + kiota -d %(FullPath) -o %(OutputPath) -l CSharp -c %(ClassName) -n %(Namespace) + + + + + + + + + + + diff --git a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj index a1851e67db..55b7f2b179 100644 --- a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj +++ b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj @@ -28,6 +28,9 @@ + + PreserveNewest + PreserveNewest From 6acec280f481605fcf2f4a32fedb5164006dd3f7 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sat, 25 Dec 2021 10:49:31 -0500 Subject: [PATCH 04/27] Added nuspec for ApiDescription package --- .../Kiota.ApiDescription.Client.nuspec | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.nuspec diff --git a/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.nuspec b/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.nuspec new file mode 100644 index 0000000000..22831844d5 --- /dev/null +++ b/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.nuspec @@ -0,0 +1,23 @@ + + + + Kiota.ApiDescription.Client + 0.5.0-preview + Microsoft + true + false + MIT + https://github.com/microsoft/Kiota + Kiota: An OpenAPI SDK generator + Copyright © Microsoft, 2021 + OpenAPI Swagger AspNetCore CodeGen TypeScript WebApi AspNet + + + + + + + + + + \ No newline at end of file From 1786bd887920dbbf367e08ae0ff197324575cf24 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 11 Feb 2022 07:51:52 -0800 Subject: [PATCH 05/27] Update src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.nuspec --- .../Kiota.ApiDescription.Client.nuspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.nuspec b/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.nuspec index 22831844d5..ff0f6b9aa1 100644 --- a/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.nuspec +++ b/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.nuspec @@ -1,7 +1,7 @@  - Kiota.ApiDescription.Client + Microsoft.Kiota.ApiDescription.Client 0.5.0-preview Microsoft true From aecee1e227bedf373d830254cb03186e18858c51 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 4 May 2022 15:14:43 -0400 Subject: [PATCH 06/27] - fixes failing unit tests --- src/Kiota.Builder/CodeDOM/CodeTypeBase.cs | 2 +- src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs | 2 +- src/Kiota.Builder/Refiners/PhpRefiner.cs | 6 +++--- src/Kiota.Builder/Writers/Go/GoConventionService.cs | 8 ++++---- src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs | 4 ++-- src/Kiota.Builder/Writers/Php/PhpConventionService.cs | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Kiota.Builder/CodeDOM/CodeTypeBase.cs b/src/Kiota.Builder/CodeDOM/CodeTypeBase.cs index c4380e2700..9579c2b27a 100644 --- a/src/Kiota.Builder/CodeDOM/CodeTypeBase.cs +++ b/src/Kiota.Builder/CodeDOM/CodeTypeBase.cs @@ -25,7 +25,7 @@ protected ChildType BaseClone(CodeTypeBase source) where ChildType : ActionOf = source.ActionOf; IsNullable = source.IsNullable; CollectionKind = source.CollectionKind; - Name = source.Name.Clone() as string; + Name = source.Name?.Clone() as string; Parent = source.Parent; return this as ChildType; } diff --git a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs index 1fe9ea86c8..952f1ff421 100644 --- a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs +++ b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs @@ -306,7 +306,7 @@ protected static void ReplaceBinaryByNativeType(CodeElement currentElement, stri currentMethod.ReturnType.Name = symbol; shouldInsertUsing = !string.IsNullOrWhiteSpace(ns); } - var binaryParameter = currentMethod.Parameters.FirstOrDefault(x => x.Type.Name.Equals(BinaryType)); + var binaryParameter = currentMethod.Parameters.FirstOrDefault(x => x.Type?.Name?.Equals(BinaryType) ?? false); if(binaryParameter != null) { binaryParameter.Type.Name = symbol; shouldInsertUsing = !string.IsNullOrWhiteSpace(ns); diff --git a/src/Kiota.Builder/Refiners/PhpRefiner.cs b/src/Kiota.Builder/Refiners/PhpRefiner.cs index 7d5f4aee40..db1cb2313f 100644 --- a/src/Kiota.Builder/Refiners/PhpRefiner.cs +++ b/src/Kiota.Builder/Refiners/PhpRefiner.cs @@ -118,8 +118,8 @@ public override void Refine(CodeNamespace generatedCode) new (x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.RequestExecutor), "Http\\Promise", "Promise", "RejectedPromise"), new (x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.RequestExecutor), "", "Exception"), new (x => x is CodeEnum, "Microsoft\\Kiota\\Abstractions\\", "Enum"), - new(x => x is CodeProperty property && property.Type.Name.Equals("DateTime", StringComparison.OrdinalIgnoreCase), "", "DateTime"), - new(x => x is CodeProperty property && property.Type.Name.Equals("DateTimeOffset", StringComparison.OrdinalIgnoreCase), "", "DateTime"), + new(x => x is CodeProperty property && (property.Type?.Name?.Equals("DateTime", StringComparison.OrdinalIgnoreCase) ?? false), "", "DateTime"), + new(x => x is CodeProperty property && (property.Type?.Name?.Equals("DateTimeOffset", StringComparison.OrdinalIgnoreCase) ?? false), "", "DateTime"), new(x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.ClientConstructor), "Microsoft\\Kiota\\Abstractions", "ApiClientBuilder") }; private static void CorrectPropertyType(CodeProperty currentProperty) { @@ -145,7 +145,7 @@ private static void CorrectPropertyType(CodeProperty currentProperty) { } else if (currentProperty.IsOfKind(CodePropertyKind.RequestBuilder)) { currentProperty.Type.Name = currentProperty.Type.Name.ToFirstCharacterUpperCase(); - } else if (currentProperty.Type.Name.Equals("DateTimeOffset", StringComparison.OrdinalIgnoreCase)) + } else if (currentProperty.Type?.Name?.Equals("DateTimeOffset", StringComparison.OrdinalIgnoreCase) ?? false) { currentProperty.Type.Name = "DateTime"; } else if (currentProperty.IsOfKind(CodePropertyKind.Options, CodePropertyKind.Headers)) diff --git a/src/Kiota.Builder/Writers/Go/GoConventionService.cs b/src/Kiota.Builder/Writers/Go/GoConventionService.cs index ed249a7542..003028520c 100644 --- a/src/Kiota.Builder/Writers/Go/GoConventionService.cs +++ b/src/Kiota.Builder/Writers/Go/GoConventionService.cs @@ -67,7 +67,7 @@ currentType.TypeDefinition is not CodeInterface && #pragma warning disable CA1822 // Method should be static public string TranslateType(CodeTypeBase type, bool includeImportSymbol) { - if(type.Name.StartsWith("map[")) return type.Name; //casing hack + if(type.Name?.StartsWith("map[") ?? false) return type.Name; //casing hack return type.Name switch { "void" => string.Empty, @@ -100,8 +100,8 @@ public bool IsPrimitiveType(string typeName) { }; } public bool IsScalarType(string typeName) { - if(typeName.StartsWith("map[")) return true; - return typeName.ToLowerInvariant() switch { + if(typeName?.StartsWith("map[") ?? false) return true; + return typeName?.ToLowerInvariant() switch { "binary" or "void" or "[]byte" => true, _ => false, }; @@ -125,7 +125,7 @@ currentEnumDefinition.Parent is CodeNamespace enumNS && (targetTypeDef as CodeClass)?.StartBlock as BlockDeclaration ?? (targetTypeDef as CodeInterface)?.StartBlock as BlockDeclaration) .Usings - .FirstOrDefault(x => currentBaseType.Name.Equals(x.Name, StringComparison.OrdinalIgnoreCase)); + .FirstOrDefault(x => currentBaseType.Name?.Equals(x.Name, StringComparison.OrdinalIgnoreCase) ?? false); return symbolUsing == null ? string.Empty : symbolUsing.Declaration.Name.GetNamespaceImportSymbol(); } } diff --git a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs index b239a9a2cd..2686b7ac71 100644 --- a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs @@ -264,7 +264,7 @@ private string GetSerializationMethodName(CodeTypeBase propType) { } } - var lowerCaseProp = propertyType.ToLower(); + var lowerCaseProp = propertyType?.ToLower(); return lowerCaseProp switch { "string" or "guid" => "writeStringValue", @@ -295,7 +295,7 @@ private string GetDeserializationMethodName(CodeTypeBase propType, CodeMethod me return $"$n->getEnumValue({propertyType.ToFirstCharacterUpperCase()}::class)"; } - var lowerCaseType = propertyType.ToLower(); + var lowerCaseType = propertyType?.ToLower(); return lowerCaseType switch { "int" => "$n->getIntegerValue()", diff --git a/src/Kiota.Builder/Writers/Php/PhpConventionService.cs b/src/Kiota.Builder/Writers/Php/PhpConventionService.cs index 35bca7bc2a..a24ff19a16 100644 --- a/src/Kiota.Builder/Writers/Php/PhpConventionService.cs +++ b/src/Kiota.Builder/Writers/Php/PhpConventionService.cs @@ -57,7 +57,7 @@ public override string GetTypeString(CodeTypeBase code, CodeElement targetElemen public override string TranslateType(CodeType type) { string typeName = type.Name; - return typeName.ToLowerInvariant() switch + return typeName?.ToLowerInvariant() switch { "boolean" => "bool", "double" or "decimal" => "float", From 34c178d5ea94969f40ad2089a64aafe95c0879e7 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 4 May 2022 15:16:42 -0400 Subject: [PATCH 07/27] - adds missing unit test after merge Signed-off-by: Vincent Biret --- .../GenerateSample.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/Kiota.Builder.IntegrationTests/GenerateSample.cs b/tests/Kiota.Builder.IntegrationTests/GenerateSample.cs index d63fbadeb9..80e43486c2 100644 --- a/tests/Kiota.Builder.IntegrationTests/GenerateSample.cs +++ b/tests/Kiota.Builder.IntegrationTests/GenerateSample.cs @@ -54,4 +54,29 @@ public async Task GeneratesModelWithDictionary(GenerationLanguage language, bool }; await new KiotaBuilder(logger, configuration).GenerateSDK(new()); } + [InlineData(GenerationLanguage.CSharp, false)] + [InlineData(GenerationLanguage.Java, false)] + [InlineData(GenerationLanguage.TypeScript, false)] + [InlineData(GenerationLanguage.Go, false)] + [InlineData(GenerationLanguage.Ruby, false)] + [InlineData(GenerationLanguage.CSharp, true)] + [InlineData(GenerationLanguage.Java, true)] + [InlineData(GenerationLanguage.PHP, false)] + [InlineData(GenerationLanguage.TypeScript, true)] + [Theory] + public async Task GeneratesResponseWithMultipleReturnFormats(GenerationLanguage language, bool backingStore) + { + var logger = LoggerFactory.Create((builder) => { + }).CreateLogger(); + + var backingStoreSuffix = backingStore ? "BackingStore" : string.Empty; + var configuration = new GenerationConfiguration + { + Language = language, + OpenAPIFilePath = "ResponseWithMultipleReturnFormats.yaml", + OutputPath = $".\\Generated\\ResponseWithMultipleReturnFormats\\{language}{backingStoreSuffix}", + UsesBackingStore = backingStore, + }; + await new KiotaBuilder(logger, configuration).GenerateSDK(new()); + } } From c09c593b827848aca6b7a1a4f590b7165cc42306 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 4 May 2022 15:28:59 -0400 Subject: [PATCH 08/27] - renames reference package Signed-off-by: Vincent Biret --- ...crosoft.OpenApi.Kiota.ApiDescription.Client.nuspec} | 10 +++++----- ...icrosoft.OpenApi.Kiota.ApiDescription.Client.props} | 0 ...rosoft.OpenApi.Kiota.ApiDescription.Client.targets} | 0 3 files changed, 5 insertions(+), 5 deletions(-) rename src/{Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.nuspec => Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.nuspec} (59%) rename src/{Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.props => Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.props} (100%) rename src/{Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.targets => Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.targets} (100%) diff --git a/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.nuspec b/src/Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.nuspec similarity index 59% rename from src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.nuspec rename to src/Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.nuspec index ff0f6b9aa1..aefc66efd3 100644 --- a/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.nuspec +++ b/src/Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.nuspec @@ -1,23 +1,23 @@  - Microsoft.Kiota.ApiDescription.Client + Microsoft.OpenApi.Kiota.ApiDescription.Client 0.5.0-preview Microsoft true false MIT - https://github.com/microsoft/Kiota + https://microsoft.github.io/kiota Kiota: An OpenAPI SDK generator Copyright © Microsoft, 2021 OpenAPI Swagger AspNetCore CodeGen TypeScript WebApi AspNet - + - - + + \ No newline at end of file diff --git a/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.props b/src/Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.props similarity index 100% rename from src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.props rename to src/Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.props diff --git a/src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.targets b/src/Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.targets similarity index 100% rename from src/Kiota.ApiDescription.Client/Kiota.ApiDescription.Client.targets rename to src/Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.targets From 05c374757224a777cab655d4e32879565342fbcd Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 4 May 2022 15:36:02 -0400 Subject: [PATCH 09/27] - renames kiota tool package --- src/Microsoft.OpenApi.snk | Bin 0 -> 596 bytes src/kiota/kiota.csproj | 14 ++++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 src/Microsoft.OpenApi.snk diff --git a/src/Microsoft.OpenApi.snk b/src/Microsoft.OpenApi.snk new file mode 100644 index 0000000000000000000000000000000000000000..c5e0df33645944250c50c1f3e11889755a9ae24d GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50097%e6)jyvZeJ;T;q~e@sB3cDmj@AvV8Q1 zH?PLLVs)FTmbjw7wsq9wpFIZbwOSX88$dDKvZrU_nRnQX&W1`27Qex>zPk?JpW=n_ z5C6cZUz65k`US5C`lG7S(<@f2sa^4-#OGb?7D_)FOl3Wn8v*~rp0mV5 zGe*TL7s#LM_6%l**Q$O`Wi63$d3|Q;hsnM+A@@TO92Msq^01`9h+v`{lQ)k=bQ@~7 z=zSKTzeS}iJ16Hy*QFYk=9U7(^QImaw;o(KCOKXvG>ppB^;fB{P?iDs*7o|AF&GDg zODd#x&?4v7k%;D!j8CueQ(2alUD(+V;$FiQgGx^6mma!{F}8}?4p7I5QRRn3Ic}~_ zw82y$OluJ2j69>8+MHvb>5Hp(7SAhkyv8R=;+OvV9ThfcHv{i2 zYeKuV^g*>Dg9e_UrHonn^ Exe + Latest net6.0 + true true + https://github.com/microsoft/kiota + MIT + true kiota + Microsoft.OpenApi.Kiota ./nupkg 0.0.23 + + - Initial public release + true https://github.com/microsoft/kiota + OpenAPI based client generator. + OpenAPI .NET CSharp TypeScript Java Go PHP Python REST API + true + ..\Microsoft.OpenApi.snk @@ -24,6 +37,7 @@ + From 833264daca7302cd8333e4a4e76b8517d68e9224 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 08:58:47 -0400 Subject: [PATCH 10/27] - adds azure devops pipeline definition for public release Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 313 ++++++++++++++++++++++++++++++++++ 1 file changed, 313 insertions(+) create mode 100644 .azure-pipelines/ci-build.yml diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml new file mode 100644 index 0000000000..7ff413dc0a --- /dev/null +++ b/.azure-pipelines/ci-build.yml @@ -0,0 +1,313 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r) + +trigger: + tags: + include: + - v* + +pool: + name: Azure Pipelines + vmImage: windows-latest + +variables: + buildPlatform: 'Any CPU' + buildConfiguration: 'Release' + ProductBinPath: '$(Build.SourcesDirectory)\src\kiota\bin\$(BuildConfiguration)' + + +stages: + +- stage: build + jobs: + - job: build + steps: + - task: UseDotNet@2 + displayName: 'Use .NET 6' + inputs: + version: 6.x + + - task: PoliCheck@1 + displayName: 'Run PoliCheck "/src"' + inputs: + inputType: CmdLine + cmdLineArgs: '/F:$(Build.SourcesDirectory)/src /T:9 /Sev:"1|2" /PE:2 /O:poli_result_src.xml' + + - task: PoliCheck@1 + displayName: 'Run PoliCheck "/test"' + inputs: + inputType: CmdLine + cmdLineArgs: '/F:$(Build.SourcesDirectory)/test /T:9 /Sev:"1|2" /PE:2 /O:poli_result_test.xml' + + # Install the nuget tool. + - task: NuGetToolInstaller@0 + displayName: 'Use NuGet >=5.2.0' + inputs: + versionSpec: '>=5.2.0' + checkLatest: true + + # Build the Product project + - task: DotNetCoreCLI@2 + displayName: 'build' + inputs: + projects: '$(Build.SourcesDirectory)\kiota.sln' + arguments: '--configuration $(BuildConfiguration) --no-incremental' + + # Run the Unit test + - task: DotNetCoreCLI@2 + displayName: 'test' + inputs: + command: test + projects: '$(Build.SourcesDirectory)\kiota.sln' + arguments: '--configuration $(BuildConfiguration) --no-build' + + # CredScan + - task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2 + displayName: 'Run CredScan - Src' + inputs: + toolMajorVersion: 'V2' + scanFolder: '$(Build.SourcesDirectory)\src' + debugMode: false + + - task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2 + displayName: 'Run CredScan - Test' + inputs: + toolMajorVersion: 'V2' + scanFolder: '$(Build.SourcesDirectory)\test' + debugMode: false + + - task: AntiMalware@3 + displayName: 'Run MpCmdRun.exe - ProductBinPath' + inputs: + FileDirPath: '$(ProductBinPath)' + enabled: false + + - task: BinSkim@3 + displayName: 'Run BinSkim - Product Binaries' + inputs: + InputType: Basic + AnalyzeTarget: '$(ProductBinPath)\**\kiota.dll' + AnalyzeSymPath: '$(ProductBinPath)' + AnalyzeVerbose: true + AnalyzeHashes: true + AnalyzeEnvironment: true + + - task: PublishSecurityAnalysisLogs@2 + displayName: 'Publish Security Analysis Logs' + inputs: + ArtifactName: SecurityLogs + + - task: PostAnalysis@1 + displayName: 'Post Analysis' + inputs: + BinSkim: true + CredScan: true + PoliCheck: true + + - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 + displayName: 'ESRP CodeSigning' + inputs: + ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)' + FolderPath: src + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "Microsoft" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "http://www.microsoft.com" + }, + { + "parameterName": "FileDigest", + "parameterValue": "/fd \"SHA256\"" + }, + { + "parameterName": "PageHash", + "parameterValue": "/NPH" + }, + { + "parameterName": "TimeStamp", + "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + } + ], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolVerify", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: 20 + + # Pack + - task: DotNetCoreCLI@2 + displayName: 'pack kiota' + inputs: + command: pack + projects: src/kiota/kiota.csproj + arguments: '-o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg' + + # Pack + - task: DotNetCoreCLI@2 + displayName: 'pack targets' + inputs: + command: pack + projects: src/Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.nuspec + arguments: '-o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg' + + - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 + displayName: 'ESRP CodeSigning Nuget Packages' + inputs: + ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)' + FolderPath: '$(Build.ArtifactStagingDirectory)' + Pattern: '*.nupkg' + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "keyCode": "CP-401405", + "operationSetCode": "NuGetSign", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-401405", + "operationSetCode": "NuGetVerify", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: 20 + + - task: PowerShell@2 + displayName: "Get Kiota's version-number from .csproj" + inputs: + targetType: 'inline' + script: | + $xml = [Xml] (Get-Content .\src\kiota\kiota.csproj) + $version = $xml.Project.PropertyGroup.Version + echo $version + echo "##vso[task.setvariable variable=kiotaversion]$version" + + # publish hidi as an .exe + - task: DotNetCoreCLI@2 + displayName: publish kiota as executable + inputs: + command: 'publish' + arguments: -c Release --runtime win-x64 /p:PublishSingleFile=true --self-contained --output $(Build.ArtifactStagingDirectory)/kiota-v$(kiotaversion) -p:PublishTrimmed=true + projects: 'src/kiota/kiota.csproj' + publishWebProjects: False + zipAfterPublish: false + + - task: CopyFiles@2 + displayName: Prepare staging folder for upload + inputs: + targetFolder: $(Build.ArtifactStagingDirectory)/Nugets + sourceFolder: $(Build.ArtifactStagingDirectory) + content: '*.nupkg' + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Artifact: Nugets' + inputs: + ArtifactName: Nugets + PathtoPublish: '$(Build.ArtifactStagingDirectory)/Nugets' + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Artifact: Kiota' + inputs: + ArtifactName: Kiota-v$(kiotaversion) + PathtoPublish: '$(Build.ArtifactStagingDirectory)/Kiota-v$(kiotaversion)' + +- stage: deploy + condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) + dependsOn: build + jobs: + - deployment: deploy_kiota + dependsOn: [] + environment: nuget-org + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - task: DownloadPipelineArtifact@2 + displayName: Download nupkg from artifacts + inputs: + artifact: Nugets + source: current + - task: DownloadPipelineArtifact@2 + displayName: Download kiota executable from artifacts + inputs: + source: current + - powershell: | + rm "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Kiota.ApiDescription.*.nupkg" -Verbose + displayName: remove other nupkgs to avoid duplication + # - pwsh: | + # $artifactName = Get-ChildItem -Path $(Pipeline.Workspace)\Nugets -Filter Microsoft.OpenApi.Kiota.*.nupkg -recurse | select -First 1 + # $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.Kiota.", "" -replace ".nupkg", "" + # #Set Variable $artifactName and $artifactVersion + # Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false; isOutput=true]$artifactVersion" + # Write-Host "##vso[task.setvariable variable=artifactName; isSecret=false; isOutput=true]$artifactName.FullName" + # echo "$artifactName" + # echo "$artifactVersion" + # displayName: 'Fetch Artifact Name' + + - task: NuGetCommand@2 + displayName: 'NuGet push' + inputs: + command: push + packagesToPush: '$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Kiota.*.nupkg' + nuGetFeedType: external + publishFeedCredentials: 'OpenAPI Nuget Connection' + # - task: GitHubRelease@1 + # displayName: 'GitHub release (create)' + # inputs: + # gitHubConnection: 'Github-MaggieKimani1' + # tagSource: userSpecifiedTag + # tag: '$(artifactVersion)' + # title: '$(artifactVersion)' + # releaseNotesSource: inline + # assets: '$(Pipeline.Workspace)\**\*.exe' + # changeLogType: issueBased + + - deployment: deploy_targets + dependsOn: [] + environment: nuget-org + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - task: DownloadPipelineArtifact@2 + displayName: Download nupkg from artifacts + inputs: + artifact: Nugets + source: current + - powershell: | + rm "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Kiota.*.nupkg" -Verbose -Exclude "*.ApiDescription.*" + displayName: remove other nupkgs to avoid duplication + - task: NuGetCommand@2 + displayName: 'NuGet push' + inputs: + command: push + packagesToPush: '$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Kiota.ApiDescription.*.nupkg' + nuGetFeedType: external + publishFeedCredentials: 'OpenAPI Nuget Connection' + From f42638487e91600e0103bc42f662b36d6f424d77 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 09:04:41 -0400 Subject: [PATCH 11/27] - fixes policheck test path Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 7ff413dc0a..90a730e73e 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -36,10 +36,10 @@ stages: cmdLineArgs: '/F:$(Build.SourcesDirectory)/src /T:9 /Sev:"1|2" /PE:2 /O:poli_result_src.xml' - task: PoliCheck@1 - displayName: 'Run PoliCheck "/test"' + displayName: 'Run PoliCheck "/tests"' inputs: inputType: CmdLine - cmdLineArgs: '/F:$(Build.SourcesDirectory)/test /T:9 /Sev:"1|2" /PE:2 /O:poli_result_test.xml' + cmdLineArgs: '/F:$(Build.SourcesDirectory)/tests /T:9 /Sev:"1|2" /PE:2 /O:poli_result_test.xml' # Install the nuget tool. - task: NuGetToolInstaller@0 From 9ecf3e5b5b8f64b5221720b6776badb4fc844b8a Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 09:09:50 -0400 Subject: [PATCH 12/27] - fixes tests path for credscan Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 90a730e73e..b2ba816c02 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -72,10 +72,10 @@ stages: debugMode: false - task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2 - displayName: 'Run CredScan - Test' + displayName: 'Run CredScan - Tests' inputs: toolMajorVersion: 'V2' - scanFolder: '$(Build.SourcesDirectory)\test' + scanFolder: '$(Build.SourcesDirectory)\tests' debugMode: false - task: AntiMalware@3 From 5488975493caaa63b407a244678e0dae1354b91d Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 10:40:19 -0400 Subject: [PATCH 13/27] - fixes pack commands Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index b2ba816c02..06fc894a7b 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -43,9 +43,9 @@ stages: # Install the nuget tool. - task: NuGetToolInstaller@0 - displayName: 'Use NuGet >=5.2.0' + displayName: 'Use NuGet >=6.1.0' inputs: - versionSpec: '>=5.2.0' + versionSpec: '>=6.1.0' checkLatest: true # Build the Product project @@ -157,16 +157,14 @@ stages: displayName: 'pack kiota' inputs: command: pack - projects: src/kiota/kiota.csproj - arguments: '-o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg' + arguments: 'src/kiota/kiota.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg' # Pack - task: DotNetCoreCLI@2 displayName: 'pack targets' inputs: command: pack - projects: src/Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.nuspec - arguments: '-o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg' + arguments: 'src/Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.nuspec -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg' - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 displayName: 'ESRP CodeSigning Nuget Packages' From 4cfab8c8d8e9d8441c47abb8ae7361b3a04972b4 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 10:58:50 -0400 Subject: [PATCH 14/27] - another attempt at fixing the pack comand Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 06fc894a7b..5398a6abdf 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -157,14 +157,16 @@ stages: displayName: 'pack kiota' inputs: command: pack - arguments: 'src/kiota/kiota.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg' + arguments: '-o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg' + workingDirectory: '$(Build.SourcesDirectory)/src/kiota' # Pack - task: DotNetCoreCLI@2 displayName: 'pack targets' inputs: command: pack - arguments: 'src/Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.nuspec -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg' + arguments: '-o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg' + workingDirectory: '$(Build.SourcesDirectory)/src/Microsoft.OpenApi.Kiota.ApiDescription.Client' - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 displayName: 'ESRP CodeSigning Nuget Packages' From 3bc2aad253d3d0e2efc2c39ccba95190fcf6ceb4 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 11:15:18 -0400 Subject: [PATCH 15/27] - switched to cli instead of broken tasks Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 5398a6abdf..92876b5592 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -153,20 +153,12 @@ stages: SessionTimeout: 20 # Pack - - task: DotNetCoreCLI@2 + - pwsh: dotnet pack $(Build.SourcesDirectory)/src/kiota.kiota.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg displayName: 'pack kiota' - inputs: - command: pack - arguments: '-o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg' - workingDirectory: '$(Build.SourcesDirectory)/src/kiota' # Pack - - task: DotNetCoreCLI@2 + - pwsh: nuget pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.nuspec -OutputDirectory $(Build.ArtifactStagingDirectory) displayName: 'pack targets' - inputs: - command: pack - arguments: '-o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg' - workingDirectory: '$(Build.SourcesDirectory)/src/Microsoft.OpenApi.Kiota.ApiDescription.Client' - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 displayName: 'ESRP CodeSigning Nuget Packages' From 39a58bc8fd545f8aee9f02a5fa30fdd337e5dbc0 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 11:28:27 -0400 Subject: [PATCH 16/27] - typo fix Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 92876b5592..117d252068 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -153,7 +153,7 @@ stages: SessionTimeout: 20 # Pack - - pwsh: dotnet pack $(Build.SourcesDirectory)/src/kiota.kiota.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg + - pwsh: dotnet pack $(Build.SourcesDirectory)/src/kiota/kiota.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg displayName: 'pack kiota' # Pack From 7288c40fbd9e16292d2291cc05b3ca9ee8468cee Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 12:35:34 -0400 Subject: [PATCH 17/27] - switches to CLI for dotnet publish Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 117d252068..a1280d98db 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -196,15 +196,9 @@ stages: echo $version echo "##vso[task.setvariable variable=kiotaversion]$version" - # publish hidi as an .exe - - task: DotNetCoreCLI@2 + # publish kiota as an .exe + - pwsh: dotnet publish src/kiota/kiota.csproj -c Release --runtime win-x64 /p:PublishSingleFile=true --self-contained --output $(Build.ArtifactStagingDirectory)/kiota-v$(kiotaversion) -p:PublishTrimmed=true displayName: publish kiota as executable - inputs: - command: 'publish' - arguments: -c Release --runtime win-x64 /p:PublishSingleFile=true --self-contained --output $(Build.ArtifactStagingDirectory)/kiota-v$(kiotaversion) -p:PublishTrimmed=true - projects: 'src/kiota/kiota.csproj' - publishWebProjects: False - zipAfterPublish: false - task: CopyFiles@2 displayName: Prepare staging folder for upload From a975454b236317fb3393d2e91e6ff21e715f2c00 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 12:45:48 -0400 Subject: [PATCH 18/27] - updates docker worfklow to push to MCR Signed-off-by: Vincent Biret --- .github/workflows/docker.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3ec25f3e1d..51679c19c8 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -6,13 +6,13 @@ on: tags: ['v*'] paths: ['src/**', '.github/workflows/**'] env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }}/generator + REGISTRY: msgraphprod.azurecr.io + IMAGE_NAME: public/${{ github.repository }}/generator jobs: push_to_registry: environment: - name: staging_feeds - name: Push Docker image to GitHub Packages + name: acr + name: Push Docker image runs-on: ubuntu-latest steps: - name: Check out the repo @@ -20,8 +20,8 @@ jobs: - name: Login to GitHub package feed uses: docker/login-action@v1.14.1 with: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ secrets.ACR_USERNAME }} + password: ${{ secrets.ACR_PASSWORD }} registry: ${{ env.REGISTRY }} - run: | $version = $Env:BRANCH_NAME -replace "refs/tags/v","" From 119935f2985dc51e2f5af99a2ed25f479fc374ca Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 12:49:43 -0400 Subject: [PATCH 19/27] - adds changelog entry for public release Signed-off-by: Vincent Biret --- CHANGELOG.md | 10 ++++++++++ src/kiota/kiota.csproj | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c91224409..91cf507be2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +### [0.1.0] - 2022-05-04 + +### Added + +- The dotnet tool is now available on the public feed `dotnet tool install -g Microsoft.OpenApi.Kiota --prerelease`. +- The dotnet OpenApi reference package is now available `Microsoft.OpenApi.Kiota.ApiDescription.Client`. +- The container image is now available on mcr. `docker pull mcr.microsoft.com/kiota/generator:latest`. + +### Changed + - Revamped the api surface for request configuration. [#1494](https://github.com/microsoft/kiota/issues/1494) - Fixed a bug in methods naming in Go after request configuration revamp. - Fixes a bug where reserved names would not be updated for inheritance. diff --git a/src/kiota/kiota.csproj b/src/kiota/kiota.csproj index 1760b7679e..e30c43de9b 100644 --- a/src/kiota/kiota.csproj +++ b/src/kiota/kiota.csproj @@ -12,7 +12,7 @@ kiota Microsoft.OpenApi.Kiota ./nupkg - 0.0.23 + 0.1.0 - Initial public release From f8da493c775217cb1d470a9c9753d24577d5806e Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 12:55:41 -0400 Subject: [PATCH 20/27] - fixes exe publication for kiota Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 2 +- src/Kiota.Builder/Kiota.Builder.csproj | 2 ++ src/kiota/kiota.csproj | 1 - 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index a1280d98db..8df0bcd307 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -197,7 +197,7 @@ stages: echo "##vso[task.setvariable variable=kiotaversion]$version" # publish kiota as an .exe - - pwsh: dotnet publish src/kiota/kiota.csproj -c Release --runtime win-x64 /p:PublishSingleFile=true --self-contained --output $(Build.ArtifactStagingDirectory)/kiota-v$(kiotaversion) -p:PublishTrimmed=true + - pwsh: dotnet publish src/kiota/kiota.csproj -c Release --runtime win-x64 /p:PublishSingleFile=true --self-contained --output $(Build.ArtifactStagingDirectory)/kiota-v$(kiotaversion) displayName: publish kiota as executable - task: CopyFiles@2 diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index add1953249..6afb2601f5 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -2,6 +2,8 @@ net6.0 + true + ..\Microsoft.OpenApi.snk diff --git a/src/kiota/kiota.csproj b/src/kiota/kiota.csproj index e30c43de9b..abf39841fa 100644 --- a/src/kiota/kiota.csproj +++ b/src/kiota/kiota.csproj @@ -4,7 +4,6 @@ Exe Latest net6.0 - true true https://github.com/microsoft/kiota MIT From d2cf6fd01b29ddcc8bf21fa263d7ffc631c30623 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 13:11:38 -0400 Subject: [PATCH 21/27] - removes the dotnet text project that should have been removed during migration Signed-off-by: Vincent Biret --- serialization/dotnet/text/.editorconfig | 119 ------------------ serialization/dotnet/text/.vscode/launch.json | 26 ---- serialization/dotnet/text/.vscode/tasks.json | 24 ---- ...soft.Kiota.Serialization.Text.Tests.csproj | 27 ---- .../UnitTest1.cs | 12 -- .../Microsoft.Kiota.Serialization.Text.sln | 33 ----- serialization/dotnet/text/README.md | 13 -- .../Microsoft.Kiota.Serialization.Text.csproj | 19 --- .../dotnet/text/src/TextParseNode.cs | 69 ---------- .../dotnet/text/src/TextParseNodeFactory.cs | 26 ---- .../text/src/TextSerializationWriter.cs | 100 --------------- .../src/TextSerializationWriterFactory.cs | 23 ---- 12 files changed, 491 deletions(-) delete mode 100644 serialization/dotnet/text/.editorconfig delete mode 100644 serialization/dotnet/text/.vscode/launch.json delete mode 100644 serialization/dotnet/text/.vscode/tasks.json delete mode 100644 serialization/dotnet/text/Microsoft.Kiota.Serialization.Text.Tests/Microsoft.Kiota.Serialization.Text.Tests.csproj delete mode 100644 serialization/dotnet/text/Microsoft.Kiota.Serialization.Text.Tests/UnitTest1.cs delete mode 100644 serialization/dotnet/text/Microsoft.Kiota.Serialization.Text.sln delete mode 100644 serialization/dotnet/text/README.md delete mode 100644 serialization/dotnet/text/src/Microsoft.Kiota.Serialization.Text.csproj delete mode 100644 serialization/dotnet/text/src/TextParseNode.cs delete mode 100644 serialization/dotnet/text/src/TextParseNodeFactory.cs delete mode 100644 serialization/dotnet/text/src/TextSerializationWriter.cs delete mode 100644 serialization/dotnet/text/src/TextSerializationWriterFactory.cs diff --git a/serialization/dotnet/text/.editorconfig b/serialization/dotnet/text/.editorconfig deleted file mode 100644 index 3ed46fbb34..0000000000 --- a/serialization/dotnet/text/.editorconfig +++ /dev/null @@ -1,119 +0,0 @@ -# Rules in this file were initially inferred by Visual Studio IntelliCode from the C:\Users\anomondi\Documents\kiota\serialization\dotnet\json codebase based on best match to current usage at 17/08/2021 -# You can modify the rules from these initially generated values to suit your own policies -# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference -[*.cs] - - -#Core editorconfig formatting - indentation - -#use soft tabs (spaces) for indentation -indent_style = space - -#Formatting - indentation options - -#indent switch case contents. -csharp_indent_case_contents = true -#indent switch labels -csharp_indent_switch_labels = true - -#Formatting - new line options - -#place else statements on a new line -csharp_new_line_before_else = true -#require members of object intializers to be on separate lines -csharp_new_line_before_members_in_object_initializers = true - -#Formatting - organize using options - -#sort System.* using directives alphabetically, and place them before other usings -dotnet_sort_system_directives_first = true - -#Formatting - spacing options - -#require NO space between a cast and the value -csharp_space_after_cast = false -#require a space before the colon for bases or interfaces in a type declaration -csharp_space_after_colon_in_inheritance_clause = true -#require NO space after a keyword in a control flow statement such as a for loop -csharp_space_after_keywords_in_control_flow_statements = false -#require a space before the colon for bases or interfaces in a type declaration -csharp_space_before_colon_in_inheritance_clause = true -#remove space within empty argument list parentheses -csharp_space_between_method_call_empty_parameter_list_parentheses = false -#remove space between method call name and opening parenthesis -csharp_space_between_method_call_name_and_opening_parenthesis = false -#do not place space characters after the opening parenthesis and before the closing parenthesis of a method call -csharp_space_between_method_call_parameter_list_parentheses = false -#remove space within empty parameter list parentheses for a method declaration -csharp_space_between_method_declaration_empty_parameter_list_parentheses = false -#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list. -csharp_space_between_method_declaration_parameter_list_parentheses = false - -#Formatting - wrapping options - -#leave code block on single line -csharp_preserve_single_line_blocks = true -#leave statements and member declarations on the same line -csharp_preserve_single_line_statements = true - -#Style - Code block preferences - -#prefer no curly braces if allowed -csharp_prefer_braces = false:suggestion - -#Style - expression bodied member options - -#prefer block bodies for constructors -csharp_style_expression_bodied_constructors = false:suggestion -#prefer expression-bodied members for methods -csharp_style_expression_bodied_methods = true:suggestion - -#Style - expression level options - -#prefer out variables to be declared inline in the argument list of a method call when possible -csharp_style_inlined_variable_declaration = true:suggestion -#prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them -dotnet_style_predefined_type_for_member_access = true:suggestion - -#Style - Expression-level preferences - -#prefer default over default(T) -csharp_prefer_simple_default_expression = true:suggestion -#prefer objects to be initialized using object initializers when possible -dotnet_style_object_initializer = true:suggestion - -#Style - implicit and explicit types - -#prefer var over explicit type in all cases, unless overridden by another code style rule -csharp_style_var_elsewhere = true:suggestion -#prefer var when the type is already mentioned on the right-hand side of a declaration expression -csharp_style_var_when_type_is_apparent = true:suggestion - -#Style - language keyword and framework type options - -#prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them -dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion - -#Style - Miscellaneous preferences - -#prefer anonymous functions over local functions -csharp_style_pattern_local_over_anonymous_function = false:suggestion - -#Style - modifier options - -#prefer accessibility modifiers to be declared except for public interface members. This will currently not differ from always and will act as future proofing for if C# adds default interface methods. -dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion - -#Style - Modifier preferences - -#when this rule is set to a list of modifiers, prefer the specified ordering. -csharp_preferred_modifier_order = public,private,static,readonly:suggestion - -#Style - qualification options - -#prefer fields not to be prefaced with this. or Me. in Visual Basic -dotnet_style_qualification_for_field = false:suggestion -#prefer methods not to be prefaced with this. or Me. in Visual Basic -dotnet_style_qualification_for_method = false:suggestion -#prefer properties not to be prefaced with this. or Me. in Visual Basic -dotnet_style_qualification_for_property = false:suggestion diff --git a/serialization/dotnet/text/.vscode/launch.json b/serialization/dotnet/text/.vscode/launch.json deleted file mode 100644 index f771e4cd9d..0000000000 --- a/serialization/dotnet/text/.vscode/launch.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - // Use IntelliSense to find out which attributes exist for C# debugging - // Use hover for the description of the existing attributes - // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md - "name": ".NET Core Launch (console)", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build", - // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/Microsoft.Kiota.Serialization.Text.Tests/bin/Debug/net6.0/Microsoft.Kiota.Serialization.Text.Tests.dll", - "args": [], - "cwd": "${workspaceFolder}/Microsoft.Kiota.Serialization.Text.Tests", - // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console - "console": "internalConsole", - "stopAtEntry": false - }, - { - "name": ".NET Core Attach", - "type": "coreclr", - "request": "attach" - } - ] -} \ No newline at end of file diff --git a/serialization/dotnet/text/.vscode/tasks.json b/serialization/dotnet/text/.vscode/tasks.json deleted file mode 100644 index 1563eed509..0000000000 --- a/serialization/dotnet/text/.vscode/tasks.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "2.0.0", - "tasks": [ - { - "label": "build", - "command": "dotnet", - "type": "shell", - "args": [ - "build", - // Ask dotnet build to generate full paths for file names. - "/property:GenerateFullPaths=true", - // Do not generate summary otherwise it leads to duplicate errors in Problems panel - "/consoleloggerparameters:NoSummary" - ], - "group": "build", - "presentation": { - "reveal": "silent" - }, - "problemMatcher": "$msCompile" - } - ] -} \ No newline at end of file diff --git a/serialization/dotnet/text/Microsoft.Kiota.Serialization.Text.Tests/Microsoft.Kiota.Serialization.Text.Tests.csproj b/serialization/dotnet/text/Microsoft.Kiota.Serialization.Text.Tests/Microsoft.Kiota.Serialization.Text.Tests.csproj deleted file mode 100644 index ef63386983..0000000000 --- a/serialization/dotnet/text/Microsoft.Kiota.Serialization.Text.Tests/Microsoft.Kiota.Serialization.Text.Tests.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - net6.0 - enable - - false - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - - - diff --git a/serialization/dotnet/text/Microsoft.Kiota.Serialization.Text.Tests/UnitTest1.cs b/serialization/dotnet/text/Microsoft.Kiota.Serialization.Text.Tests/UnitTest1.cs deleted file mode 100644 index af7f54cc92..0000000000 --- a/serialization/dotnet/text/Microsoft.Kiota.Serialization.Text.Tests/UnitTest1.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Xunit; - -namespace Microsoft.Kiota.Serialization.Text.Tests; - -public class UnitTest1 -{ - [Fact] - public void Test1() - { - - } -} \ No newline at end of file diff --git a/serialization/dotnet/text/Microsoft.Kiota.Serialization.Text.sln b/serialization/dotnet/text/Microsoft.Kiota.Serialization.Text.sln deleted file mode 100644 index 8a5f6acae1..0000000000 --- a/serialization/dotnet/text/Microsoft.Kiota.Serialization.Text.sln +++ /dev/null @@ -1,33 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30114.105 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Kiota.Serialization.Text", "src\Microsoft.Kiota.Serialization.Text.csproj", "{29CEB2E3-93C5-4AFF-BAE1-DFF7BADF9A4D}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{89E4E773-D199-4D1A-A8D6-24EF61CBACED}" - ProjectSection(SolutionItems) = preProject - .editorconfig = .editorconfig - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Kiota.Serialization.Text.Tests", "Microsoft.Kiota.Serialization.Text.Tests\Microsoft.Kiota.Serialization.Text.Tests.csproj", "{53A7CB1A-280A-4BEB-B064-91065436CD4C}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {29CEB2E3-93C5-4AFF-BAE1-DFF7BADF9A4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {29CEB2E3-93C5-4AFF-BAE1-DFF7BADF9A4D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {29CEB2E3-93C5-4AFF-BAE1-DFF7BADF9A4D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {29CEB2E3-93C5-4AFF-BAE1-DFF7BADF9A4D}.Release|Any CPU.Build.0 = Release|Any CPU - {53A7CB1A-280A-4BEB-B064-91065436CD4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {53A7CB1A-280A-4BEB-B064-91065436CD4C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {53A7CB1A-280A-4BEB-B064-91065436CD4C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {53A7CB1A-280A-4BEB-B064-91065436CD4C}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/serialization/dotnet/text/README.md b/serialization/dotnet/text/README.md deleted file mode 100644 index 12b5053e50..0000000000 --- a/serialization/dotnet/text/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# To-do - -![Dotnet Serialization Text](https://github.com/microsoft/kiota/actions/workflows/serialization-dotnet-text.yml/badge.svg) - -- [x] coverage code -- [ ] analyzers -- [x] unit test project -- [x] docs comments - -## Using the text Serialization implementations - -1. [Add the package feed](https://docs.github.com/en/packages/guides/configuring-dotnet-cli-for-use-with-github-packages#authenticating-to-github-packages) in the `nuget.config` file. (owner microsoft). -1. `dotnet add package Microsoft.Kiota.Serialization.Text`. diff --git a/serialization/dotnet/text/src/Microsoft.Kiota.Serialization.Text.csproj b/serialization/dotnet/text/src/Microsoft.Kiota.Serialization.Text.csproj deleted file mode 100644 index 30c51560df..0000000000 --- a/serialization/dotnet/text/src/Microsoft.Kiota.Serialization.Text.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - netstandard2.1 - latest - true - https://github.com/microsoft/kiota - 1.0.0 - true - true - - - - - - - - - diff --git a/serialization/dotnet/text/src/TextParseNode.cs b/serialization/dotnet/text/src/TextParseNode.cs deleted file mode 100644 index 406ade0cbc..0000000000 --- a/serialization/dotnet/text/src/TextParseNode.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Xml; -using Microsoft.Kiota.Abstractions; -using Microsoft.Kiota.Abstractions.Serialization; - -namespace Microsoft.Kiota.Serialization.Text; -/// -/// The implementation for the text/plain content type -/// -public class TextParseNode : IParseNode -{ - internal const string NoStructuredDataMessage = "text does not support structured data"; - private readonly string Text; - /// - /// Initializes a new instance of the class. - /// - /// The text value. - public TextParseNode(string text) - { - Text = text?.Trim('"'); - } - /// - public Action OnBeforeAssignFieldValues { get; set; } - /// - public Action OnAfterAssignFieldValues { get; set; } - /// - public bool? GetBoolValue() => bool.TryParse(Text, out var result) ? result : null; - /// - public byte[] GetByteArrayValue() => string.IsNullOrEmpty(Text) ? null : Convert.FromBase64String(Text); - /// - public byte? GetByteValue() => byte.TryParse(Text, out var result) ? result : null; - /// - public IParseNode GetChildNode(string identifier) => throw new InvalidOperationException(NoStructuredDataMessage); - /// - public IEnumerable GetCollectionOfObjectValues(ParsableFactory factory) where T : IParsable => throw new InvalidOperationException(NoStructuredDataMessage); - /// - public IEnumerable GetCollectionOfPrimitiveValues() => throw new InvalidOperationException(NoStructuredDataMessage); - /// - public DateTimeOffset? GetDateTimeOffsetValue() => DateTimeOffset.TryParse(Text, out var result) ? result : null; - /// - public Date? GetDateValue() => DateTime.TryParse(Text, out var result) ? new Date(result) : null; - /// - public decimal? GetDecimalValue() => decimal.TryParse(Text, out var result) ? result : null; - /// - public double? GetDoubleValue() => double.TryParse(Text, out var result) ? result : null; - /// - public float? GetFloatValue() => float.TryParse(Text, out var result) ? result : null; - /// - public Guid? GetGuidValue() => Guid.TryParse(Text, out var result) ? result : null; - /// - public int? GetIntValue() => int.TryParse(Text, out var result) ? result : null; - /// - public long? GetLongValue() => long.TryParse(Text, out var result) ? result : null; - /// - public T GetObjectValue(ParsableFactory factory) where T : IParsable => throw new InvalidOperationException(NoStructuredDataMessage); - /// - public sbyte? GetSbyteValue() => sbyte.TryParse(Text, out var result) ? result : null; - /// - public string GetStringValue() => Text; - /// - public TimeSpan? GetTimeSpanValue() => string.IsNullOrEmpty(Text) ? null : XmlConvert.ToTimeSpan(Text); - /// - public Time? GetTimeValue() => DateTime.TryParse(Text, out var result) ? new Time(result) : null; - /// - IEnumerable IParseNode.GetCollectionOfEnumValues() => throw new InvalidOperationException(NoStructuredDataMessage); - /// - T? IParseNode.GetEnumValue() => Enum.TryParse(Text, true, out var result) ? result : null; -} diff --git a/serialization/dotnet/text/src/TextParseNodeFactory.cs b/serialization/dotnet/text/src/TextParseNodeFactory.cs deleted file mode 100644 index 92526c80db..0000000000 --- a/serialization/dotnet/text/src/TextParseNodeFactory.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.IO; -using Microsoft.Kiota.Abstractions.Serialization; - -namespace Microsoft.Kiota.Serialization.Text; - -/// -/// The implementation for text/plain content types -/// -public class TextParseNodeFactory : IParseNodeFactory -{ - /// - public string ValidContentType => "text/plain"; - /// - public IParseNode GetRootParseNode(string contentType, Stream content) { - if(string.IsNullOrEmpty(contentType)) - throw new ArgumentNullException(nameof(contentType)); - else if(!ValidContentType.Equals(contentType, StringComparison.OrdinalIgnoreCase)) - throw new ArgumentOutOfRangeException($"expected a {ValidContentType} content type"); - - _ = content ?? throw new ArgumentNullException(nameof(content)); - using var reader = new StreamReader(content); - var stringContent = reader.ReadToEnd(); - return new TextParseNode(stringContent); - } -} diff --git a/serialization/dotnet/text/src/TextSerializationWriter.cs b/serialization/dotnet/text/src/TextSerializationWriter.cs deleted file mode 100644 index 9a4403c8bd..0000000000 --- a/serialization/dotnet/text/src/TextSerializationWriter.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System; -using System.IO; -using System.Collections.Generic; -using System.Xml; -using Microsoft.Kiota.Abstractions; -using Microsoft.Kiota.Abstractions.Serialization; -using System.Text; -using Microsoft.Kiota.Abstractions.Extensions; -using System.Linq; - -namespace Microsoft.Kiota.Serialization.Text; - -/// -/// The implementation for text content types. -/// -public class TextSerializationWriter : ISerializationWriter, IDisposable { - private readonly MemoryStream _stream = new MemoryStream(); - private readonly StreamWriter writer; - /// - /// Initializes a new instance of the class. - /// - public TextSerializationWriter() - { - writer = new(_stream); - } - private bool written; - /// - public Action OnBeforeObjectSerialization { get; set; } - /// - public Action OnAfterObjectSerialization { get; set; } - /// - public Action OnStartObjectSerialization { get; set; } - /// - public void Dispose() - { - _stream?.Dispose(); - writer?.Dispose(); - GC.SuppressFinalize(this); - } - /// - public Stream GetSerializedContent() { - writer.Flush(); - return _stream; - } - /// - public void WriteAdditionalData(IDictionary value) => throw new InvalidOperationException(TextParseNode.NoStructuredDataMessage); - /// - public void WriteBoolValue(string key, bool? value) => WriteStringValue(key, value?.ToString()); - /// - public void WriteByteArrayValue(string key, byte[] value) => WriteStringValue(key, value.Any() ? Convert.ToBase64String(value) : string.Empty); - /// - public void WriteByteValue(string key, byte? value) => WriteStringValue(key, value?.ToString()); - /// - public void WriteCollectionOfObjectValues(string key, IEnumerable values) where T : IParsable => throw new InvalidOperationException(TextParseNode.NoStructuredDataMessage); - /// - public void WriteCollectionOfPrimitiveValues(string key, IEnumerable values) => throw new InvalidOperationException(TextParseNode.NoStructuredDataMessage); - /// - public void WriteDateTimeOffsetValue(string key, DateTimeOffset? value) => WriteStringValue(key, value.HasValue ? value.Value.ToString() : null); - /// - public void WriteDateValue(string key, Date? value) => WriteStringValue(key, value?.ToString()); - /// - public void WriteDecimalValue(string key, decimal? value) => WriteStringValue(key, value?.ToString()); - /// - public void WriteDoubleValue(string key, double? value) => WriteStringValue(key, value?.ToString()); - /// - public void WriteFloatValue(string key, float? value) => WriteStringValue(key, value?.ToString()); - /// - public void WriteGuidValue(string key, Guid? value) => WriteStringValue(key, value?.ToString()); - /// - public void WriteIntValue(string key, int? value) => WriteStringValue(key, value?.ToString()); - /// - public void WriteLongValue(string key, long? value) => WriteStringValue(key, value?.ToString()); - /// - public void WriteNullValue(string key) => WriteStringValue(key, "null"); - /// - public void WriteObjectValue(string key, T value) where T : IParsable => throw new InvalidOperationException(TextParseNode.NoStructuredDataMessage); - /// - public void WriteSbyteValue(string key, sbyte? value) => WriteStringValue(key, value?.ToString()); - /// - public void WriteStringValue(string key, string value) - { - if(!string.IsNullOrEmpty(key)) - throw new InvalidOperationException(TextParseNode.NoStructuredDataMessage); - if(!string.IsNullOrEmpty(value)) - if(written) - throw new InvalidOperationException("a value was already written for this serialization writer, text content only supports a single value"); - else { - writer.Write(value); - written = true; - } - } - /// - public void WriteTimeSpanValue(string key, TimeSpan? value) => WriteStringValue(key, value.HasValue ? XmlConvert.ToString(value.Value) : null); - /// - public void WriteTimeValue(string key, Time? value) => WriteStringValue(key, value?.ToString()); - /// - void ISerializationWriter.WriteCollectionOfEnumValues(string key, IEnumerable values) => throw new InvalidOperationException(TextParseNode.NoStructuredDataMessage); - /// - void ISerializationWriter.WriteEnumValue(string key, T? value) => WriteStringValue(key, value.HasValue ? value.Value.ToString().ToFirstCharacterLowerCase() : null); -} diff --git a/serialization/dotnet/text/src/TextSerializationWriterFactory.cs b/serialization/dotnet/text/src/TextSerializationWriterFactory.cs deleted file mode 100644 index 91e9a45ffb..0000000000 --- a/serialization/dotnet/text/src/TextSerializationWriterFactory.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using Microsoft.Kiota.Abstractions.Serialization; - -namespace Microsoft.Kiota.Serialization.Text; - -/// -/// The implementation for the text content type -/// -public class TextSerializationWriterFactory : ISerializationWriterFactory { - /// - public string ValidContentType { get; } = "text/plain"; - - /// - public ISerializationWriter GetSerializationWriter(string contentType) - { - if(string.IsNullOrEmpty(contentType)) - throw new ArgumentNullException(nameof(contentType)); - else if(!ValidContentType.Equals(contentType, StringComparison.OrdinalIgnoreCase)) - throw new ArgumentOutOfRangeException($"expected a {ValidContentType} content type"); - - return new TextSerializationWriter(); - } -} From 9acf4923628bcae3d4d357fe84df958832a8dae7 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 13:12:27 -0400 Subject: [PATCH 22/27] - updates public documentation after public release Signed-off-by: Vincent Biret --- docs/get-started/dotnet.md | 2 +- docs/get-started/index.md | 35 +++------------------------ docs/get-started/reference-openapi.md | 1 + 3 files changed, 6 insertions(+), 32 deletions(-) diff --git a/docs/get-started/dotnet.md b/docs/get-started/dotnet.md index 5f81b3327b..9847f22cb6 100644 --- a/docs/get-started/dotnet.md +++ b/docs/get-started/dotnet.md @@ -10,7 +10,7 @@ parent: Get started ## Target project requirements -Before you can compile and run the generated files, you will need to make sure they are part of a project with the required dependencies. After creating a new project, or reusing an existing one, you will need to add references to the [abstraction](https://github.com/microsoft/kiota/tree/main/abstractions/dotnet), [authentication](https://github.com/microsoft/kiota/tree/main/authentication/dotnet/azure), [http](https://github.com/microsoft/kiota/tree/main/http/dotnet/httpclient), and [serialization](https://github.com/microsoft/kiota/tree/main/serialization/dotnet/json) packages from the GitHub feed. +Before you can compile and run the generated files, you will need to make sure they are part of a project with the required dependencies. After creating a new project, or reusing an existing one, you will need to add references to the [abstraction](https://github.com/microsoft/kiota-abstractions-dotnet), [authentication](https://github.com/microsoft/kiota-authentication-azure-dotnet), [http](https://github.com/microsoft/kiota-http-dotnet), and [JSON](https://github.com/microsoft/kiota-serialization-json-dotnet) and [text](https://github.com/microsoft/kiota-serialization-text-dotnet) serialization packages from the GitHub feed. ## Creating target projects diff --git a/docs/get-started/index.md b/docs/get-started/index.md index e161d08a57..1921d7d995 100644 --- a/docs/get-started/index.md +++ b/docs/get-started/index.md @@ -21,39 +21,12 @@ You can download the latest version from the [releases page](https://github.com/ If you have the [.NET SDK](https://dotnet.microsoft.com/download) installed, you can install Kiota as a [.NET tool](https://docs.microsoft.com/dotnet/core/tools/global-tools). -### Configure NuGet to access GitHub - -Before you can install Kiota as a .NET tool you need to create a NuGet configuration file to access the authenticated GitHub package feed. The following steps show you how to create this file. **This is a temporary step until we publish the Kiota tool to the public NuGet feed.** - -1. Navigate to [New personal access token](https://github.com/settings/tokens/new) and generate a new token. (permissions: `package:read`, `repo`). -1. Copy the token, you will need it later. -1. Enable the SSO on the token if you are a Microsoft employee. -1. Create a `nuget.config` file in the current directory with the following content. - - ```xml - - - - - - - - - - - - - - - ``` - -### Install the .NET tool +## Install the .NET tool Execute the following command to install the tool. ```shell -dotnet tool install --global --configfile nuget.config kiota +dotnet tool install --global --prerelease Microsoft.OpenApi.Kiota ``` ## Run in Docker @@ -63,7 +36,7 @@ You can run Kiota in our Docker container with one of the following commands. ```shell docker run -v /some/output/path:/app/output \ -v /some/input/description.yml:/app/openapi.yml \ -ghcr.io/microsoft/kiota/generator --language csharp -n samespaceprefix +mcr.microsoft.com/kiota/generator --language csharp -n samespaceprefix ``` > **Note:** you can alternatively use the `--openapi` parameter with a URI instead of volume mapping. @@ -71,7 +44,7 @@ ghcr.io/microsoft/kiota/generator --language csharp -n samespaceprefix To generate a SDK from an online OpenAPI description and into the current directory: ```shell -docker run -v ${PWD}:/app/output ghcr.io/microsoft/kiota/generator \ +docker run -v ${PWD}:/app/output mcr.microsoft.com/kiota/generator \ --language typescript -n gfx -d \ https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml ``` diff --git a/docs/get-started/reference-openapi.md b/docs/get-started/reference-openapi.md index 2f33077faa..45e4c976a5 100644 --- a/docs/get-started/reference-openapi.md +++ b/docs/get-started/reference-openapi.md @@ -10,6 +10,7 @@ The following is a minimal OpenAPI description that describes how to call the `/ - [Build SDKs for .NET](dotnet.md) - [Build SDKs for Go](go.md) - [Build SDKs for Java](java.md) +- [Build SDKs for Ruby](ruby.md) - [Build SDKs for TypeScript](typescript.md) ```yaml From 9d5f3940a74cd4d6a230ca02fbf5b7eb15500c9b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 13:14:01 -0400 Subject: [PATCH 23/27] - updates broken links in docker file Signed-off-by: Vincent Biret --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8daa68a81f..3d658520c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,5 +14,5 @@ VOLUME /app/output VOLUME /app/openapi.yml ENTRYPOINT ["dotnet", "kiota.dll"] LABEL description="# Welcome to Kiota Generator \ -To start generating SDKs checkout [the getting started documentation](https://github.com/microsoft/kiota/#running-kiota-with-docker) \ -[Source dockerfile](https://github.com/microsoft/kiota/blob/main/releases/Dockerfile)" \ No newline at end of file +To start generating SDKs checkout [the getting started documentation](https://microsoft.github.io/kiota/get-started/#run-in-docker) \ +[Source dockerfile](https://github.com/microsoft/kiota/blob/main/Dockerfile)" \ No newline at end of file From f8dc830a18ca677518cb4ec13aac7f877fc15896 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 13:19:48 -0400 Subject: [PATCH 24/27] - disables condition for deployment test Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 8df0bcd307..59ebaa31ff 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -220,7 +220,7 @@ stages: PathtoPublish: '$(Build.ArtifactStagingDirectory)/Kiota-v$(kiotaversion)' - stage: deploy - condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) + # condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) dependsOn: build jobs: - deployment: deploy_kiota From 25b53ae792b94836c072af4fbd29781fe6949b61 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 13:41:51 -0400 Subject: [PATCH 25/27] - fixes non-compliant nuget fields Signed-off-by: Vincent Biret --- .../Microsoft.OpenApi.Kiota.ApiDescription.Client.nuspec | 2 +- src/kiota/kiota.csproj | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.nuspec b/src/Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.nuspec index aefc66efd3..037faeb284 100644 --- a/src/Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.nuspec +++ b/src/Microsoft.OpenApi.Kiota.ApiDescription.Client/Microsoft.OpenApi.Kiota.ApiDescription.Client.nuspec @@ -9,7 +9,7 @@ MIT https://microsoft.github.io/kiota Kiota: An OpenAPI SDK generator - Copyright © Microsoft, 2021 + © Microsoft Corporation. All rights reserved. OpenAPI Swagger AspNetCore CodeGen TypeScript WebApi AspNet diff --git a/src/kiota/kiota.csproj b/src/kiota/kiota.csproj index abf39841fa..28005dbc21 100644 --- a/src/kiota/kiota.csproj +++ b/src/kiota/kiota.csproj @@ -9,9 +9,12 @@ MIT true kiota + Microsoft + Microsoft + Microsoft.OpenApi.Kiota Microsoft.OpenApi.Kiota ./nupkg - 0.1.0 + 0.1.0-preview - Initial public release From a85a311098af0fd74b4b73e888b443730a2845d1 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 13:58:07 -0400 Subject: [PATCH 26/27] - fixes wrong copyright on main package --- src/kiota/kiota.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/kiota/kiota.csproj b/src/kiota/kiota.csproj index 28005dbc21..32c0ddb879 100644 --- a/src/kiota/kiota.csproj +++ b/src/kiota/kiota.csproj @@ -21,6 +21,7 @@ true https://github.com/microsoft/kiota OpenAPI based client generator. + © Microsoft Corporation. All rights reserved. OpenAPI .NET CSharp TypeScript Java Go PHP Python REST API true ..\Microsoft.OpenApi.snk From db572593b4f0b39f5b235bc13df870d70f2c7e67 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 May 2022 13:58:24 -0400 Subject: [PATCH 27/27] Revert "- disables condition for deployment test" This reverts commit f8dc830a18ca677518cb4ec13aac7f877fc15896. --- .azure-pipelines/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 59ebaa31ff..8df0bcd307 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -220,7 +220,7 @@ stages: PathtoPublish: '$(Build.ArtifactStagingDirectory)/Kiota-v$(kiotaversion)' - stage: deploy - # condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) + condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) dependsOn: build jobs: - deployment: deploy_kiota