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 12, 2021
1 parent e40315d commit ec08028
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Ruby JSON serialization #429

### Changed

- Fixed #428 a bug where inline double defintion would make code dom generation fail

## [0.0.7] - 2021-08-04

### Added
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 ec08028

Please sign in to comment.