[CSharp] feat!: add useDateOnly flag (#17471)

* feat: DateOnly for client

* fix: generated doc for csharp

* doc: fix generators README for csharp

* add DateOnly option for aspnet

* refactor: update csharp docs

* refactor: fix typo

* finish

* finish

* finish

* regenerate

* rebuild and regenerate

* fix build error

* finish

* revert path

* regenerate

* remove exceed samples

* regenerate

* add DateOnly to nullable

* remove obsolete file from list

* update test files list

* remove obsolete sample build

* revert manual tests

* revert samples to master and regenerate

* remove new samples

* remove eol

* remove eol

* add new specs

* try fix test

* update tests

* update files

* remove eol

* revert

* remove eol

* regenerate

* add net6+ support to aspnetcore

* add jobs
This commit is contained in:
Anakael 2024-01-10 06:34:14 +03:00 committed by GitHub
parent 9b62b9bb05
commit 11caad92df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
189 changed files with 8858 additions and 277 deletions

View File

@ -4,6 +4,7 @@ on:
push:
paths:
- 'samples/client/petstore/csharp/**net6.0**/'
- 'samples/client/petstore/csharp/**net7.0**/'
- 'samples/client/petstore/csharp/OpenAPIClient-generichost-netcore**/'
- 'samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/**'
- 'samples/server/petstore/aspnetcore-6.0/**'
@ -12,6 +13,7 @@ on:
pull_request:
paths:
- 'samples/client/petstore/csharp/**net6.0**/'
- 'samples/client/petstore/csharp/**net7.0**/'
- 'samples/client/petstore/csharp/OpenAPIClient-generichost-netcore**/'
- 'samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/**'
- 'samples/server/petstore/aspnetcore-6.0/**'
@ -35,6 +37,8 @@ jobs:
- samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf
- samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf
- samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests
- samples/client/petstore/csharp/OpenAPIClient-generichost-net7.0-useDateTimeForDate
- samples/client/petstore/csharp/OpenAPIClient-net7.0-useDateTimeForDate
- samples/server/petstore/aspnetcore-6.0
- samples/server/petstore/aspnetcore-6.0-pocoModels
- samples/server/petstore/aspnetcore-6.0-project4Models

View File

@ -0,0 +1,9 @@
# for csharp generichost
generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-generichost-net7.0-useDateTimeForDate
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/dates-api.yaml
library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties:
packageGuid: '{2E60EF87-DB0B-4D01-A36E-F5E90F7EC757}'
useDateTimeForDate: true

View File

@ -0,0 +1,9 @@
# for .net standard
generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-net7.0-useDateTimeForDate
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/dates-api.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties:
packageGuid: '{D0A67E81-4061-48EB-B4B8-C73BDF8B2D95}'
targetFramework: net7.0
useDateTimeForDate: true

View File

@ -12,7 +12,7 @@ The following generators are available:
* [cpp-restsdk](cpp-restsdk.md)
* [cpp-tizen](cpp-tizen.md)
* [csharp](csharp.md)
* [csharp-netcore](csharp-netcore.md)
* [csharp-functions](csharp-functions.md)
* [dart](dart.md)
* [dart-dio](dart-dio.md)
* [eiffel](eiffel.md)

View File

@ -47,6 +47,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sourceFolder|source folder for generated code| |src|
|swashbuckleVersion|Swashbuckle version: 3.0.0 (deprecated), 4.0.0 (deprecated), 5.0.0 (deprecated), 6.4.0|<dl><dt>**3.0.0**</dt><dd>Swashbuckle 3.0.0</dd><dt>**4.0.0**</dt><dd>Swashbuckle 4.0.0</dd><dt>**5.0.0**</dt><dd>Swashbuckle 5.0.0</dd><dt>**6.4.0**</dt><dd>Swashbuckle 6.4.0</dd></dl>|3.0.0|
|useCollection|Deserialize array types to Collection&lt;T&gt; instead of List&lt;T&gt;.| |false|
|useDateTimeForDate|Use DateTime to model date properties even if DateOnly supported. (.net 6.0+ only)| |false|
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|useDefaultRouting|Use default routing for the ASP.NET Core version.| |true|
|useFrameworkReference|Use frameworkReference for ASP.NET Core 3.0+ and PackageReference ASP.NET Core 2.2 or earlier.| |false|
@ -74,6 +75,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul">
<li>Boolean</li>
<li>Collection</li>
<li>DateOnly</li>
<li>DateOnly?</li>
<li>DateTime</li>
<li>DateTime?</li>
<li>DateTimeOffset</li>

View File

@ -44,6 +44,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src|
|useCollection|Deserialize array types to Collection&lt;T&gt; instead of List&lt;T&gt;.| |false|
|useDateTimeForDate|Use DateTime to model date properties even if DateOnly supported. (.net 6.0+ only)| |false|
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|useNewtonsoft|Uses the Newtonsoft JSON library.| |true|
@ -67,6 +68,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul">
<li>Boolean</li>
<li>Collection</li>
<li>DateOnly</li>
<li>DateOnly?</li>
<li>DateTime</li>
<li>DateTime?</li>
<li>DateTimeOffset</li>

View File

@ -47,6 +47,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sourceFolder|source folder for generated code| |src|
|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.1`|<dl><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3</dd><dt>**netstandard1.4**</dt><dd>.NET Standard 1.4</dd><dt>**netstandard1.5**</dt><dd>.NET Standard 1.5</dd><dt>**netstandard1.6**</dt><dd>.NET Standard 1.6</dd><dt>**netstandard2.0**</dt><dd>.NET Standard 2.0</dd><dt>**netstandard2.1**</dt><dd>.NET Standard 2.1</dd><dt>**net47**</dt><dd>.NET Framework 4.7</dd><dt>**net48**</dt><dd>.NET Framework 4.8</dd><dt>**net6.0**</dt><dd>.NET 6.0 (End of Support 12 November 2024)</dd><dt>**net7.0**</dt><dd>.NET 7.0</dd><dt>**net8.0**</dt><dd>.NET 8.0</dd></dl>|net8.0|
|useCollection|Deserialize array types to Collection&lt;T&gt; instead of List&lt;T&gt;.| |false|
|useDateTimeForDate|Use DateTime to model date properties even if DateOnly supported. (.net 6.0+ only)| |false|
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped.| |false|
|useSourceGeneration|Use source generation where available (only `generichost` library supports this option).| |false|
@ -73,6 +74,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul">
<li>Boolean</li>
<li>Collection</li>
<li>DateOnly</li>
<li>DateOnly?</li>
<li>DateTime</li>
<li>DateTime?</li>
<li>DateTimeOffset</li>

View File

@ -156,6 +156,9 @@ public class CodegenConstants {
public static final String USE_DATETIME_OFFSET = "useDateTimeOffset";
public static final String USE_DATETIME_OFFSET_DESC = "Use DateTimeOffset to model date-time properties";
public static final String USE_DATETIME_FOR_DATE = "useDateTimeForDate";
public static final String USE_DATETIME_FOR_DATE_DESC = "Use DateTime to model date properties even if DateOnly supported. (.net 6.0+ only)";
public static final String ENSURE_UNIQUE_PARAMS = "ensureUniqueParams";
public static final String ENSURE_UNIQUE_PARAMS_DESC = "Whether to ensure parameter names are unique in an operation (rename parameters that are not).";

View File

@ -55,6 +55,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
protected boolean optionalProjectFileFlag = true;
protected boolean optionalMethodArgumentFlag = true;
protected boolean useDateTimeOffsetFlag = false;
protected boolean useDateTimeForDateFlag = false;
protected boolean useCollection = false;
protected boolean returnICollection = false;
protected boolean netCoreProjectFileFlag = false;
@ -186,6 +187,8 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
"DateTime",
"DateTimeOffset?",
"DateTimeOffset",
"DateOnly?",
"DateOnly",
"Boolean",
"Double",
"Decimal",
@ -234,6 +237,11 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
this.setTypeMapping();
}
public void useDateTimeForDate(boolean flag) {
this.useDateTimeForDateFlag = flag;
this.setTypeMapping();
}
@Override
protected void addParentFromContainer(CodegenModel model, Schema schema) {
// we do not want to inherit simply because additionalProperties is true
@ -354,6 +362,13 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
additionalProperties.put(CodegenConstants.USE_DATETIME_OFFSET, useDateTimeOffsetFlag);
}
// {{useDateTimeForDate}}
if (additionalProperties.containsKey(CodegenConstants.USE_DATETIME_FOR_DATE)) {
useDateTimeForDate(convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_DATETIME_FOR_DATE));
} else {
additionalProperties.put(CodegenConstants.USE_DATETIME_FOR_DATE, useDateTimeForDateFlag);
}
if (additionalProperties.containsKey(CodegenConstants.USE_COLLECTION)) {
setUseCollection(convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_COLLECTION));
} else {
@ -1756,6 +1771,12 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
return (this.getValueTypes().contains(var.dataType) || var.isEnum);
}
protected boolean useNet60OrLater() { return false; }
protected boolean useDateOnly() {
return useNet60OrLater() && !useDateTimeForDateFlag;
}
@Override
public void setParameterExampleValue(CodegenParameter p) {
String example;
@ -1820,16 +1841,18 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
}
example = "System.Text.Encoding.ASCII.GetBytes(\"" + escapeText(example) + "\")";
} else if (p.isDate) {
String dateType = typeMapping.get("date");
if (example == null) {
example = "DateTime.Parse(\"2013-10-20\")";
example = dateType + ".Parse(\"2013-10-20\")";
} else {
example = "DateTime.Parse(\"" + example + "\")";
example = dateType + ".Parse(\"" + example + "\")";
}
} else if (p.isDateTime) {
String dateType = typeMapping.get("DateTime");
if (example == null) {
example = "DateTime.Parse(\"2013-10-20T19:20:30+01:00\")";
example = dateType + ".Parse(\"2013-10-20T19:20:30+01:00\")";
} else {
example = "DateTime.Parse(\"" + example + "\")";
example = dateType + ".Parse(\"" + example + "\")";
}
} else if (p.isDecimal) {
if (example == null) {
@ -1993,7 +2016,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
}
protected Set<String> getValueTypes() {
return new HashSet<>(Arrays.asList("decimal", "bool", "int", "uint", "long", "ulong", "float", "double", "DateTime", "DateTimeOffset", "Guid"));
return new HashSet<>(Arrays.asList("decimal", "bool", "int", "uint", "long", "ulong", "float", "double", "DateTime", "DateOnly", "DateTimeOffset", "Guid"));
}
protected void setTypeMapping() {
@ -2012,7 +2035,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
typeMapping.put("decimal", "decimal");
typeMapping.put("BigDecimal", "decimal");
typeMapping.put("DateTime", this.useDateTimeOffsetFlag ? "DateTimeOffset" : "DateTime");
typeMapping.put("date", "DateTime");
typeMapping.put("date", this.useDateOnly() ? "DateOnly" : "DateTime");
typeMapping.put("file", "System.IO.Stream");
typeMapping.put("array", "List");
typeMapping.put("list", "List");

View File

@ -52,6 +52,7 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
public static final String BUILD_TARGET = "buildTarget";
public static final String MODEL_CLASS_MODIFIER = "modelClassModifier";
public static final String TARGET_FRAMEWORK = "targetFramework";
public static final String NET_60_OR_LATER = "net60OrLater";
public static final String PROJECT_SDK = "projectSdk";
public static final String SDK_WEB = "Microsoft.NET.Sdk.Web";
@ -209,6 +210,10 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
CodegenConstants.USE_DATETIME_OFFSET_DESC,
useDateTimeOffsetFlag);
addSwitch(CodegenConstants.USE_DATETIME_FOR_DATE,
CodegenConstants.USE_DATETIME_FOR_DATE_DESC,
useDateTimeForDateFlag);
addSwitch(CodegenConstants.USE_COLLECTION,
CodegenConstants.USE_COLLECTION_DESC,
useCollection);
@ -299,7 +304,7 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
@Override
protected Set<String> getNullableTypes() {
return new HashSet<>(Arrays.asList("decimal", "bool", "int", "uint", "long", "ulong", "float", "double",
"DateTime", "DateTimeOffset", "Guid"));
"DateTime", "DateOnly", "DateTimeOffset", "Guid"));
}
@Override
@ -462,6 +467,11 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
this.setTypeMapping();
}
@Override
protected boolean useNet60OrLater() {
return additionalProperties.containsKey(NET_60_OR_LATER);
}
public void setPackageGuid(String packageGuid) {
this.packageGuid = packageGuid;
}
@ -775,6 +785,20 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
useFrameworkReference = true;
additionalProperties.put(USE_FRAMEWORK_REFERENCE, useFrameworkReference);
additionalProperties.put(TARGET_FRAMEWORK, "net6.0");
} else if (aspnetCoreVersion.getOptValue().startsWith("7.")) {
LOGGER.warn(
"ASP.NET core version is {} so changing to use frameworkReference instead of packageReference ",
aspnetCoreVersion.getOptValue());
useFrameworkReference = true;
additionalProperties.put(USE_FRAMEWORK_REFERENCE, useFrameworkReference);
additionalProperties.put(TARGET_FRAMEWORK, "net7.0");
} else if (aspnetCoreVersion.getOptValue().startsWith("8.")) {
LOGGER.warn(
"ASP.NET core version is {} so changing to use frameworkReference instead of packageReference ",
aspnetCoreVersion.getOptValue());
useFrameworkReference = true;
additionalProperties.put(USE_FRAMEWORK_REFERENCE, useFrameworkReference);
additionalProperties.put(TARGET_FRAMEWORK, "net8.0");
} else {
if (additionalProperties.containsKey(USE_FRAMEWORK_REFERENCE)) {
useFrameworkReference = convertPropertyToBooleanAndWriteBack(USE_FRAMEWORK_REFERENCE);
@ -783,6 +807,17 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
}
additionalProperties.put(TARGET_FRAMEWORK, "netcoreapp" + aspnetCoreVersion);
}
setAddititonalPropertyForFramework();
}
private void setAddititonalPropertyForFramework() {
String targetFramework = ((String)additionalProperties.get(TARGET_FRAMEWORK));
if (targetFramework.startsWith("net6.0") ||
targetFramework.startsWith("net7.0") ||
targetFramework.startsWith("net8.0")) {
additionalProperties.put(NET_60_OR_LATER, true);
}
}
private void setUseNewtonsoft() {

View File

@ -114,6 +114,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
protected boolean supportsAsync = Boolean.TRUE;
protected boolean netStandard = Boolean.FALSE;
protected boolean supportsFileParameters = Boolean.TRUE;
protected boolean supportsDateOnly = Boolean.FALSE;
protected boolean validatable = Boolean.TRUE;
protected boolean equatable = Boolean.FALSE;
@ -264,6 +265,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
CodegenConstants.USE_DATETIME_OFFSET_DESC,
this.useDateTimeOffsetFlag);
addSwitch(CodegenConstants.USE_DATETIME_FOR_DATE,
CodegenConstants.USE_DATETIME_FOR_DATE_DESC,
useDateTimeForDateFlag);
addSwitch(CodegenConstants.USE_COLLECTION,
CodegenConstants.USE_COLLECTION_DESC,
this.useCollection);
@ -359,6 +364,11 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
: new HashSet<>(Arrays.asList("decimal", "bool", "int", "uint", "long", "ulong", "float", "double"));
}
@Override
protected boolean useNet60OrLater() {
return additionalProperties.containsKey(NET_60_OR_LATER);
}
@Override
protected void setTypeMapping() {
super.setTypeMapping();
@ -782,6 +792,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
syncBooleanProperty(additionalProperties, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, this::setUseOneOfDiscriminatorLookup, this.useOneOfDiscriminatorLookup);
syncBooleanProperty(additionalProperties, "supportsFileParameters", this::setSupportsFileParameters, this.supportsFileParameters);
syncBooleanProperty(additionalProperties, "useSourceGeneration", this::setUseSourceGeneration, this.useSourceGeneration);
syncBooleanProperty(additionalProperties, "supportsDateOnly", this::setSupportsDateOnly, this.supportsDateOnly);
final String testPackageName = testPackageName();
String packageFolder = sourceFolder + File.separator + packageName;
@ -843,6 +854,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
}
}
if (useDateOnly()) {
setSupportsDateOnly(true);
additionalProperties.put("supportsDateOnly", true);
}
// include the spec in the output
supportingFiles.add(new SupportingFile("openapi.mustache", "api", "openapi.yaml"));
@ -988,6 +1003,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
supportingFiles.add(new SupportingFile("ApiFactory.mustache", clientPackageDir, "ApiFactory.cs"));
supportingFiles.add(new SupportingFile("DateTimeJsonConverter.mustache", clientPackageDir, "DateTimeJsonConverter.cs"));
supportingFiles.add(new SupportingFile("DateTimeNullableJsonConverter.mustache", clientPackageDir, "DateTimeNullableJsonConverter.cs"));
if (useDateOnly()) {
supportingFiles.add(new SupportingFile("DateOnlyJsonConverter.mustache", clientPackageDir, "DateOnlyJsonConverter.cs"));
supportingFiles.add(new SupportingFile("DateOnlyNullableJsonConverter.mustache", clientPackageDir, "DateOnlyNullableJsonConverter.cs"));
}
supportingFiles.add(new SupportingFile("ApiResponseEventArgs`1.mustache", clientPackageDir, "ApiResponseEventArgs.cs"));
supportingFiles.add(new SupportingFile("ExceptionEventArgs.mustache", clientPackageDir, "ExceptionEventArgs.cs"));
supportingFiles.add(new SupportingFile("JsonSerializerOptionsProvider.mustache", clientPackageDir, "JsonSerializerOptionsProvider.cs"));
@ -1092,6 +1111,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
this.supportsFileParameters = supportsFileParameters;
}
public void setSupportsDateOnly(Boolean supportsDateOnly) {
this.supportsDateOnly = supportsDateOnly;
}
public void setSupportsRetry(Boolean supportsRetry) {
this.supportsRetry = supportsRetry;
}

View File

