-
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
59edee0
commit c9fe3f4
Showing
8 changed files
with
248 additions
and
12 deletions.
There are no files selected for viewing
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
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
58 changes: 58 additions & 0 deletions
58
...er.FartingUnicorn.Tests.SingleField.StringType.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.StringType.NonNullableNonOptional_Tests.BlogPost> MapToFartingUnicorn_Tests_SingleField_StringType_NonNullableNonOptional_Tests_BlogPost(JsonElement jsonElement, string[] path = null) | ||
{ | ||
if(path is null) | ||
{ | ||
path = ["$"]; | ||
} | ||
/*object*/ | ||
{ | ||
if (jsonElement.ValueKind != JsonValueKind.Object) | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.StringType.NonNullableNonOptional_Tests.BlogPost>.Error(new ValueHasWrongTypeError(path, "Object", jsonElement.ValueKind.ToString())); | ||
} | ||
} | ||
var obj = new FartingUnicorn.Tests.SingleField.StringType.NonNullableNonOptional_Tests.BlogPost(); | ||
|
||
List<IError> errors = new(); | ||
var isTitlePropertyDefined = jsonElement.TryGetProperty("Title", out var jsonTitleProperty); | ||
if (isTitlePropertyDefined) | ||
{ | ||
// type = String, isOption = False, isNullable = False | ||
if (jsonTitleProperty.ValueKind == JsonValueKind.Null) | ||
{ | ||
errors.Add(new RequiredValueMissingError([.. path, "Title"])); | ||
} | ||
else if (jsonTitleProperty.ValueKind == JsonValueKind.String) | ||
{ | ||
obj.Title = jsonTitleProperty.GetString(); | ||
} | ||
else | ||
{ | ||
errors.Add(new ValueHasWrongTypeError([.. path, "Title"], "String", jsonTitleProperty.ValueKind.ToString())); | ||
} | ||
} | ||
else | ||
{ | ||
errors.Add(new RequiredPropertyMissingError([.. path, "Title"])); | ||
} | ||
if(errors.Any()) | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.StringType.NonNullableNonOptional_Tests.BlogPost>.Error(errors); | ||
} | ||
if(false)/*check if is option*/ | ||
{ | ||
} | ||
else | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.StringType.NonNullableNonOptional_Tests.BlogPost>.Ok(obj); | ||
} | ||
throw new NotImplementedException(); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...apper.FartingUnicorn.Tests.SingleField.StringType.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.StringType.NonNullableOptional_Tests.BlogPost> MapToFartingUnicorn_Tests_SingleField_StringType_NonNullableOptional_Tests_BlogPost(JsonElement jsonElement, string[] path = null) | ||
{ | ||
if(path is null) | ||
{ | ||
path = ["$"]; | ||
} | ||
/*object*/ | ||
{ | ||
if (jsonElement.ValueKind != JsonValueKind.Object) | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.StringType.NonNullableOptional_Tests.BlogPost>.Error(new ValueHasWrongTypeError(path, "Object", jsonElement.ValueKind.ToString())); | ||
} | ||
} | ||
var obj = new FartingUnicorn.Tests.SingleField.StringType.NonNullableOptional_Tests.BlogPost(); | ||
|
||
List<IError> errors = new(); | ||
var isTitlePropertyDefined = jsonElement.TryGetProperty("Title", out var jsonTitleProperty); | ||
if (isTitlePropertyDefined) | ||
{ | ||
// type = String, isOption = True, isNullable = False | ||
if (jsonTitleProperty.ValueKind == JsonValueKind.Null) | ||
{ | ||
obj.Title = new None<String>(); | ||
} | ||
else if (jsonTitleProperty.ValueKind == JsonValueKind.String) | ||
{ | ||
obj.Title = new Some<string>(jsonTitleProperty.GetString()); | ||
} | ||
else | ||
{ | ||
errors.Add(new ValueHasWrongTypeError([.. path, "Title"], "String", jsonTitleProperty.ValueKind.ToString())); | ||
} | ||
} | ||
else | ||
{ | ||
errors.Add(new RequiredPropertyMissingError([.. path, "Title"])); | ||
} | ||
if(errors.Any()) | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.StringType.NonNullableOptional_Tests.BlogPost>.Error(errors); | ||
} | ||
if(false)/*check if is option*/ | ||
{ | ||
} | ||
else | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.StringType.NonNullableOptional_Tests.BlogPost>.Ok(obj); | ||
} | ||
throw new NotImplementedException(); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...apper.FartingUnicorn.Tests.SingleField.StringType.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.StringType.NullableNonOptional_Tests.BlogPost> MapToFartingUnicorn_Tests_SingleField_StringType_NullableNonOptional_Tests_BlogPost(JsonElement jsonElement, string[] path = null) | ||
{ | ||
if(path is null) | ||
{ | ||
path = ["$"]; | ||
} | ||
/*object*/ | ||
{ | ||
if (jsonElement.ValueKind != JsonValueKind.Object) | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.StringType.NullableNonOptional_Tests.BlogPost>.Error(new ValueHasWrongTypeError(path, "Object", jsonElement.ValueKind.ToString())); | ||
} | ||
} | ||
var obj = new FartingUnicorn.Tests.SingleField.StringType.NullableNonOptional_Tests.BlogPost(); | ||
|
||
List<IError> errors = new(); | ||
var isTitlePropertyDefined = jsonElement.TryGetProperty("Title", out var jsonTitleProperty); | ||
if (isTitlePropertyDefined) | ||
{ | ||
// type = String, isOption = False, isNullable = True | ||
if (jsonTitleProperty.ValueKind == JsonValueKind.Null) | ||
{ | ||
errors.Add(new RequiredValueMissingError([.. path, "Title"])); | ||
} | ||
else if (jsonTitleProperty.ValueKind == JsonValueKind.String) | ||
{ | ||
obj.Title = jsonTitleProperty.GetString(); | ||
} | ||
else | ||
{ | ||
errors.Add(new ValueHasWrongTypeError([.. path, "Title"], "String", jsonTitleProperty.ValueKind.ToString())); | ||
} | ||
} | ||
else | ||
{ | ||
obj.Title = null; | ||
} | ||
if(errors.Any()) | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.StringType.NullableNonOptional_Tests.BlogPost>.Error(errors); | ||
} | ||
if(false)/*check if is option*/ | ||
{ | ||
} | ||
else | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.StringType.NullableNonOptional_Tests.BlogPost>.Ok(obj); | ||
} | ||
throw new NotImplementedException(); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...r/Mapper.FartingUnicorn.Tests.SingleField.StringType.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.StringType.NullableOptional_Tests.BlogPost> MapToFartingUnicorn_Tests_SingleField_StringType_NullableOptional_Tests_BlogPost(JsonElement jsonElement, string[] path = null) | ||
{ | ||
if(path is null) | ||
{ | ||
path = ["$"]; | ||
} | ||
/*object*/ | ||
{ | ||
if (jsonElement.ValueKind != JsonValueKind.Object) | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.StringType.NullableOptional_Tests.BlogPost>.Error(new ValueHasWrongTypeError(path, "Object", jsonElement.ValueKind.ToString())); | ||
} | ||
} | ||
var obj = new FartingUnicorn.Tests.SingleField.StringType.NullableOptional_Tests.BlogPost(); | ||
|
||
List<IError> errors = new(); | ||
var isTitlePropertyDefined = jsonElement.TryGetProperty("Title", out var jsonTitleProperty); | ||
if (isTitlePropertyDefined) | ||
{ | ||
// type = String, isOption = True, isNullable = True | ||
if (jsonTitleProperty.ValueKind == JsonValueKind.Null) | ||
{ | ||
obj.Title = new None<String>(); | ||
} | ||
else if (jsonTitleProperty.ValueKind == JsonValueKind.String) | ||
{ | ||
obj.Title = new Some<string>(jsonTitleProperty.GetString()); | ||
} | ||
else | ||
{ | ||
errors.Add(new ValueHasWrongTypeError([.. path, "Title"], "String", jsonTitleProperty.ValueKind.ToString())); | ||
} | ||
} | ||
else | ||
{ | ||
obj.Title = null; | ||
} | ||
if(errors.Any()) | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.StringType.NullableOptional_Tests.BlogPost>.Error(errors); | ||
} | ||
if(false)/*check if is option*/ | ||
{ | ||
} | ||
else | ||
{ | ||
return Result<FartingUnicorn.Tests.SingleField.StringType.NullableOptional_Tests.BlogPost>.Ok(obj); | ||
} | ||
throw new NotImplementedException(); | ||
} | ||
} |
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
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