Skip to content

Commit

Permalink
- fixes #428 a bug where inline double defintion would make dom gener…
Browse files Browse the repository at this point in the history
…ation fail
  • Loading branch information
baywet committed Aug 13, 2021
1 parent 872d443 commit e778f7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Fixed a bug where raw collections requests would not be supported #467
- Fixed #428 a bug where inline double defintion would make code dom generation fail

## [0.0.7] - 2021-08-04

Expand Down
2 changes: 2 additions & 0 deletions src/Kiota.Builder/KiotaBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ private CodeProperty CreateProperty(string childIdentifier, string childType, Co
private static HashSet<string> typeNamesToSkip = new() {"object", "array"};
private static CodeType GetPrimitiveType(CodeElement parent, OpenApiSchema typeSchema, string childType) {
var typeNames = new List<string>{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));

Expand Down

0 comments on commit e778f7e

Please sign in to comment.