@ -53,6 +53,7 @@ public class CSharpFunctionsServerCodegen extends AbstractCSharpCodegen {
public static final String COMPATIBILITY_VERSION = "compatibilityVersion";
public static final String USE_NEWTONSOFT = "useNewtonsoft";
public static final String NEWTONSOFT_VERSION = "newtonsoftVersion";
public static final String NET_60_OR_LATER = "net60OrLater";
private String packageGuid = "{" + randomUUID().toString().toUpperCase(Locale.ROOT) + "}";
private String userSecretsGuid = randomUUID().toString();
@ -188,6 +189,10 @@ public class CSharpFunctionsServerCodegen extends AbstractCSharpCodegen {
CodegenConstants.USE_DATETIME_OFFSET_DESC,
useDateTimeOffsetFlag);
addSwitch(CodegenConstants.USE_DATETIME_FOR_DATE,
CodegenConstants.USE_DATETIME_FOR_DATE_DESC,
useDateTimeForDateFlag);
addSwitch(CodegenConstants.USE_COLLECTION,
CodegenConstants.USE_COLLECTION_DESC,
useCollection);
@ -263,18 +268,8 @@ public class CSharpFunctionsServerCodegen extends AbstractCSharpCodegen {
}
@Override
protected void setTypeMapping() {
super.setTypeMapping();
typeMapping.put("boolean", "bool");
typeMapping.put("integer", "int");
typeMapping.put("float", "float");
typeMapping.put("long", "long");
typeMapping.put("double", "double");
typeMapping.put("number", "decimal");
typeMapping.put("DateTime", "DateTime");
typeMapping.put("date", "DateTime");
typeMapping.put("UUID", "Guid");
typeMapping.put("URI", "string");
protected boolean useNet60OrLater() {
return additionalProperties.containsKey(NET_60_OR_LATER);
}
@Override
@ -607,6 +602,13 @@ public class CSharpFunctionsServerCodegen extends AbstractCSharpCodegen {
//set .NET target version
String targetFrameworkVersion = "net" + netCoreVersion.getOptValue();
additionalProperties.put(TARGET_FRAMEWORK, targetFrameworkVersion);
setAddititonalPropertyForFramework();
}
private void setAddititonalPropertyForFramework() {
if (((String)additionalProperties.get(TARGET_FRAMEWORK)).startsWith("net6.0")) {
additionalProperties.put(NET_60_OR_LATER, true);
}
}
private void setOperationIsAsync() {

View File

@ -0,0 +1,2 @@
"yyyy'-'MM'-'dd",
"yyyyMMdd"

View File

@ -0,0 +1,51 @@
{{>partial_header}}
using System;
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace {{packageName}}.{{clientPackage}}
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
{{>visibility}} class DateOnlyJsonConverter : JsonConverter<DateOnly>
{
/// <summary>
/// The formats used to deserialize the date
/// </summary>
public static string[] Formats { get; } = {
{{>DateFormats}}
};
/// <summary>
/// Returns a DateOnly from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) {
if (reader.TokenType == JsonTokenType.Null)
throw new NotSupportedException();
string value = reader.GetString(){{nrt!}};
foreach(string format in Formats)
if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result))
return result;
throw new NotSupportedException();
}
/// <summary>
/// Writes the DateOnly to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="dateOnlyValue"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, DateOnly dateOnlyValue, JsonSerializerOptions options) =>
writer.WriteStringValue(dateOnlyValue.ToString("{{{dateFormat}}}", CultureInfo.InvariantCulture));
}
}

View File

@ -0,0 +1,56 @@
{{>partial_header}}
using System;
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace {{packageName}}.{{clientPackage}}
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
{{>visibility}} class DateOnlyNullableJsonConverter : JsonConverter<DateOnly?>
{
/// <summary>
/// The formats used to deserialize the date
/// </summary>
public static string[] Formats { get; } = {
{{>DateFormats}}
};
/// <summary>
/// Returns a DateOnly from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override DateOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) {
if (reader.TokenType == JsonTokenType.Null)
return null;
string value = reader.GetString(){{nrt!}};
foreach(string format in Formats)
if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result))
return result;
throw new NotSupportedException();
}
/// <summary>
/// Writes the DateOnly to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="dateOnlyValue"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, DateOnly? dateOnlyValue, JsonSerializerOptions options)
{
if (dateOnlyValue == null)
writer.WriteNullValue();
else
writer.WriteStringValue(dateOnlyValue.Value.ToString("{{{dateFormat}}}", CultureInfo.InvariantCulture));
}
}
}

View File

@ -6,7 +6,9 @@
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ssK",
{{^supportsDateOnly}}
"yyyy'-'MM'-'dd",
{{/supportsDateOnly}}
"yyyyMMddTHHmmss.fffffffK",
"yyyyMMddTHHmmss.ffffffK",
"yyyyMMddTHHmmss.fffffK",
@ -15,4 +17,6 @@
"yyyyMMddTHHmmss.ffK",
"yyyyMMddTHHmmss.fK",
"yyyyMMddTHHmmssK",
"yyyyMMdd"
{{^supportsDateOnly}}
"yyyyMMdd"
{{/supportsDateOnly}}

View File

@ -7,7 +7,7 @@ using System.Text.Json.Serialization;
namespace {{packageName}}.{{clientPackage}}
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// Formatter for {{#supportsDateOnly}}'date-time'{{/supportsDateOnly}}{{^supportsDateOnly}}'date' and 'date-time'{{/supportsDateOnly}} openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
{{>visibility}} class DateTimeJsonConverter : JsonConverter<DateTime>

View File

@ -7,7 +7,7 @@ using System.Text.Json.Serialization;
namespace {{packageName}}.{{clientPackage}}
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// Formatter for {{#supportsDateOnly}}'date-time'{{/supportsDateOnly}}{{^supportsDateOnly}}'date' and 'date-time'{{/supportsDateOnly}} openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
{{>visibility}} class DateTimeNullableJsonConverter : JsonConverter<DateTime?>

View File

