From 3956839c365405dbdce151c7f6594aece55f2a85 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 12 Aug 2021 09:32:41 -0400 Subject: [PATCH] - fixes #428 a bug where inline double defintion would make dom generation fail --- CHANGELOG.md | 1 + src/Kiota.Builder/KiotaBuilder.cs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f76c4398e3..60913b40cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed a bug where raw collections requests would not be supported #467 - Fixes a bug where in memory backing store would not return changed properties to null #243 - Fixes a bug where generated models would be tied to a specific backing store implementation #400 +- Fixed #428 a bug where inline double defintion would make code dom generation fail ## [0.0.7] - 2021-08-04 diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 45d1c37ece..16c3a6ea9f 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -485,6 +485,8 @@ private CodeProperty CreateProperty(string childIdentifier, string childType, Co private static HashSet typeNamesToSkip = new() {"object", "array"}; private static CodeType GetPrimitiveType(CodeElement parent, OpenApiSchema typeSchema, string childType) { var typeNames = new List{typeSchema?.Items?.Type, childType, typeSchema?.Type}; + if(typeSchema?.AnyOf?.Any() ?? false) + typeNames.AddRange(typeSchema.AnyOf.Select(x => x.Type)); // double is sometimes an anyof string, number and enum // first value that's not null, and not "object" for primitive collections, the items type matters var typeName = typeNames.FirstOrDefault(x => !string.IsNullOrEmpty(x) && !typeNamesToSkip.Contains(x));