forked from loafle/openapi-generator-original
[C#][NancyFX] Better "Add" for Dictionary and using {{packageName}} for NancyFX (#3449)
* use square bucket for C# dictionary * use packageName for nancyfx generator, update info to debug for log * use packageName for nancyfx generator, update info to debug for log
This commit is contained in:
parent
8184732da2
commit
30c2503f9f
31
bin/nancyfx-petstore-server.sh
Executable file
31
bin/nancyfx-petstore-server.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/nancyfx -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l nancyfx -o samples/server/petstore/nancyfx"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
@ -5,6 +5,6 @@ If Not Exist %executable% (
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l nancyfx -o samples\server\petstore\nancyfx\
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l nancyfx -o samples\server\petstore\nancyfx\
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
|
@ -222,7 +222,7 @@ public class NancyFXServerCodegen extends AbstractCSharpCodegen {
|
||||
}
|
||||
|
||||
private void postProcessParentModels(final Map<String, Object> models) {
|
||||
log.info("Processing parents: " + parentModels);
|
||||
log.debug("Processing parents: " + parentModels);
|
||||
for (final String parent : parentModels) {
|
||||
final CodegenModel parentModel = modelByName(parent, models);
|
||||
parentModel.hasChildren = true;
|
||||
@ -301,7 +301,7 @@ public class NancyFXServerCodegen extends AbstractCSharpCodegen {
|
||||
} else {
|
||||
result = enumName;
|
||||
}
|
||||
log.info(String.format("toEnumVarName('%s', %s) = '%s'", name, datatype, enumName));
|
||||
log.debug(String.format("toEnumVarName('%s', %s) = '%s'", name, datatype, enumName));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ public class NancyFXServerCodegen extends AbstractCSharpCodegen {
|
||||
} else {
|
||||
apiName = capitalize(name);
|
||||
}
|
||||
log.info(String.format("toApiName('%s') = '%s'", name, apiName));
|
||||
log.debug(String.format("toApiName('%s') = '%s'", name, apiName));
|
||||
return apiName;
|
||||
}
|
||||
|
||||
@ -334,7 +334,7 @@ public class NancyFXServerCodegen extends AbstractCSharpCodegen {
|
||||
} else {
|
||||
result = null;
|
||||
}
|
||||
log.info(String.format("toModelImport('%s') = '%s'", name, result));
|
||||
log.debug(String.format("toModelImport('%s') = '%s'", name, result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -158,9 +158,7 @@ namespace {{packageName}}.Client
|
||||
/// <returns></returns>
|
||||
public void AddDefaultHeader(string key, string value)
|
||||
{
|
||||
if (_defaultHeaderMap.ContainsKey(key))
|
||||
_defaultHeaderMap.Remove(key);
|
||||
_defaultHeaderMap.Add(key, value);
|
||||
_defaultHeaderMap[key] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -171,9 +169,7 @@ namespace {{packageName}}.Client
|
||||
/// <returns></returns>
|
||||
public void AddApiKey(string key, string value)
|
||||
{
|
||||
if (ApiKey.ContainsKey(key))
|
||||
ApiKey.Remove(key);
|
||||
ApiKey.Add(key, value);
|
||||
ApiKey[key] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -183,9 +179,7 @@ namespace {{packageName}}.Client
|
||||
/// <param name="value">Api Key value.</param>
|
||||
public void AddApiKeyPrefix(string key, string value)
|
||||
{
|
||||
if (ApiKeyPrefix.ContainsKey(key))
|
||||
ApiKeyPrefix.Remove(key);
|
||||
ApiKeyPrefix.Add(key, value);
|
||||
ApiKeyPrefix[key] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>{{packageName}}.{{packageContext}}</RootNamespace>
|
||||
<AssemblyName>{{packageTitle}}</AssemblyName>
|
||||
<AssemblyName>{{packageName}}</AssemblyName>
|
||||
{{^supportsUWP}}
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
{{/supportsUWP}}
|
||||
|
@ -2,7 +2,7 @@ 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}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{1ABB7E18-6533-446C-9EEA-0E0839F5C12A}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{B7B26355-6F11-47C6-AB34-6237A673E486}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
|
||||
EndProject
|
||||
@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1ABB7E18-6533-446C-9EEA-0E0839F5C12A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1ABB7E18-6533-446C-9EEA-0E0839F5C12A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1ABB7E18-6533-446C-9EEA-0E0839F5C12A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1ABB7E18-6533-446C-9EEA-0E0839F5C12A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B7B26355-6F11-47C6-AB34-6237A673E486}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B7B26355-6F11-47C6-AB34-6237A673E486}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B7B26355-6F11-47C6-AB34-6237A673E486}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B7B26355-6F11-47C6-AB34-6237A673E486}.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
|
||||
|
@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c
|
||||
|
||||
- API version: 1.0.0
|
||||
- SDK version: 1.0.0
|
||||
- Build date: 2016-07-24T11:20:06.818-04:00
|
||||
- Build date: 2016-07-26T00:22:48.731+08:00
|
||||
- Build package: class io.swagger.codegen.languages.CSharpClientCodegen
|
||||
|
||||
## Frameworks supported
|
||||
@ -137,6 +137,12 @@ Class | Method | HTTP request | Description
|
||||
|
||||
## Documentation for Authorization
|
||||
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
### petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
@ -146,9 +152,3 @@ Class | Method | HTTP request | Description
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
|
@ -179,9 +179,7 @@ namespace IO.Swagger.Client
|
||||
/// <returns></returns>
|
||||
public void AddDefaultHeader(string key, string value)
|
||||
{
|
||||
if (_defaultHeaderMap.ContainsKey(key))
|
||||
_defaultHeaderMap.Remove(key);
|
||||
_defaultHeaderMap.Add(key, value);
|
||||
_defaultHeaderMap[key] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -192,9 +190,7 @@ namespace IO.Swagger.Client
|
||||
/// <returns></returns>
|
||||
public void AddApiKey(string key, string value)
|
||||
{
|
||||
if (ApiKey.ContainsKey(key))
|
||||
ApiKey.Remove(key);
|
||||
ApiKey.Add(key, value);
|
||||
ApiKey[key] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -204,9 +200,7 @@ namespace IO.Swagger.Client
|
||||
/// <param name="value">Api Key value.</param>
|
||||
public void AddApiKeyPrefix(string key, string value)
|
||||
{
|
||||
if (ApiKeyPrefix.ContainsKey(key))
|
||||
ApiKeyPrefix.Remove(key);
|
||||
ApiKeyPrefix.Add(key, value);
|
||||
ApiKeyPrefix[key] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -24,7 +24,7 @@ limitations under the License.
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{1ABB7E18-6533-446C-9EEA-0E0839F5C12A}</ProjectGuid>
|
||||
<ProjectGuid>{B7B26355-6F11-47C6-AB34-6237A673E486}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>IO.Swagger</RootNamespace>
|
||||
|
23
samples/server/petstore/nancyfx/.swagger-codegen-ignore
Normal file
23
samples/server/petstore/nancyfx/.swagger-codegen-ignore
Normal file
@ -0,0 +1,23 @@
|
||||
# Swagger Codegen Ignore
|
||||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||
|
||||
# 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 Swagger Codgen 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
|
@ -2,7 +2,7 @@ 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}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{1DE2DD8D-1AFB-4BC2-9FB5-04DE7DCA1353}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{4E6FF76E-03ED-499F-B05C-4315904C488E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -10,10 +10,10 @@ Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1DE2DD8D-1AFB-4BC2-9FB5-04DE7DCA1353}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1DE2DD8D-1AFB-4BC2-9FB5-04DE7DCA1353}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1DE2DD8D-1AFB-4BC2-9FB5-04DE7DCA1353}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1DE2DD8D-1AFB-4BC2-9FB5-04DE7DCA1353}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4E6FF76E-03ED-499F-B05C-4315904C488E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4E6FF76E-03ED-499F-B05C-4315904C488E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4E6FF76E-03ED-499F-B05C-4315904C488E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4E6FF76E-03ED-499F-B05C-4315904C488E}.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
|
||||
|
201
samples/server/petstore/nancyfx/LICENSE
Normal file
201
samples/server/petstore/nancyfx/LICENSE
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
@ -3,11 +3,11 @@
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{1DE2DD8D-1AFB-4BC2-9FB5-04DE7DCA1353}</ProjectGuid>
|
||||
<ProjectGuid>{4E6FF76E-03ED-499F-B05C-4315904C488E}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>IO.Swagger.v2</RootNamespace>
|
||||
<AssemblyName></AssemblyName>
|
||||
<AssemblyName>IO.Swagger</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
@ -39,8 +39,8 @@
|
||||
<HintPath>..\..\packages\NodaTime.1.3.1\lib\net35-Client\NodaTime.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Sharpility, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Sharpility.1.2.1\lib\net45\Sharpility.dll</HintPath>
|
||||
<Reference Include="Sharpility, Version=1.2.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Sharpility.1.2.2\lib\net45\Sharpility.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Collections.Immutable, Version=1.1.37.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
|
@ -8,7 +8,7 @@
|
||||
<owners>swagger-codegen</owners>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>NancyFx IO.Swagger API</description>
|
||||
<copyright>http://helloreverb.com/terms/</copyright>
|
||||
<copyright>http://swagger.io/terms/</copyright>
|
||||
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>
|
||||
</metadata>
|
||||
</package>
|
@ -0,0 +1,185 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Sharpility.Extensions;
|
||||
using NodaTime;
|
||||
|
||||
namespace IO.Swagger.v2.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// ApiResponse
|
||||
/// </summary>
|
||||
public sealed class ApiResponse: IEquatable<ApiResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// Code
|
||||
/// </summary>
|
||||
public int? Code { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Type
|
||||
/// </summary>
|
||||
public string Type { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Message
|
||||
/// </summary>
|
||||
public string Message { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Empty constructor required by some serializers.
|
||||
/// Use ApiResponse.Builder() for instance creation instead.
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
public ApiResponse()
|
||||
{
|
||||
}
|
||||
|
||||
private ApiResponse(int? Code, string Type, string Message)
|
||||
{
|
||||
|
||||
this.Code = Code;
|
||||
|
||||
this.Type = Type;
|
||||
|
||||
this.Message = Message;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns builder of ApiResponse.
|
||||
/// </summary>
|
||||
/// <returns>ApiResponseBuilder</returns>
|
||||
public static ApiResponseBuilder Builder()
|
||||
{
|
||||
return new ApiResponseBuilder();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns ApiResponseBuilder with properties set.
|
||||
/// Use it to change properties.
|
||||
/// </summary>
|
||||
/// <returns>ApiResponseBuilder</returns>
|
||||
public ApiResponseBuilder With()
|
||||
{
|
||||
return Builder()
|
||||
.Code(Code)
|
||||
.Type(Type)
|
||||
.Message(Message);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.PropertiesToString();
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return this.EqualsByProperties(obj);
|
||||
}
|
||||
|
||||
public bool Equals(ApiResponse other)
|
||||
{
|
||||
return Equals((object) other);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return this.PropertiesHash();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of == operator for (ApiResponse.
|
||||
/// </summary>
|
||||
/// <param name="left">Compared (ApiResponse</param>
|
||||
/// <param name="right">Compared (ApiResponse</param>
|
||||
/// <returns>true if compared items are equals, false otherwise</returns>
|
||||
public static bool operator == (ApiResponse left, ApiResponse right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of != operator for (ApiResponse.
|
||||
/// </summary>
|
||||
/// <param name="left">Compared (ApiResponse</param>
|
||||
/// <param name="right">Compared (ApiResponse</param>
|
||||
/// <returns>true if compared items are not equals, false otherwise</returns>
|
||||
public static bool operator != (ApiResponse left, ApiResponse right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builder of ApiResponse.
|
||||
/// </summary>
|
||||
public sealed class ApiResponseBuilder
|
||||
{
|
||||
private int? _Code;
|
||||
private string _Type;
|
||||
private string _Message;
|
||||
|
||||
internal ApiResponseBuilder()
|
||||
{
|
||||
SetupDefaults();
|
||||
}
|
||||
|
||||
private void SetupDefaults()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets value for ApiResponse.Code property.
|
||||
/// </summary>
|
||||
/// <param name="value">Code</param>
|
||||
public ApiResponseBuilder Code(int? value)
|
||||
{
|
||||
_Code = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets value for ApiResponse.Type property.
|
||||
/// </summary>
|
||||
/// <param name="value">Type</param>
|
||||
public ApiResponseBuilder Type(string value)
|
||||
{
|
||||
_Type = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets value for ApiResponse.Message property.
|
||||
/// </summary>
|
||||
/// <param name="value">Message</param>
|
||||
public ApiResponseBuilder Message(string value)
|
||||
{
|
||||
_Message = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Builds instance of ApiResponse.
|
||||
/// </summary>
|
||||
/// <returns>ApiResponse</returns>
|
||||
public ApiResponse Build()
|
||||
{
|
||||
Validate();
|
||||
return new ApiResponse(
|
||||
Code: _Code,
|
||||
Type: _Type,
|
||||
Message: _Message
|
||||
);
|
||||
}
|
||||
|
||||
private void Validate()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -155,6 +155,7 @@ namespace IO.Swagger.v2.Models
|
||||
|
||||
private void SetupDefaults()
|
||||
{
|
||||
_Complete = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -9,6 +9,10 @@ using NodaTime;
|
||||
|
||||
namespace IO.Swagger.v2.Modules
|
||||
{
|
||||
/// <summary>
|
||||
/// Status values that need to be considered for filter
|
||||
/// </summary>
|
||||
public enum FindPetsByStatusList<StatusEnum> { };
|
||||
|
||||
/// <summary>
|
||||
/// Module processing requests of Pet domain.
|
||||
@ -24,8 +28,10 @@ namespace IO.Swagger.v2.Modules
|
||||
Post["/pet"] = parameters =>
|
||||
{
|
||||
var body = this.Bind<Pet>();
|
||||
Preconditions.IsNotNull(body, "Required parameter: 'body' is missing at 'AddPet'");
|
||||
|
||||
service.AddPet(Context, body);
|
||||
return new Response { ContentType = "application/json"};
|
||||
return new Response { ContentType = "application/xml"};
|
||||
};
|
||||
|
||||
Delete["/pet/{petId}"] = parameters =>
|
||||
@ -35,18 +41,22 @@ namespace IO.Swagger.v2.Modules
|
||||
Preconditions.IsNotNull(petId, "Required parameter: 'petId' is missing at 'DeletePet'");
|
||||
|
||||
service.DeletePet(Context, petId, apiKey);
|
||||
return new Response { ContentType = "application/json"};
|
||||
return new Response { ContentType = "application/xml"};
|
||||
};
|
||||
|
||||
Get["/pet/findByStatus"] = parameters =>
|
||||
{
|
||||
var status = Parameters.ValueOf<List<string>>(parameters, Context.Request, "status", ParameterType.Query);
|
||||
var status = Parameters.ValueOf<FindPetsByStatusList<StatusEnum>?>(parameters, Context.Request, "status", ParameterType.Query);
|
||||
Preconditions.IsNotNull(status, "Required parameter: 'status' is missing at 'FindPetsByStatus'");
|
||||
|
||||
return service.FindPetsByStatus(Context, status);
|
||||
};
|
||||
|
||||
Get["/pet/findByTags"] = parameters =>
|
||||
{
|
||||
var tags = Parameters.ValueOf<List<string>>(parameters, Context.Request, "tags", ParameterType.Query);
|
||||
Preconditions.IsNotNull(tags, "Required parameter: 'tags' is missing at 'FindPetsByTags'");
|
||||
|
||||
return service.FindPetsByTags(Context, tags);
|
||||
};
|
||||
|
||||
@ -61,19 +71,21 @@ namespace IO.Swagger.v2.Modules
|
||||
Put["/pet"] = parameters =>
|
||||
{
|
||||
var body = this.Bind<Pet>();
|
||||
Preconditions.IsNotNull(body, "Required parameter: 'body' is missing at 'UpdatePet'");
|
||||
|
||||
service.UpdatePet(Context, body);
|
||||
return new Response { ContentType = "application/json"};
|
||||
return new Response { ContentType = "application/xml"};
|
||||
};
|
||||
|
||||
Post["/pet/{petId}"] = parameters =>
|
||||
{
|
||||
var petId = Parameters.ValueOf<string>(parameters, Context.Request, "petId", ParameterType.Path);
|
||||
var petId = Parameters.ValueOf<long?>(parameters, Context.Request, "petId", ParameterType.Path);
|
||||
var name = Parameters.ValueOf<string>(parameters, Context.Request, "name", ParameterType.Undefined);
|
||||
var status = Parameters.ValueOf<string>(parameters, Context.Request, "status", ParameterType.Undefined);
|
||||
Preconditions.IsNotNull(petId, "Required parameter: 'petId' is missing at 'UpdatePetWithForm'");
|
||||
|
||||
service.UpdatePetWithForm(Context, petId, name, status);
|
||||
return new Response { ContentType = "application/json"};
|
||||
return new Response { ContentType = "application/xml"};
|
||||
};
|
||||
|
||||
Post["/pet/{petId}/uploadImage"] = parameters =>
|
||||
@ -83,8 +95,7 @@ namespace IO.Swagger.v2.Modules
|
||||
var file = Parameters.ValueOf<System.IO.Stream>(parameters, Context.Request, "file", ParameterType.Undefined);
|
||||
Preconditions.IsNotNull(petId, "Required parameter: 'petId' is missing at 'UploadFile'");
|
||||
|
||||
service.UploadFile(Context, petId, additionalMetadata, file);
|
||||
return new Response { ContentType = "application/json"};
|
||||
return service.UploadFile(Context, petId, additionalMetadata, file);
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -98,7 +109,7 @@ namespace IO.Swagger.v2.Modules
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="context">Context of request</param>
|
||||
/// <param name="body">Pet object that needs to be added to the store (optional)</param>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
/// <returns></returns>
|
||||
void AddPet(NancyContext context, Pet body);
|
||||
|
||||
@ -112,26 +123,26 @@ namespace IO.Swagger.v2.Modules
|
||||
void DeletePet(NancyContext context, long? petId, string apiKey);
|
||||
|
||||
/// <summary>
|
||||
/// Multiple status values can be provided with comma seperated strings
|
||||
/// Multiple status values can be provided with comma separated strings
|
||||
/// </summary>
|
||||
/// <param name="context">Context of request</param>
|
||||
/// <param name="status">Status values that need to be considered for filter (optional, default to available)</param>
|
||||
/// <param name="status">Status values that need to be considered for filter</param>
|
||||
/// <returns>List<Pet></returns>
|
||||
List<Pet> FindPetsByStatus(NancyContext context, List<string> status);
|
||||
List<Pet> FindPetsByStatus(NancyContext context, FindPetsByStatusList<StatusEnum>? status);
|
||||
|
||||
/// <summary>
|
||||
/// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
/// </summary>
|
||||
/// <param name="context">Context of request</param>
|
||||
/// <param name="tags">Tags to filter by (optional)</param>
|
||||
/// <param name="tags">Tags to filter by</param>
|
||||
/// <returns>List<Pet></returns>
|
||||
List<Pet> FindPetsByTags(NancyContext context, List<string> tags);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
/// Returns a single pet
|
||||
/// </summary>
|
||||
/// <param name="context">Context of request</param>
|
||||
/// <param name="petId">ID of pet that needs to be fetched</param>
|
||||
/// <param name="petId">ID of pet to return</param>
|
||||
/// <returns>Pet</returns>
|
||||
Pet GetPetById(NancyContext context, long? petId);
|
||||
|
||||
@ -139,7 +150,7 @@ namespace IO.Swagger.v2.Modules
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="context">Context of request</param>
|
||||
/// <param name="body">Pet object that needs to be added to the store (optional)</param>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
/// <returns></returns>
|
||||
void UpdatePet(NancyContext context, Pet body);
|
||||
|
||||
@ -151,7 +162,7 @@ namespace IO.Swagger.v2.Modules
|
||||
/// <param name="name">Updated name of the pet (optional)</param>
|
||||
/// <param name="status">Updated status of the pet (optional)</param>
|
||||
/// <returns></returns>
|
||||
void UpdatePetWithForm(NancyContext context, string petId, string name, string status);
|
||||
void UpdatePetWithForm(NancyContext context, long? petId, string name, string status);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@ -160,8 +171,8 @@ namespace IO.Swagger.v2.Modules
|
||||
/// <param name="petId">ID of pet to update</param>
|
||||
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
|
||||
/// <param name="file">file to upload (optional)</param>
|
||||
/// <returns></returns>
|
||||
void UploadFile(NancyContext context, long? petId, string additionalMetadata, System.IO.Stream file);
|
||||
/// <returns>ApiResponse</returns>
|
||||
ApiResponse UploadFile(NancyContext context, long? petId, string additionalMetadata, System.IO.Stream file);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -179,7 +190,7 @@ namespace IO.Swagger.v2.Modules
|
||||
DeletePet(petId, apiKey);
|
||||
}
|
||||
|
||||
public virtual List<Pet> FindPetsByStatus(NancyContext context, List<string> status)
|
||||
public virtual List<Pet> FindPetsByStatus(NancyContext context, FindPetsByStatusList<StatusEnum>? status)
|
||||
{
|
||||
return FindPetsByStatus(status);
|
||||
}
|
||||
@ -199,21 +210,21 @@ namespace IO.Swagger.v2.Modules
|
||||
UpdatePet(body);
|
||||
}
|
||||
|
||||
public virtual void UpdatePetWithForm(NancyContext context, string petId, string name, string status)
|
||||
public virtual void UpdatePetWithForm(NancyContext context, long? petId, string name, string status)
|
||||
{
|
||||
UpdatePetWithForm(petId, name, status);
|
||||
}
|
||||
|
||||
public virtual void UploadFile(NancyContext context, long? petId, string additionalMetadata, System.IO.Stream file)
|
||||
public virtual ApiResponse UploadFile(NancyContext context, long? petId, string additionalMetadata, System.IO.Stream file)
|
||||
{
|
||||
UploadFile(petId, additionalMetadata, file);
|
||||
return UploadFile(petId, additionalMetadata, file);
|
||||
}
|
||||
|
||||
protected abstract void AddPet(Pet body);
|
||||
|
||||
protected abstract void DeletePet(long? petId, string apiKey);
|
||||
|
||||
protected abstract List<Pet> FindPetsByStatus(List<string> status);
|
||||
protected abstract List<Pet> FindPetsByStatus(FindPetsByStatusList<StatusEnum>? status);
|
||||
|
||||
protected abstract List<Pet> FindPetsByTags(List<string> tags);
|
||||
|
||||
@ -221,9 +232,9 @@ namespace IO.Swagger.v2.Modules
|
||||
|
||||
protected abstract void UpdatePet(Pet body);
|
||||
|
||||
protected abstract void UpdatePetWithForm(string petId, string name, string status);
|
||||
protected abstract void UpdatePetWithForm(long? petId, string name, string status);
|
||||
|
||||
protected abstract void UploadFile(long? petId, string additionalMetadata, System.IO.Stream file);
|
||||
protected abstract ApiResponse UploadFile(long? petId, string additionalMetadata, System.IO.Stream file);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ namespace IO.Swagger.v2.Modules
|
||||
Preconditions.IsNotNull(orderId, "Required parameter: 'orderId' is missing at 'DeleteOrder'");
|
||||
|
||||
service.DeleteOrder(Context, orderId);
|
||||
return new Response { ContentType = "application/json"};
|
||||
return new Response { ContentType = "application/xml"};
|
||||
};
|
||||
|
||||
Get["/store/inventory"] = parameters =>
|
||||
@ -38,7 +38,7 @@ namespace IO.Swagger.v2.Modules
|
||||
|
||||
Get["/store/order/{orderId}"] = parameters =>
|
||||
{
|
||||
var orderId = Parameters.ValueOf<string>(parameters, Context.Request, "orderId", ParameterType.Path);
|
||||
var orderId = Parameters.ValueOf<long?>(parameters, Context.Request, "orderId", ParameterType.Path);
|
||||
Preconditions.IsNotNull(orderId, "Required parameter: 'orderId' is missing at 'GetOrderById'");
|
||||
|
||||
return service.GetOrderById(Context, orderId);
|
||||
@ -47,6 +47,8 @@ namespace IO.Swagger.v2.Modules
|
||||
Post["/store/order"] = parameters =>
|
||||
{
|
||||
var body = this.Bind<Order>();
|
||||
Preconditions.IsNotNull(body, "Required parameter: 'body' is missing at 'PlaceOrder'");
|
||||
|
||||
return service.PlaceOrder(Context, body);
|
||||
};
|
||||
}
|
||||
@ -78,13 +80,13 @@ namespace IO.Swagger.v2.Modules
|
||||
/// <param name="context">Context of request</param>
|
||||
/// <param name="orderId">ID of pet that needs to be fetched</param>
|
||||
/// <returns>Order</returns>
|
||||
Order GetOrderById(NancyContext context, string orderId);
|
||||
Order GetOrderById(NancyContext context, long? orderId);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="context">Context of request</param>
|
||||
/// <param name="body">order placed for purchasing the pet (optional)</param>
|
||||
/// <param name="body">order placed for purchasing the pet</param>
|
||||
/// <returns>Order</returns>
|
||||
Order PlaceOrder(NancyContext context, Order body);
|
||||
}
|
||||
@ -104,7 +106,7 @@ namespace IO.Swagger.v2.Modules
|
||||
return GetInventory();
|
||||
}
|
||||
|
||||
public virtual Order GetOrderById(NancyContext context, string orderId)
|
||||
public virtual Order GetOrderById(NancyContext context, long? orderId)
|
||||
{
|
||||
return GetOrderById(orderId);
|
||||
}
|
||||
@ -118,7 +120,7 @@ namespace IO.Swagger.v2.Modules
|
||||
|
||||
protected abstract Dictionary<string, int?> GetInventory();
|
||||
|
||||
protected abstract Order GetOrderById(string orderId);
|
||||
protected abstract Order GetOrderById(long? orderId);
|
||||
|
||||
protected abstract Order PlaceOrder(Order body);
|
||||
}
|
||||
|
@ -24,22 +24,28 @@ namespace IO.Swagger.v2.Modules
|
||||
Post["/user"] = parameters =>
|
||||
{
|
||||
var body = this.Bind<User>();
|
||||
Preconditions.IsNotNull(body, "Required parameter: 'body' is missing at 'CreateUser'");
|
||||
|
||||
service.CreateUser(Context, body);
|
||||
return new Response { ContentType = "application/json"};
|
||||
return new Response { ContentType = "application/xml"};
|
||||
};
|
||||
|
||||
Post["/user/createWithArray"] = parameters =>
|
||||
{
|
||||
var body = this.Bind<List<User>>();
|
||||
Preconditions.IsNotNull(body, "Required parameter: 'body' is missing at 'CreateUsersWithArrayInput'");
|
||||
|
||||
service.CreateUsersWithArrayInput(Context, body);
|
||||
return new Response { ContentType = "application/json"};
|
||||
return new Response { ContentType = "application/xml"};
|
||||
};
|
||||
|
||||
Post["/user/createWithList"] = parameters =>
|
||||
{
|
||||
var body = this.Bind<List<User>>();
|
||||
Preconditions.IsNotNull(body, "Required parameter: 'body' is missing at 'CreateUsersWithListInput'");
|
||||
|
||||
service.CreateUsersWithListInput(Context, body);
|
||||
return new Response { ContentType = "application/json"};
|
||||
return new Response { ContentType = "application/xml"};
|
||||
};
|
||||
|
||||
Delete["/user/{username}"] = parameters =>
|
||||
@ -48,7 +54,7 @@ namespace IO.Swagger.v2.Modules
|
||||
Preconditions.IsNotNull(username, "Required parameter: 'username' is missing at 'DeleteUser'");
|
||||
|
||||
service.DeleteUser(Context, username);
|
||||
return new Response { ContentType = "application/json"};
|
||||
return new Response { ContentType = "application/xml"};
|
||||
};
|
||||
|
||||
Get["/user/{username}"] = parameters =>
|
||||
@ -63,6 +69,10 @@ namespace IO.Swagger.v2.Modules
|
||||
{
|
||||
var username = Parameters.ValueOf<string>(parameters, Context.Request, "username", ParameterType.Query);
|
||||
var password = Parameters.ValueOf<string>(parameters, Context.Request, "password", ParameterType.Query);
|
||||
Preconditions.IsNotNull(username, "Required parameter: 'username' is missing at 'LoginUser'");
|
||||
|
||||
Preconditions.IsNotNull(password, "Required parameter: 'password' is missing at 'LoginUser'");
|
||||
|
||||
return service.LoginUser(Context, username, password);
|
||||
};
|
||||
|
||||
@ -70,7 +80,7 @@ namespace IO.Swagger.v2.Modules
|
||||
{
|
||||
|
||||
service.LogoutUser(Context);
|
||||
return new Response { ContentType = "application/json"};
|
||||
return new Response { ContentType = "application/xml"};
|
||||
};
|
||||
|
||||
Put["/user/{username}"] = parameters =>
|
||||
@ -79,8 +89,10 @@ namespace IO.Swagger.v2.Modules
|
||||
var body = this.Bind<User>();
|
||||
Preconditions.IsNotNull(username, "Required parameter: 'username' is missing at 'UpdateUser'");
|
||||
|
||||
Preconditions.IsNotNull(body, "Required parameter: 'body' is missing at 'UpdateUser'");
|
||||
|
||||
service.UpdateUser(Context, username, body);
|
||||
return new Response { ContentType = "application/json"};
|
||||
return new Response { ContentType = "application/xml"};
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -94,7 +106,7 @@ namespace IO.Swagger.v2.Modules
|
||||
/// This can only be done by the logged in user.
|
||||
/// </summary>
|
||||
/// <param name="context">Context of request</param>
|
||||
/// <param name="body">Created user object (optional)</param>
|
||||
/// <param name="body">Created user object</param>
|
||||
/// <returns></returns>
|
||||
void CreateUser(NancyContext context, User body);
|
||||
|
||||
@ -102,7 +114,7 @@ namespace IO.Swagger.v2.Modules
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="context">Context of request</param>
|
||||
/// <param name="body">List of user object (optional)</param>
|
||||
/// <param name="body">List of user object</param>
|
||||
/// <returns></returns>
|
||||
void CreateUsersWithArrayInput(NancyContext context, List<User> body);
|
||||
|
||||
@ -110,7 +122,7 @@ namespace IO.Swagger.v2.Modules
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="context">Context of request</param>
|
||||
/// <param name="body">List of user object (optional)</param>
|
||||
/// <param name="body">List of user object</param>
|
||||
/// <returns></returns>
|
||||
void CreateUsersWithListInput(NancyContext context, List<User> body);
|
||||
|
||||
@ -134,8 +146,8 @@ namespace IO.Swagger.v2.Modules
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="context">Context of request</param>
|
||||
/// <param name="username">The user name for login (optional)</param>
|
||||
/// <param name="password">The password for login in clear text (optional)</param>
|
||||
/// <param name="username">The user name for login</param>
|
||||
/// <param name="password">The password for login in clear text</param>
|
||||
/// <returns>string</returns>
|
||||
string LoginUser(NancyContext context, string username, string password);
|
||||
|
||||
@ -151,7 +163,7 @@ namespace IO.Swagger.v2.Modules
|
||||
/// </summary>
|
||||
/// <param name="context">Context of request</param>
|
||||
/// <param name="username">name that need to be deleted</param>
|
||||
/// <param name="body">Updated user object (optional)</param>
|
||||
/// <param name="body">Updated user object</param>
|
||||
/// <returns></returns>
|
||||
void UpdateUser(NancyContext context, string username, User body);
|
||||
}
|
||||
|
@ -2,6 +2,6 @@
|
||||
<packages>
|
||||
<package id="Nancy" version="1.4.1" targetFramework="net45" />
|
||||
<package id="NodaTime" version="1.3.1" targetFramework="net45" />
|
||||
<package id="Sharpility" version="1.2.1" targetFramework="net45" />
|
||||
<package id="Sharpility" version="1.2.2" targetFramework="net45" />
|
||||
<package id="System.Collections.Immutable" version="1.1.37" targetFramework="net45" />
|
||||
</packages>
|
Loading…
x
Reference in New Issue
Block a user