@ -35,6 +35,10 @@ namespace {{packageName}}.{{clientPackage}}
_jsonOptions.Converters.Add(new JsonStringEnumConverter());
_jsonOptions.Converters.Add(new DateTimeJsonConverter());
_jsonOptions.Converters.Add(new DateTimeNullableJsonConverter());
{{#supportsDateOnly}}
_jsonOptions.Converters.Add(new DateOnlyJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter());
{{/supportsDateOnly}}
{{#models}}
{{#model}}
{{#isEnum}}

View File

@ -208,7 +208,7 @@
{{/isNumeric}}
{{#isDate}}
if (utf8JsonReader.TokenType != JsonTokenType.Null)
{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}JsonSerializer.Deserialize<DateTime{{#isNullable}}?{{/isNullable}}>(ref utf8JsonReader, jsonSerializerOptions));
{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}JsonSerializer.Deserialize<{{#supportsDateOnly}}DateOnly{{/supportsDateOnly}}{{^supportsDateOnly}}DateTime{{/supportsDateOnly}}{{#isNullable}}?{{/isNullable}}>(ref utf8JsonReader, jsonSerializerOptions));
{{/isDate}}
{{#isDateTime}}
if (utf8JsonReader.TokenType != JsonTokenType.Null)

View File

@ -0,0 +1,25 @@
openapi: 3.0.0
info:
title: OpenAPI Dates
version: 1.0.0
description: Thic spec contains endpoints with dates in different formats
license:
name: Apache-2.0
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
paths:
/now:
get:
responses:
'200':
description: now dates
content:
application/json:
schema:
type: object
properties:
today:
type: string
format: date
now:
type: string
format: date-time

View File

@ -108,7 +108,7 @@ No authorization required
<a id="testquerydatetimedatestring"></a>
# **TestQueryDatetimeDateString**
> string TestQueryDatetimeDateString (DateTime? datetimeQuery = null, DateTime? dateQuery = null, string? stringQuery = null)
> string TestQueryDatetimeDateString (DateTime? datetimeQuery = null, DateOnly? dateQuery = null, string? stringQuery = null)
Test query parameter(s)
@ -132,7 +132,7 @@ namespace Example
config.BasePath = "http://localhost:3000";
var apiInstance = new QueryApi(config);
var datetimeQuery = DateTime.Parse("2013-10-20T19:20:30+01:00"); // DateTime? | (optional)
var dateQuery = DateTime.Parse("2013-10-20"); // DateTime? | (optional)
var dateQuery = DateOnly.Parse("2013-10-20"); // DateOnly? | (optional)
var stringQuery = "stringQuery_example"; // string? | (optional)
try
@ -177,7 +177,7 @@ catch (ApiException e)
| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **datetimeQuery** | **DateTime?** | | [optional] |
| **dateQuery** | **DateTime?** | | [optional] |
| **dateQuery** | **DateOnly?** | | [optional] |
| **stringQuery** | **string?** | | [optional] |
### Return type

View File

@ -64,7 +64,7 @@ namespace Org.OpenAPITools.Api
/// <param name="stringQuery"> (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>string</returns>
string TestQueryDatetimeDateString(DateTime? datetimeQuery = default(DateTime?), DateTime? dateQuery = default(DateTime?), string? stringQuery = default(string?), int operationIndex = 0);
string TestQueryDatetimeDateString(DateTime? datetimeQuery = default(DateTime?), DateOnly? dateQuery = default(DateOnly?), string? stringQuery = default(string?), int operationIndex = 0);
/// <summary>
/// Test query parameter(s)
@ -78,7 +78,7 @@ namespace Org.OpenAPITools.Api
/// <param name="stringQuery"> (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of string</returns>
ApiResponse<string> TestQueryDatetimeDateStringWithHttpInfo(DateTime? datetimeQuery = default(DateTime?), DateTime? dateQuery = default(DateTime?), string? stringQuery = default(string?), int operationIndex = 0);
ApiResponse<string> TestQueryDatetimeDateStringWithHttpInfo(DateTime? datetimeQuery = default(DateTime?), DateOnly? dateQuery = default(DateOnly?), string? stringQuery = default(string?), int operationIndex = 0);
/// <summary>
/// Test query parameter(s)
/// </summary>
@ -270,7 +270,7 @@ namespace Org.OpenAPITools.Api
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of string</returns>
System.Threading.Tasks.Task<string> TestQueryDatetimeDateStringAsync(DateTime? datetimeQuery = default(DateTime?), DateTime? dateQuery = default(DateTime?), string? stringQuery = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
System.Threading.Tasks.Task<string> TestQueryDatetimeDateStringAsync(DateTime? datetimeQuery = default(DateTime?), DateOnly? dateQuery = default(DateOnly?), string? stringQuery = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Test query parameter(s)
@ -285,7 +285,7 @@ namespace Org.OpenAPITools.Api
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (string)</returns>
System.Threading.Tasks.Task<ApiResponse<string>> TestQueryDatetimeDateStringWithHttpInfoAsync(DateTime? datetimeQuery = default(DateTime?), DateTime? dateQuery = default(DateTime?), string? stringQuery = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
System.Threading.Tasks.Task<ApiResponse<string>> TestQueryDatetimeDateStringWithHttpInfoAsync(DateTime? datetimeQuery = default(DateTime?), DateOnly? dateQuery = default(DateOnly?), string? stringQuery = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Test query parameter(s)
/// </summary>
@ -719,7 +719,7 @@ namespace Org.OpenAPITools.Api
/// <param name="stringQuery"> (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>string</returns>
public string TestQueryDatetimeDateString(DateTime? datetimeQuery = default(DateTime?), DateTime? dateQuery = default(DateTime?), string? stringQuery = default(string?), int operationIndex = 0)
public string TestQueryDatetimeDateString(DateTime? datetimeQuery = default(DateTime?), DateOnly? dateQuery = default(DateOnly?), string? stringQuery = default(string?), int operationIndex = 0)
{
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = TestQueryDatetimeDateStringWithHttpInfo(datetimeQuery, dateQuery, stringQuery);
return localVarResponse.Data;
@ -734,7 +734,7 @@ namespace Org.OpenAPITools.Api
/// <param name="stringQuery"> (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of string</returns>
public Org.OpenAPITools.Client.ApiResponse<string> TestQueryDatetimeDateStringWithHttpInfo(DateTime? datetimeQuery = default(DateTime?), DateTime? dateQuery = default(DateTime?), string? stringQuery = default(string?), int operationIndex = 0)
public Org.OpenAPITools.Client.ApiResponse<string> TestQueryDatetimeDateStringWithHttpInfo(DateTime? datetimeQuery = default(DateTime?), DateOnly? dateQuery = default(DateOnly?), string? stringQuery = default(string?), int operationIndex = 0)
{
Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
@ -799,7 +799,7 @@ namespace Org.OpenAPITools.Api
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of string</returns>
public async System.Threading.Tasks.Task<string> TestQueryDatetimeDateStringAsync(DateTime? datetimeQuery = default(DateTime?), DateTime? dateQuery = default(DateTime?), string? stringQuery = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public async System.Threading.Tasks.Task<string> TestQueryDatetimeDateStringAsync(DateTime? datetimeQuery = default(DateTime?), DateOnly? dateQuery = default(DateOnly?), string? stringQuery = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = await TestQueryDatetimeDateStringWithHttpInfoAsync(datetimeQuery, dateQuery, stringQuery, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
@ -815,7 +815,7 @@ namespace Org.OpenAPITools.Api
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (string)</returns>
public async System.Threading.Tasks.Task<Org.OpenAPITools.Client.ApiResponse<string>> TestQueryDatetimeDateStringWithHttpInfoAsync(DateTime? datetimeQuery = default(DateTime?), DateTime? dateQuery = default(DateTime?), string? stringQuery = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public async System.Threading.Tasks.Task<Org.OpenAPITools.Client.ApiResponse<string>> TestQueryDatetimeDateStringWithHttpInfoAsync(DateTime? datetimeQuery = default(DateTime?), DateOnly? dateQuery = default(DateOnly?), string? stringQuery = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();

View File

@ -122,6 +122,8 @@ src/UseSourceGeneration/Client/BasicToken.cs
src/UseSourceGeneration/Client/BearerToken.cs
src/UseSourceGeneration/Client/ClientUtils.cs
src/UseSourceGeneration/Client/CookieContainer.cs
src/UseSourceGeneration/Client/DateOnlyJsonConverter.cs
src/UseSourceGeneration/Client/DateOnlyNullableJsonConverter.cs
src/UseSourceGeneration/Client/DateTimeJsonConverter.cs
src/UseSourceGeneration/Client/DateTimeNullableJsonConverter.cs
src/UseSourceGeneration/Client/ExceptionEventArgs.cs

View File

@ -896,7 +896,7 @@ No authorization required
<a id="testendpointparameters"></a>
# **TestEndpointParameters**
> void TestEndpointParameters (byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime date = null, System.IO.Stream binary = null, float varFloat = null, int integer = null, int int32 = null, long int64 = null, string varString = null, string password = null, string callback = null, DateTime dateTime = null)
> void TestEndpointParameters (byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateOnly date = null, System.IO.Stream binary = null, float varFloat = null, int integer = null, int int32 = null, long int64 = null, string varString = null, string password = null, string callback = null, DateTime dateTime = null)
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@ -927,7 +927,7 @@ namespace Example
var number = 8.14D; // decimal | None
var varDouble = 1.2D; // double | None
var patternWithoutDelimiter = "patternWithoutDelimiter_example"; // string | None
var date = DateTime.Parse("2013-10-20"); // DateTime | None (optional)
var date = DateOnly.Parse("2013-10-20"); // DateOnly | None (optional)
var binary = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | None (optional)
var varFloat = 3.4F; // float | None (optional)
var integer = 56; // int | None (optional)
@ -979,7 +979,7 @@ catch (ApiException e)
| **number** | **decimal** | None | |
| **varDouble** | **double** | None | |
| **patternWithoutDelimiter** | **string** | None | |
| **date** | **DateTime** | None | [optional] |
| **date** | **DateOnly** | None | [optional] |
| **binary** | **System.IO.Stream****System.IO.Stream** | None | [optional] |
| **varFloat** | **float** | None | [optional] |
| **integer** | **int** | None | [optional] |

View File

@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**DateOnlyProperty** | **DateTime** | | [optional]
**DateOnlyProperty** | **DateOnly** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -5,7 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**VarByte** | **byte[]** | |
**Date** | **DateTime** | |
**Date** | **DateOnly** | |
**Number** | **decimal** | |
**Password** | **string** | |
**Binary** | **System.IO.Stream** | | [optional]

View File

@ -8,7 +8,7 @@ Name | Type | Description | Notes
**ArrayItemsNullable** | **List&lt;Object&gt;** | | [optional]
**ArrayNullableProp** | **List&lt;Object&gt;** | | [optional]
**BooleanProp** | **bool** | | [optional]
**DateProp** | **DateTime** | | [optional]
**DateProp** | **DateOnly** | | [optional]
**DatetimeProp** | **DateTime** | | [optional]
**IntegerProp** | **int** | | [optional]
**NumberProp** | **decimal** | | [optional]

View File

@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**RequiredNotNullableDateProp** | **DateTime** | |
**RequiredNotNullableDateProp** | **DateOnly** | |
**RequiredNotnullableArrayOfString** | **List&lt;string&gt;** | |
**RequiredNotnullableBooleanProp** | **bool** | |
**RequiredNotnullableDatetimeProp** | **DateTime** | |
@ -17,7 +17,7 @@ Name | Type | Description | Notes
**RequiredNotnullableintegerProp** | **int** | |
**RequiredNullableArrayOfString** | **List&lt;string&gt;** | |
**RequiredNullableBooleanProp** | **bool** | |
**RequiredNullableDateProp** | **DateTime** | |
**RequiredNullableDateProp** | **DateOnly** | |
**RequiredNullableDatetimeProp** | **DateTime** | |
**RequiredNullableEnumInteger** | **int** | |
**RequiredNullableEnumIntegerOnly** | **int** | |
@ -26,9 +26,9 @@ Name | Type | Description | Notes
**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | |
**RequiredNullableStringProp** | **string** | |
**RequiredNullableUuid** | **Guid** | |
**NotRequiredNotnullableDateProp** | **DateTime** | | [optional]
**NotRequiredNotnullableDateProp** | **DateOnly** | | [optional]
**NotRequiredNotnullableintegerProp** | **int** | | [optional]
**NotRequiredNullableDateProp** | **DateTime** | | [optional]
**NotRequiredNullableDateProp** | **DateOnly** | | [optional]
**NotRequiredNullableIntegerProp** | **int** | | [optional]
**NotrequiredNotnullableArrayOfString** | **List&lt;string&gt;** | | [optional]
**NotrequiredNotnullableBooleanProp** | **bool** | | [optional]

View File

@ -288,7 +288,7 @@ namespace UseSourceGeneration.Api
/// <param name="dateTime">None (optional, default to &quot;2010-02-01T10:20:10.111110+01:00&quot;)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ITestEndpointParametersApiResponse"/>&gt;</returns>
Task<ITestEndpointParametersApiResponse> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default);
Task<ITestEndpointParametersApiResponse> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@ -312,7 +312,7 @@ namespace UseSourceGeneration.Api
/// <param name="dateTime">None (optional, default to &quot;2010-02-01T10:20:10.111110+01:00&quot;)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ITestEndpointParametersApiResponse"/>?&gt;</returns>
Task<ITestEndpointParametersApiResponse?> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default);
Task<ITestEndpointParametersApiResponse?> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// To test enum parameters
@ -3243,7 +3243,7 @@ namespace UseSourceGeneration.Api
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
partial void FormatTestEndpointParameters(ref byte[] varByte, ref decimal number, ref double varDouble, ref string patternWithoutDelimiter, ref Option<DateTime> date, ref Option<System.IO.Stream> binary, ref Option<float> varFloat, ref Option<int> integer, ref Option<int> int32, ref Option<long> int64, ref Option<string> varString, ref Option<string> password, ref Option<string> callback, ref Option<DateTime> dateTime);
partial void FormatTestEndpointParameters(ref byte[] varByte, ref decimal number, ref double varDouble, ref string patternWithoutDelimiter, ref Option<DateOnly> date, ref Option<System.IO.Stream> binary, ref Option<float> varFloat, ref Option<int> integer, ref Option<int> int32, ref Option<long> int64, ref Option<string> varString, ref Option<string> password, ref Option<string> callback, ref Option<DateTime> dateTime);
/// <summary>
/// Validates the request parameters
@ -3294,7 +3294,7 @@ namespace UseSourceGeneration.Api
/// <param name="password"></param>
/// <param name="callback"></param>
/// <param name="dateTime"></param>
private void AfterTestEndpointParametersDefaultImplementation(ITestEndpointParametersApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime)
private void AfterTestEndpointParametersDefaultImplementation(ITestEndpointParametersApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime)
{
bool suppressDefaultLog = false;
AfterTestEndpointParameters(ref suppressDefaultLog, apiResponseLocalVar, varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime);
@ -3321,7 +3321,7 @@ namespace UseSourceGeneration.Api
/// <param name="password"></param>
/// <param name="callback"></param>
/// <param name="dateTime"></param>
partial void AfterTestEndpointParameters(ref bool suppressDefaultLog, ITestEndpointParametersApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime);
partial void AfterTestEndpointParameters(ref bool suppressDefaultLog, ITestEndpointParametersApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime);
/// <summary>
/// Logs exceptions that occur while retrieving the server response
@ -3343,7 +3343,7 @@ namespace UseSourceGeneration.Api
/// <param name="password"></param>
/// <param name="callback"></param>
/// <param name="dateTime"></param>
private void OnErrorTestEndpointParametersDefaultImplementation(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime)
private void OnErrorTestEndpointParametersDefaultImplementation(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime)
{
bool suppressDefaultLog = false;
OnErrorTestEndpointParameters(ref suppressDefaultLog, exception, pathFormat, path, varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime);
@ -3372,7 +3372,7 @@ namespace UseSourceGeneration.Api
/// <param name="password"></param>
/// <param name="callback"></param>
/// <param name="dateTime"></param>
partial void OnErrorTestEndpointParameters(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime);
partial void OnErrorTestEndpointParameters(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime);
/// <summary>
/// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@ -3393,7 +3393,7 @@ namespace UseSourceGeneration.Api
/// <param name="dateTime">None (optional, default to &quot;2010-02-01T10:20:10.111110+01:00&quot;)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ITestEndpointParametersApiResponse"/>&gt;</returns>
public async Task<ITestEndpointParametersApiResponse?> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default)
public async Task<ITestEndpointParametersApiResponse?> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default)
{
try
{
@ -3425,7 +3425,7 @@ namespace UseSourceGeneration.Api
/// <param name="dateTime">None (optional, default to &quot;2010-02-01T10:20:10.111110+01:00&quot;)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ITestEndpointParametersApiResponse"/>&gt;</returns>
public async Task<ITestEndpointParametersApiResponse> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default)
public async Task<ITestEndpointParametersApiResponse> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default)
{
UriBuilder uriBuilderLocalVar = new UriBuilder();

View File

@ -0,0 +1,61 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace UseSourceGeneration.Client
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class DateOnlyJsonConverter : JsonConverter<DateOnly>
{
/// <summary>
/// The formats used to deserialize the date
/// </summary>
public static string[] Formats { get; } = {
"yyyy'-'MM'-'dd",
"yyyyMMdd"
};
/// <summary>
/// Returns a DateOnly from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) {
if (reader.TokenType == JsonTokenType.Null)
throw new NotSupportedException();
string value = reader.GetString()!;
foreach(string format in Formats)
if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result))
return result;
throw new NotSupportedException();
}
/// <summary>
/// Writes the DateOnly to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="dateOnlyValue"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, DateOnly dateOnlyValue, JsonSerializerOptions options) =>
writer.WriteStringValue(dateOnlyValue.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture));
}
}

View File

@ -0,0 +1,66 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace UseSourceGeneration.Client
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class DateOnlyNullableJsonConverter : JsonConverter<DateOnly?>
{
/// <summary>
/// The formats used to deserialize the date
/// </summary>
public static string[] Formats { get; } = {
"yyyy'-'MM'-'dd",
"yyyyMMdd"
};
/// <summary>
/// Returns a DateOnly from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override DateOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) {
if (reader.TokenType == JsonTokenType.Null)
return null;
string value = reader.GetString()!;
foreach(string format in Formats)
if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result))
return result;
throw new NotSupportedException();
}
/// <summary>
/// Writes the DateOnly to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="dateOnlyValue"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, DateOnly? dateOnlyValue, JsonSerializerOptions options)
{
if (dateOnlyValue == null)
writer.WriteNullValue();
else
writer.WriteStringValue(dateOnlyValue.Value.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture));
}
}
}

View File

@ -15,7 +15,7 @@ using System.Text.Json.Serialization;
namespace UseSourceGeneration.Client
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class DateTimeJsonConverter : JsonConverter<DateTime>
@ -32,7 +32,6 @@ namespace UseSourceGeneration.Client
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ssK",
"yyyy'-'MM'-'dd",
"yyyyMMddTHHmmss.fffffffK",
"yyyyMMddTHHmmss.ffffffK",
"yyyyMMddTHHmmss.fffffK",
@ -41,7 +40,7 @@ namespace UseSourceGeneration.Client
"yyyyMMddTHHmmss.ffK",
"yyyyMMddTHHmmss.fK",
"yyyyMMddTHHmmssK",
"yyyyMMdd"
};
/// <summary>

View File

@ -15,7 +15,7 @@ using System.Text.Json.Serialization;
namespace UseSourceGeneration.Client
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class DateTimeNullableJsonConverter : JsonConverter<DateTime?>
@ -32,7 +32,6 @@ namespace UseSourceGeneration.Client
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ssK",
"yyyy'-'MM'-'dd",
"yyyyMMddTHHmmss.fffffffK",
"yyyyMMddTHHmmss.ffffffK",
"yyyyMMddTHHmmss.fffffK",
@ -41,7 +40,7 @@ namespace UseSourceGeneration.Client
"yyyyMMddTHHmmss.ffK",
"yyyyMMddTHHmmss.fK",
"yyyyMMddTHHmmssK",
"yyyyMMdd"
};
/// <summary>

View File

@ -41,6 +41,8 @@ namespace UseSourceGeneration.Client
_jsonOptions.Converters.Add(new JsonStringEnumConverter());
_jsonOptions.Converters.Add(new DateTimeJsonConverter());
_jsonOptions.Converters.Add(new DateTimeNullableJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter());
_jsonOptions.Converters.Add(new ActivityJsonConverter());
_jsonOptions.Converters.Add(new ActivityOutputElementRepresentationJsonConverter());
_jsonOptions.Converters.Add(new AdditionalPropertiesClassJsonConverter());

View File

@ -37,7 +37,7 @@ namespace UseSourceGeneration.Model
/// </summary>
/// <param name="dateOnlyProperty">dateOnlyProperty</param>
[JsonConstructor]
public DateOnlyClass(Option<DateTime?> dateOnlyProperty = default)
public DateOnlyClass(Option<DateOnly?> dateOnlyProperty = default)
{
DateOnlyPropertyOption = dateOnlyProperty;
OnCreated();
@ -50,14 +50,14 @@ namespace UseSourceGeneration.Model
/// </summary>
[JsonIgnore]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public Option<DateTime?> DateOnlyPropertyOption { get; private set; }
public Option<DateOnly?> DateOnlyPropertyOption { get; private set; }
/// <summary>
/// Gets or Sets DateOnlyProperty
/// </summary>
/// <example>Fri Jul 21 00:00:00 UTC 2017</example>
[JsonPropertyName("dateOnlyProperty")]
public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } }
public DateOnly? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } }
/// <summary>
/// Gets or Sets additional properties
@ -117,7 +117,7 @@ namespace UseSourceGeneration.Model
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option<DateTime?> dateOnlyProperty = default;
Option<DateOnly?> dateOnlyProperty = default;
while (utf8JsonReader.Read())
{
@ -136,7 +136,7 @@ namespace UseSourceGeneration.Model
{
case "dateOnlyProperty":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
dateOnlyProperty = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime>(ref utf8JsonReader, jsonSerializerOptions));
dateOnlyProperty = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly>(ref utf8JsonReader, jsonSerializerOptions));
break;
default:
break;

View File

@ -55,7 +55,7 @@ namespace UseSourceGeneration.Model
/// <param name="unsignedLong">unsignedLong</param>
/// <param name="uuid">uuid</param>
[JsonConstructor]
public FormatTest(byte[] varByte, DateTime date, decimal number, string password, Option<System.IO.Stream?> binary = default, Option<DateTime?> dateTime = default, Option<decimal?> varDecimal = default, Option<double?> varDouble = default, Option<float?> varFloat = default, Option<int?> int32 = default, Option<long?> int64 = default, Option<int?> integer = default, Option<string?> patternWithBackslash = default, Option<string?> patternWithDigits = default, Option<string?> patternWithDigitsAndDelimiter = default, Option<string?> varString = default, Option<uint?> unsignedInteger = default, Option<ulong?> unsignedLong = default, Option<Guid?> uuid = default)
public FormatTest(byte[] varByte, DateOnly date, decimal number, string password, Option<System.IO.Stream?> binary = default, Option<DateTime?> dateTime = default, Option<decimal?> varDecimal = default, Option<double?> varDouble = default, Option<float?> varFloat = default, Option<int?> int32 = default, Option<long?> int64 = default, Option<int?> integer = default, Option<string?> patternWithBackslash = default, Option<string?> patternWithDigits = default, Option<string?> patternWithDigitsAndDelimiter = default, Option<string?> varString = default, Option<uint?> unsignedInteger = default, Option<ulong?> unsignedLong = default, Option<Guid?> uuid = default)
{
VarByte = varByte;
Date = date;
@ -92,7 +92,7 @@ namespace UseSourceGeneration.Model
/// </summary>
/// <example>Sun Feb 02 00:00:00 UTC 2020</example>
[JsonPropertyName("date")]
public DateTime Date { get; set; }
public DateOnly Date { get; set; }
/// <summary>
/// Gets or Sets Number
@ -512,7 +512,7 @@ namespace UseSourceGeneration.Model
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option<byte[]?> varByte = default;
Option<DateTime?> date = default;
Option<DateOnly?> date = default;
Option<decimal?> number = default;
Option<string?> password = default;
Option<System.IO.Stream?> binary = default;
@ -552,7 +552,7 @@ namespace UseSourceGeneration.Model
break;
case "date":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
date = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime>(ref utf8JsonReader, jsonSerializerOptions));
date = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "number":
if (utf8JsonReader.TokenType != JsonTokenType.Null)

View File

@ -48,7 +48,7 @@ namespace UseSourceGeneration.Model
/// <param name="objectNullableProp">objectNullableProp</param>
/// <param name="stringProp">stringProp</param>
[JsonConstructor]
public NullableClass(Option<List<Object>?> arrayAndItemsNullableProp = default, Option<List<Object>?> arrayItemsNullable = default, Option<List<Object>?> arrayNullableProp = default, Option<bool?> booleanProp = default, Option<DateTime?> dateProp = default, Option<DateTime?> datetimeProp = default, Option<int?> integerProp = default, Option<decimal?> numberProp = default, Option<Dictionary<string, Object>?> objectAndItemsNullableProp = default, Option<Dictionary<string, Object>?> objectItemsNullable = default, Option<Dictionary<string, Object>?> objectNullableProp = default, Option<string?> stringProp = default)
public NullableClass(Option<List<Object>?> arrayAndItemsNullableProp = default, Option<List<Object>?> arrayItemsNullable = default, Option<List<Object>?> arrayNullableProp = default, Option<bool?> booleanProp = default, Option<DateOnly?> dateProp = default, Option<DateTime?> datetimeProp = default, Option<int?> integerProp = default, Option<decimal?> numberProp = default, Option<Dictionary<string, Object>?> objectAndItemsNullableProp = default, Option<Dictionary<string, Object>?> objectItemsNullable = default, Option<Dictionary<string, Object>?> objectNullableProp = default, Option<string?> stringProp = default)
{
ArrayAndItemsNullablePropOption = arrayAndItemsNullableProp;
ArrayItemsNullableOption = arrayItemsNullable;
@ -124,13 +124,13 @@ namespace UseSourceGeneration.Model
/// </summary>
[JsonIgnore]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public Option<DateTime?> DatePropOption { get; private set; }
public Option<DateOnly?> DatePropOption { get; private set; }
/// <summary>
/// Gets or Sets DateProp
/// </summary>
[JsonPropertyName("date_prop")]
public DateTime? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new(value); } }
public DateOnly? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new(value); } }
/// <summary>
/// Used to track the state of DatetimeProp
@ -301,7 +301,7 @@ namespace UseSourceGeneration.Model
Option<List<Object>?> arrayItemsNullable = default;
Option<List<Object>?> arrayNullableProp = default;
Option<bool?> booleanProp = default;
Option<DateTime?> dateProp = default;
Option<DateOnly?> dateProp = default;
Option<DateTime?> datetimeProp = default;
Option<int?> integerProp = default;
Option<decimal?> numberProp = default;
@ -343,7 +343,7 @@ namespace UseSourceGeneration.Model
break;
case "date_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
dateProp = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime?>(ref utf8JsonReader, jsonSerializerOptions));
dateProp = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly?>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "datetime_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)

View File

@ -80,7 +80,7 @@ namespace UseSourceGeneration.Model
/// <param name="notrequiredNullableStringProp">notrequiredNullableStringProp</param>
/// <param name="notrequiredNullableUuid">notrequiredNullableUuid</param>
[JsonConstructor]
public RequiredClass(DateTime requiredNotNullableDateProp, List<string> requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, List<string>? requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string? requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option<DateTime?> notRequiredNotnullableDateProp = default, Option<int?> notRequiredNotnullableintegerProp = default, Option<DateTime?> notRequiredNullableDateProp = default, Option<int?> notRequiredNullableIntegerProp = default, Option<List<string>?> notrequiredNotnullableArrayOfString = default, Option<bool?> notrequiredNotnullableBooleanProp = default, Option<DateTime?> notrequiredNotnullableDatetimeProp = default, Option<NotrequiredNotnullableEnumIntegerEnum?> notrequiredNotnullableEnumInteger = default, Option<NotrequiredNotnullableEnumIntegerOnlyEnum?> notrequiredNotnullableEnumIntegerOnly = default, Option<NotrequiredNotnullableEnumStringEnum?> notrequiredNotnullableEnumString = default, Option<OuterEnumDefaultValue?> notrequiredNotnullableOuterEnumDefaultValue = default, Option<string?> notrequiredNotnullableStringProp = default, Option<Guid?> notrequiredNotnullableUuid = default, Option<List<string>?> notrequiredNullableArrayOfString = default, Option<bool?> notrequiredNullableBooleanProp = default, Option<DateTime?> notrequiredNullableDatetimeProp = default, Option<NotrequiredNullableEnumIntegerEnum?> notrequiredNullableEnumInteger = default, Option<NotrequiredNullableEnumIntegerOnlyEnum?> notrequiredNullableEnumIntegerOnly = default, Option<NotrequiredNullableEnumStringEnum?> notrequiredNullableEnumString = default, Option<OuterEnumDefaultValue?> notrequiredNullableOuterEnumDefaultValue = default, Option<string?> notrequiredNullableStringProp = default, Option<Guid?> notrequiredNullableUuid = default)
public RequiredClass(DateOnly requiredNotNullableDateProp, List<string> requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, List<string>? requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateOnly? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string? requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option<DateOnly?> notRequiredNotnullableDateProp = default, Option<int?> notRequiredNotnullableintegerProp = default, Option<DateOnly?> notRequiredNullableDateProp = default, Option<int?> notRequiredNullableIntegerProp = default, Option<List<string>?> notrequiredNotnullableArrayOfString = default, Option<bool?> notrequiredNotnullableBooleanProp = default, Option<DateTime?> notrequiredNotnullableDatetimeProp = default, Option<NotrequiredNotnullableEnumIntegerEnum?> notrequiredNotnullableEnumInteger = default, Option<NotrequiredNotnullableEnumIntegerOnlyEnum?> notrequiredNotnullableEnumIntegerOnly = default, Option<NotrequiredNotnullableEnumStringEnum?> notrequiredNotnullableEnumString = default, Option<OuterEnumDefaultValue?> notrequiredNotnullableOuterEnumDefaultValue = default, Option<string?> notrequiredNotnullableStringProp = default, Option<Guid?> notrequiredNotnullableUuid = default, Option<List<string>?> notrequiredNullableArrayOfString = default, Option<bool?> notrequiredNullableBooleanProp = default, Option<DateTime?> notrequiredNullableDatetimeProp = default, Option<NotrequiredNullableEnumIntegerEnum?> notrequiredNullableEnumInteger = default, Option<NotrequiredNullableEnumIntegerOnlyEnum?> notrequiredNullableEnumIntegerOnly = default, Option<NotrequiredNullableEnumStringEnum?> notrequiredNullableEnumString = default, Option<OuterEnumDefaultValue?> notrequiredNullableOuterEnumDefaultValue = default, Option<string?> notrequiredNullableStringProp = default, Option<Guid?> notrequiredNullableUuid = default)
{
RequiredNotNullableDateProp = requiredNotNullableDateProp;
RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString;
@ -1365,7 +1365,7 @@ namespace UseSourceGeneration.Model
/// Gets or Sets RequiredNotNullableDateProp
/// </summary>
[JsonPropertyName("required_not_nullable_date_prop")]
public DateTime RequiredNotNullableDateProp { get; set; }
public DateOnly RequiredNotNullableDateProp { get; set; }
/// <summary>
/// Gets or Sets RequiredNotnullableArrayOfString
@ -1420,7 +1420,7 @@ namespace UseSourceGeneration.Model
/// Gets or Sets RequiredNullableDateProp
/// </summary>
[JsonPropertyName("required_nullable_date_prop")]
public DateTime? RequiredNullableDateProp { get; set; }
public DateOnly? RequiredNullableDateProp { get; set; }
/// <summary>
/// Gets or Sets RequiredNullableDatetimeProp
@ -1452,13 +1452,13 @@ namespace UseSourceGeneration.Model
/// </summary>
[JsonIgnore]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public Option<DateTime?> NotRequiredNotnullableDatePropOption { get; private set; }
public Option<DateOnly?> NotRequiredNotnullableDatePropOption { get; private set; }
/// <summary>
/// Gets or Sets NotRequiredNotnullableDateProp
/// </summary>
[JsonPropertyName("not_required_notnullable_date_prop")]
public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } }
public DateOnly? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } }
/// <summary>
/// Used to track the state of NotRequiredNotnullableintegerProp
@ -1478,13 +1478,13 @@ namespace UseSourceGeneration.Model
/// </summary>
[JsonIgnore]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public Option<DateTime?> NotRequiredNullableDatePropOption { get; private set; }
public Option<DateOnly?> NotRequiredNullableDatePropOption { get; private set; }
/// <summary>
/// Gets or Sets NotRequiredNullableDateProp
/// </summary>
[JsonPropertyName("not_required_nullable_date_prop")]
public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } }
public DateOnly? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } }
/// <summary>
/// Used to track the state of NotRequiredNullableIntegerProp
@ -1767,7 +1767,7 @@ namespace UseSourceGeneration.Model
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option<DateTime?> requiredNotNullableDateProp = default;
Option<DateOnly?> requiredNotNullableDateProp = default;
Option<List<string>?> requiredNotnullableArrayOfString = default;
Option<bool?> requiredNotnullableBooleanProp = default;
Option<DateTime?> requiredNotnullableDatetimeProp = default;
@ -1780,7 +1780,7 @@ namespace UseSourceGeneration.Model
Option<int?> requiredNotnullableintegerProp = default;
Option<List<string>?> requiredNullableArrayOfString = default;
Option<bool?> requiredNullableBooleanProp = default;
Option<DateTime?> requiredNullableDateProp = default;
Option<DateOnly?> requiredNullableDateProp = default;
Option<DateTime?> requiredNullableDatetimeProp = default;
Option<RequiredClass.RequiredNullableEnumIntegerEnum?> requiredNullableEnumInteger = default;
Option<RequiredClass.RequiredNullableEnumIntegerOnlyEnum?> requiredNullableEnumIntegerOnly = default;
@ -1789,9 +1789,9 @@ namespace UseSourceGeneration.Model
Option<OuterEnumDefaultValue?> requiredNullableOuterEnumDefaultValue = default;
Option<string?> requiredNullableStringProp = default;
Option<Guid?> requiredNullableUuid = default;
Option<DateTime?> notRequiredNotnullableDateProp = default;
Option<DateOnly?> notRequiredNotnullableDateProp = default;
Option<int?> notRequiredNotnullableintegerProp = default;
Option<DateTime?> notRequiredNullableDateProp = default;
Option<DateOnly?> notRequiredNullableDateProp = default;
Option<int?> notRequiredNullableIntegerProp = default;
Option<List<string>?> notrequiredNotnullableArrayOfString = default;
Option<bool?> notrequiredNotnullableBooleanProp = default;
@ -1829,7 +1829,7 @@ namespace UseSourceGeneration.Model
{
case "required_not_nullable_date_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
requiredNotNullableDateProp = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime>(ref utf8JsonReader, jsonSerializerOptions));
requiredNotNullableDateProp = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "required_notnullable_array_of_string":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
@ -1882,7 +1882,7 @@ namespace UseSourceGeneration.Model
break;
case "required_nullable_date_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
requiredNullableDateProp = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime?>(ref utf8JsonReader, jsonSerializerOptions));
requiredNullableDateProp = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly?>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "required_nullable_datetime_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
@ -1919,7 +1919,7 @@ namespace UseSourceGeneration.Model
break;
case "not_required_notnullable_date_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
notRequiredNotnullableDateProp = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime>(ref utf8JsonReader, jsonSerializerOptions));
notRequiredNotnullableDateProp = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "not_required_notnullableinteger_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
@ -1927,7 +1927,7 @@ namespace UseSourceGeneration.Model
break;
case "not_required_nullable_date_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
notRequiredNullableDateProp = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime?>(ref utf8JsonReader, jsonSerializerOptions));
notRequiredNullableDateProp = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly?>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "not_required_nullable_integer_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)

