[NancyFx] Fix for issue #7024, date field mapped to ZonedDateTime (#7025)

* add support for async routes/endpoints

you can now set --optional-properties async=true to generate
a nancyfx server stub that uses asynchronous programming.

(cherry picked from commit 126869cb0b967e8063417e11993cf6326ce8ffd4)

* add nancyfx-petstore-server-async.sh to generate sample of async nancyfx.

* Rename async => asyncServer

* update bin/nancyfx-petstore-server-async.sh

* rename async => asyncServer in api.mustache + small bugfix

* run ./bin/nancyfx-petstore-server.sh and ./bin/nancyfx-petstore-server-async.sh

* remove additional new line in api.mustache + add space after if

* run ./bin/nancyfx-petstore-server.sh and ./bin/nancyfx-petstore-server-async.sh

* Map `date` fields to LocalDate c# type + add a JsonConverter for LocalDate.
This commit is contained in:
craffael
2017-11-27 09:46:09 +01:00
committed by William Cheng
parent 1b90a05754
commit fc5ec6271a
9 changed files with 195 additions and 8 deletions

View File

@@ -121,6 +121,7 @@ public class NancyFXServerCodegen extends AbstractCSharpCodegen {
modelPackage = isNullOrEmpty(packageName) ? MODEL_NAMESPACE : packageName + "." + MODEL_NAMESPACE;
supportingFiles.add(new SupportingFile("parameters.mustache", sourceFile("Utils"), "Parameters.cs"));
supportingFiles.add(new SupportingFile("localDateConverter.mustache", sourceFile("Utils"), "LocalDateConverter.cs"));
supportingFiles.add(new SupportingFile("packages.config.mustache", sourceFolder(), "packages.config"));
supportingFiles.add(new SupportingFile("nuspec.mustache", sourceFolder(), packageName + ".nuspec"));
@@ -391,12 +392,12 @@ public class NancyFXServerCodegen extends AbstractCSharpCodegen {
private static Map<String, String> nodaTimeTypesMappings() {
return ImmutableMap.of(
"time", "LocalTime?",
"date", "ZonedDateTime?",
"date", "LocalDate?",
"datetime", "ZonedDateTime?");
}
private static Set<String> nodaTimePrimitiveTypes() {
return ImmutableSet.of("LocalTime?", "ZonedDateTime?");
return ImmutableSet.of("LocalTime?", "LocalDate?","ZonedDateTime?");
}
private class DependencyInfo {