-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ffa1ea3
commit 242de30
Showing
6 changed files
with
541 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
...apper.FartingUnicorn.Tests.SingleField.IntType.NonNullableNonOptional_Tests.BlogPost.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using DotNetThoughts.Results; | ||
using System.Text.Json; | ||
|
||
namespace FartingUnicorn.Generated; | ||
|
||
public static partial class Mappers | ||
{ | ||
public static Result<FartingUnicorn.Tests.SingleField.IntType.NonNullableNonOptional_Tests.BlogPost> MapToFartingUnicorn_Tests_SingleField_IntType_NonNullableNonOptional_Tests_BlogPost(JsonElement jsonElement, string[] path = null) | ||
{ | ||
if(path is null) | ||
{ | ||
path = ["$"]; | ||
} | ||
/*object*/ | ||
{ | ||
if (jsonElement.ValueKind != JsonValueKind.Object) | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.IntType.NonNullableNonOptional_Tests.BlogPost>.Error(new ValueHasWrongTypeError(path, "Object", jsonElement.ValueKind.ToString())); | ||
} | ||
} | ||
var obj = new FartingUnicorn.Tests.SingleField.IntType.NonNullableNonOptional_Tests.BlogPost(); | ||
|
||
List<IError> errors = new(); | ||
var isRatingPropertyDefined = jsonElement.TryGetProperty("Rating", out var jsonRatingProperty); | ||
if (isRatingPropertyDefined) | ||
{ | ||
// type = Int32, isOption = False, isNullable = False | ||
if (jsonRatingProperty.ValueKind == JsonValueKind.Null) | ||
{ | ||
errors.Add(new RequiredValueMissingError([.. path, "Rating"])); | ||
} | ||
else if (jsonRatingProperty.ValueKind == JsonValueKind.Number) | ||
{ | ||
obj.Rating = jsonRatingProperty.GetInt32(); | ||
} | ||
else | ||
{ | ||
errors.Add(new ValueHasWrongTypeError([.. path, "Rating"], "Number", jsonRatingProperty.ValueKind.ToString())); | ||
} | ||
} | ||
else | ||
{ | ||
errors.Add(new RequiredPropertyMissingError([.. path, "Rating"])); | ||
} | ||
if(errors.Any()) | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.IntType.NonNullableNonOptional_Tests.BlogPost>.Error(errors); | ||
} | ||
if(false)/*check if is option*/ | ||
{ | ||
} | ||
else | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.IntType.NonNullableNonOptional_Tests.BlogPost>.Ok(obj); | ||
} | ||
throw new NotImplementedException(); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...r/Mapper.FartingUnicorn.Tests.SingleField.IntType.NonNullableOptional_Tests.BlogPost.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using DotNetThoughts.Results; | ||
using System.Text.Json; | ||
|
||
namespace FartingUnicorn.Generated; | ||
|
||
public static partial class Mappers | ||
{ | ||
public static Result<FartingUnicorn.Tests.SingleField.IntType.NonNullableOptional_Tests.BlogPost> MapToFartingUnicorn_Tests_SingleField_IntType_NonNullableOptional_Tests_BlogPost(JsonElement jsonElement, string[] path = null) | ||
{ | ||
if(path is null) | ||
{ | ||
path = ["$"]; | ||
} | ||
/*object*/ | ||
{ | ||
if (jsonElement.ValueKind != JsonValueKind.Object) | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.IntType.NonNullableOptional_Tests.BlogPost>.Error(new ValueHasWrongTypeError(path, "Object", jsonElement.ValueKind.ToString())); | ||
} | ||
} | ||
var obj = new FartingUnicorn.Tests.SingleField.IntType.NonNullableOptional_Tests.BlogPost(); | ||
|
||
List<IError> errors = new(); | ||
var isRatingPropertyDefined = jsonElement.TryGetProperty("Rating", out var jsonRatingProperty); | ||
if (isRatingPropertyDefined) | ||
{ | ||
// type = Int32, isOption = True, isNullable = False | ||
if (jsonRatingProperty.ValueKind == JsonValueKind.Null) | ||
{ | ||
obj.Rating = new None<Int32>(); | ||
} | ||
else if (jsonRatingProperty.ValueKind == JsonValueKind.Number) | ||
{ | ||
obj.Rating = new Some<int>(jsonRatingProperty.GetInt32()); | ||
} | ||
else | ||
{ | ||
errors.Add(new ValueHasWrongTypeError([.. path, "Rating"], "Number", jsonRatingProperty.ValueKind.ToString())); | ||
} | ||
} | ||
else | ||
{ | ||
errors.Add(new RequiredPropertyMissingError([.. path, "Rating"])); | ||
} | ||
if(errors.Any()) | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.IntType.NonNullableOptional_Tests.BlogPost>.Error(errors); | ||
} | ||
if(false)/*check if is option*/ | ||
{ | ||
} | ||
else | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.IntType.NonNullableOptional_Tests.BlogPost>.Ok(obj); | ||
} | ||
throw new NotImplementedException(); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...r/Mapper.FartingUnicorn.Tests.SingleField.IntType.NullableNonOptional_Tests.BlogPost.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using DotNetThoughts.Results; | ||
using System.Text.Json; | ||
|
||
namespace FartingUnicorn.Generated; | ||
|
||
public static partial class Mappers | ||
{ | ||
public static Result<FartingUnicorn.Tests.SingleField.IntType.NullableNonOptional_Tests.BlogPost> MapToFartingUnicorn_Tests_SingleField_IntType_NullableNonOptional_Tests_BlogPost(JsonElement jsonElement, string[] path = null) | ||
{ | ||
if(path is null) | ||
{ | ||
path = ["$"]; | ||
} | ||
/*object*/ | ||
{ | ||
if (jsonElement.ValueKind != JsonValueKind.Object) | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.IntType.NullableNonOptional_Tests.BlogPost>.Error(new ValueHasWrongTypeError(path, "Object", jsonElement.ValueKind.ToString())); | ||
} | ||
} | ||
var obj = new FartingUnicorn.Tests.SingleField.IntType.NullableNonOptional_Tests.BlogPost(); | ||
|
||
List<IError> errors = new(); | ||
var isRatingPropertyDefined = jsonElement.TryGetProperty("Rating", out var jsonRatingProperty); | ||
if (isRatingPropertyDefined) | ||
{ | ||
// type = Int32, isOption = False, isNullable = True | ||
if (jsonRatingProperty.ValueKind == JsonValueKind.Null) | ||
{ | ||
errors.Add(new RequiredValueMissingError([.. path, "Rating"])); | ||
} | ||
else if (jsonRatingProperty.ValueKind == JsonValueKind.Number) | ||
{ | ||
obj.Rating = jsonRatingProperty.GetInt32(); | ||
} | ||
else | ||
{ | ||
errors.Add(new ValueHasWrongTypeError([.. path, "Rating"], "Number", jsonRatingProperty.ValueKind.ToString())); | ||
} | ||
} | ||
else | ||
{ | ||
obj.Rating = null; | ||
} | ||
if(errors.Any()) | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.IntType.NullableNonOptional_Tests.BlogPost>.Error(errors); | ||
} | ||
if(false)/*check if is option*/ | ||
{ | ||
} | ||
else | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.IntType.NullableNonOptional_Tests.BlogPost>.Ok(obj); | ||
} | ||
throw new NotImplementedException(); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...ator/Mapper.FartingUnicorn.Tests.SingleField.IntType.NullableOptional_Tests.BlogPost.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using DotNetThoughts.Results; | ||
using System.Text.Json; | ||
|
||
namespace FartingUnicorn.Generated; | ||
|
||
public static partial class Mappers | ||
{ | ||
public static Result<FartingUnicorn.Tests.SingleField.IntType.NullableOptional_Tests.BlogPost> MapToFartingUnicorn_Tests_SingleField_IntType_NullableOptional_Tests_BlogPost(JsonElement jsonElement, string[] path = null) | ||
{ | ||
if(path is null) | ||
{ | ||
path = ["$"]; | ||
} | ||
/*object*/ | ||
{ | ||
if (jsonElement.ValueKind != JsonValueKind.Object) | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.IntType.NullableOptional_Tests.BlogPost>.Error(new ValueHasWrongTypeError(path, "Object", jsonElement.ValueKind.ToString())); | ||
} | ||
} | ||
var obj = new FartingUnicorn.Tests.SingleField.IntType.NullableOptional_Tests.BlogPost(); | ||
|
||
List<IError> errors = new(); | ||
var isRatingPropertyDefined = jsonElement.TryGetProperty("Rating", out var jsonRatingProperty); | ||
if (isRatingPropertyDefined) | ||
{ | ||
// type = Int32, isOption = True, isNullable = True | ||
if (jsonRatingProperty.ValueKind == JsonValueKind.Null) | ||
{ | ||
obj.Rating = new None<Int32>(); | ||
} | ||
else if (jsonRatingProperty.ValueKind == JsonValueKind.Number) | ||
{ | ||
obj.Rating = new Some<int>(jsonRatingProperty.GetInt32()); | ||
} | ||
else | ||
{ | ||
errors.Add(new ValueHasWrongTypeError([.. path, "Rating"], "Number", jsonRatingProperty.ValueKind.ToString())); | ||
} | ||
} | ||
else | ||
{ | ||
obj.Rating = null; | ||
} | ||
if(errors.Any()) | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.IntType.NullableOptional_Tests.BlogPost>.Error(errors); | ||
} | ||
if(false)/*check if is option*/ | ||
{ | ||
} | ||
else | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.IntType.NullableOptional_Tests.BlogPost>.Ok(obj); | ||
} | ||
throw new NotImplementedException(); | ||
} | ||
} |
Oops, something went wrong.