View File

@ -122,6 +122,8 @@ src/Org.OpenAPITools/Client/BasicToken.cs
src/Org.OpenAPITools/Client/BearerToken.cs
src/Org.OpenAPITools/Client/ClientUtils.cs
src/Org.OpenAPITools/Client/CookieContainer.cs
src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs
src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs
src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs
src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs
src/Org.OpenAPITools/Client/ExceptionEventArgs.cs

View File

@ -896,7 +896,7 @@ No authorization required
<a id="testendpointparameters"></a>
# **TestEndpointParameters**
> void TestEndpointParameters (byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime date = null, System.IO.Stream binary = null, float varFloat = null, int integer = null, int int32 = null, long int64 = null, string varString = null, string password = null, string callback = null, DateTime dateTime = null)
> void TestEndpointParameters (byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateOnly date = null, System.IO.Stream binary = null, float varFloat = null, int integer = null, int int32 = null, long int64 = null, string varString = null, string password = null, string callback = null, DateTime dateTime = null)
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@ -927,7 +927,7 @@ namespace Example
var number = 8.14D; // decimal | None
var varDouble = 1.2D; // double | None
var patternWithoutDelimiter = "patternWithoutDelimiter_example"; // string | None
var date = DateTime.Parse("2013-10-20"); // DateTime | None (optional)
var date = DateOnly.Parse("2013-10-20"); // DateOnly | None (optional)
var binary = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | None (optional)
var varFloat = 3.4F; // float | None (optional)
var integer = 56; // int | None (optional)
@ -979,7 +979,7 @@ catch (ApiException e)
| **number** | **decimal** | None | |
| **varDouble** | **double** | None | |
| **patternWithoutDelimiter** | **string** | None | |
| **date** | **DateTime** | None | [optional] |
| **date** | **DateOnly** | None | [optional] |
| **binary** | **System.IO.Stream****System.IO.Stream** | None | [optional] |
| **varFloat** | **float** | None | [optional] |
| **integer** | **int** | None | [optional] |

View File

@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**DateOnlyProperty** | **DateTime** | | [optional]
**DateOnlyProperty** | **DateOnly** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -5,7 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**VarByte** | **byte[]** | |
**Date** | **DateTime** | |
**Date** | **DateOnly** | |
**Number** | **decimal** | |
**Password** | **string** | |
**Binary** | **System.IO.Stream** | | [optional]

View File

@ -8,7 +8,7 @@ Name | Type | Description | Notes
**ArrayItemsNullable** | **List&lt;Object&gt;** | | [optional]
**ArrayNullableProp** | **List&lt;Object&gt;** | | [optional]
**BooleanProp** | **bool** | | [optional]
**DateProp** | **DateTime** | | [optional]
**DateProp** | **DateOnly** | | [optional]
**DatetimeProp** | **DateTime** | | [optional]
**IntegerProp** | **int** | | [optional]
**NumberProp** | **decimal** | | [optional]

View File

@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**RequiredNotNullableDateProp** | **DateTime** | |
**RequiredNotNullableDateProp** | **DateOnly** | |
**RequiredNotnullableArrayOfString** | **List&lt;string&gt;** | |
**RequiredNotnullableBooleanProp** | **bool** | |
**RequiredNotnullableDatetimeProp** | **DateTime** | |
@ -17,7 +17,7 @@ Name | Type | Description | Notes
**RequiredNotnullableintegerProp** | **int** | |
**RequiredNullableArrayOfString** | **List&lt;string&gt;** | |
**RequiredNullableBooleanProp** | **bool** | |
**RequiredNullableDateProp** | **DateTime** | |
**RequiredNullableDateProp** | **DateOnly** | |
**RequiredNullableDatetimeProp** | **DateTime** | |
**RequiredNullableEnumInteger** | **int** | |
**RequiredNullableEnumIntegerOnly** | **int** | |
@ -26,9 +26,9 @@ Name | Type | Description | Notes
**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | |
**RequiredNullableStringProp** | **string** | |
**RequiredNullableUuid** | **Guid** | |
**NotRequiredNotnullableDateProp** | **DateTime** | | [optional]
**NotRequiredNotnullableDateProp** | **DateOnly** | | [optional]
**NotRequiredNotnullableintegerProp** | **int** | | [optional]
**NotRequiredNullableDateProp** | **DateTime** | | [optional]
**NotRequiredNullableDateProp** | **DateOnly** | | [optional]
**NotRequiredNullableIntegerProp** | **int** | | [optional]
**NotrequiredNotnullableArrayOfString** | **List&lt;string&gt;** | | [optional]
**NotrequiredNotnullableBooleanProp** | **bool** | | [optional]

View File

@ -164,7 +164,7 @@ namespace Org.OpenAPITools.Test.Api
decimal number = default!;
double varDouble = default!;
string patternWithoutDelimiter = default!;
Client.Option<DateTime> date = default!;
Client.Option<DateOnly> date = default!;
Client.Option<System.IO.Stream> binary = default!;
Client.Option<float> varFloat = default!;
Client.Option<int> integer = default!;

View File

@ -288,7 +288,7 @@ namespace Org.OpenAPITools.Api
/// <param name="dateTime">None (optional, default to &quot;2010-02-01T10:20:10.111110+01:00&quot;)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ITestEndpointParametersApiResponse"/>&gt;</returns>
Task<ITestEndpointParametersApiResponse> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default);
Task<ITestEndpointParametersApiResponse> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@ -312,7 +312,7 @@ namespace Org.OpenAPITools.Api
/// <param name="dateTime">None (optional, default to &quot;2010-02-01T10:20:10.111110+01:00&quot;)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ITestEndpointParametersApiResponse"/>?&gt;</returns>
Task<ITestEndpointParametersApiResponse?> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default);
Task<ITestEndpointParametersApiResponse?> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// To test enum parameters
@ -3243,7 +3243,7 @@ namespace Org.OpenAPITools.Api
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
partial void FormatTestEndpointParameters(ref byte[] varByte, ref decimal number, ref double varDouble, ref string patternWithoutDelimiter, ref Option<DateTime> date, ref Option<System.IO.Stream> binary, ref Option<float> varFloat, ref Option<int> integer, ref Option<int> int32, ref Option<long> int64, ref Option<string> varString, ref Option<string> password, ref Option<string> callback, ref Option<DateTime> dateTime);
partial void FormatTestEndpointParameters(ref byte[] varByte, ref decimal number, ref double varDouble, ref string patternWithoutDelimiter, ref Option<DateOnly> date, ref Option<System.IO.Stream> binary, ref Option<float> varFloat, ref Option<int> integer, ref Option<int> int32, ref Option<long> int64, ref Option<string> varString, ref Option<string> password, ref Option<string> callback, ref Option<DateTime> dateTime);
/// <summary>
/// Validates the request parameters
@ -3294,7 +3294,7 @@ namespace Org.OpenAPITools.Api
/// <param name="password"></param>
/// <param name="callback"></param>
/// <param name="dateTime"></param>
private void AfterTestEndpointParametersDefaultImplementation(ITestEndpointParametersApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime)
private void AfterTestEndpointParametersDefaultImplementation(ITestEndpointParametersApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime)
{
bool suppressDefaultLog = false;
AfterTestEndpointParameters(ref suppressDefaultLog, apiResponseLocalVar, varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime);
@ -3321,7 +3321,7 @@ namespace Org.OpenAPITools.Api
/// <param name="password"></param>
/// <param name="callback"></param>
/// <param name="dateTime"></param>
partial void AfterTestEndpointParameters(ref bool suppressDefaultLog, ITestEndpointParametersApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime);
partial void AfterTestEndpointParameters(ref bool suppressDefaultLog, ITestEndpointParametersApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime);
/// <summary>
/// Logs exceptions that occur while retrieving the server response
@ -3343,7 +3343,7 @@ namespace Org.OpenAPITools.Api
/// <param name="password"></param>
/// <param name="callback"></param>
/// <param name="dateTime"></param>
private void OnErrorTestEndpointParametersDefaultImplementation(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime)
private void OnErrorTestEndpointParametersDefaultImplementation(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime)
{
bool suppressDefaultLog = false;
OnErrorTestEndpointParameters(ref suppressDefaultLog, exception, pathFormat, path, varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime);
@ -3372,7 +3372,7 @@ namespace Org.OpenAPITools.Api
/// <param name="password"></param>
/// <param name="callback"></param>
/// <param name="dateTime"></param>
partial void OnErrorTestEndpointParameters(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime);
partial void OnErrorTestEndpointParameters(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime);
/// <summary>
/// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@ -3393,7 +3393,7 @@ namespace Org.OpenAPITools.Api
/// <param name="dateTime">None (optional, default to &quot;2010-02-01T10:20:10.111110+01:00&quot;)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ITestEndpointParametersApiResponse"/>&gt;</returns>
public async Task<ITestEndpointParametersApiResponse?> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default)
public async Task<ITestEndpointParametersApiResponse?> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default)
{
try
{
@ -3425,7 +3425,7 @@ namespace Org.OpenAPITools.Api
/// <param name="dateTime">None (optional, default to &quot;2010-02-01T10:20:10.111110+01:00&quot;)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ITestEndpointParametersApiResponse"/>&gt;</returns>
public async Task<ITestEndpointParametersApiResponse> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default)
public async Task<ITestEndpointParametersApiResponse> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default)
{
UriBuilder uriBuilderLocalVar = new UriBuilder();

View File

@ -0,0 +1,61 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class DateOnlyJsonConverter : JsonConverter<DateOnly>
{
/// <summary>
/// The formats used to deserialize the date
/// </summary>
public static string[] Formats { get; } = {
"yyyy'-'MM'-'dd",
"yyyyMMdd"
};
/// <summary>
/// Returns a DateOnly from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) {
if (reader.TokenType == JsonTokenType.Null)
throw new NotSupportedException();
string value = reader.GetString()!;
foreach(string format in Formats)
if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result))
return result;
throw new NotSupportedException();
}
/// <summary>
/// Writes the DateOnly to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="dateOnlyValue"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, DateOnly dateOnlyValue, JsonSerializerOptions options) =>
writer.WriteStringValue(dateOnlyValue.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture));
}
}

View File

@ -0,0 +1,66 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class DateOnlyNullableJsonConverter : JsonConverter<DateOnly?>
{
/// <summary>
/// The formats used to deserialize the date
/// </summary>
public static string[] Formats { get; } = {
"yyyy'-'MM'-'dd",
"yyyyMMdd"
};
/// <summary>
/// Returns a DateOnly from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override DateOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) {
if (reader.TokenType == JsonTokenType.Null)
return null;
string value = reader.GetString()!;
foreach(string format in Formats)
if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result))
return result;
throw new NotSupportedException();
}
/// <summary>
/// Writes the DateOnly to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="dateOnlyValue"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, DateOnly? dateOnlyValue, JsonSerializerOptions options)
{
if (dateOnlyValue == null)
writer.WriteNullValue();
else
writer.WriteStringValue(dateOnlyValue.Value.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture));
}
}
}

View File

@ -15,7 +15,7 @@ using System.Text.Json.Serialization;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class DateTimeJsonConverter : JsonConverter<DateTime>
@ -32,7 +32,6 @@ namespace Org.OpenAPITools.Client
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ssK",
"yyyy'-'MM'-'dd",
"yyyyMMddTHHmmss.fffffffK",
"yyyyMMddTHHmmss.ffffffK",
"yyyyMMddTHHmmss.fffffK",
@ -41,7 +40,7 @@ namespace Org.OpenAPITools.Client
"yyyyMMddTHHmmss.ffK",
"yyyyMMddTHHmmss.fK",
"yyyyMMddTHHmmssK",
"yyyyMMdd"
};
/// <summary>

View File

@ -15,7 +15,7 @@ using System.Text.Json.Serialization;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class DateTimeNullableJsonConverter : JsonConverter<DateTime?>
@ -32,7 +32,6 @@ namespace Org.OpenAPITools.Client
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ssK",
"yyyy'-'MM'-'dd",
"yyyyMMddTHHmmss.fffffffK",
"yyyyMMddTHHmmss.ffffffK",
"yyyyMMddTHHmmss.fffffK",
@ -41,7 +40,7 @@ namespace Org.OpenAPITools.Client
"yyyyMMddTHHmmss.ffK",
"yyyyMMddTHHmmss.fK",
"yyyyMMddTHHmmssK",
"yyyyMMdd"
};
/// <summary>

View File

@ -41,6 +41,8 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new JsonStringEnumConverter());
_jsonOptions.Converters.Add(new DateTimeJsonConverter());
_jsonOptions.Converters.Add(new DateTimeNullableJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter());
_jsonOptions.Converters.Add(new ActivityJsonConverter());
_jsonOptions.Converters.Add(new ActivityOutputElementRepresentationJsonConverter());
_jsonOptions.Converters.Add(new AdditionalPropertiesClassJsonConverter());

View File

@ -36,7 +36,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="dateOnlyProperty">dateOnlyProperty</param>
[JsonConstructor]
public DateOnlyClass(Option<DateTime?> dateOnlyProperty = default)
public DateOnlyClass(Option<DateOnly?> dateOnlyProperty = default)
{
DateOnlyPropertyOption = dateOnlyProperty;
OnCreated();
@ -49,14 +49,14 @@ namespace Org.OpenAPITools.Model
/// </summary>
[JsonIgnore]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public Option<DateTime?> DateOnlyPropertyOption { get; private set; }
public Option<DateOnly?> DateOnlyPropertyOption { get; private set; }
/// <summary>
/// Gets or Sets DateOnlyProperty
/// </summary>
/// <example>Fri Jul 21 00:00:00 UTC 2017</example>
[JsonPropertyName("dateOnlyProperty")]
public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } }
public DateOnly? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } }
/// <summary>
/// Gets or Sets additional properties
@ -116,7 +116,7 @@ namespace Org.OpenAPITools.Model
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option<DateTime?> dateOnlyProperty = default;
Option<DateOnly?> dateOnlyProperty = default;
while (utf8JsonReader.Read())
{
@ -135,7 +135,7 @@ namespace Org.OpenAPITools.Model
{
case "dateOnlyProperty":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
dateOnlyProperty = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime>(ref utf8JsonReader, jsonSerializerOptions));
dateOnlyProperty = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly>(ref utf8JsonReader, jsonSerializerOptions));
break;
default:
break;

View File

@ -54,7 +54,7 @@ namespace Org.OpenAPITools.Model
/// <param name="unsignedLong">unsignedLong</param>
/// <param name="uuid">uuid</param>
[JsonConstructor]
public FormatTest(byte[] varByte, DateTime date, decimal number, string password, Option<System.IO.Stream?> binary = default, Option<DateTime?> dateTime = default, Option<decimal?> varDecimal = default, Option<double?> varDouble = default, Option<float?> varFloat = default, Option<int?> int32 = default, Option<long?> int64 = default, Option<int?> integer = default, Option<string?> patternWithBackslash = default, Option<string?> patternWithDigits = default, Option<string?> patternWithDigitsAndDelimiter = default, Option<string?> varString = default, Option<uint?> unsignedInteger = default, Option<ulong?> unsignedLong = default, Option<Guid?> uuid = default)
public FormatTest(byte[] varByte, DateOnly date, decimal number, string password, Option<System.IO.Stream?> binary = default, Option<DateTime?> dateTime = default, Option<decimal?> varDecimal = default, Option<double?> varDouble = default, Option<float?> varFloat = default, Option<int?> int32 = default, Option<long?> int64 = default, Option<int?> integer = default, Option<string?> patternWithBackslash = default, Option<string?> patternWithDigits = default, Option<string?> patternWithDigitsAndDelimiter = default, Option<string?> varString = default, Option<uint?> unsignedInteger = default, Option<ulong?> unsignedLong = default, Option<Guid?> uuid = default)
{
VarByte = varByte;
Date = date;
@ -91,7 +91,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <example>Sun Feb 02 00:00:00 UTC 2020</example>
[JsonPropertyName("date")]
public DateTime Date { get; set; }
public DateOnly Date { get; set; }
/// <summary>
/// Gets or Sets Number
@ -511,7 +511,7 @@ namespace Org.OpenAPITools.Model
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option<byte[]?> varByte = default;
Option<DateTime?> date = default;
Option<DateOnly?> date = default;
Option<decimal?> number = default;
Option<string?> password = default;
Option<System.IO.Stream?> binary = default;
@ -551,7 +551,7 @@ namespace Org.OpenAPITools.Model
break;
case "date":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
date = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime>(ref utf8JsonReader, jsonSerializerOptions));
date = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "number":
if (utf8JsonReader.TokenType != JsonTokenType.Null)

