mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 11:23:58 +00:00
NancyFx:
- Including API docs
This commit is contained in:
parent
a72640ce9c
commit
1d167b709d
@ -27,6 +27,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Debug\{{packageName}}.XML</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@ -35,6 +36,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Release\{{packageName}}.XML</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Nancy, Version=1.4.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
|
@ -11,8 +11,15 @@ namespace {{packageName}}.{{packageContext}}.Modules
|
||||
{ {{#operations}}{{#operation}}{{#allParams}}{{#isEnum}}
|
||||
{{>innerApiEnum}}{{/isEnum}}{{/allParams}}{{/operation}}
|
||||
|
||||
/// <summary>
|
||||
/// Module processing requests of {{classname}} domain.
|
||||
/// </summary>
|
||||
public sealed class {{classname}}Module : NancyModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets up HTTP methods mappings.
|
||||
/// </summary>
|
||||
/// <param name="service">Service handling requests</param>
|
||||
public {{classname}}Module({{classname}}Service service) : base("{{baseContext}}")
|
||||
{ {{#operation}}
|
||||
{{httpMethod}}["{{path}}"] = parameters =>
|
||||
@ -28,13 +35,25 @@ namespace {{packageName}}.{{packageContext}}.Modules
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Service handling {{classname}} requests.
|
||||
/// </summary>
|
||||
public interface {{classname}}Service
|
||||
{
|
||||
{{#operation}}{{#returnType}}{{&returnType}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}}(NancyContext context{{#allParams.0}}, {{/allParams.0}}{{>paramsList}});{{#hasMore}}
|
||||
{{#operation}}/// <summary>
|
||||
/// {{notes}}
|
||||
/// </summary>
|
||||
/// <param name="context">Context of request</param>
|
||||
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
|
||||
{{/allParams}}/// <returns>{{#returnType}}{{returnType}}{{/returnType}}</returns>
|
||||
{{#returnType}}{{&returnType}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}}(NancyContext context{{#allParams.0}}, {{/allParams.0}}{{>paramsList}});{{#hasMore}}
|
||||
|
||||
{{/hasMore}}{{/operation}}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Abstraction of {{classname}}Service.
|
||||
/// </summary>
|
||||
public abstract class Abstract{{classname}}Service: {{classname}}Service
|
||||
{
|
||||
{{#operation}}public virtual {{#returnType}}{{&returnType}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}}(NancyContext context{{#allParams.0}}, {{/allParams.0}}{{>paramsList}})
|
||||
|
@ -1 +1,4 @@
|
||||
public enum {{>innerApiEnumName}} { {{#allowableValues}}{{#values}}{{&.}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}} };
|
||||
/// <summary>
|
||||
/// {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
|
||||
/// </summary>
|
||||
public enum {{>innerApiEnumName}} { {{#allowableValues}}{{#values}}{{&.}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}} };
|
@ -12,28 +12,45 @@ namespace {{packageName}}.{{packageContext}}.Models
|
||||
{{>innerModelEnum}}{{/isEnum}}{{#items.isEnum}}
|
||||
{{#items}}{{>innerModelEnum}}{{/items}}{{/items.isEnum}}{{/vars}}
|
||||
|
||||
/// <summary>
|
||||
/// {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
|
||||
/// </summary>
|
||||
public sealed class {{classname}}: {{#parent}}{{{parent}}}, {{/parent}} IEquatable<{{classname}}>
|
||||
{ {{#vars}}
|
||||
public {{>nullableDataType}} {{name}} { get; private set; }{{/vars}}
|
||||
/// <summary>
|
||||
/// {{^description}}{{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||
/// </summary>
|
||||
public {{>nullableDataType}} {{name}} { get; private set; }
|
||||
{{/vars}}
|
||||
|
||||
/// <summary>
|
||||
/// Required by some serializers.
|
||||
/// Empty constructor required by some serializers.
|
||||
/// Use {{classname}}.Builder() for instance creation instead.
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
public {{classname}}(){}
|
||||
public {{classname}}() {}
|
||||
|
||||
public {{classname}}({{#vars}}{{>nullableDataType}} {{name}}{{#hasMore}}, {{/hasMore}}{{/vars}})
|
||||
private {{classname}}({{#vars}}{{>nullableDataType}} {{name}}{{#hasMore}}, {{/hasMore}}{{/vars}})
|
||||
{
|
||||
{{#vars}}
|
||||
this.{{name}} = {{name}};
|
||||
{{/vars}}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns builder of {{classname}}.
|
||||
/// </summary>
|
||||
/// <returns>{{classname}}Builder</returns>
|
||||
public static {{classname}}Builder Builder()
|
||||
{
|
||||
return new {{classname}}Builder();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns {{classname}}Builder with properties set.
|
||||
/// Use it to change properties.
|
||||
/// </summary>
|
||||
/// <returns>{{classname}}Builder</returns>
|
||||
public {{classname}}Builder With()
|
||||
{
|
||||
return Builder()
|
||||
@ -62,18 +79,30 @@ namespace {{packageName}}.{{packageContext}}.Models
|
||||
return this.PropertiesHash();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of == operator for ({{classname}}.
|
||||
/// </summary>
|
||||
/// <param name="left">Compared ({{classname}}</param>
|
||||
/// <param name="right">Compared ({{classname}}</param>
|
||||
/// <returns>true if compared items are equals, false otherwise</returns>
|
||||
public static bool operator == ({{classname}} left, {{classname}} right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of != operator for ({{classname}}.
|
||||
/// </summary>
|
||||
/// <param name="left">Compared ({{classname}}</param>
|
||||
/// <param name="right">Compared ({{classname}}</param>
|
||||
/// <returns>true if compared items are not equals, false otherwise</returns>
|
||||
public static bool operator != ({{classname}} left, {{classname}} right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builder of {{classname}} model
|
||||
/// Builder of {{classname}}.
|
||||
/// </summary>
|
||||
public sealed class {{classname}}Builder
|
||||
{
|
||||
@ -98,6 +127,10 @@ namespace {{packageName}}.{{packageContext}}.Models
|
||||
}
|
||||
|
||||
{{#vars}}
|
||||
/// <summary>
|
||||
/// Sets value for {{classname}}.{{{name}}} property.
|
||||
/// </summary>
|
||||
/// <param name="value">{{^description}}{{{name}}}{{/description}}{{#description}}{{description}}{{/description}}</param>
|
||||
public {{classname}}Builder {{name}}({{>nullableDataType}} value)
|
||||
{
|
||||
_{{name}} = value;
|
||||
@ -106,6 +139,10 @@ namespace {{packageName}}.{{packageContext}}.Models
|
||||
|
||||
{{/vars}}
|
||||
|
||||
/// <summary>
|
||||
/// Builds instance of {{classname}}.
|
||||
/// </summary>
|
||||
/// <returns>{{classname}}</returns>
|
||||
public {{classname}} Build()
|
||||
{
|
||||
Validate();
|
||||
|
Loading…
Reference in New Issue
Block a user