From f8a50097374bbc82bcb0277866182d5628de6516 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Tue, 30 Jan 2024 16:36:43 +0300 Subject: [PATCH 01/17] Fixes broken tests --- src/Kiota.Builder/KiotaBuilder.cs | 14 ++++++++------ tests/Kiota.Builder.Tests/KiotaBuilderTests.cs | 9 ++++++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index bd618c9e94..43cb2f5fdc 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -686,6 +686,7 @@ public async Task CreateLanguageSourceFilesAsync(GenerationLanguage language, Co private const string CoreInterfaceType = "IRequestAdapter"; private const string RequestAdapterParameterName = "requestAdapter"; private const string ConstructorMethodName = "constructor"; + private const string UntypedNodeName = "UntypedNode"; /// /// Create a CodeClass instance that is a request builder class for the OpenApiUrlTreeNode /// @@ -1207,7 +1208,7 @@ openApiExtension is OpenApiPrimaryErrorMessageExtension primaryErrorMessageExten if (typeSchema?.OneOf?.Any() ?? false) typeNames.AddRange(typeSchema.OneOf.Select(x => x.Type)); // double is sometimes an oneof string, number and enum // first value that's not null, and not "object" for primitive collections, the items type matters - var typeName = typeNames.FirstOrDefault(static x => !string.IsNullOrEmpty(x) && !typeNamesToSkip.Contains(x)); + var typeName = typeNames.Find(static x => !string.IsNullOrEmpty(x) && !typeNamesToSkip.Contains(x)); var isExternal = false; if (typeSchema?.Items?.IsEnum() ?? false) @@ -1784,7 +1785,7 @@ private CodeTypeBase CreateComposedModelDeclaration(OpenApiUrlTreeNode currentNo } return unionType; } - private CodeTypeBase? CreateModelDeclarations(OpenApiUrlTreeNode currentNode, OpenApiSchema schema, OpenApiOperation? operation, CodeElement parentElement, string suffixForInlineSchema, OpenApiResponse? response = default, string typeNameForInlineSchema = "", bool isRequestBody = false) + private CodeTypeBase CreateModelDeclarations(OpenApiUrlTreeNode currentNode, OpenApiSchema schema, OpenApiOperation? operation, CodeElement parentElement, string suffixForInlineSchema, OpenApiResponse? response = default, string typeNameForInlineSchema = "", bool isRequestBody = false) { var (codeNamespace, responseValue, suffix) = schema.IsReferencedSchema() switch { @@ -1829,13 +1830,13 @@ private CodeTypeBase CreateComposedModelDeclaration(OpenApiUrlTreeNode currentNo } if (!string.IsNullOrEmpty(schema.Type) || !string.IsNullOrEmpty(schema.Format)) - return GetPrimitiveType(schema, string.Empty); + return GetPrimitiveType(schema, string.Empty) ?? new CodeType { Name = UntypedNodeName, IsExternal = true }; if ((schema.AnyOf.Any() || schema.OneOf.Any() || schema.AllOf.Any()) && (schema.AnyOf.FirstOrDefault(static x => x.IsSemanticallyMeaningful(true)) ?? schema.OneOf.FirstOrDefault(static x => x.IsSemanticallyMeaningful(true)) ?? schema.AllOf.FirstOrDefault(static x => x.IsSemanticallyMeaningful(true))) is { } childSchema) // we have an empty node because of some local override for schema properties and need to unwrap it. return CreateModelDeclarations(currentNode, childSchema, operation, parentElement, suffixForInlineSchema, response, typeNameForInlineSchema, isRequestBody); - return null; + return new CodeType { Name = UntypedNodeName ,IsExternal = true}; } - private CodeTypeBase? CreateCollectionModelDeclaration(OpenApiUrlTreeNode currentNode, OpenApiSchema schema, OpenApiOperation? operation, CodeNamespace codeNamespace, string typeNameForInlineSchema, bool isRequestBody) + private CodeTypeBase CreateCollectionModelDeclaration(OpenApiUrlTreeNode currentNode, OpenApiSchema schema, OpenApiOperation? operation, CodeNamespace codeNamespace, string typeNameForInlineSchema, bool isRequestBody) { CodeTypeBase? type = GetPrimitiveType(schema.Items, string.Empty); var isEnumOrComposedCollectionType = schema.Items.IsEnum() //the collection could be an enum type so override with strong type instead of string type. @@ -1847,7 +1848,8 @@ private CodeTypeBase CreateComposedModelDeclaration(OpenApiUrlTreeNode currentNo var targetNamespace = GetShortestNamespace(codeNamespace, schema.Items); type = CreateModelDeclarations(currentNode, schema.Items, operation, targetNamespace, string.Empty, typeNameForInlineSchema: typeNameForInlineSchema, isRequestBody: isRequestBody); } - if (type is null) return null; + if (type is null) + return new CodeType { Name = UntypedNodeName,IsExternal = true}; type.CollectionKind = CodeTypeBase.CodeTypeCollectionKind.Complex; return type; } diff --git a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs index 8521c78141..833019cea8 100644 --- a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs +++ b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs @@ -1243,8 +1243,8 @@ public void Object_Arrays_are_supported() var valueProp = userResponseClass.FindChildByName("value", false); Assert.NotNull(valueProp); var unknownProp = userResponseClass.FindChildByName("unknown", false); - Assert.Null(unknownProp); - Assert.Equal(1, mockLogger.Count.First(static x => x.Key == LogLevel.Warning).Value); + Assert.NotNull(unknownProp); + Assert.Equal("UntypedNode", unknownProp.Type.Name);// left out property is an UntypedNode } [Fact] public void TextPlainEndpointsAreSupported() @@ -6816,7 +6816,10 @@ public async Task SkipsInvalidItemsProperties() var resultClass = codeModel.FindChildByName("DirectoryObjectGetResponse"); Assert.NotNull(resultClass); var keysToCheck = new HashSet(StringComparer.OrdinalIgnoreCase) { "datasets", "datakeys", "datainfo" }; - Assert.Empty(resultClass.Properties.Where(x => x.IsOfKind(CodePropertyKind.Custom) && keysToCheck.Contains(x.Name))); + var propertiesToValidate = resultClass.Properties.Where(x => x.IsOfKind(CodePropertyKind.Custom) && keysToCheck.Contains(x.Name)).ToArray(); + Assert.NotNull(propertiesToValidate); + Assert.NotEmpty(propertiesToValidate); + Assert.Equal(keysToCheck.Count, propertiesToValidate.Length);// all the properties are present Assert.Single(resultClass.Properties.Where(x => x.IsOfKind(CodePropertyKind.Custom) && x.Name.Equals("id", StringComparison.OrdinalIgnoreCase))); } [Fact] From 75d7f38548bbcebb9a4cf2777cc3dd3c241eb484 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Tue, 30 Jan 2024 17:12:05 +0300 Subject: [PATCH 02/17] WIP. Tests --- src/Kiota.Builder/KiotaBuilder.cs | 2 +- src/Kiota.Builder/Refiners/CSharpRefiner.cs | 3 +++ src/Kiota.Builder/Refiners/CliRefiner.cs | 1 + src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs | 13 ++++++++++++- src/Kiota.Builder/Refiners/GoRefiner.cs | 1 + src/Kiota.Builder/Refiners/JavaRefiner.cs | 1 + src/Kiota.Builder/Refiners/PhpRefiner.cs | 1 + src/Kiota.Builder/Refiners/PythonRefiner.cs | 1 + src/Kiota.Builder/Refiners/RubyRefiner.cs | 1 + src/Kiota.Builder/Refiners/SwiftRefiner.cs | 1 + src/Kiota.Builder/Refiners/TypeScriptRefiner.cs | 1 + 11 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 43cb2f5fdc..de9efb9996 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -686,7 +686,7 @@ public async Task CreateLanguageSourceFilesAsync(GenerationLanguage language, Co private const string CoreInterfaceType = "IRequestAdapter"; private const string RequestAdapterParameterName = "requestAdapter"; private const string ConstructorMethodName = "constructor"; - private const string UntypedNodeName = "UntypedNode"; + internal const string UntypedNodeName = "UntypedNode"; /// /// Create a CodeClass instance that is a request builder class for the OpenApiUrlTreeNode /// diff --git a/src/Kiota.Builder/Refiners/CSharpRefiner.cs b/src/Kiota.Builder/Refiners/CSharpRefiner.cs index 3920ad5220..18071b16c8 100644 --- a/src/Kiota.Builder/Refiners/CSharpRefiner.cs +++ b/src/Kiota.Builder/Refiners/CSharpRefiner.cs @@ -182,6 +182,9 @@ protected static void MakeEnumPropertiesNullable(CodeElement currentElement) SerializationNamespaceName, "ParseNodeHelper"), new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.Headers), AbstractionsNamespaceName, "RequestHeaders"), + //TODO revise this(add Kind or compare a local name) + new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.Custom) && prop.Type.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase), + AbstractionsNamespaceName, "RequestHeaders"), new (static x => x is CodeEnum prop && prop.Options.Any(x => x.IsNameEscaped), "System.Runtime.Serialization", "EnumMemberAttribute"), new (static x => x is IDeprecableElement element && element.Deprecation is not null && element.Deprecation.IsDeprecated, diff --git a/src/Kiota.Builder/Refiners/CliRefiner.cs b/src/Kiota.Builder/Refiners/CliRefiner.cs index 666e7de988..1526a34c98 100644 --- a/src/Kiota.Builder/Refiners/CliRefiner.cs +++ b/src/Kiota.Builder/Refiners/CliRefiner.cs @@ -49,6 +49,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance }); AddDefaultImports(generatedCode, defaultUsingEvaluators); AddDefaultImports(generatedCode, additionalUsingEvaluators); + RemoveUntypedNodePropertyValues(generatedCode); CorrectCoreType(generatedCode, CorrectMethodType, CorrectPropertyType); cancellationToken.ThrowIfCancellationRequested(); MoveClassesWithNamespaceNamesUnderNamespace(generatedCode); diff --git a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs index 8220666d32..a1e17ddd47 100644 --- a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs +++ b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -1431,6 +1431,16 @@ protected static void RemoveRequestConfigurationClassesCommonProperties(CodeElem CrawlTree(currentElement, x => RemoveRequestConfigurationClassesCommonProperties(x, baseTypeUsing)); } + protected static void RemoveUntypedNodePropertyValues(CodeElement currentElement) + { + if (currentElement is CodeProperty currentProperty + && currentElement.Parent is CodeClass parentClass + && currentProperty.Type.Name.Equals(KiotaBuilder.UntypedNodeName,StringComparison.OrdinalIgnoreCase)) + { + parentClass.RemoveChildElement(currentProperty); + } + CrawlTree(currentElement, RemoveUntypedNodePropertyValues); + } protected static void RemoveRequestConfigurationClasses(CodeElement currentElement, CodeUsing? configurationParameterTypeUsing = null, CodeType? defaultValueForGenericTypeParam = null, bool keepRequestConfigurationClass = false, bool addDeprecation = false, CodeUsing? usingForDefaultGenericParameter = null) { if (currentElement is CodeClass currentClass && currentClass.IsOfKind(CodeClassKind.RequestConfiguration) && @@ -1477,6 +1487,7 @@ private static CodeType GetGenericTypeForRequestConfiguration(CodeType configura newType.GenericTypeParameterValues.Add(genericTypeParamValue); return newType; } + internal static void AddPrimaryErrorMessage(CodeElement currentElement, string name, Func type, bool asProperty = false) { if (currentElement is CodeClass { IsErrorDefinition: true } currentClass) diff --git a/src/Kiota.Builder/Refiners/GoRefiner.cs b/src/Kiota.Builder/Refiners/GoRefiner.cs index 6a63209638..92423a4c55 100644 --- a/src/Kiota.Builder/Refiners/GoRefiner.cs +++ b/src/Kiota.Builder/Refiners/GoRefiner.cs @@ -107,6 +107,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance AddDefaultImports( generatedCode, defaultUsingEvaluators); + RemoveUntypedNodePropertyValues(generatedCode); CorrectCoreType( generatedCode, CorrectMethodType, diff --git a/src/Kiota.Builder/Refiners/JavaRefiner.cs b/src/Kiota.Builder/Refiners/JavaRefiner.cs index 33fe45e1d5..0e0f8d7d22 100644 --- a/src/Kiota.Builder/Refiners/JavaRefiner.cs +++ b/src/Kiota.Builder/Refiners/JavaRefiner.cs @@ -108,6 +108,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance AddPropertiesAndMethodTypesImports(generatedCode, true, false, true); cancellationToken.ThrowIfCancellationRequested(); AddDefaultImports(generatedCode, defaultUsingEvaluators); + RemoveUntypedNodePropertyValues(generatedCode); AddParsableImplementsForModelClasses(generatedCode, "Parsable"); AddEnumSetImport(generatedCode); cancellationToken.ThrowIfCancellationRequested(); diff --git a/src/Kiota.Builder/Refiners/PhpRefiner.cs b/src/Kiota.Builder/Refiners/PhpRefiner.cs index 93df413e31..bd84dbacfe 100644 --- a/src/Kiota.Builder/Refiners/PhpRefiner.cs +++ b/src/Kiota.Builder/Refiners/PhpRefiner.cs @@ -52,6 +52,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance AddParsableImplementsForModelClasses(generatedCode, "Parsable"); AddRequestConfigurationConstructors(generatedCode); AddDefaultImports(generatedCode, defaultUsingEvaluators); + RemoveUntypedNodePropertyValues(generatedCode); AddCollectionValidationUtilImportToModels(generatedCode); cancellationToken.ThrowIfCancellationRequested(); AddGetterAndSetterMethods(generatedCode, diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index cc5b593ff5..786a62c301 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -20,6 +20,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance CorrectCommonNames(generatedCode); RemoveMethodByKind(generatedCode, CodeMethodKind.RawUrlConstructor); AddDefaultImports(generatedCode, defaultUsingEvaluators); + RemoveUntypedNodePropertyValues(generatedCode); DisableActionOf(generatedCode, CodeParameterKind.RequestConfiguration); MoveRequestBuilderPropertiesToBaseType(generatedCode, diff --git a/src/Kiota.Builder/Refiners/RubyRefiner.cs b/src/Kiota.Builder/Refiners/RubyRefiner.cs index 90e5864dd2..fbf48ee5e6 100644 --- a/src/Kiota.Builder/Refiners/RubyRefiner.cs +++ b/src/Kiota.Builder/Refiners/RubyRefiner.cs @@ -62,6 +62,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance cancellationToken.ThrowIfCancellationRequested(); AddParsableImplementsForModelClasses(generatedCode, "MicrosoftKiotaAbstractions::Parsable"); AddDefaultImports(generatedCode, defaultUsingEvaluators); + RemoveUntypedNodePropertyValues(generatedCode); CorrectCoreType(generatedCode, CorrectMethodType, CorrectPropertyType, CorrectImplements); cancellationToken.ThrowIfCancellationRequested(); ReplacePropertyNames(generatedCode, diff --git a/src/Kiota.Builder/Refiners/SwiftRefiner.cs b/src/Kiota.Builder/Refiners/SwiftRefiner.cs index 1a2cc104c5..fb6988db1c 100644 --- a/src/Kiota.Builder/Refiners/SwiftRefiner.cs +++ b/src/Kiota.Builder/Refiners/SwiftRefiner.cs @@ -44,6 +44,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance AddDefaultImports( generatedCode, defaultUsingEvaluators); + RemoveUntypedNodePropertyValues(generatedCode); cancellationToken.ThrowIfCancellationRequested(); CorrectCoreType( generatedCode, diff --git a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs index 43fdb97c1a..5604d0f977 100644 --- a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs +++ b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs @@ -63,6 +63,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance // `AddInnerClasses` will have inner classes moved to their own files, so we add the imports after so that the files don't miss anything. // This is because imports are added at the file level so nested classes would potentially use the higher level imports. AddDefaultImports(generatedCode, defaultUsingEvaluators); + RemoveUntypedNodePropertyValues(generatedCode); DisableActionOf(generatedCode, CodeParameterKind.RequestConfiguration); cancellationToken.ThrowIfCancellationRequested(); From 785f50cf80e722e50f65fc25cf0f18bc23cbb259 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Wed, 31 Jan 2024 16:24:53 +0300 Subject: [PATCH 03/17] Bring back missing properties --- src/Kiota.Builder/Refiners/CSharpRefiner.cs | 1 - tests/Kiota.Builder.Tests/KiotaBuilderTests.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Kiota.Builder/Refiners/CSharpRefiner.cs b/src/Kiota.Builder/Refiners/CSharpRefiner.cs index 18071b16c8..c01ad3044b 100644 --- a/src/Kiota.Builder/Refiners/CSharpRefiner.cs +++ b/src/Kiota.Builder/Refiners/CSharpRefiner.cs @@ -182,7 +182,6 @@ protected static void MakeEnumPropertiesNullable(CodeElement currentElement) SerializationNamespaceName, "ParseNodeHelper"), new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.Headers), AbstractionsNamespaceName, "RequestHeaders"), - //TODO revise this(add Kind or compare a local name) new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.Custom) && prop.Type.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase), AbstractionsNamespaceName, "RequestHeaders"), new (static x => x is CodeEnum prop && prop.Options.Any(x => x.IsNameEscaped), diff --git a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs index 8314a7e238..99b2d47aae 100644 --- a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs +++ b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs @@ -1280,7 +1280,7 @@ public void Object_Arrays_are_supported() Assert.NotNull(valueProp); var unknownProp = userResponseClass.FindChildByName("unknown", false); Assert.NotNull(unknownProp); - Assert.Equal("UntypedNode", unknownProp.Type.Name);// left out property is an UntypedNode + Assert.Equal(KiotaBuilder.UntypedNodeName, unknownProp.Type.Name);// left out property is an UntypedNode } [Fact] public void TextPlainEndpointsAreSupported() From 2b994c40edf0c9d9a2f96ddc67f4727d46cd0ae6 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Wed, 31 Jan 2024 16:27:09 +0300 Subject: [PATCH 04/17] Fix typo --- src/Kiota.Builder/Refiners/CSharpRefiner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Refiners/CSharpRefiner.cs b/src/Kiota.Builder/Refiners/CSharpRefiner.cs index c01ad3044b..b49bba0483 100644 --- a/src/Kiota.Builder/Refiners/CSharpRefiner.cs +++ b/src/Kiota.Builder/Refiners/CSharpRefiner.cs @@ -183,7 +183,7 @@ protected static void MakeEnumPropertiesNullable(CodeElement currentElement) new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.Headers), AbstractionsNamespaceName, "RequestHeaders"), new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.Custom) && prop.Type.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase), - AbstractionsNamespaceName, "RequestHeaders"), + AbstractionsNamespaceName, KiotaBuilder.UntypedNodeName), new (static x => x is CodeEnum prop && prop.Options.Any(x => x.IsNameEscaped), "System.Runtime.Serialization", "EnumMemberAttribute"), new (static x => x is IDeprecableElement element && element.Deprecation is not null && element.Deprecation.IsDeprecated, From bcea41c27401b23207cac57f28f67aec0e6b6722 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Wed, 31 Jan 2024 16:32:19 +0300 Subject: [PATCH 05/17] Format --- src/Kiota.Builder/KiotaBuilder.cs | 6 +++--- src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs | 6 +++--- src/Kiota.Builder/Refiners/PythonRefiner.cs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 9991b3a769..dca3e05b3d 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -1840,7 +1840,7 @@ private CodeTypeBase CreateModelDeclarations(OpenApiUrlTreeNode currentNode, Ope if ((schema.AnyOf.Any() || schema.OneOf.Any() || schema.AllOf.Any()) && (schema.AnyOf.FirstOrDefault(static x => x.IsSemanticallyMeaningful(true)) ?? schema.OneOf.FirstOrDefault(static x => x.IsSemanticallyMeaningful(true)) ?? schema.AllOf.FirstOrDefault(static x => x.IsSemanticallyMeaningful(true))) is { } childSchema) // we have an empty node because of some local override for schema properties and need to unwrap it. return CreateModelDeclarations(currentNode, childSchema, operation, parentElement, suffixForInlineSchema, response, typeNameForInlineSchema, isRequestBody); - return new CodeType { Name = UntypedNodeName ,IsExternal = true}; + return new CodeType { Name = UntypedNodeName, IsExternal = true }; } private CodeTypeBase CreateCollectionModelDeclaration(OpenApiUrlTreeNode currentNode, OpenApiSchema schema, OpenApiOperation? operation, CodeNamespace codeNamespace, string typeNameForInlineSchema, bool isRequestBody) { @@ -1854,8 +1854,8 @@ private CodeTypeBase CreateCollectionModelDeclaration(OpenApiUrlTreeNode current var targetNamespace = GetShortestNamespace(codeNamespace, schema.Items); type = CreateModelDeclarations(currentNode, schema.Items, operation, targetNamespace, string.Empty, typeNameForInlineSchema: typeNameForInlineSchema, isRequestBody: isRequestBody); } - if (type is null) - return new CodeType { Name = UntypedNodeName,IsExternal = true}; + if (type is null) + return new CodeType { Name = UntypedNodeName, IsExternal = true }; type.CollectionKind = CodeTypeBase.CodeTypeCollectionKind.Complex; return type; } diff --git a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs index a1e17ddd47..c8896c44b5 100644 --- a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs +++ b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -1433,9 +1433,9 @@ protected static void RemoveRequestConfigurationClassesCommonProperties(CodeElem } protected static void RemoveUntypedNodePropertyValues(CodeElement currentElement) { - if (currentElement is CodeProperty currentProperty + if (currentElement is CodeProperty currentProperty && currentElement.Parent is CodeClass parentClass - && currentProperty.Type.Name.Equals(KiotaBuilder.UntypedNodeName,StringComparison.OrdinalIgnoreCase)) + && currentProperty.Type.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase)) { parentClass.RemoveChildElement(currentProperty); } diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index 8764a3a6d8..4a7dca7841 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading; From a135d49663fc2fa156158434c6546f2e887c8be2 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Thu, 8 Feb 2024 09:51:36 +0300 Subject: [PATCH 06/17] Java fixes --- src/Kiota.Builder/Refiners/CSharpRefiner.cs | 2 +- src/Kiota.Builder/Refiners/JavaRefiner.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/Refiners/CSharpRefiner.cs b/src/Kiota.Builder/Refiners/CSharpRefiner.cs index b49bba0483..d50537ba77 100644 --- a/src/Kiota.Builder/Refiners/CSharpRefiner.cs +++ b/src/Kiota.Builder/Refiners/CSharpRefiner.cs @@ -183,7 +183,7 @@ protected static void MakeEnumPropertiesNullable(CodeElement currentElement) new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.Headers), AbstractionsNamespaceName, "RequestHeaders"), new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.Custom) && prop.Type.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase), - AbstractionsNamespaceName, KiotaBuilder.UntypedNodeName), + SerializationNamespaceName, KiotaBuilder.UntypedNodeName), new (static x => x is CodeEnum prop && prop.Options.Any(x => x.IsNameEscaped), "System.Runtime.Serialization", "EnumMemberAttribute"), new (static x => x is IDeprecableElement element && element.Deprecation is not null && element.Deprecation.IsDeprecated, diff --git a/src/Kiota.Builder/Refiners/JavaRefiner.cs b/src/Kiota.Builder/Refiners/JavaRefiner.cs index 8e1f61b58f..29df18664b 100644 --- a/src/Kiota.Builder/Refiners/JavaRefiner.cs +++ b/src/Kiota.Builder/Refiners/JavaRefiner.cs @@ -108,7 +108,6 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance AddPropertiesAndMethodTypesImports(generatedCode, true, false, true); cancellationToken.ThrowIfCancellationRequested(); AddDefaultImports(generatedCode, defaultUsingEvaluators); - RemoveUntypedNodePropertyValues(generatedCode); AddParsableImplementsForModelClasses(generatedCode, "Parsable"); AddEnumSetImport(generatedCode); cancellationToken.ThrowIfCancellationRequested(); @@ -264,6 +263,8 @@ private static void AddEnumSetImport(CodeElement currentElement) AbstractionsNamespaceName, "QueryParameters"), new (static x => x is CodeClass @class && @class.OriginalComposedType is CodeIntersectionType intersectionType && intersectionType.Types.Any(static y => !y.IsExternal), SerializationNamespaceName, "ParseNodeHelper"), + new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.Custom) && prop.Type.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase), + SerializationNamespaceName, KiotaBuilder.UntypedNodeName), new (static x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.RequestExecutor, CodeMethodKind.RequestGenerator) && method.Parameters.Any(static y => y.IsOfKind(CodeParameterKind.RequestBody) && y.Type.Name.Equals(MultipartBodyClassName, StringComparison.OrdinalIgnoreCase)), AbstractionsNamespaceName, MultipartBodyClassName) }; From bcacb183f47bd9e2a60a82e81a0c74ad9299b0ad Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Tue, 27 Feb 2024 11:24:43 +0300 Subject: [PATCH 07/17] Todo testing --- src/Kiota.Builder/Refiners/GoRefiner.cs | 1 - src/Kiota.Builder/Refiners/TypeScriptRefiner.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Kiota.Builder/Refiners/GoRefiner.cs b/src/Kiota.Builder/Refiners/GoRefiner.cs index 0a5d0fd3bc..fcdd9bce1d 100644 --- a/src/Kiota.Builder/Refiners/GoRefiner.cs +++ b/src/Kiota.Builder/Refiners/GoRefiner.cs @@ -109,7 +109,6 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance AddDefaultImports( generatedCode, defaultUsingEvaluators); - RemoveUntypedNodePropertyValues(generatedCode); CorrectCoreType( generatedCode, CorrectMethodType, diff --git a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs index a35a2d4e86..65a217ec15 100644 --- a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs +++ b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs @@ -64,7 +64,6 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance // `AddInnerClasses` will have inner classes moved to their own files, so we add the imports after so that the files don't miss anything. // This is because imports are added at the file level so nested classes would potentially use the higher level imports. AddDefaultImports(generatedCode, defaultUsingEvaluators); - RemoveUntypedNodePropertyValues(generatedCode); DisableActionOf(generatedCode, CodeParameterKind.RequestConfiguration); cancellationToken.ThrowIfCancellationRequested(); From 6d5afc6d2d2386dd01be6a6b0f9fb8e7b1e21e1c Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Wed, 28 Feb 2024 23:13:20 +0300 Subject: [PATCH 08/17] CLI does not need it. --- src/Kiota.Builder/Refiners/CliRefiner.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Kiota.Builder/Refiners/CliRefiner.cs b/src/Kiota.Builder/Refiners/CliRefiner.cs index 1526a34c98..666e7de988 100644 --- a/src/Kiota.Builder/Refiners/CliRefiner.cs +++ b/src/Kiota.Builder/Refiners/CliRefiner.cs @@ -49,7 +49,6 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance }); AddDefaultImports(generatedCode, defaultUsingEvaluators); AddDefaultImports(generatedCode, additionalUsingEvaluators); - RemoveUntypedNodePropertyValues(generatedCode); CorrectCoreType(generatedCode, CorrectMethodType, CorrectPropertyType); cancellationToken.ThrowIfCancellationRequested(); MoveClassesWithNamespaceNamesUnderNamespace(generatedCode); From 0f81eaa3b2a68b9bf87ff0feb677180fc7b8bcc9 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Wed, 28 Feb 2024 23:15:02 +0300 Subject: [PATCH 09/17] Adds CI for intergration tests. --- it/config.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/it/config.json b/it/config.json index 6ef1c46a70..bef7691eac 100644 --- a/it/config.json +++ b/it/config.json @@ -339,5 +339,11 @@ "Rationale": "https://github.com/microsoft/kiota/issues/1812" } ] + }, + "apisguru::apis.guru": { + "Suppressions": [ + ], + "IdempotencySuppressions": [ + ] } } From 270486efada5a6b8d2a0a6b4f91db84625e41cad Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Wed, 28 Feb 2024 23:25:27 +0300 Subject: [PATCH 10/17] Add intergration test for validation --- .github/workflows/integration-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 0d367a37e3..8e1fc56376 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -58,6 +58,8 @@ jobs: - "apisguru::twilio.com:api" - "apisguru::docusign.net" - "apisguru::github.com:api.github.com" + - "apisguru::apis.guru" + steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 From 3a892b581a973e10cdc5bf76a77770f4a7007a82 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Thu, 29 Feb 2024 12:41:30 +0300 Subject: [PATCH 11/17] Fix golang compilation --- src/Kiota.Builder/Refiners/GoRefiner.cs | 17 ++++++++++------- .../Writers/Go/CodeMethodWriter.cs | 3 ++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Kiota.Builder/Refiners/GoRefiner.cs b/src/Kiota.Builder/Refiners/GoRefiner.cs index fcdd9bce1d..f178ef9902 100644 --- a/src/Kiota.Builder/Refiners/GoRefiner.cs +++ b/src/Kiota.Builder/Refiners/GoRefiner.cs @@ -570,7 +570,7 @@ private static void AddErrorAndStringsImportForEnums(CodeElement currentElement) new (static x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.Deserializer, CodeMethodKind.Factory), "github.com/microsoft/kiota-abstractions-go/serialization", "ParseNode", "Parsable"), new (static x => x is CodeClass codeClass && codeClass.IsOfKind(CodeClassKind.Model), - "github.com/microsoft/kiota-abstractions-go/serialization", "Parsable"), + SerializationNamespaceName, "Parsable"), new (static x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.RequestGenerator) && method.Parameters.Any(x => x.IsOfKind(CodeParameterKind.RequestBody) && @@ -578,16 +578,16 @@ private static void AddErrorAndStringsImportForEnums(CodeElement currentElement) x.Type is CodeType pType && (pType.TypeDefinition is CodeClass || pType.TypeDefinition is CodeInterface)), - "github.com/microsoft/kiota-abstractions-go/serialization", "Parsable"), + SerializationNamespaceName, "Parsable"), new (static x => x is CodeClass @class && @class.IsOfKind(CodeClassKind.Model) && (@class.Properties.Any(x => x.IsOfKind(CodePropertyKind.AdditionalData)) || @class.StartBlock.Implements.Any(x => KiotaBuilder.AdditionalHolderInterface.Equals(x.Name, StringComparison.OrdinalIgnoreCase))), - "github.com/microsoft/kiota-abstractions-go/serialization", "AdditionalDataHolder"), + SerializationNamespaceName, "AdditionalDataHolder"), new (static x => x is CodeClass @class && @class.OriginalComposedType is CodeUnionType unionType && unionType.Types.Any(static y => !y.IsExternal) && unionType.DiscriminatorInformation.HasBasicDiscriminatorInformation, "strings", "EqualFold"), new (static x => x is CodeMethod method && (method.IsOfKind(CodeMethodKind.RequestExecutor) || method.IsOfKind(CodeMethodKind.RequestGenerator)), "context","*context"), new (static x => x is CodeClass @class && @class.OriginalComposedType is CodeIntersectionType intersectionType && intersectionType.Types.Any(static y => !y.IsExternal) && intersectionType.DiscriminatorInformation.HasBasicDiscriminatorInformation, - "github.com/microsoft/kiota-abstractions-go/serialization", "MergeDeserializersForIntersectionWrapper"), + SerializationNamespaceName, "MergeDeserializersForIntersectionWrapper"), new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.Headers), AbstractionsNamespaceName, "RequestHeaders"), new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.BackingStore), "github.com/microsoft/kiota-abstractions-go/store","BackingStore"), @@ -596,10 +596,13 @@ x.Type is CodeType pType && "github.com/microsoft/kiota-abstractions-go/store", "BackingStoreFactory"), new (static x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.RequestExecutor, CodeMethodKind.RequestGenerator) && method.Parameters.Any(static y => y.IsOfKind(CodeParameterKind.RequestBody) && y.Type.Name.Equals(MultipartBodyClassName, StringComparison.OrdinalIgnoreCase)), AbstractionsNamespaceName, MultipartBodyClassName), + new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.Custom) && prop.Type.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase), + SerializationNamespaceName, KiotaBuilder.UntypedNodeName), new (static x => x is CodeEnum @enum && @enum.Flags,"", "math"), }; private const string MultipartBodyClassName = "MultipartBody"; private const string AbstractionsNamespaceName = "github.com/microsoft/kiota-abstractions-go"; + private const string SerializationNamespaceName = "github.com/microsoft/kiota-abstractions-go/serialization"; private void CorrectImplements(ProprietableBlockDeclaration block) { @@ -672,21 +675,21 @@ private static void CorrectMethodType(CodeMethod currentMethod) {"TimeSpan", ("ISODuration", new CodeUsing { Name = "ISODuration", Declaration = new CodeType { - Name = "github.com/microsoft/kiota-abstractions-go/serialization", + Name = SerializationNamespaceName, IsExternal = true, }, })}, {"DateOnly", (string.Empty, new CodeUsing { Name = "DateOnly", Declaration = new CodeType { - Name = "github.com/microsoft/kiota-abstractions-go/serialization", + Name = SerializationNamespaceName, IsExternal = true, }, })}, {"TimeOnly", (string.Empty, new CodeUsing { Name = "TimeOnly", Declaration = new CodeType { - Name = "github.com/microsoft/kiota-abstractions-go/serialization", + Name = SerializationNamespaceName, IsExternal = true, }, })}, diff --git a/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs index 41b1456864..b3d49ecacc 100644 --- a/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs @@ -708,6 +708,7 @@ private void WriteFieldDeserializer(CodeProperty property, LanguageWriter writer (CodeInterface, false) => (GetTypeAssertion("val", propertyTypeImportName), string.Empty, false), (CodeInterface, true) => ("res", string.Empty, false), (_, true) => ("res", "*", true), + (null, false) when property.Type.AllTypes.First().Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase) => (GetTypeAssertion("val", $"*{propertyTypeImportName}"), string.Empty, true), _ => ("val", string.Empty, true), }; if (property.Type.CollectionKind != CodeTypeBase.CodeTypeCollectionKind.None) @@ -978,7 +979,7 @@ private void WriteSerializationMethodCall(CodeTypeBase propType, CodeElement par serializationKey = $"\"{serializationKey}\""; var errorPrefix = $"err {errorVarDeclaration(shouldDeclareErrorVar)}= writer."; var isEnum = propType is CodeType eType && eType.TypeDefinition is CodeEnum; - var isComplexType = propType is CodeType cType && (cType.TypeDefinition is CodeClass || cType.TypeDefinition is CodeInterface); + var isComplexType = propType is CodeType cType && (cType.TypeDefinition is CodeClass || cType.TypeDefinition is CodeInterface || cType.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase)); var isInterface = propType is CodeType iType && iType.TypeDefinition is CodeInterface; if (addBlockForErrorScope) if (isEnum || propType.IsCollection) From fcb9830c8739753313833452439cc78edf5f1c59 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Thu, 29 Feb 2024 15:19:35 +0300 Subject: [PATCH 12/17] Cleanup go runnability --- src/Kiota.Builder/Refiners/GoRefiner.cs | 8 ++++++++ src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs | 5 +++-- src/Kiota.Builder/Writers/Go/GoConventionService.cs | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/Refiners/GoRefiner.cs b/src/Kiota.Builder/Refiners/GoRefiner.cs index f178ef9902..7dafcd70f0 100644 --- a/src/Kiota.Builder/Refiners/GoRefiner.cs +++ b/src/Kiota.Builder/Refiners/GoRefiner.cs @@ -603,6 +603,7 @@ x.Type is CodeType pType && private const string MultipartBodyClassName = "MultipartBody"; private const string AbstractionsNamespaceName = "github.com/microsoft/kiota-abstractions-go"; private const string SerializationNamespaceName = "github.com/microsoft/kiota-abstractions-go/serialization"; + internal const string UntypedNodeName = "UntypedNodeable"; private void CorrectImplements(ProprietableBlockDeclaration block) { @@ -700,6 +701,13 @@ private static void CorrectMethodType(CodeMethod currentMethod) IsExternal = true, }, })}, + {KiotaBuilder.UntypedNodeName, (GoRefiner.UntypedNodeName, new CodeUsing { + Name = GoRefiner.UntypedNodeName, + Declaration = new CodeType { + Name = SerializationNamespaceName, + IsExternal = true, + }, + })}, }; private static void CorrectPropertyType(CodeProperty currentProperty) { diff --git a/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs index b3d49ecacc..989c9df1d7 100644 --- a/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs @@ -4,6 +4,7 @@ using Kiota.Builder.CodeDOM; using Kiota.Builder.Extensions; +using Kiota.Builder.Refiners; namespace Kiota.Builder.Writers.Go; public class CodeMethodWriter : BaseElementWriter @@ -708,7 +709,7 @@ private void WriteFieldDeserializer(CodeProperty property, LanguageWriter writer (CodeInterface, false) => (GetTypeAssertion("val", propertyTypeImportName), string.Empty, false), (CodeInterface, true) => ("res", string.Empty, false), (_, true) => ("res", "*", true), - (null, false) when property.Type.AllTypes.First().Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase) => (GetTypeAssertion("val", $"*{propertyTypeImportName}"), string.Empty, true), + (null, false) when property.Type.AllTypes.First().Name.Equals(GoRefiner.UntypedNodeName, StringComparison.OrdinalIgnoreCase) => (GetTypeAssertion("val", $"{propertyTypeImportName}"), string.Empty, true), _ => ("val", string.Empty, true), }; if (property.Type.CollectionKind != CodeTypeBase.CodeTypeCollectionKind.None) @@ -979,7 +980,7 @@ private void WriteSerializationMethodCall(CodeTypeBase propType, CodeElement par serializationKey = $"\"{serializationKey}\""; var errorPrefix = $"err {errorVarDeclaration(shouldDeclareErrorVar)}= writer."; var isEnum = propType is CodeType eType && eType.TypeDefinition is CodeEnum; - var isComplexType = propType is CodeType cType && (cType.TypeDefinition is CodeClass || cType.TypeDefinition is CodeInterface || cType.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase)); + var isComplexType = propType is CodeType cType && (cType.TypeDefinition is CodeClass || cType.TypeDefinition is CodeInterface || cType.Name.Equals(GoRefiner.UntypedNodeName, StringComparison.OrdinalIgnoreCase)); var isInterface = propType is CodeType iType && iType.TypeDefinition is CodeInterface; if (addBlockForErrorScope) if (isEnum || propType.IsCollection) diff --git a/src/Kiota.Builder/Writers/Go/GoConventionService.cs b/src/Kiota.Builder/Writers/Go/GoConventionService.cs index df513ad5be..5582ba25b8 100644 --- a/src/Kiota.Builder/Writers/Go/GoConventionService.cs +++ b/src/Kiota.Builder/Writers/Go/GoConventionService.cs @@ -5,6 +5,7 @@ using Kiota.Builder.CodeDOM; using Kiota.Builder.Extensions; +using Kiota.Builder.Refiners; namespace Kiota.Builder.Writers.Go; public class GoConventionService : CommonLanguageConventionService @@ -62,6 +63,7 @@ public string GetTypeString(CodeTypeBase code, CodeElement targetElement, bool i currentType.IsNullable && currentType.TypeDefinition is not CodeInterface && currentType.CollectionKind == CodeTypeBase.CodeTypeCollectionKind.None && + !currentType.Name.Equals(GoRefiner.UntypedNodeName, StringComparison.OrdinalIgnoreCase) && !IsScalarType(currentType.Name) ? "*" : string.Empty; var collectionPrefix = currentType.CollectionKind switch From a4664e1324d541a956d11739ba8e5ad23b9fca0d Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Mon, 4 Mar 2024 11:41:03 +0300 Subject: [PATCH 13/17] Fix missing imports. --- src/Kiota.Builder/Refiners/TypeScriptRefiner.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs index 65a217ec15..7a3d3aa436 100644 --- a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs +++ b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs @@ -527,7 +527,9 @@ private static bool HasMultipartBody(CodeMethod m) => new (static x => x is CodeProperty prop && prop.Kind is CodePropertyKind.BackingStore, AbstractionsPackageName, true, "BackingStore", "BackedModel"), new (static x => x is CodeMethod m && HasMultipartBody(m), - AbstractionsPackageName, MultipartBodyClassName, $"serialize{MultipartBodyClassName}") + AbstractionsPackageName, MultipartBodyClassName, $"serialize{MultipartBodyClassName}"), + new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.Custom) && prop.Type.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase), + AbstractionsPackageName, KiotaBuilder.UntypedNodeName, "createUntypedNodeFromDiscriminatorValue"), }; private const string MultipartBodyClassName = "MultipartBody"; private static void CorrectImplements(ProprietableBlockDeclaration block) From 87c9412a46d30d66671e0234653a554e9d83cf9f Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Mon, 4 Mar 2024 21:23:39 +0300 Subject: [PATCH 14/17] Adds more tests --- .../Refiners/CSharpLanguageRefinerTests.cs | 25 +++++++++++++++++++ .../Refiners/GoLanguageRefinerTests.cs | 24 ++++++++++++++++++ .../Refiners/JavaLanguageRefinerTests.cs | 25 +++++++++++++++++++ .../TypeScriptLanguageRefinerTests.cs | 21 ++++++++++++++++ 4 files changed, 95 insertions(+) diff --git a/tests/Kiota.Builder.Tests/Refiners/CSharpLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/CSharpLanguageRefinerTests.cs index 85e263c2f3..27b5091fd4 100644 --- a/tests/Kiota.Builder.Tests/Refiners/CSharpLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/CSharpLanguageRefinerTests.cs @@ -662,5 +662,30 @@ public async Task ReplacesLocallyDefinedTimeOnlyByNativeType() Assert.NotEmpty(model.StartBlock.Usings); Assert.Equal("TimeOnlyObject", method.ReturnType.Name); } + [Fact] + public async Task AddsUsingForUntypedNode() + { + var model = root.AddClass(new CodeClass + { + Name = "model", + Kind = CodeClassKind.Model + }).First(); + var property = model.AddProperty(new CodeProperty + { + Name = "property", + Type = new CodeType + { + Name = KiotaBuilder.UntypedNodeName, + IsExternal = true + }, + }).First(); + await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.CSharp }, root); + Assert.Equal(KiotaBuilder.UntypedNodeName, property.Type.Name); + Assert.NotEmpty(model.StartBlock.Usings); + var nodeUsing = model.StartBlock.Usings.Where(static declaredUsing => declaredUsing.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase)).ToArray(); + Assert.Single(nodeUsing); + Assert.Equal("Microsoft.Kiota.Abstractions.Serialization", nodeUsing[0].Declaration.Name); + + } #endregion } diff --git a/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs index 3d7d08a7f0..9857df54d6 100644 --- a/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs @@ -1074,5 +1074,29 @@ public async Task AddsMethodsOverloads() Assert.Contains(childMethods, x => !x.IsOverload && x.IsOfKind(CodeMethodKind.RequestGenerator) && x.Parameters.Count() == 3);// ctx + body + query config Assert.Equal(2, childMethods.Count()); } + [Fact] + public async Task AddsUsingForUntypedNode() + { + var model = root.AddClass(new CodeClass + { + Name = "model", + Kind = CodeClassKind.Model + }).First(); + var property = model.AddProperty(new CodeProperty + { + Name = "property", + Type = new CodeType + { + Name = KiotaBuilder.UntypedNodeName, + IsExternal = true + }, + }).First(); + await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Go }, root); + Assert.Equal(GoRefiner.UntypedNodeName, property.Type.Name);// type is renamed + Assert.NotEmpty(model.StartBlock.Usings); + var nodeUsing = model.StartBlock.Usings.Where(static declaredUsing => declaredUsing.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase)).ToArray(); + Assert.Single(nodeUsing); + Assert.Equal("github.com/microsoft/kiota-abstractions-go/serialization", nodeUsing[0].Declaration.Name); + } #endregion } diff --git a/tests/Kiota.Builder.Tests/Refiners/JavaLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/JavaLanguageRefinerTests.cs index b8416e1fc5..8c36e68216 100644 --- a/tests/Kiota.Builder.Tests/Refiners/JavaLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/JavaLanguageRefinerTests.cs @@ -702,5 +702,30 @@ public async Task SplitsLongRefiners() Assert.Equal(4, model.Methods.Count()); Assert.Equal("String", model.Methods.First(static x => x.IsOverload).Parameters.First().Type.Name); } + + [Fact] + public async Task AddsUsingForUntypedNode() + { + var model = root.AddClass(new CodeClass + { + Name = "model", + Kind = CodeClassKind.Model + }).First(); + var property = model.AddProperty(new CodeProperty + { + Name = "property", + Type = new CodeType + { + Name = KiotaBuilder.UntypedNodeName, + IsExternal = true + }, + }).First(); + await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Java }, root); + Assert.Equal(KiotaBuilder.UntypedNodeName, property.Type.Name); + Assert.NotEmpty(model.StartBlock.Usings); + var nodeUsing = model.StartBlock.Usings.Where(static declaredUsing => declaredUsing.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase)).ToArray(); + Assert.Single(nodeUsing); + Assert.Equal("com.microsoft.kiota.serialization", nodeUsing[0].Declaration.Name); + } #endregion } diff --git a/tests/Kiota.Builder.Tests/Refiners/TypeScriptLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/TypeScriptLanguageRefinerTests.cs index b3030025e0..e7704461fa 100644 --- a/tests/Kiota.Builder.Tests/Refiners/TypeScriptLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/TypeScriptLanguageRefinerTests.cs @@ -802,5 +802,26 @@ public async Task GeneratesCodeFiles() Assert.Null(root.FindChildByName($"{model.Name.ToFirstCharacterUpperCase()}", false)); } + [Fact] + public async Task AddsUsingForUntypedNode() + { + var generationConfiguration = new GenerationConfiguration { Language = GenerationLanguage.TypeScript }; + var model = TestHelper.CreateModelClassInModelsNamespace(generationConfiguration, root); + var property = model.AddProperty(new CodeProperty + { + Name = "property", + Type = new CodeType + { + Name = KiotaBuilder.UntypedNodeName, + IsExternal = true + }, + }).First(); + await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.TypeScript }, root); + Assert.Equal(KiotaBuilder.UntypedNodeName, property.Type.Name);// type is renamed + Assert.NotEmpty(model.StartBlock.Usings); + var nodeUsing = model.StartBlock.Usings.Where(static declaredUsing => declaredUsing.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase)).ToArray(); + Assert.Single(nodeUsing); + Assert.Equal("@microsoft/kiota-abstractions", nodeUsing[0].Declaration.Name); + } #endregion } From 5bccb1e188da6518c135690aacd18d9a88ad9f3e Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Wed, 20 Mar 2024 16:18:13 +0300 Subject: [PATCH 15/17] Adds changelog entry. --- CHANGELOG.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 204b88679d..a1b014ed9b 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 a warning message in the CLI when using preview languages. [#4316](https://github.com/microsoft/kiota/issues/4316) +- Added support for handling untyped Json content in C#,Golang, TypeScript and Java[#2319](https://github.com/microsoft/kiota/issues/2319) ### Changed @@ -642,9 +643,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed a bug where path parameters would be missing if no operation was present at the segment the parameter is defined. [#1940](https://github.com/microsoft/kiota/issues/1940) - Fixed a bug where nested classes with long names caused compilation errors for java generated libraries. [#1949](https://github.com/microsoft/kiota/issues/1949) - Removed use of anonymous classes in java generated libraries to reduce the number of java classes created at compilation time. [#1980](https://github.com/microsoft/kiota/pull/1980) -- Fixed a bug where generation would result in wrong indentation in some classes for Python [#1996]((https://github.com/microsoft/kiota/issues/1996). -- Fixed a bug where error class modules were hardcoded for Python [#1999]((https://github.com/microsoft/kiota/issues/1999) -- Fixed a bug where generation would sometimes result in wrong original names for query parameters in Python [#2000]((https://github.com/microsoft/kiota/issues/2000). +- Fixed a bug where generation would result in wrong indentation in some classes for Python [#1996]((). +- Fixed a bug where error class modules were hardcoded for Python [#1999](() +- Fixed a bug where generation would sometimes result in wrong original names for query parameters in Python [#2000]((). - Fixed a bug where Java would fail to compile for endpoints that return collections. ## [0.7.1] - 2022-11-01 @@ -1283,8 +1284,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Initial GitHub release - - - - - From a6f7650f6681c95132a5bff967cb43cdcdafc2ef Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 20 Mar 2024 09:21:58 -0400 Subject: [PATCH 16/17] Apply suggestions from code review --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1b014ed9b..2d6facbca6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added a warning message in the CLI when using preview languages. [#4316](https://github.com/microsoft/kiota/issues/4316) -- Added support for handling untyped Json content in C#,Golang, TypeScript and Java[#2319](https://github.com/microsoft/kiota/issues/2319) +- Added support for handling untyped Json content in C#,Golang, TypeScript and Java. [#2319](https://github.com/microsoft/kiota/issues/2319) ### Changed @@ -643,9 +643,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed a bug where path parameters would be missing if no operation was present at the segment the parameter is defined. [#1940](https://github.com/microsoft/kiota/issues/1940) - Fixed a bug where nested classes with long names caused compilation errors for java generated libraries. [#1949](https://github.com/microsoft/kiota/issues/1949) - Removed use of anonymous classes in java generated libraries to reduce the number of java classes created at compilation time. [#1980](https://github.com/microsoft/kiota/pull/1980) -- Fixed a bug where generation would result in wrong indentation in some classes for Python [#1996]((). -- Fixed a bug where error class modules were hardcoded for Python [#1999](() -- Fixed a bug where generation would sometimes result in wrong original names for query parameters in Python [#2000]((). +- Fixed a bug where generation would result in wrong indentation in some classes for Python [#1996](https://github.com/microsoft/kiota/issues/1996). +- Fixed a bug where error class modules were hardcoded for Python [#1999](https://github.com/microsoft/kiota/issues/1999) +- Fixed a bug where generation would sometimes result in wrong original names for query parameters in Python [#2000](https://github.com/microsoft/kiota/issues/2000). - Fixed a bug where Java would fail to compile for endpoints that return collections. ## [0.7.1] - 2022-11-01 From d9edd0ba16861b4b571531e359a9f940db1a5373 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Thu, 21 Mar 2024 15:00:08 +0300 Subject: [PATCH 17/17] Fix intergrations tests updates. --- .github/dependabot.yml | 168 +++++++++++++++++++---------------- it/go/client/api_client.go | 49 ++++++++++ it/go/go.mod | 40 ++++----- it/go/go.sum | 82 ++++++++--------- it/java/basic/pom.xml | 2 +- it/java/gh/pom.xml | 2 +- it/java/pom.xml | 2 +- it/java/query-params/pom.xml | 2 +- 8 files changed, 203 insertions(+), 144 deletions(-) create mode 100644 it/go/client/api_client.go diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5303727326..ef2cc5f75b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,89 +1,99 @@ version: 2 updates: -- package-ecosystem: nuget - directory: "/" - schedule: - interval: daily - open-pull-requests-limit: 10 - labels: - - generator - groups: - kiota-dependencies: - patterns: - - "*kiota*" -- package-ecosystem: github-actions - directory: "/" - schedule: - interval: daily - open-pull-requests-limit: 10 + - package-ecosystem: nuget + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 + labels: + - generator + groups: + kiota-dependencies: + patterns: + - "*kiota*" + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 -- package-ecosystem: nuget - directory: "/it/csharp" - schedule: - interval: daily - open-pull-requests-limit: 10 - groups: - kiota-dependencies: - patterns: - - "*kiota*" + - package-ecosystem: nuget + directory: "/it/csharp" + schedule: + interval: daily + open-pull-requests-limit: 10 + groups: + kiota-dependencies: + patterns: + - "*kiota*" -- package-ecosystem: gomod - directory: "/it/go" - schedule: - interval: daily - open-pull-requests-limit: 10 - groups: - kiota-dependencies: - patterns: - - "*kiota*" + - package-ecosystem: gomod + directory: "/it/go" + schedule: + interval: daily + open-pull-requests-limit: 10 + groups: + kiota-dependencies: + patterns: + - "*kiota*" -- package-ecosystem: composer - directory: "/it/php" - schedule: - interval: daily - open-pull-requests-limit: 10 - groups: - kiota-dependencies: - patterns: - - "*kiota*" + - package-ecosystem: composer + directory: "/it/php" + schedule: + interval: daily + open-pull-requests-limit: 10 + groups: + kiota-dependencies: + patterns: + - "*kiota*" -- package-ecosystem: pip - directory: "/it/python" - schedule: - interval: daily - open-pull-requests-limit: 10 - groups: - kiota-dependencies: - patterns: - - "*kiota*" + - package-ecosystem: pip + directory: "/it/python" + schedule: + interval: daily + open-pull-requests-limit: 10 + groups: + kiota-dependencies: + patterns: + - "*kiota*" -- package-ecosystem: bundler - directory: "/it/ruby" - schedule: - interval: daily - open-pull-requests-limit: 10 - groups: - kiota-dependencies: - patterns: - - "*kiota*" + - package-ecosystem: bundler + directory: "/it/ruby" + schedule: + interval: daily + open-pull-requests-limit: 10 + groups: + kiota-dependencies: + patterns: + - "*kiota*" -- package-ecosystem: npm - directory: "/it/typescript" - schedule: - interval: daily - open-pull-requests-limit: 10 - groups: - kiota-dependencies: - patterns: - - "*kiota*" + - package-ecosystem: maven + directory: "/it/java" + schedule: + interval: daily + open-pull-requests-limit: 10 + groups: + kiota-dependencies: + patterns: + - "*kiota*" -- package-ecosystem: npm - directory: "/vscode/microsoft-kiota" - schedule: - interval: daily - open-pull-requests-limit: 10 - groups: - eslint: - patterns: - - "*eslint*" + - package-ecosystem: npm + directory: "/it/typescript" + schedule: + interval: daily + open-pull-requests-limit: 10 + groups: + kiota-dependencies: + patterns: + - "*kiota*" + + - package-ecosystem: npm + directory: "/vscode/microsoft-kiota" + schedule: + interval: daily + open-pull-requests-limit: 10 + groups: + eslint: + patterns: + - "*eslint*" diff --git a/it/go/client/api_client.go b/it/go/client/api_client.go new file mode 100644 index 0000000000..6c66b46ae6 --- /dev/null +++ b/it/go/client/api_client.go @@ -0,0 +1,49 @@ +// This is a temporary file to be used until the code is generated and will be overwritten. +package client + +import ( + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + i4bcdc892e61ac17e2afc10b5e2b536b29f4fd6c1ad30f4a5a68df47495db3347 "github.com/microsoft/kiota-serialization-form-go" + i25911dc319edd61cbac496af7eab5ef20b6069a42515e22ec6a9bc97bf598488 "github.com/microsoft/kiota-serialization-json-go" + i56887720f41ac882814261620b1c8459c4a992a0207af547c4453dd39fabc426 "github.com/microsoft/kiota-serialization-multipart-go" + i7294a22093d408fdca300f11b81a887d89c47b764af06c8b803e2323973fdb83 "github.com/microsoft/kiota-serialization-text-go" +) + +// ApiClient the main entry point of the SDK, exposes the configuration and the fluent API. +type ApiClient struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} + +// NewApiClient instantiates a new ApiClient and sets the default values. +func NewApiClient(requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ApiClient { + m := &ApiClient{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}", map[string]string{}), + } + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RegisterDefaultSerializer(func() i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriterFactory { + return i25911dc319edd61cbac496af7eab5ef20b6069a42515e22ec6a9bc97bf598488.NewJsonSerializationWriterFactory() + }) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RegisterDefaultSerializer(func() i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriterFactory { + return i7294a22093d408fdca300f11b81a887d89c47b764af06c8b803e2323973fdb83.NewTextSerializationWriterFactory() + }) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RegisterDefaultSerializer(func() i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriterFactory { + return i4bcdc892e61ac17e2afc10b5e2b536b29f4fd6c1ad30f4a5a68df47495db3347.NewFormSerializationWriterFactory() + }) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RegisterDefaultSerializer(func() i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriterFactory { + return i56887720f41ac882814261620b1c8459c4a992a0207af547c4453dd39fabc426.NewMultipartSerializationWriterFactory() + }) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RegisterDefaultDeserializer(func() i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNodeFactory { + return i25911dc319edd61cbac496af7eab5ef20b6069a42515e22ec6a9bc97bf598488.NewJsonParseNodeFactory() + }) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RegisterDefaultDeserializer(func() i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNodeFactory { + return i7294a22093d408fdca300f11b81a887d89c47b764af06c8b803e2323973fdb83.NewTextParseNodeFactory() + }) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RegisterDefaultDeserializer(func() i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNodeFactory { + return i4bcdc892e61ac17e2afc10b5e2b536b29f4fd6c1ad30f4a5a68df47495db3347.NewFormParseNodeFactory() + }) + if m.BaseRequestBuilder.RequestAdapter.GetBaseUrl() == "" { + m.BaseRequestBuilder.RequestAdapter.SetBaseUrl("https://localhost/v2") + } + m.BaseRequestBuilder.PathParameters["baseurl"] = m.BaseRequestBuilder.RequestAdapter.GetBaseUrl() + return m +} diff --git a/it/go/go.mod b/it/go/go.mod index f85968410d..c376a2fa48 100644 --- a/it/go/go.mod +++ b/it/go/go.mod @@ -3,37 +3,37 @@ module integrationtest go 1.20 require ( - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 - github.com/microsoft/kiota-abstractions-go v1.5.0 - github.com/microsoft/kiota-authentication-azure-go v1.0.1 - github.com/microsoft/kiota-http-go v1.1.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 + github.com/microsoft/kiota-abstractions-go v1.6.0 + github.com/microsoft/kiota-authentication-azure-go v1.0.2 + github.com/microsoft/kiota-http-go v1.3.3 github.com/microsoft/kiota-serialization-form-go v1.0.0 - github.com/microsoft/kiota-serialization-json-go v1.0.4 + github.com/microsoft/kiota-serialization-json-go v1.0.7 github.com/microsoft/kiota-serialization-multipart-go v1.0.0 github.com/microsoft/kiota-serialization-text-go v1.0.0 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.10.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect github.com/cjlapao/common-go v0.0.39 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.1.0 // indirect - github.com/google/uuid v1.4.0 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/std-uritemplate/std-uritemplate/go v0.0.46 // indirect - github.com/stretchr/testify v1.8.4 // indirect - go.opentelemetry.io/otel v1.20.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect - golang.org/x/crypto v0.15.0 // indirect - golang.org/x/net v0.18.0 // indirect - golang.org/x/sys v0.14.0 // indirect + github.com/std-uritemplate/std-uritemplate/go v0.0.55 // indirect + github.com/stretchr/testify v1.9.0 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/it/go/go.sum b/it/go/go.sum index be4954b5c8..2943be1ea8 100644 --- a/it/go/go.sum +++ b/it/go/go.sum @@ -1,65 +1,65 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 h1:fb8kj/Dh4CSwgsOzHeZY4Xh68cFVbzXx+ONXGMY//4w= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0/go.mod h1:uReU2sSxZExRPBAg3qKzmAucSi51+SP1OhohieR821Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 h1:BMAjVKJM0U/CYF27gA0ZMmXGkOcvfFtD0oHVZ1TIPRI= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0/go.mod h1:1fXstnBMas5kzG+S3q8UoJcmyU6nUeunJcMDHcRYHhs= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 h1:d81/ng9rET2YqdVkVwkb6EXeRrLJIwyGnJcAlAWKwhs= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.0 h1:hVeq+yCyUi+MsoO/CU95yqCIcdzra5ovzk8Q2BBpV2M= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.0/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.10.0 h1:n1DH8TPV4qqPTje2RcUBYwtrTWlabVp4n46+74X2pn4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.10.0/go.mod h1:HDcZnuGbiyppErN6lB+idp4CKhjbc8gwjto6OPpyggM= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 h1:sO0/P7g68FrryJzljemN+6GTssUXdANk6aJ7T1ZxnsQ= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1/go.mod h1:h8hyGFDsU5HMivxiS2iYFZsgDbU9OnnJ163x5UGVKYo= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/cjlapao/common-go v0.0.39 h1:bAAUrj2B9v0kMzbAOhzjSmiyDy+rd56r2sy7oEiQLlA= github.com/cjlapao/common-go v0.0.39/go.mod h1:M3dzazLjTjEtZJbbxoA5ZDiGCiHmpwqW9l4UWaddwOA= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang-jwt/jwt/v5 v5.1.0 h1:UGKbA/IPjtS6zLcdB7i5TyACMgSbOTiR8qzXgw8HWQU= -github.com/golang-jwt/jwt/v5 v5.1.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= -github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/microsoft/kiota-abstractions-go v1.5.0 h1:CD36eKsJ6NZLLu6LS5UqDPApIkrZEq2L7E0Uw/CTKzc= -github.com/microsoft/kiota-abstractions-go v1.5.0/go.mod h1:NRJnAFg8qqOoX/VQWTe3ZYmcIbLa20LNC+eTqO2j60U= -github.com/microsoft/kiota-authentication-azure-go v1.0.1 h1:F4HH+2QQHSecQg50gVEZaUcxA8/XxCaC2oOMYv2gTIM= -github.com/microsoft/kiota-authentication-azure-go v1.0.1/go.mod h1:IbifJeoi+sULI0vjnsWYSmDu5atFo/4FZ6WCoAkPjsc= -github.com/microsoft/kiota-http-go v1.1.0 h1:L5I93EiNtlP/X6YzeTlhjWt7Q1DxzC9CmWSVtX3b0tE= -github.com/microsoft/kiota-http-go v1.1.0/go.mod h1:zESUM6ovki9LEupqziCbxJ+FAYoF0dFDYZVpOkAfSLc= +github.com/microsoft/kiota-abstractions-go v1.6.0 h1:qbGBNMU0/o5myKbikCBXJFohVCFrrpx2cO15Rta2WyA= +github.com/microsoft/kiota-abstractions-go v1.6.0/go.mod h1:7YH20ZbRWXGfHSSvdHkdztzgCB9mRdtFx13+hrYIEpo= +github.com/microsoft/kiota-authentication-azure-go v1.0.2 h1:tClGeyFZJ+4Bakf8u0euPM4wqy4ethycdOgx3jyH3pI= +github.com/microsoft/kiota-authentication-azure-go v1.0.2/go.mod h1:aTcti0bUJEcq7kBfQG4Sr4ElvRNuaalXcFEu4iEyQ6M= +github.com/microsoft/kiota-http-go v1.3.3 h1:FKjK5BLFONu5eIBxtrkirkixFQmcPwitZ8iwZHKbESo= +github.com/microsoft/kiota-http-go v1.3.3/go.mod h1:IWw/PwtBs/GYz+Pa75gPW7MFNFv0aKPFsLw5WqzL1SE= github.com/microsoft/kiota-serialization-form-go v1.0.0 h1:UNdrkMnLFqUCccQZerKjblsyVgifS11b3WCx+eFEsAI= github.com/microsoft/kiota-serialization-form-go v1.0.0/go.mod h1:h4mQOO6KVTNciMF6azi1J9QB19ujSw3ULKcSNyXXOMA= -github.com/microsoft/kiota-serialization-json-go v1.0.4 h1:5TaISWwd2Me8clrK7SqNATo0tv9seOq59y4I5953egQ= -github.com/microsoft/kiota-serialization-json-go v1.0.4/go.mod h1:rM4+FsAY+9AEpBsBzkFFis+b/LZLlNKKewuLwK9Q6Mg= +github.com/microsoft/kiota-serialization-json-go v1.0.7 h1:yMbckSTPrjZdM4EMXgzLZSA3CtDaUBI350u0VoYRz7Y= +github.com/microsoft/kiota-serialization-json-go v1.0.7/go.mod h1:1krrY7DYl3ivPIzl4xTaBpew6akYNa8/Tal8g+kb0cc= github.com/microsoft/kiota-serialization-multipart-go v1.0.0 h1:3O5sb5Zj+moLBiJympbXNaeV07K0d46IfuEd5v9+pBs= github.com/microsoft/kiota-serialization-multipart-go v1.0.0/go.mod h1:yauLeBTpANk4L03XD985akNysG24SnRJGaveZf+p4so= github.com/microsoft/kiota-serialization-text-go v1.0.0 h1:XOaRhAXy+g8ZVpcq7x7a0jlETWnWrEum0RhmbYrTFnA= github.com/microsoft/kiota-serialization-text-go v1.0.0/go.mod h1:sM1/C6ecnQ7IquQOGUrUldaO5wj+9+v7G2W3sQ3fy6M= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/std-uritemplate/std-uritemplate/go v0.0.46 h1:rWcEym/hz9YhPTXJELTXfrq48lTx69jNVhv+dOMmyZY= -github.com/std-uritemplate/std-uritemplate/go v0.0.46/go.mod h1:Qov4Ay4U83j37XjgxMYevGJFLbnZ2o9cEOhGufBKgKY= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= -go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= -go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= -go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= -go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= -go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= -golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= -golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= -golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= -golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +github.com/std-uritemplate/std-uritemplate/go v0.0.55 h1:muSH037g97K7U2f94G9LUuE8tZlJsoSSrPsO9V281WY= +github.com/std-uritemplate/std-uritemplate/go v0.0.55/go.mod h1:rG/bqh/ThY4xE5de7Rap3vaDkYUT76B0GPJ0loYeTTc= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= +go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= +go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/it/java/basic/pom.xml b/it/java/basic/pom.xml index 88757938f6..6f1bad14e6 100644 --- a/it/java/basic/pom.xml +++ b/it/java/basic/pom.xml @@ -15,7 +15,7 @@ UTF-8 UTF-8 - 0.12.1 + 1.1.1 diff --git a/it/java/gh/pom.xml b/it/java/gh/pom.xml index 641d5bdc48..4dae43e904 100644 --- a/it/java/gh/pom.xml +++ b/it/java/gh/pom.xml @@ -15,7 +15,7 @@ UTF-8 UTF-8 - 0.12.1 + 1.1.1 diff --git a/it/java/pom.xml b/it/java/pom.xml index f7135ceb7e..990679bc97 100644 --- a/it/java/pom.xml +++ b/it/java/pom.xml @@ -15,7 +15,7 @@ UTF-8 UTF-8 - 0.12.1 + 1.1.1 diff --git a/it/java/query-params/pom.xml b/it/java/query-params/pom.xml index 88757938f6..6f1bad14e6 100644 --- a/it/java/query-params/pom.xml +++ b/it/java/query-params/pom.xml @@ -15,7 +15,7 @@ UTF-8 UTF-8 - 0.12.1 + 1.1.1