View File

@ -47,7 +47,7 @@ namespace Org.OpenAPITools.Model
/// <param name="objectNullableProp">objectNullableProp</param>
/// <param name="stringProp">stringProp</param>
[JsonConstructor]
public NullableClass(Option<List<Object>?> arrayAndItemsNullableProp = default, Option<List<Object>?> arrayItemsNullable = default, Option<List<Object>?> arrayNullableProp = default, Option<bool?> booleanProp = default, Option<DateTime?> dateProp = default, Option<DateTime?> datetimeProp = default, Option<int?> integerProp = default, Option<decimal?> numberProp = default, Option<Dictionary<string, Object>?> objectAndItemsNullableProp = default, Option<Dictionary<string, Object>?> objectItemsNullable = default, Option<Dictionary<string, Object>?> objectNullableProp = default, Option<string?> stringProp = default)
public NullableClass(Option<List<Object>?> arrayAndItemsNullableProp = default, Option<List<Object>?> arrayItemsNullable = default, Option<List<Object>?> arrayNullableProp = default, Option<bool?> booleanProp = default, Option<DateOnly?> dateProp = default, Option<DateTime?> datetimeProp = default, Option<int?> integerProp = default, Option<decimal?> numberProp = default, Option<Dictionary<string, Object>?> objectAndItemsNullableProp = default, Option<Dictionary<string, Object>?> objectItemsNullable = default, Option<Dictionary<string, Object>?> objectNullableProp = default, Option<string?> stringProp = default)
{
ArrayAndItemsNullablePropOption = arrayAndItemsNullableProp;
ArrayItemsNullableOption = arrayItemsNullable;
@ -123,13 +123,13 @@ namespace Org.OpenAPITools.Model
/// </summary>
[JsonIgnore]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public Option<DateTime?> DatePropOption { get; private set; }
public Option<DateOnly?> DatePropOption { get; private set; }
/// <summary>
/// Gets or Sets DateProp
/// </summary>
[JsonPropertyName("date_prop")]
public DateTime? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new(value); } }
public DateOnly? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new(value); } }
/// <summary>
/// Used to track the state of DatetimeProp
@ -300,7 +300,7 @@ namespace Org.OpenAPITools.Model
Option<List<Object>?> arrayItemsNullable = default;
Option<List<Object>?> arrayNullableProp = default;
Option<bool?> booleanProp = default;
Option<DateTime?> dateProp = default;
Option<DateOnly?> dateProp = default;
Option<DateTime?> datetimeProp = default;
Option<int?> integerProp = default;
Option<decimal?> numberProp = default;
@ -342,7 +342,7 @@ namespace Org.OpenAPITools.Model
break;
case "date_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
dateProp = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime?>(ref utf8JsonReader, jsonSerializerOptions));
dateProp = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly?>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "datetime_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)

View File

@ -79,7 +79,7 @@ namespace Org.OpenAPITools.Model
/// <param name="notrequiredNullableStringProp">notrequiredNullableStringProp</param>
/// <param name="notrequiredNullableUuid">notrequiredNullableUuid</param>
[JsonConstructor]
public RequiredClass(DateTime requiredNotNullableDateProp, List<string> requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, List<string>? requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string? requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option<DateTime?> notRequiredNotnullableDateProp = default, Option<int?> notRequiredNotnullableintegerProp = default, Option<DateTime?> notRequiredNullableDateProp = default, Option<int?> notRequiredNullableIntegerProp = default, Option<List<string>?> notrequiredNotnullableArrayOfString = default, Option<bool?> notrequiredNotnullableBooleanProp = default, Option<DateTime?> notrequiredNotnullableDatetimeProp = default, Option<NotrequiredNotnullableEnumIntegerEnum?> notrequiredNotnullableEnumInteger = default, Option<NotrequiredNotnullableEnumIntegerOnlyEnum?> notrequiredNotnullableEnumIntegerOnly = default, Option<NotrequiredNotnullableEnumStringEnum?> notrequiredNotnullableEnumString = default, Option<OuterEnumDefaultValue?> notrequiredNotnullableOuterEnumDefaultValue = default, Option<string?> notrequiredNotnullableStringProp = default, Option<Guid?> notrequiredNotnullableUuid = default, Option<List<string>?> notrequiredNullableArrayOfString = default, Option<bool?> notrequiredNullableBooleanProp = default, Option<DateTime?> notrequiredNullableDatetimeProp = default, Option<NotrequiredNullableEnumIntegerEnum?> notrequiredNullableEnumInteger = default, Option<NotrequiredNullableEnumIntegerOnlyEnum?> notrequiredNullableEnumIntegerOnly = default, Option<NotrequiredNullableEnumStringEnum?> notrequiredNullableEnumString = default, Option<OuterEnumDefaultValue?> notrequiredNullableOuterEnumDefaultValue = default, Option<string?> notrequiredNullableStringProp = default, Option<Guid?> notrequiredNullableUuid = default)
public RequiredClass(DateOnly requiredNotNullableDateProp, List<string> requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, List<string>? requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateOnly? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string? requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option<DateOnly?> notRequiredNotnullableDateProp = default, Option<int?> notRequiredNotnullableintegerProp = default, Option<DateOnly?> notRequiredNullableDateProp = default, Option<int?> notRequiredNullableIntegerProp = default, Option<List<string>?> notrequiredNotnullableArrayOfString = default, Option<bool?> notrequiredNotnullableBooleanProp = default, Option<DateTime?> notrequiredNotnullableDatetimeProp = default, Option<NotrequiredNotnullableEnumIntegerEnum?> notrequiredNotnullableEnumInteger = default, Option<NotrequiredNotnullableEnumIntegerOnlyEnum?> notrequiredNotnullableEnumIntegerOnly = default, Option<NotrequiredNotnullableEnumStringEnum?> notrequiredNotnullableEnumString = default, Option<OuterEnumDefaultValue?> notrequiredNotnullableOuterEnumDefaultValue = default, Option<string?> notrequiredNotnullableStringProp = default, Option<Guid?> notrequiredNotnullableUuid = default, Option<List<string>?> notrequiredNullableArrayOfString = default, Option<bool?> notrequiredNullableBooleanProp = default, Option<DateTime?> notrequiredNullableDatetimeProp = default, Option<NotrequiredNullableEnumIntegerEnum?> notrequiredNullableEnumInteger = default, Option<NotrequiredNullableEnumIntegerOnlyEnum?> notrequiredNullableEnumIntegerOnly = default, Option<NotrequiredNullableEnumStringEnum?> notrequiredNullableEnumString = default, Option<OuterEnumDefaultValue?> notrequiredNullableOuterEnumDefaultValue = default, Option<string?> notrequiredNullableStringProp = default, Option<Guid?> notrequiredNullableUuid = default)
{
RequiredNotNullableDateProp = requiredNotNullableDateProp;
RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString;
@ -1364,7 +1364,7 @@ namespace Org.OpenAPITools.Model
/// Gets or Sets RequiredNotNullableDateProp
/// </summary>
[JsonPropertyName("required_not_nullable_date_prop")]
public DateTime RequiredNotNullableDateProp { get; set; }
public DateOnly RequiredNotNullableDateProp { get; set; }
/// <summary>
/// Gets or Sets RequiredNotnullableArrayOfString
@ -1419,7 +1419,7 @@ namespace Org.OpenAPITools.Model
/// Gets or Sets RequiredNullableDateProp
/// </summary>
[JsonPropertyName("required_nullable_date_prop")]
public DateTime? RequiredNullableDateProp { get; set; }
public DateOnly? RequiredNullableDateProp { get; set; }
/// <summary>
/// Gets or Sets RequiredNullableDatetimeProp
@ -1451,13 +1451,13 @@ namespace Org.OpenAPITools.Model
/// </summary>
[JsonIgnore]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public Option<DateTime?> NotRequiredNotnullableDatePropOption { get; private set; }
public Option<DateOnly?> NotRequiredNotnullableDatePropOption { get; private set; }
/// <summary>
/// Gets or Sets NotRequiredNotnullableDateProp
/// </summary>
[JsonPropertyName("not_required_notnullable_date_prop")]
public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } }
public DateOnly? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } }
/// <summary>
/// Used to track the state of NotRequiredNotnullableintegerProp
@ -1477,13 +1477,13 @@ namespace Org.OpenAPITools.Model
/// </summary>
[JsonIgnore]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public Option<DateTime?> NotRequiredNullableDatePropOption { get; private set; }
public Option<DateOnly?> NotRequiredNullableDatePropOption { get; private set; }
/// <summary>
/// Gets or Sets NotRequiredNullableDateProp
/// </summary>
[JsonPropertyName("not_required_nullable_date_prop")]
public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } }
public DateOnly? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } }
/// <summary>
/// Used to track the state of NotRequiredNullableIntegerProp
@ -1766,7 +1766,7 @@ namespace Org.OpenAPITools.Model
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option<DateTime?> requiredNotNullableDateProp = default;
Option<DateOnly?> requiredNotNullableDateProp = default;
Option<List<string>?> requiredNotnullableArrayOfString = default;
Option<bool?> requiredNotnullableBooleanProp = default;
Option<DateTime?> requiredNotnullableDatetimeProp = default;
@ -1779,7 +1779,7 @@ namespace Org.OpenAPITools.Model
Option<int?> requiredNotnullableintegerProp = default;
Option<List<string>?> requiredNullableArrayOfString = default;
Option<bool?> requiredNullableBooleanProp = default;
Option<DateTime?> requiredNullableDateProp = default;
Option<DateOnly?> requiredNullableDateProp = default;
Option<DateTime?> requiredNullableDatetimeProp = default;
Option<RequiredClass.RequiredNullableEnumIntegerEnum?> requiredNullableEnumInteger = default;
Option<RequiredClass.RequiredNullableEnumIntegerOnlyEnum?> requiredNullableEnumIntegerOnly = default;
@ -1788,9 +1788,9 @@ namespace Org.OpenAPITools.Model
Option<OuterEnumDefaultValue?> requiredNullableOuterEnumDefaultValue = default;
Option<string?> requiredNullableStringProp = default;
Option<Guid?> requiredNullableUuid = default;
Option<DateTime?> notRequiredNotnullableDateProp = default;
Option<DateOnly?> notRequiredNotnullableDateProp = default;
Option<int?> notRequiredNotnullableintegerProp = default;
Option<DateTime?> notRequiredNullableDateProp = default;
Option<DateOnly?> notRequiredNullableDateProp = default;
Option<int?> notRequiredNullableIntegerProp = default;
Option<List<string>?> notrequiredNotnullableArrayOfString = default;
Option<bool?> notrequiredNotnullableBooleanProp = default;
@ -1828,7 +1828,7 @@ namespace Org.OpenAPITools.Model
{
case "required_not_nullable_date_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
requiredNotNullableDateProp = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime>(ref utf8JsonReader, jsonSerializerOptions));
requiredNotNullableDateProp = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "required_notnullable_array_of_string":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
@ -1881,7 +1881,7 @@ namespace Org.OpenAPITools.Model
break;
case "required_nullable_date_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
requiredNullableDateProp = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime?>(ref utf8JsonReader, jsonSerializerOptions));
requiredNullableDateProp = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly?>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "required_nullable_datetime_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
@ -1918,7 +1918,7 @@ namespace Org.OpenAPITools.Model
break;
case "not_required_notnullable_date_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
notRequiredNotnullableDateProp = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime>(ref utf8JsonReader, jsonSerializerOptions));
notRequiredNotnullableDateProp = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "not_required_notnullableinteger_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
@ -1926,7 +1926,7 @@ namespace Org.OpenAPITools.Model
break;
case "not_required_nullable_date_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
notRequiredNullableDateProp = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime?>(ref utf8JsonReader, jsonSerializerOptions));
notRequiredNullableDateProp = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly?>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "not_required_nullable_integer_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)

View File

@ -122,6 +122,8 @@ src/Org.OpenAPITools/Client/BasicToken.cs
src/Org.OpenAPITools/Client/BearerToken.cs
src/Org.OpenAPITools/Client/ClientUtils.cs
src/Org.OpenAPITools/Client/CookieContainer.cs
src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs
src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs
src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs
src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs
src/Org.OpenAPITools/Client/ExceptionEventArgs.cs

View File

@ -896,7 +896,7 @@ No authorization required
<a id="testendpointparameters"></a>
# **TestEndpointParameters**
> void TestEndpointParameters (byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime date = null, System.IO.Stream binary = null, float varFloat = null, int integer = null, int int32 = null, long int64 = null, string varString = null, string password = null, string callback = null, DateTime dateTime = null)
> void TestEndpointParameters (byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateOnly date = null, System.IO.Stream binary = null, float varFloat = null, int integer = null, int int32 = null, long int64 = null, string varString = null, string password = null, string callback = null, DateTime dateTime = null)
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@ -927,7 +927,7 @@ namespace Example
var number = 8.14D; // decimal | None
var varDouble = 1.2D; // double | None
var patternWithoutDelimiter = "patternWithoutDelimiter_example"; // string | None
var date = DateTime.Parse("2013-10-20"); // DateTime | None (optional)
var date = DateOnly.Parse("2013-10-20"); // DateOnly | None (optional)
var binary = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | None (optional)
var varFloat = 3.4F; // float | None (optional)
var integer = 56; // int | None (optional)
@ -979,7 +979,7 @@ catch (ApiException e)
| **number** | **decimal** | None | |
| **varDouble** | **double** | None | |
| **patternWithoutDelimiter** | **string** | None | |
| **date** | **DateTime** | None | [optional] |
| **date** | **DateOnly** | None | [optional] |
| **binary** | **System.IO.Stream****System.IO.Stream** | None | [optional] |
| **varFloat** | **float** | None | [optional] |
| **integer** | **int** | None | [optional] |

View File

@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**DateOnlyProperty** | **DateTime** | | [optional]
**DateOnlyProperty** | **DateOnly** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -5,7 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**VarByte** | **byte[]** | |
**Date** | **DateTime** | |
**Date** | **DateOnly** | |
**Number** | **decimal** | |
**Password** | **string** | |
**Binary** | **System.IO.Stream** | | [optional]

View File

@ -8,7 +8,7 @@ Name | Type | Description | Notes
**ArrayItemsNullable** | **List&lt;Object&gt;** | | [optional]
**ArrayNullableProp** | **List&lt;Object&gt;** | | [optional]
**BooleanProp** | **bool** | | [optional]
**DateProp** | **DateTime** | | [optional]
**DateProp** | **DateOnly** | | [optional]
**DatetimeProp** | **DateTime** | | [optional]
**IntegerProp** | **int** | | [optional]
**NumberProp** | **decimal** | | [optional]

View File

@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**RequiredNotNullableDateProp** | **DateTime** | |
**RequiredNotNullableDateProp** | **DateOnly** | |
**RequiredNotnullableArrayOfString** | **List&lt;string&gt;** | |
**RequiredNotnullableBooleanProp** | **bool** | |
**RequiredNotnullableDatetimeProp** | **DateTime** | |
@ -17,7 +17,7 @@ Name | Type | Description | Notes
**RequiredNotnullableintegerProp** | **int** | |
**RequiredNullableArrayOfString** | **List&lt;string&gt;** | |
**RequiredNullableBooleanProp** | **bool** | |
**RequiredNullableDateProp** | **DateTime** | |
**RequiredNullableDateProp** | **DateOnly** | |
**RequiredNullableDatetimeProp** | **DateTime** | |
**RequiredNullableEnumInteger** | **int** | |
**RequiredNullableEnumIntegerOnly** | **int** | |
@ -26,9 +26,9 @@ Name | Type | Description | Notes
**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | |
**RequiredNullableStringProp** | **string** | |
**RequiredNullableUuid** | **Guid** | |
**NotRequiredNotnullableDateProp** | **DateTime** | | [optional]
**NotRequiredNotnullableDateProp** | **DateOnly** | | [optional]
**NotRequiredNotnullableintegerProp** | **int** | | [optional]
**NotRequiredNullableDateProp** | **DateTime** | | [optional]
**NotRequiredNullableDateProp** | **DateOnly** | | [optional]
**NotRequiredNullableIntegerProp** | **int** | | [optional]
**NotrequiredNotnullableArrayOfString** | **List&lt;string&gt;** | | [optional]
**NotrequiredNotnullableBooleanProp** | **bool** | | [optional]

View File

@ -164,7 +164,7 @@ namespace Org.OpenAPITools.Test.Api
decimal number = default;
double varDouble = default;
string patternWithoutDelimiter = default;
Client.Option<DateTime> date = default;
Client.Option<DateOnly> date = default;
Client.Option<System.IO.Stream> binary = default;
Client.Option<float> varFloat = default;
Client.Option<int> integer = default;

View File

