forked from loafle/openapi-generator-original
* Output DateOnly in the correct default format * Only add conditional if we are net60 or later * Update samples
This commit is contained in:
parent
fce8bb9604
commit
c7d9857c8d
@ -114,6 +114,14 @@ namespace {{packageName}}.Client
|
|||||||
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
||||||
// For example: 2009-06-15T13:45:30.0000000
|
// For example: 2009-06-15T13:45:30.0000000
|
||||||
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
||||||
|
{{#net60OrLater}}
|
||||||
|
if (obj is DateOnly dateOnly)
|
||||||
|
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
|
||||||
|
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
|
||||||
|
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
||||||
|
// For example: 2009-06-15
|
||||||
|
return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
||||||
|
{{/net60OrLater}}
|
||||||
if (obj is bool boolean)
|
if (obj is bool boolean)
|
||||||
return boolean ? "true" : "false";
|
return boolean ? "true" : "false";
|
||||||
if (obj is ICollection collection) {
|
if (obj is ICollection collection) {
|
||||||
|
@ -101,6 +101,12 @@ namespace Org.OpenAPITools.Client
|
|||||||
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
||||||
// For example: 2009-06-15T13:45:30.0000000
|
// For example: 2009-06-15T13:45:30.0000000
|
||||||
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
||||||
|
if (obj is DateOnly dateOnly)
|
||||||
|
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
|
||||||
|
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
|
||||||
|
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
||||||
|
// For example: 2009-06-15
|
||||||
|
return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
||||||
if (obj is bool boolean)
|
if (obj is bool boolean)
|
||||||
return boolean ? "true" : "false";
|
return boolean ? "true" : "false";
|
||||||
if (obj is ICollection collection) {
|
if (obj is ICollection collection) {
|
||||||
|
@ -100,6 +100,12 @@ namespace Org.OpenAPITools.Client
|
|||||||
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
||||||
// For example: 2009-06-15T13:45:30.0000000
|
// For example: 2009-06-15T13:45:30.0000000
|
||||||
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
||||||
|
if (obj is DateOnly dateOnly)
|
||||||
|
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
|
||||||
|
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
|
||||||
|
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
||||||
|
// For example: 2009-06-15
|
||||||
|
return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
||||||
if (obj is bool boolean)
|
if (obj is bool boolean)
|
||||||
return boolean ? "true" : "false";
|
return boolean ? "true" : "false";
|
||||||
if (obj is ICollection collection) {
|
if (obj is ICollection collection) {
|
||||||
|
@ -116,6 +116,12 @@ namespace Org.OpenAPITools.Client
|
|||||||
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
||||||
// For example: 2009-06-15T13:45:30.0000000
|
// For example: 2009-06-15T13:45:30.0000000
|
||||||
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
||||||
|
if (obj is DateOnly dateOnly)
|
||||||
|
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
|
||||||
|
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
|
||||||
|
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
||||||
|
// For example: 2009-06-15
|
||||||
|
return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
||||||
if (obj is bool boolean)
|
if (obj is bool boolean)
|
||||||
return boolean ? "true" : "false";
|
return boolean ? "true" : "false";
|
||||||
if (obj is ICollection collection) {
|
if (obj is ICollection collection) {
|
||||||
|
@ -116,6 +116,12 @@ namespace Org.OpenAPITools.Client
|
|||||||
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
||||||
// For example: 2009-06-15T13:45:30.0000000
|
// For example: 2009-06-15T13:45:30.0000000
|
||||||
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
||||||
|
if (obj is DateOnly dateOnly)
|
||||||
|
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
|
||||||
|
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
|
||||||
|
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
||||||
|
// For example: 2009-06-15
|
||||||
|
return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
||||||
if (obj is bool boolean)
|
if (obj is bool boolean)
|
||||||
return boolean ? "true" : "false";
|
return boolean ? "true" : "false";
|
||||||
if (obj is ICollection collection) {
|
if (obj is ICollection collection) {
|
||||||
|
@ -100,6 +100,12 @@ namespace Org.OpenAPITools.Client
|
|||||||
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
||||||
// For example: 2009-06-15T13:45:30.0000000
|
// For example: 2009-06-15T13:45:30.0000000
|
||||||
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
||||||
|
if (obj is DateOnly dateOnly)
|
||||||
|
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
|
||||||
|
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
|
||||||
|
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
||||||
|
// For example: 2009-06-15
|
||||||
|
return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
||||||
if (obj is bool boolean)
|
if (obj is bool boolean)
|
||||||
return boolean ? "true" : "false";
|
return boolean ? "true" : "false";
|
||||||
if (obj is ICollection collection) {
|
if (obj is ICollection collection) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user