@ -286,7 +286,7 @@ namespace Org.OpenAPITools.Api
/// <param name="dateTime">None (optional, default to &quot;2010-02-01T10:20:10.111110+01:00&quot;)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ITestEndpointParametersApiResponse"/>&gt;</returns>
Task<ITestEndpointParametersApiResponse> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default);
Task<ITestEndpointParametersApiResponse> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@ -310,7 +310,7 @@ namespace Org.OpenAPITools.Api
/// <param name="dateTime">None (optional, default to &quot;2010-02-01T10:20:10.111110+01:00&quot;)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ITestEndpointParametersApiResponse"/>&gt;</returns>
Task<ITestEndpointParametersApiResponse> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default);
Task<ITestEndpointParametersApiResponse> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// To test enum parameters
@ -3241,7 +3241,7 @@ namespace Org.OpenAPITools.Api
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
partial void FormatTestEndpointParameters(ref byte[] varByte, ref decimal number, ref double varDouble, ref string patternWithoutDelimiter, ref Option<DateTime> date, ref Option<System.IO.Stream> binary, ref Option<float> varFloat, ref Option<int> integer, ref Option<int> int32, ref Option<long> int64, ref Option<string> varString, ref Option<string> password, ref Option<string> callback, ref Option<DateTime> dateTime);
partial void FormatTestEndpointParameters(ref byte[] varByte, ref decimal number, ref double varDouble, ref string patternWithoutDelimiter, ref Option<DateOnly> date, ref Option<System.IO.Stream> binary, ref Option<float> varFloat, ref Option<int> integer, ref Option<int> int32, ref Option<long> int64, ref Option<string> varString, ref Option<string> password, ref Option<string> callback, ref Option<DateTime> dateTime);
/// <summary>
/// Validates the request parameters
@ -3292,7 +3292,7 @@ namespace Org.OpenAPITools.Api
/// <param name="password"></param>
/// <param name="callback"></param>
/// <param name="dateTime"></param>
private void AfterTestEndpointParametersDefaultImplementation(ITestEndpointParametersApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime)
private void AfterTestEndpointParametersDefaultImplementation(ITestEndpointParametersApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime)
{
bool suppressDefaultLog = false;
AfterTestEndpointParameters(ref suppressDefaultLog, apiResponseLocalVar, varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime);
@ -3319,7 +3319,7 @@ namespace Org.OpenAPITools.Api
/// <param name="password"></param>
/// <param name="callback"></param>
/// <param name="dateTime"></param>
partial void AfterTestEndpointParameters(ref bool suppressDefaultLog, ITestEndpointParametersApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime);
partial void AfterTestEndpointParameters(ref bool suppressDefaultLog, ITestEndpointParametersApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime);
/// <summary>
/// Logs exceptions that occur while retrieving the server response
@ -3341,7 +3341,7 @@ namespace Org.OpenAPITools.Api
/// <param name="password"></param>
/// <param name="callback"></param>
/// <param name="dateTime"></param>
private void OnErrorTestEndpointParametersDefaultImplementation(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime)
private void OnErrorTestEndpointParametersDefaultImplementation(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime)
{
bool suppressDefaultLog = false;
OnErrorTestEndpointParameters(ref suppressDefaultLog, exception, pathFormat, path, varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime);
@ -3370,7 +3370,7 @@ namespace Org.OpenAPITools.Api
/// <param name="password"></param>
/// <param name="callback"></param>
/// <param name="dateTime"></param>
partial void OnErrorTestEndpointParameters(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime);
partial void OnErrorTestEndpointParameters(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date, Option<System.IO.Stream> binary, Option<float> varFloat, Option<int> integer, Option<int> int32, Option<long> int64, Option<string> varString, Option<string> password, Option<string> callback, Option<DateTime> dateTime);
/// <summary>
/// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@ -3391,7 +3391,7 @@ namespace Org.OpenAPITools.Api
/// <param name="dateTime">None (optional, default to &quot;2010-02-01T10:20:10.111110+01:00&quot;)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ITestEndpointParametersApiResponse"/>&gt;</returns>
public async Task<ITestEndpointParametersApiResponse> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default)
public async Task<ITestEndpointParametersApiResponse> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default)
{
try
{
@ -3423,7 +3423,7 @@ namespace Org.OpenAPITools.Api
/// <param name="dateTime">None (optional, default to &quot;2010-02-01T10:20:10.111110+01:00&quot;)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ITestEndpointParametersApiResponse"/>&gt;</returns>
public async Task<ITestEndpointParametersApiResponse> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateTime> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default)
public async Task<ITestEndpointParametersApiResponse> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option<DateOnly> date = default, Option<System.IO.Stream> binary = default, Option<float> varFloat = default, Option<int> integer = default, Option<int> int32 = default, Option<long> int64 = default, Option<string> varString = default, Option<string> password = default, Option<string> callback = default, Option<DateTime> dateTime = default, System.Threading.CancellationToken cancellationToken = default)
{
UriBuilder uriBuilderLocalVar = new UriBuilder();

View File

@ -0,0 +1,61 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class DateOnlyJsonConverter : JsonConverter<DateOnly>
{
/// <summary>
/// The formats used to deserialize the date
/// </summary>
public static string[] Formats { get; } = {
"yyyy'-'MM'-'dd",
"yyyyMMdd"
};
/// <summary>
/// Returns a DateOnly from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) {
if (reader.TokenType == JsonTokenType.Null)
throw new NotSupportedException();
string value = reader.GetString();
foreach(string format in Formats)
if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result))
return result;
throw new NotSupportedException();
}
/// <summary>
/// Writes the DateOnly to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="dateOnlyValue"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, DateOnly dateOnlyValue, JsonSerializerOptions options) =>
writer.WriteStringValue(dateOnlyValue.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture));
}
}

View File

@ -0,0 +1,66 @@
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class DateOnlyNullableJsonConverter : JsonConverter<DateOnly?>
{
/// <summary>
/// The formats used to deserialize the date
/// </summary>
public static string[] Formats { get; } = {
"yyyy'-'MM'-'dd",
"yyyyMMdd"
};
/// <summary>
/// Returns a DateOnly from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override DateOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) {
if (reader.TokenType == JsonTokenType.Null)
return null;
string value = reader.GetString();
foreach(string format in Formats)
if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result))
return result;
throw new NotSupportedException();
}
/// <summary>
/// Writes the DateOnly to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="dateOnlyValue"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, DateOnly? dateOnlyValue, JsonSerializerOptions options)
{
if (dateOnlyValue == null)
writer.WriteNullValue();
else
writer.WriteStringValue(dateOnlyValue.Value.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture));
}
}
}

View File

@ -15,7 +15,7 @@ using System.Text.Json.Serialization;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class DateTimeJsonConverter : JsonConverter<DateTime>
@ -32,7 +32,6 @@ namespace Org.OpenAPITools.Client
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ssK",
"yyyy'-'MM'-'dd",
"yyyyMMddTHHmmss.fffffffK",
"yyyyMMddTHHmmss.ffffffK",
"yyyyMMddTHHmmss.fffffK",
@ -41,7 +40,7 @@ namespace Org.OpenAPITools.Client
"yyyyMMddTHHmmss.ffK",
"yyyyMMddTHHmmss.fK",
"yyyyMMddTHHmmssK",
"yyyyMMdd"
};
/// <summary>

View File

@ -15,7 +15,7 @@ using System.Text.Json.Serialization;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class DateTimeNullableJsonConverter : JsonConverter<DateTime?>
@ -32,7 +32,6 @@ namespace Org.OpenAPITools.Client
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ssK",
"yyyy'-'MM'-'dd",
"yyyyMMddTHHmmss.fffffffK",
"yyyyMMddTHHmmss.ffffffK",
"yyyyMMddTHHmmss.fffffK",
@ -41,7 +40,7 @@ namespace Org.OpenAPITools.Client
"yyyyMMddTHHmmss.ffK",
"yyyyMMddTHHmmss.fK",
"yyyyMMddTHHmmssK",
"yyyyMMdd"
};
/// <summary>

View File

@ -39,6 +39,8 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new JsonStringEnumConverter());
_jsonOptions.Converters.Add(new DateTimeJsonConverter());
_jsonOptions.Converters.Add(new DateTimeNullableJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter());
_jsonOptions.Converters.Add(new ActivityJsonConverter());
_jsonOptions.Converters.Add(new ActivityOutputElementRepresentationJsonConverter());
_jsonOptions.Converters.Add(new AdditionalPropertiesClassJsonConverter());

View File

@ -34,7 +34,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="dateOnlyProperty">dateOnlyProperty</param>
[JsonConstructor]
public DateOnlyClass(Option<DateTime?> dateOnlyProperty = default)
public DateOnlyClass(Option<DateOnly?> dateOnlyProperty = default)
{
DateOnlyPropertyOption = dateOnlyProperty;
OnCreated();
@ -47,14 +47,14 @@ namespace Org.OpenAPITools.Model
/// </summary>
[JsonIgnore]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public Option<DateTime?> DateOnlyPropertyOption { get; private set; }
public Option<DateOnly?> DateOnlyPropertyOption { get; private set; }
/// <summary>
/// Gets or Sets DateOnlyProperty
/// </summary>
/// <example>Fri Jul 21 00:00:00 UTC 2017</example>
[JsonPropertyName("dateOnlyProperty")]
public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } }
public DateOnly? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } }
/// <summary>
/// Gets or Sets additional properties
@ -114,7 +114,7 @@ namespace Org.OpenAPITools.Model
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option<DateTime?> dateOnlyProperty = default;
Option<DateOnly?> dateOnlyProperty = default;
while (utf8JsonReader.Read())
{
@ -133,7 +133,7 @@ namespace Org.OpenAPITools.Model
{
case "dateOnlyProperty":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
dateOnlyProperty = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime>(ref utf8JsonReader, jsonSerializerOptions));
dateOnlyProperty = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly>(ref utf8JsonReader, jsonSerializerOptions));
break;
default:
break;

View File

@ -52,7 +52,7 @@ namespace Org.OpenAPITools.Model
/// <param name="unsignedLong">unsignedLong</param>
/// <param name="uuid">uuid</param>
[JsonConstructor]
public FormatTest(byte[] varByte, DateTime date, decimal number, string password, Option<System.IO.Stream> binary = default, Option<DateTime?> dateTime = default, Option<decimal?> varDecimal = default, Option<double?> varDouble = default, Option<float?> varFloat = default, Option<int?> int32 = default, Option<long?> int64 = default, Option<int?> integer = default, Option<string> patternWithBackslash = default, Option<string> patternWithDigits = default, Option<string> patternWithDigitsAndDelimiter = default, Option<string> varString = default, Option<uint?> unsignedInteger = default, Option<ulong?> unsignedLong = default, Option<Guid?> uuid = default)
public FormatTest(byte[] varByte, DateOnly date, decimal number, string password, Option<System.IO.Stream> binary = default, Option<DateTime?> dateTime = default, Option<decimal?> varDecimal = default, Option<double?> varDouble = default, Option<float?> varFloat = default, Option<int?> int32 = default, Option<long?> int64 = default, Option<int?> integer = default, Option<string> patternWithBackslash = default, Option<string> patternWithDigits = default, Option<string> patternWithDigitsAndDelimiter = default, Option<string> varString = default, Option<uint?> unsignedInteger = default, Option<ulong?> unsignedLong = default, Option<Guid?> uuid = default)
{
VarByte = varByte;
Date = date;
@ -89,7 +89,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <example>Sun Feb 02 00:00:00 UTC 2020</example>
[JsonPropertyName("date")]
public DateTime Date { get; set; }
public DateOnly Date { get; set; }
/// <summary>
/// Gets or Sets Number
@ -509,7 +509,7 @@ namespace Org.OpenAPITools.Model
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option<byte[]> varByte = default;
Option<DateTime?> date = default;
Option<DateOnly?> date = default;
Option<decimal?> number = default;
Option<string> password = default;
Option<System.IO.Stream> binary = default;
@ -549,7 +549,7 @@ namespace Org.OpenAPITools.Model
break;
case "date":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
date = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime>(ref utf8JsonReader, jsonSerializerOptions));
date = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "number":
if (utf8JsonReader.TokenType != JsonTokenType.Null)

View File

@ -45,7 +45,7 @@ namespace Org.OpenAPITools.Model
/// <param name="objectNullableProp">objectNullableProp</param>
/// <param name="stringProp">stringProp</param>
[JsonConstructor]
public NullableClass(Option<List<Object>> arrayAndItemsNullableProp = default, Option<List<Object>> arrayItemsNullable = default, Option<List<Object>> arrayNullableProp = default, Option<bool?> booleanProp = default, Option<DateTime?> dateProp = default, Option<DateTime?> datetimeProp = default, Option<int?> integerProp = default, Option<decimal?> numberProp = default, Option<Dictionary<string, Object>> objectAndItemsNullableProp = default, Option<Dictionary<string, Object>> objectItemsNullable = default, Option<Dictionary<string, Object>> objectNullableProp = default, Option<string> stringProp = default)
public NullableClass(Option<List<Object>> arrayAndItemsNullableProp = default, Option<List<Object>> arrayItemsNullable = default, Option<List<Object>> arrayNullableProp = default, Option<bool?> booleanProp = default, Option<DateOnly?> dateProp = default, Option<DateTime?> datetimeProp = default, Option<int?> integerProp = default, Option<decimal?> numberProp = default, Option<Dictionary<string, Object>> objectAndItemsNullableProp = default, Option<Dictionary<string, Object>> objectItemsNullable = default, Option<Dictionary<string, Object>> objectNullableProp = default, Option<string> stringProp = default)
{
ArrayAndItemsNullablePropOption = arrayAndItemsNullableProp;
ArrayItemsNullableOption = arrayItemsNullable;
@ -121,13 +121,13 @@ namespace Org.OpenAPITools.Model
/// </summary>
[JsonIgnore]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public Option<DateTime?> DatePropOption { get; private set; }
public Option<DateOnly?> DatePropOption { get; private set; }
/// <summary>
/// Gets or Sets DateProp
/// </summary>
[JsonPropertyName("date_prop")]
public DateTime? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new(value); } }
public DateOnly? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new(value); } }
/// <summary>
/// Used to track the state of DatetimeProp
@ -298,7 +298,7 @@ namespace Org.OpenAPITools.Model
Option<List<Object>> arrayItemsNullable = default;
Option<List<Object>> arrayNullableProp = default;
Option<bool?> booleanProp = default;
Option<DateTime?> dateProp = default;
Option<DateOnly?> dateProp = default;
Option<DateTime?> datetimeProp = default;
Option<int?> integerProp = default;
Option<decimal?> numberProp = default;
@ -340,7 +340,7 @@ namespace Org.OpenAPITools.Model
break;
case "date_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
dateProp = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime?>(ref utf8JsonReader, jsonSerializerOptions));
dateProp = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly?>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "datetime_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)

View File

@ -77,7 +77,7 @@ namespace Org.OpenAPITools.Model
/// <param name="notrequiredNullableStringProp">notrequiredNullableStringProp</param>
/// <param name="notrequiredNullableUuid">notrequiredNullableUuid</param>
[JsonConstructor]
public RequiredClass(DateTime requiredNotNullableDateProp, List<string> requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, List<string> requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option<DateTime?> notRequiredNotnullableDateProp = default, Option<int?> notRequiredNotnullableintegerProp = default, Option<DateTime?> notRequiredNullableDateProp = default, Option<int?> notRequiredNullableIntegerProp = default, Option<List<string>> notrequiredNotnullableArrayOfString = default, Option<bool?> notrequiredNotnullableBooleanProp = default, Option<DateTime?> notrequiredNotnullableDatetimeProp = default, Option<NotrequiredNotnullableEnumIntegerEnum?> notrequiredNotnullableEnumInteger = default, Option<NotrequiredNotnullableEnumIntegerOnlyEnum?> notrequiredNotnullableEnumIntegerOnly = default, Option<NotrequiredNotnullableEnumStringEnum?> notrequiredNotnullableEnumString = default, Option<OuterEnumDefaultValue?> notrequiredNotnullableOuterEnumDefaultValue = default, Option<string> notrequiredNotnullableStringProp = default, Option<Guid?> notrequiredNotnullableUuid = default, Option<List<string>> notrequiredNullableArrayOfString = default, Option<bool?> notrequiredNullableBooleanProp = default, Option<DateTime?> notrequiredNullableDatetimeProp = default, Option<NotrequiredNullableEnumIntegerEnum?> notrequiredNullableEnumInteger = default, Option<NotrequiredNullableEnumIntegerOnlyEnum?> notrequiredNullableEnumIntegerOnly = default, Option<NotrequiredNullableEnumStringEnum?> notrequiredNullableEnumString = default, Option<OuterEnumDefaultValue?> notrequiredNullableOuterEnumDefaultValue = default, Option<string> notrequiredNullableStringProp = default, Option<Guid?> notrequiredNullableUuid = default)
public RequiredClass(DateOnly requiredNotNullableDateProp, List<string> requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, List<string> requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateOnly? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option<DateOnly?> notRequiredNotnullableDateProp = default, Option<int?> notRequiredNotnullableintegerProp = default, Option<DateOnly?> notRequiredNullableDateProp = default, Option<int?> notRequiredNullableIntegerProp = default, Option<List<string>> notrequiredNotnullableArrayOfString = default, Option<bool?> notrequiredNotnullableBooleanProp = default, Option<DateTime?> notrequiredNotnullableDatetimeProp = default, Option<NotrequiredNotnullableEnumIntegerEnum?> notrequiredNotnullableEnumInteger = default, Option<NotrequiredNotnullableEnumIntegerOnlyEnum?> notrequiredNotnullableEnumIntegerOnly = default, Option<NotrequiredNotnullableEnumStringEnum?> notrequiredNotnullableEnumString = default, Option<OuterEnumDefaultValue?> notrequiredNotnullableOuterEnumDefaultValue = default, Option<string> notrequiredNotnullableStringProp = default, Option<Guid?> notrequiredNotnullableUuid = default, Option<List<string>> notrequiredNullableArrayOfString = default, Option<bool?> notrequiredNullableBooleanProp = default, Option<DateTime?> notrequiredNullableDatetimeProp = default, Option<NotrequiredNullableEnumIntegerEnum?> notrequiredNullableEnumInteger = default, Option<NotrequiredNullableEnumIntegerOnlyEnum?> notrequiredNullableEnumIntegerOnly = default, Option<NotrequiredNullableEnumStringEnum?> notrequiredNullableEnumString = default, Option<OuterEnumDefaultValue?> notrequiredNullableOuterEnumDefaultValue = default, Option<string> notrequiredNullableStringProp = default, Option<Guid?> notrequiredNullableUuid = default)
{
RequiredNotNullableDateProp = requiredNotNullableDateProp;
RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString;
@ -1362,7 +1362,7 @@ namespace Org.OpenAPITools.Model
/// Gets or Sets RequiredNotNullableDateProp
/// </summary>
[JsonPropertyName("required_not_nullable_date_prop")]
public DateTime RequiredNotNullableDateProp { get; set; }
public DateOnly RequiredNotNullableDateProp { get; set; }
/// <summary>
/// Gets or Sets RequiredNotnullableArrayOfString
@ -1417,7 +1417,7 @@ namespace Org.OpenAPITools.Model
/// Gets or Sets RequiredNullableDateProp
/// </summary>
[JsonPropertyName("required_nullable_date_prop")]
public DateTime? RequiredNullableDateProp { get; set; }
public DateOnly? RequiredNullableDateProp { get; set; }
/// <summary>
/// Gets or Sets RequiredNullableDatetimeProp
@ -1449,13 +1449,13 @@ namespace Org.OpenAPITools.Model
/// </summary>
[JsonIgnore]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public Option<DateTime?> NotRequiredNotnullableDatePropOption { get; private set; }
public Option<DateOnly?> NotRequiredNotnullableDatePropOption { get; private set; }
/// <summary>
/// Gets or Sets NotRequiredNotnullableDateProp
/// </summary>
[JsonPropertyName("not_required_notnullable_date_prop")]
public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } }
public DateOnly? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } }
/// <summary>
/// Used to track the state of NotRequiredNotnullableintegerProp
@ -1475,13 +1475,13 @@ namespace Org.OpenAPITools.Model
/// </summary>
[JsonIgnore]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public Option<DateTime?> NotRequiredNullableDatePropOption { get; private set; }
public Option<DateOnly?> NotRequiredNullableDatePropOption { get; private set; }
/// <summary>
/// Gets or Sets NotRequiredNullableDateProp
/// </summary>
[JsonPropertyName("not_required_nullable_date_prop")]
public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } }
public DateOnly? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } }
/// <summary>
/// Used to track the state of NotRequiredNullableIntegerProp
@ -1764,7 +1764,7 @@ namespace Org.OpenAPITools.Model
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option<DateTime?> requiredNotNullableDateProp = default;
Option<DateOnly?> requiredNotNullableDateProp = default;
Option<List<string>> requiredNotnullableArrayOfString = default;
Option<bool?> requiredNotnullableBooleanProp = default;
Option<DateTime?> requiredNotnullableDatetimeProp = default;
@ -1777,7 +1777,7 @@ namespace Org.OpenAPITools.Model
Option<int?> requiredNotnullableintegerProp = default;
Option<List<string>> requiredNullableArrayOfString = default;
Option<bool?> requiredNullableBooleanProp = default;
Option<DateTime?> requiredNullableDateProp = default;
Option<DateOnly?> requiredNullableDateProp = default;
Option<DateTime?> requiredNullableDatetimeProp = default;
Option<RequiredClass.RequiredNullableEnumIntegerEnum?> requiredNullableEnumInteger = default;
Option<RequiredClass.RequiredNullableEnumIntegerOnlyEnum?> requiredNullableEnumIntegerOnly = default;
@ -1786,9 +1786,9 @@ namespace Org.OpenAPITools.Model
Option<OuterEnumDefaultValue?> requiredNullableOuterEnumDefaultValue = default;
Option<string> requiredNullableStringProp = default;
Option<Guid?> requiredNullableUuid = default;
Option<DateTime?> notRequiredNotnullableDateProp = default;
Option<DateOnly?> notRequiredNotnullableDateProp = default;
Option<int?> notRequiredNotnullableintegerProp = default;
Option<DateTime?> notRequiredNullableDateProp = default;
Option<DateOnly?> notRequiredNullableDateProp = default;
Option<int?> notRequiredNullableIntegerProp = default;
Option<List<string>> notrequiredNotnullableArrayOfString = default;
Option<bool?> notrequiredNotnullableBooleanProp = default;
@ -1826,7 +1826,7 @@ namespace Org.OpenAPITools.Model
{
case "required_not_nullable_date_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
requiredNotNullableDateProp = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime>(ref utf8JsonReader, jsonSerializerOptions));
requiredNotNullableDateProp = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "required_notnullable_array_of_string":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
@ -1879,7 +1879,7 @@ namespace Org.OpenAPITools.Model
break;
case "required_nullable_date_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
requiredNullableDateProp = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime?>(ref utf8JsonReader, jsonSerializerOptions));
requiredNullableDateProp = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly?>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "required_nullable_datetime_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
@ -1916,7 +1916,7 @@ namespace Org.OpenAPITools.Model
break;
case "not_required_notnullable_date_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
notRequiredNotnullableDateProp = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime>(ref utf8JsonReader, jsonSerializerOptions));
notRequiredNotnullableDateProp = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "not_required_notnullableinteger_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
@ -1924,7 +1924,7 @@ namespace Org.OpenAPITools.Model
break;
case "not_required_nullable_date_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
notRequiredNullableDateProp = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime?>(ref utf8JsonReader, jsonSerializerOptions));
notRequiredNullableDateProp = new Option<DateOnly?>(JsonSerializer.Deserialize<DateOnly?>(ref utf8JsonReader, jsonSerializerOptions));
break;
case "not_required_nullable_integer_prop":
if (utf8JsonReader.TokenType != JsonTokenType.Null)

View File

@ -0,0 +1,362 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd

View File

@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@ -0,0 +1,36 @@
.gitignore
Org.OpenAPITools.sln
README.md
api/openapi.yaml
appveyor.yml
docs/apis/DefaultApi.md
docs/models/NowGet200Response.md
docs/scripts/git_push.ps1
docs/scripts/git_push.sh
src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs
src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj
src/Org.OpenAPITools.Test/README.md
src/Org.OpenAPITools/Api/DefaultApi.cs
src/Org.OpenAPITools/Api/IApi.cs
src/Org.OpenAPITools/Client/ApiException.cs
src/Org.OpenAPITools/Client/ApiFactory.cs
src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs
src/Org.OpenAPITools/Client/ApiResponse`1.cs
src/Org.OpenAPITools/Client/ClientUtils.cs
src/Org.OpenAPITools/Client/CookieContainer.cs
src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs
src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs
src/Org.OpenAPITools/Client/ExceptionEventArgs.cs
src/Org.OpenAPITools/Client/HostConfiguration.cs
src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs
src/Org.OpenAPITools/Client/Option.cs
src/Org.OpenAPITools/Client/RateLimitProvider`1.cs
src/Org.OpenAPITools/Client/TokenBase.cs
src/Org.OpenAPITools/Client/TokenContainer`1.cs
src/Org.OpenAPITools/Client/TokenProvider`1.cs
src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs
src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs
src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs
src/Org.OpenAPITools/Model/NowGet200Response.cs
src/Org.OpenAPITools/Org.OpenAPITools.csproj
src/Org.OpenAPITools/README.md

View File

@ -0,0 +1,27 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
VisualStudioVersion = 12.0.0.0
MinimumVisualStudioVersion = 10.0.0.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{2E60EF87-DB0B-4D01-A36E-F5E90F7EC757}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2E60EF87-DB0B-4D01-A36E-F5E90F7EC757}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E60EF87-DB0B-4D01-A36E-F5E90F7EC757}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E60EF87-DB0B-4D01-A36E-F5E90F7EC757}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E60EF87-DB0B-4D01-A36E-F5E90F7EC757}.Release|Any CPU.Build.0 = Release|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1 @@
# Created with Openapi Generator

View File

@ -0,0 +1,35 @@
openapi: 3.0.0
info:
description: Thic spec contains endpoints with dates in different formats
license:
name: Apache-2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
title: OpenAPI Dates
version: 1.0.0
servers:
- url: /
paths:
/now:
get:
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/_now_get_200_response'
description: now dates
components:
schemas:
_now_get_200_response:
example:
today: 2000-01-23
now: 2000-01-23T04:56:07.000+00:00
properties:
today:
format: date
type: string
now:
format: date-time
type: string
type: object

View File

@ -0,0 +1,9 @@
# auto-generated by OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator)
#
image: Visual Studio 2019
clone_depth: 1
build_script:
- dotnet build -c Release
- dotnet test -c Release
after_build:
- dotnet pack .\src\Org.OpenAPITools\Org.OpenAPITools.csproj -o ../../output -c Release --no-build

View File

@ -0,0 +1,90 @@
# Org.OpenAPITools.Api.DefaultApi
All URIs are relative to *http://localhost*
| Method | HTTP request | Description |
|--------|--------------|-------------|
| [**NowGet**](DefaultApi.md#nowget) | **GET** /now | |
<a id="nowget"></a>
# **NowGet**
> NowGet200Response NowGet ()
### Example
```csharp
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class NowGetExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://localhost";
var apiInstance = new DefaultApi(config);
try
{
NowGet200Response result = apiInstance.NowGet();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DefaultApi.NowGet: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the NowGetWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
ApiResponse<NowGet200Response> response = apiInstance.NowGetWithHttpInfo();
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DefaultApi.NowGetWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**NowGet200Response**](NowGet200Response.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | now dates | - |
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)

View File

@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.NowGet200Response
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Now** | **DateTime** | | [optional]
**Today** | **DateTime** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,75 @@
param(
[Parameter()][Alias("g")][String]$GitHost = "github.com",
[Parameter()][Alias("u")][String]$GitUserId = "GIT_USER_ID",
[Parameter()][Alias("r")][String]$GitRepoId = "GIT_REPO_ID",
[Parameter()][Alias("m")][string]$Message = "Minor update",
[Parameter()][Alias("h")][switch]$Help
)
function Publish-ToGitHost{
if ([string]::IsNullOrWhiteSpace($Message) -or $Message -eq "Minor update"){
# it seems unlikely that we would want our git commit message to be the default, so lets prompt the user
$Message = Read-Host -Prompt "Please provide a commit message or press enter"
$Message = if([string]::IsNullOrWhiteSpace($Message)) { "no message provided" } else { $Message }
}
git init
git add .
git commit -am "${Message}"
$branchName=$(git rev-parse --abbrev-ref HEAD)
$gitRemote=$(git remote)
if([string]::IsNullOrWhiteSpace($gitRemote)){
git remote add origin https://${GitHost}/${GitUserId}/${GitRepoId}.git
}
Write-Output "Pulling from https://${GitHost}/${GitUserId}/${GitRepoId}.git"
git pull origin $branchName --ff-only
if ($LastExitCode -ne 0){
if (${GitHost} -eq "github.com"){
Write-Output "The ${GitRepoId} repository may not exist yet. Creating it now with the GitHub CLI."
gh auth login --hostname github.com --web
gh repo create $GitRepoId --private
# sleep 2 seconds to ensure git finishes creation of the repo
Start-Sleep -Seconds 2
}
else{
throw "There was an issue pulling the origin branch. The remote repository may not exist yet."
}
}
Write-Output "Pushing to https://${GitHost}/${GitUserId}/${GitRepoId}.git"
git push origin $branchName
}
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 3.0
if ($Help){
Write-Output "
This script will initialize a git repository, then add and commit all files.
The local repository will then be pushed to your preferred git provider.
If the remote repository does not exist yet and you are using GitHub,
the repository will be created for you provided you have the GitHub CLI installed.
Parameters:
-g | -GitHost -> ex: github.com
-m | -Message -> the git commit message
-r | -GitRepoId -> the name of the repository
-u | -GitUserId -> your user id
"
return
}
$rootPath=Resolve-Path -Path $PSScriptRoot/../..
Push-Location $rootPath
try {
Publish-ToGitHost $GitHost $GitUserId $GitRepoId $Message
}
finally{
Pop-Location
}

View File

@ -0,0 +1,49 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
git_user_id=${1:-GIT_USER_ID}
git_repo_id=${2:-GIT_REPO_ID}
release_note=${3:-Minor update}
git_host=${4:-github.com}
starting_directory=$(pwd)
script_root="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
cd $script_root
cd ../..
if [ "$release_note" = "" ] || [ "$release_note" = "Minor update" ]; then
# it seems unlikely that we would want our git commit message to be the default, so lets prompt the user
echo "Please provide a commit message or press enter"
read user_input
release_note=$user_input
if [ "$release_note" = "" ]; then
release_note="no message provided"
fi
fi
git init
git add .
git commit -am "$release_note"
branch_name=$(git rev-parse --abbrev-ref HEAD)
git_remote=$(git remote)
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
echo "[INFO] Pulling from https://${git_host}/${git_user_id}/${git_repo_id}.git"
git pull origin $branch_name --ff-only
echo "[INFO] Pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin $branch_name
cd $starting_directory

View File

@ -0,0 +1,58 @@
/*
* OpenAPI Dates
*
* Thic spec contains endpoints with dates in different formats
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using Microsoft.Extensions.Hosting;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Extensions;
/* *********************************************************************************
* Follow these manual steps to construct tests.
* This file will not be overwritten.
* *********************************************************************************
* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly.
* Take care not to commit credentials to any repository.
*
* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients.
* To mock the client, use the generic AddApiHttpClients.
* To mock the server, change the client's BaseAddress.
*
* 3. Locate the test you want below
* - remove the skip property from the Fact attribute
* - set the value of any variables if necessary
*
* 4. Run the tests and ensure they work.
*
*/
namespace Org.OpenAPITools.Test.Api
{
/// <summary>
/// Base class for API tests
/// </summary>
public class ApiTestsBase
{
protected readonly IHost _host;
public ApiTestsBase(string[] args)
{
_host = CreateHostBuilder(args).Build();
}
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args)
.ConfigureApi((context, services, options) =>
{
});
}
}

View File

@ -0,0 +1,64 @@
/*
* OpenAPI Dates
*
* Thic spec contains endpoints with dates in different formats
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;
using Microsoft.Extensions.DependencyInjection;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Model;
/* *********************************************************************************
* Follow these manual steps to construct tests.
* This file will not be overwritten.
* *********************************************************************************
* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly.
* Take care not to commit credentials to any repository.
*
* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients.
* To mock the client, use the generic AddApiHttpClients.
* To mock the server, change the client's BaseAddress.
*
* 3. Locate the test you want below
* - remove the skip property from the Fact attribute
* - set the value of any variables if necessary
*
* 4. Run the tests and ensure they work.
*
*/
namespace Org.OpenAPITools.Test.Api
{
/// <summary>
/// Class for testing DefaultApi
/// </summary>
public sealed class DefaultApiTests : ApiTestsBase
{
private readonly IDefaultApi _instance;
public DefaultApiTests(): base(Array.Empty<string>())
{
_instance = _host.Services.GetRequiredService<IDefaultApi>();
}
/// <summary>
/// Test NowGet
/// </summary>
[Fact (Skip = "not implemented")]
public async Task NowGetAsyncTest()
{
var response = await _instance.NowGetAsync();
var model = response.Ok();
Assert.IsType<NowGet200Response>(model);
}
}
}

View File

@ -0,0 +1,103 @@
/*
* OpenAPI Dates
*
* Thic spec contains endpoints with dates in different formats
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
using System.Security.Cryptography;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Extensions;
using Xunit;
namespace Org.OpenAPITools.Test.Api
{
/// <summary>
/// Tests the dependency injection.
/// </summary>
public class DependencyInjectionTest
{
private readonly IHost _hostUsingConfigureWithoutAClient =
Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) =>
{
})
.Build();
private readonly IHost _hostUsingConfigureWithAClient =
Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) =>
{
options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS));
})
.Build();
private readonly IHost _hostUsingAddWithoutAClient =
Host.CreateDefaultBuilder([]).ConfigureServices((host, services) =>
{
services.AddApi(options =>
{
});
})
.Build();
private readonly IHost _hostUsingAddWithAClient =
Host.CreateDefaultBuilder([]).ConfigureServices((host, services) =>
{
services.AddApi(options =>
{
options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS));
});
})
.Build();
/// <summary>
/// Test dependency injection when using the configure method
/// </summary>
[Fact]
public void ConfigureApiWithAClientTest()
{
var defaultApi = _hostUsingConfigureWithAClient.Services.GetRequiredService<IDefaultApi>();
Assert.True(defaultApi.HttpClient.BaseAddress != null);
}
/// <summary>
/// Test dependency injection when using the configure method
/// </summary>
[Fact]
public void ConfigureApiWithoutAClientTest()
{
var defaultApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService<IDefaultApi>();
Assert.True(defaultApi.HttpClient.BaseAddress != null);
}
/// <summary>
/// Test dependency injection when using the add method
/// </summary>
[Fact]
public void AddApiWithAClientTest()
{
var defaultApi = _hostUsingAddWithAClient.Services.GetRequiredService<IDefaultApi>();
Assert.True(defaultApi.HttpClient.BaseAddress != null);
}
/// <summary>
/// Test dependency injection when using the add method
/// </summary>
[Fact]
public void AddApiWithoutAClientTest()
{
var defaultApi = _hostUsingAddWithoutAClient.Services.GetRequiredService<IDefaultApi>();
Assert.True(defaultApi.HttpClient.BaseAddress != null);
}
}
}

View File

@ -0,0 +1,74 @@
/*
* OpenAPI Dates
*
* Thic spec contains endpoints with dates in different formats
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using Xunit;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Org.OpenAPITools.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing NowGet200Response
/// </summary>
/// <remarks>
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
/// Please update the test case below to test the model.
/// </remarks>
public class NowGet200ResponseTests : IDisposable
{
// TODO uncomment below to declare an instance variable for NowGet200Response
//private NowGet200Response instance;
public NowGet200ResponseTests()
{
// TODO uncomment below to create an instance of NowGet200Response
//instance = new NowGet200Response();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of NowGet200Response
/// </summary>
[Fact]
public void NowGet200ResponseInstanceTest()
{
// TODO uncomment below to test "IsType" NowGet200Response
//Assert.IsType<NowGet200Response>(instance);
}
/// <summary>
/// Test the property 'Now'
/// </summary>
[Fact]
public void NowTest()
{
// TODO unit test for the property 'Now'
}
/// <summary>
/// Test the property 'Today'
/// </summary>
[Fact]
public void TodayTest()
{
// TODO unit test for the property 'Today'
}
}
}

View File

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Org.OpenAPITools.Test</AssemblyName>
<RootNamespace>Org.OpenAPITools.Test</RootNamespace>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Org.OpenAPITools\Org.OpenAPITools.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,332 @@
// <auto-generated>
/*
* OpenAPI Dates
*
* Thic spec contains endpoints with dates in different formats
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
using System.Diagnostics.CodeAnalysis;
namespace Org.OpenAPITools.Api
{
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// This class is registered as transient.
/// </summary>
public interface IDefaultApi : IApi
{
/// <summary>
/// The class containing the events
/// </summary>
DefaultApiEvents Events { get; }
/// <summary>
///
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="INowGetApiResponse"/>&gt;</returns>
Task<INowGetApiResponse> NowGetAsync(System.Threading.CancellationToken cancellationToken = default);
/// <summary>
///
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="INowGetApiResponse"/>?&gt;</returns>
Task<INowGetApiResponse?> NowGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
}
/// <summary>
/// The <see cref="INowGetApiResponse"/>
/// </summary>
public interface INowGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk<Org.OpenAPITools.Model.NowGet200Response?>
{
/// <summary>
/// Returns true if the response is 200 Ok
/// </summary>
/// <returns></returns>
bool IsOk { get; }
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public class DefaultApiEvents
{
/// <summary>
/// The event raised after the server response
/// </summary>
public event EventHandler<ApiResponseEventArgs>? OnNowGet;
/// <summary>
/// The event raised after an error querying the server
/// </summary>
public event EventHandler<ExceptionEventArgs>? OnErrorNowGet;
internal void ExecuteOnNowGet(DefaultApi.NowGetApiResponse apiResponse)
{
OnNowGet?.Invoke(this, new ApiResponseEventArgs(apiResponse));
}
internal void ExecuteOnErrorNowGet(Exception exception)
{
OnErrorNowGet?.Invoke(this, new ExceptionEventArgs(exception));
}
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public sealed partial class DefaultApi : IDefaultApi
{
private JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// The logger factory
/// </summary>
public ILoggerFactory LoggerFactory { get; }
/// <summary>
/// The logger
/// </summary>
public ILogger<DefaultApi> Logger { get; }
/// <summary>
/// The HttpClient
/// </summary>
public HttpClient HttpClient { get; }
/// <summary>
/// The class containing the events
/// </summary>
public DefaultApiEvents Events { get; }
/// <summary>
/// Initializes a new instance of the <see cref="DefaultApi"/> class.
/// </summary>
/// <returns></returns>
public DefaultApi(ILogger<DefaultApi> logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, DefaultApiEvents defaultApiEvents)
{
_jsonSerializerOptions = jsonSerializerOptionsProvider.Options;
LoggerFactory = loggerFactory;
Logger = LoggerFactory.CreateLogger<DefaultApi>();
HttpClient = httpClient;
Events = defaultApiEvents;
}
/// <summary>
/// Processes the server response
/// </summary>
/// <param name="apiResponseLocalVar"></param>
private void AfterNowGetDefaultImplementation(INowGetApiResponse apiResponseLocalVar)
{
bool suppressDefaultLog = false;
AfterNowGet(ref suppressDefaultLog, apiResponseLocalVar);
if (!suppressDefaultLog)
Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
}
/// <summary>
/// Processes the server response
/// </summary>
/// <param name="suppressDefaultLog"></param>
/// <param name="apiResponseLocalVar"></param>
partial void AfterNowGet(ref bool suppressDefaultLog, INowGetApiResponse apiResponseLocalVar);
/// <summary>
/// Logs exceptions that occur while retrieving the server response
/// </summary>
/// <param name="exception"></param>
/// <param name="pathFormat"></param>
/// <param name="path"></param>
private void OnErrorNowGetDefaultImplementation(Exception exception, string pathFormat, string path)
{
bool suppressDefaultLog = false;
OnErrorNowGet(ref suppressDefaultLog, exception, pathFormat, path);
if (!suppressDefaultLog)
Logger.LogError(exception, "An error occurred while sending the request to the server.");
}
/// <summary>
/// A partial method that gives developers a way to provide customized exception handling
/// </summary>
/// <param name="suppressDefaultLog"></param>
/// <param name="exception"></param>
/// <param name="pathFormat"></param>
/// <param name="path"></param>
partial void OnErrorNowGet(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path);
/// <summary>
///
/// </summary>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="INowGetApiResponse"/>&gt;</returns>
public async Task<INowGetApiResponse?> NowGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
{
try
{
return await NowGetAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception)
{
return null;
}
}
/// <summary>
///
/// </summary>
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="INowGetApiResponse"/>&gt;</returns>
public async Task<INowGetApiResponse> NowGetAsync(System.Threading.CancellationToken cancellationToken = default)
{
UriBuilder uriBuilderLocalVar = new UriBuilder();
try
{
using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
{
uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host;
uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/now";
httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
string[] acceptLocalVars = new string[] {
"application/json"
};
string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
if (acceptLocalVar != null)
httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
httpRequestMessageLocalVar.Method = HttpMethod.Get;
DateTime requestedAtLocalVar = DateTime.UtcNow;
using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
{
string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
ILogger<NowGetApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<NowGetApiResponse>();
NowGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/now", requestedAtLocalVar, _jsonSerializerOptions);
AfterNowGetDefaultImplementation(apiResponseLocalVar);
Events.ExecuteOnNowGet(apiResponseLocalVar);
return apiResponseLocalVar;
}
}
}
catch(Exception e)
{
OnErrorNowGetDefaultImplementation(e, "/now", uriBuilderLocalVar.Path);
Events.ExecuteOnErrorNowGet(e);
throw;
}
}
/// <summary>
/// The <see cref="NowGetApiResponse"/>
/// </summary>
public partial class NowGetApiResponse : Org.OpenAPITools.Client.ApiResponse, INowGetApiResponse
{
/// <summary>
/// The logger
/// </summary>
public ILogger<NowGetApiResponse> Logger { get; }
/// <summary>
/// The <see cref="NowGetApiResponse"/>
/// </summary>
/// <param name="logger"></param>
/// <param name="httpRequestMessage"></param>
/// <param name="httpResponseMessage"></param>
/// <param name="rawContent"></param>
/// <param name="path"></param>
/// <param name="requestedAt"></param>
/// <param name="jsonSerializerOptions"></param>
public NowGetApiResponse(ILogger<NowGetApiResponse> logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
{
Logger = logger;
OnCreated(httpRequestMessage, httpResponseMessage);
}
partial void OnCreated(System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
/// <summary>
/// Returns true if the response is 200 Ok
/// </summary>
/// <returns></returns>
public bool IsOk => 200 == (int)StatusCode;
/// <summary>
/// Deserializes the response if the response is 200 Ok
/// </summary>
/// <returns></returns>
public Org.OpenAPITools.Model.NowGet200Response? Ok()
{
// This logic may be modified with the AsModel.mustache template
return IsOk
? System.Text.Json.JsonSerializer.Deserialize<Org.OpenAPITools.Model.NowGet200Response>(RawContent, _jsonSerializerOptions)
: null;
}
/// <summary>
/// Returns true if the response is 200 Ok and the deserialized response is not null
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.NowGet200Response? result)
{
result = null;
try
{
result = Ok();
} catch (Exception e)
{
OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200);
}
return result != null;
}
private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
{
bool suppressDefaultLog = false;
OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
if (!suppressDefaultLog)
Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
}
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
}
}

View File

@ -0,0 +1,15 @@
using System.Net.Http;
namespace Org.OpenAPITools.Api
{
/// <summary>
/// Any Api client
/// </summary>
public interface IApi
{
/// <summary>
/// The HttpClient
/// </summary>
HttpClient HttpClient { get; }
}
}

View File

@ -0,0 +1,52 @@
// <auto-generated>
/*
* OpenAPI Dates
*
* Thic spec contains endpoints with dates in different formats
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// API Exception
/// </summary>
public class ApiException : Exception
{
/// <summary>
/// The reason the api request failed
/// </summary>
public string? ReasonPhrase { get; }
/// <summary>
/// The HttpStatusCode
/// </summary>
public System.Net.HttpStatusCode StatusCode { get; }
/// <summary>
/// The raw data returned by the api
/// </summary>
public string RawContent { get; }
/// <summary>
/// Construct the ApiException from parts of the response
/// </summary>
/// <param name="reasonPhrase"></param>
/// <param name="statusCode"></param>
/// <param name="rawContent"></param>
public ApiException(string? reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent)
{
ReasonPhrase = reasonPhrase;
StatusCode = statusCode;
RawContent = rawContent;
}
}
}

View File

@ -0,0 +1,49 @@
using System;
using Microsoft.Extensions.DependencyInjection;
using Org.OpenAPITools.Api;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// An IApiFactory interface
/// </summary>
public interface IApiFactory
{
/// <summary>
/// A method to create an IApi of type IResult
/// </summary>
/// <typeparam name="IResult"></typeparam>
/// <returns></returns>
IResult Create<IResult>() where IResult : IApi;
}
/// <summary>
/// An ApiFactory
/// </summary>
public class ApiFactory : IApiFactory
{
/// <summary>
/// The service provider
/// </summary>
public IServiceProvider Services { get; }
/// <summary>
/// Initializes a new instance of the <see cref="ApiFactory"/> class.
/// </summary>
/// <param name="services"></param>
public ApiFactory(IServiceProvider services)
{
Services = services;
}
/// <summary>
/// A method to create an IApi of type IResult
/// </summary>
/// <typeparam name="IResult"></typeparam>
/// <returns></returns>
public IResult Create<IResult>() where IResult : IApi
{
return Services.GetRequiredService<IResult>();
}
}
}

View File

@ -0,0 +1,24 @@
using System;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Useful for tracking server health
/// </summary>
public class ApiResponseEventArgs : EventArgs
{
/// <summary>
/// The ApiResponse
/// </summary>
public ApiResponse ApiResponse { get; }
/// <summary>
/// The ApiResponseEventArgs
/// </summary>
/// <param name="apiResponse"></param>
public ApiResponseEventArgs(ApiResponse apiResponse)
{
ApiResponse = apiResponse;
}
}
}

View File

@ -0,0 +1,172 @@
// <auto-generated>
/*
* OpenAPI Dates
*
* Thic spec contains endpoints with dates in different formats
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Diagnostics.CodeAnalysis;
using System.Net;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Provides a non-generic contract for the ApiResponse wrapper.
/// </summary>
public partial interface IApiResponse
{
/// <summary>
/// The IsSuccessStatusCode from the api response
/// </summary>
bool IsSuccessStatusCode { get; }
/// <summary>
/// Gets the status code (HTTP status code)
/// </summary>
/// <value>The status code.</value>
HttpStatusCode StatusCode { get; }
/// <summary>
/// The raw content of this response.
/// </summary>
string RawContent { get; }
/// <summary>
/// The DateTime when the request was retrieved.
/// </summary>
DateTime DownloadedAt { get; }
/// <summary>
/// The headers contained in the api response
/// </summary>
System.Net.Http.Headers.HttpResponseHeaders Headers { get; }
/// <summary>
/// The path used when making the request.
/// </summary>
string Path { get; }
/// <summary>
/// The reason phrase contained in the api response
/// </summary>
string? ReasonPhrase { get; }
/// <summary>
/// The DateTime when the request was sent.
/// </summary>
DateTime RequestedAt { get; }
/// <summary>
/// The Uri used when making the request.
/// </summary>
Uri? RequestUri { get; }
}
/// <summary>
/// API Response
/// </summary>
public partial class ApiResponse : IApiResponse
{
/// <summary>
/// Gets the status code (HTTP status code)
/// </summary>
/// <value>The status code.</value>
public HttpStatusCode StatusCode { get; }
/// <summary>
/// The raw data
/// </summary>
public string RawContent { get; protected set; }
/// <summary>
/// The IsSuccessStatusCode from the api response
/// </summary>
public bool IsSuccessStatusCode { get; }
/// <summary>
/// The reason phrase contained in the api response
/// </summary>
public string? ReasonPhrase { get; }
/// <summary>
/// The headers contained in the api response
/// </summary>
public System.Net.Http.Headers.HttpResponseHeaders Headers { get; }
/// <summary>
/// The DateTime when the request was retrieved.
/// </summary>
public DateTime DownloadedAt { get; } = DateTime.UtcNow;
/// <summary>
/// The DateTime when the request was sent.
/// </summary>
public DateTime RequestedAt { get; }
/// <summary>
/// The path used when making the request.
/// </summary>
public string Path { get; }
/// <summary>
/// The Uri used when making the request.
/// </summary>
public Uri? RequestUri { get; }
/// <summary>
/// The <see cref="System.Text.Json.JsonSerializerOptions"/>
/// </summary>
protected System.Text.Json.JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// Construct the response using an HttpResponseMessage
/// </summary>
/// <param name="httpRequestMessage"></param>
/// <param name="httpResponseMessage"></param>
/// <param name="rawContent"></param>
/// <param name="path"></param>
/// <param name="requestedAt"></param>
/// <param name="jsonSerializerOptions"></param>
public ApiResponse(System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions)
{
StatusCode = httpResponseMessage.StatusCode;
Headers = httpResponseMessage.Headers;
IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode;
ReasonPhrase = httpResponseMessage.ReasonPhrase;
RawContent = rawContent;
Path = path;
RequestUri = httpRequestMessage.RequestUri;
RequestedAt = requestedAt;
_jsonSerializerOptions = jsonSerializerOptions;
OnCreated(httpRequestMessage, httpResponseMessage);
}
partial void OnCreated(System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
}
/// <summary>
/// An interface for responses of type
/// </summary>
/// <typeparam name="TType"></typeparam>
public interface IOk<TType> : IApiResponse
{
/// <summary>
/// Deserializes the response if the response is Ok
/// </summary>
/// <returns></returns>
TType Ok();
/// <summary>
/// Returns true if the response is Ok and the deserialized response is not null
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
bool TryOk([NotNullWhen(true)]out TType? result);
}
}

View File

@ -0,0 +1,279 @@
/*
* OpenAPI Dates
*
* Thic spec contains endpoints with dates in different formats
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using Org.OpenAPITools.Model;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Org.OpenAPITools.Test")]
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Utility functions providing some benefit to API client consumers.
/// </summary>
public static class ClientUtils
{
/// <summary>
/// A delegate for events.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <returns></returns>
public delegate void EventHandler<T>(object sender, T e) where T : EventArgs;
/// <summary>
/// Returns true when deserialization succeeds.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="json"></param>
/// <param name="options"></param>
/// <param name="result"></param>
/// <returns></returns>
public static bool TryDeserialize<T>(string json, JsonSerializerOptions options, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result)
{
try
{
result = JsonSerializer.Deserialize<T>(json, options);
return result != null;
}
catch (Exception)
{
result = default;
return false;
}
}
/// <summary>
/// Returns true when deserialization succeeds.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="reader"></param>
/// <param name="options"></param>
/// <param name="result"></param>
/// <returns></returns>
public static bool TryDeserialize<T>(ref Utf8JsonReader reader, JsonSerializerOptions options, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result)
{
try
{
result = JsonSerializer.Deserialize<T>(ref reader, options);
return result != null;
}
catch (Exception)
{
result = default;
return false;
}
}
/// <summary>
/// Sanitize filename by removing the path
/// </summary>
/// <param name="filename">Filename</param>
/// <returns>Filename</returns>
public static string SanitizeFilename(string filename)
{
Match match = Regex.Match(filename, @".*[/\\](.*)$");
return match.Success ? match.Groups[1].Value : filename;
}
/// <summary>
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
/// Otherwise just return the string.
/// </summary>
/// <param name="obj">The parameter (header, path, query, form).</param>
/// <param name="format">The DateTime serialization format.</param>
/// <returns>Formatted string.</returns>
public static string? ParameterToString(object obj, string? format = ISO8601_DATETIME_FORMAT)
{
if (obj is DateTime dateTime)
// 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-15T13:45:30.0000000
return dateTime.ToString(format);
if (obj is DateTimeOffset dateTimeOffset)
// 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-15T13:45:30.0000000
return dateTimeOffset.ToString(format);
if (obj is bool boolean)
return boolean
? "true"
: "false";
if (obj is ICollection collection)
{
List<string?> entries = new();
foreach (var entry in collection)
entries.Add(ParameterToString(entry));
return string.Join(",", entries);
}
return Convert.ToString(obj, System.Globalization.CultureInfo.InvariantCulture);
}
/// <summary>
/// URL encode a string
/// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50
/// </summary>
/// <param name="input">string to be URL encoded</param>
/// <returns>Byte array</returns>
public static string UrlEncode(string input)
{
const int maxLength = 32766;
if (input == null)
{
throw new ArgumentNullException("input");
}
if (input.Length <= maxLength)
{
return Uri.EscapeDataString(input);
}
StringBuilder sb = new StringBuilder(input.Length * 2);
int index = 0;
while (index < input.Length)
{
int length = Math.Min(input.Length - index, maxLength);
string subString = input.Substring(index, length);
sb.Append(Uri.EscapeDataString(subString));
index += subString.Length;
}
return sb.ToString();
}
/// <summary>
/// Encode string in base64 format.
/// </summary>
/// <param name="text">string to be encoded.</param>
/// <returns>Encoded string.</returns>
public static string Base64Encode(string text)
{
return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text));
}
/// <summary>
/// Convert stream to byte array
/// </summary>
/// <param name="inputStream">Input stream to be converted</param>
/// <returns>Byte array</returns>
public static byte[] ReadAsBytes(Stream inputStream)
{
using (var ms = new MemoryStream())
{
inputStream.CopyTo(ms);
return ms.ToArray();
}
}
/// <summary>
/// Select the Content-Type header's value from the given content-type array:
/// if JSON type exists in the given array, use it;
/// otherwise use the first one defined in 'consumes'
/// </summary>
/// <param name="contentTypes">The Content-Type array to select from.</param>
/// <returns>The Content-Type header to use.</returns>
public static string? SelectHeaderContentType(string[] contentTypes)
{
if (contentTypes.Length == 0)
return null;
foreach (var contentType in contentTypes)
{
if (IsJsonMime(contentType))
return contentType;
}
return contentTypes[0]; // use the first content type specified in 'consumes'
}
/// <summary>
/// Select the Accept header's value from the given accepts array:
/// if JSON exists in the given array, use it;
/// otherwise use all of them (joining into a string)
/// </summary>
/// <param name="accepts">The accepts array to select from.</param>
/// <returns>The Accept header to use.</returns>
public static string? SelectHeaderAccept(string[] accepts)
{
if (accepts.Length == 0)
return null;
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
return "application/json";
return string.Join(",", accepts);
}
/// <summary>
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
/// </summary>
public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
/// <summary>
/// Check if the given MIME is a JSON MIME.
/// JSON MIME examples:
/// application/json
/// application/json; charset=UTF8
/// APPLICATION/JSON
/// application/vnd.company+json
/// </summary>
/// <param name="mime">MIME</param>
/// <returns>Returns True if MIME type is json.</returns>
public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
}
/// <summary>
/// The base path of the API
/// </summary>
public const string BASE_ADDRESS = "http://localhost";
/// <summary>
/// The scheme of the API
/// </summary>
public const string SCHEME = "http";
/// <summary>
/// The context path of the API
/// </summary>
public const string CONTEXT_PATH = "";
/// <summary>
/// The host of the API
/// </summary>
public const string HOST = "localhost";
/// <summary>
/// The format to use for DateTime serialization
/// </summary>
public const string ISO8601_DATETIME_FORMAT = "o";
}
}

View File

@ -0,0 +1,20 @@
// <auto-generated>
#nullable enable
using System.Linq;
using System.Collections.Generic;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// A class containing a CookieContainer
/// </summary>
public sealed class CookieContainer
{
/// <summary>
/// The collection of tokens
/// </summary>
public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer();
}
}

View File

@ -0,0 +1,77 @@
/*
* OpenAPI Dates
*
* Thic spec contains endpoints with dates in different formats
*
* The version of the OpenAPI document: 1.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Formatter for 'date' and 'date-time' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class DateTimeJsonConverter : JsonConverter<DateTime>
{
/// <summary>
/// The formats used to deserialize the date
/// </summary>
public static string[] Formats { get; } = {
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK",
"yyyy'-'MM'-'dd'T'HH':'mm':'ssK",
"yyyy'-'MM'-'dd",
"yyyyMMddTHHmmss.fffffffK",
"yyyyMMddTHHmmss.ffffffK",
"yyyyMMddTHHmmss.fffffK",
"yyyyMMddTHHmmss.ffffK",
"yyyyMMddTHHmmss.fffK",
"yyyyMMddTHHmmss.ffK",
"yyyyMMddTHHmmss.fK",
"yyyyMMddTHHmmssK",
"yyyyMMdd"
};
/// <summary>
/// Returns a DateTime from the Json object
/// </summary>
/// <param name="reader"></param>
/// <param name="typeToConvert"></param>
/// <param name="options"></param>
/// <returns></returns>
public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) {
if (reader.TokenType == JsonTokenType.Null)
throw new NotSupportedException();
string value = reader.GetString()!;
foreach(string format in Formats)
if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result))
return result;
throw new NotSupportedException();
}
/// <summary>
/// Writes the DateTime to the json writer
/// </summary>
/// <param name="writer"></param>
/// <param name="dateTimeValue"></param>
/// <param name="options"></param>
public override void Write(Utf8JsonWriter writer, DateTime dateTimeValue, JsonSerializerOptions options) =>
writer.WriteStringValue(dateTimeValue.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture));
}
}

Some files were not shown because too many files have changed in this diff Show More