mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 11:23:58 +00:00
Versioning of generated model (namespace, base context).
This commit is contained in:
parent
bf68801295
commit
c59f2b0322
@ -5,6 +5,7 @@ import io.swagger.codegen.CodegenOperation;
|
||||
import io.swagger.codegen.CodegenProperty;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.SupportingFile;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.models.properties.Property;
|
||||
import io.swagger.models.properties.StringProperty;
|
||||
import org.slf4j.Logger;
|
||||
@ -144,6 +145,12 @@ public class NancyFXServerCodegen extends AbstractCSharpCodegen {
|
||||
return super.toApiFilename(name) + "Module";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preprocessSwagger(Swagger swagger) {
|
||||
additionalProperties.put("packageContext", sanitizeName(swagger.getBasePath()));
|
||||
additionalProperties.put("baseContext", swagger.getBasePath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumName(CodegenProperty property) {
|
||||
return sanitizeName(camelize(property.name)) ;
|
||||
|
@ -6,7 +6,7 @@
|
||||
<ProjectGuid>{{packageGuid}}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>{{packageName}}</RootNamespace>
|
||||
<RootNamespace>{{packageName}}.{{packageContext}}</RootNamespace>
|
||||
<AssemblyName>{{packageTitle}}</AssemblyName>
|
||||
{{^supportsUWP}}
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
|
@ -3,17 +3,17 @@ using Nancy;
|
||||
using Nancy.ModelBinding;
|
||||
using System.Collections.Generic;
|
||||
using Sharpility.Base;
|
||||
using {{packageName}}.Models;
|
||||
using {{packageName}}.Utils;
|
||||
using {{packageName}}.{{packageContext}}.Models;
|
||||
using {{packageName}}.{{packageContext}}.Utils;
|
||||
using NodaTime;
|
||||
|
||||
namespace {{packageName}}.Modules
|
||||
namespace {{packageName}}.{{packageContext}}.Modules
|
||||
{ {{#operations}}{{#operation}}{{#allParams}}{{#isEnum}}
|
||||
{{>innerApiEnum}}{{/isEnum}}{{/allParams}}{{/operation}}
|
||||
|
||||
public partial class {{classname}}Module : NancyModule
|
||||
{
|
||||
public {{classname}}Module({{classname}}Service service) : base("")
|
||||
public {{classname}}Module({{classname}}Service service) : base("{{baseContext}}")
|
||||
{ {{#operation}}
|
||||
{{httpMethod}}["{{path}}"] = parameters =>
|
||||
{
|
||||
|
@ -7,7 +7,7 @@ using NodaTime;
|
||||
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
namespace {{packageName}}.Models
|
||||
namespace {{packageName}}.{{packageContext}}.Models
|
||||
{ {{#vars}}{{#isEnum}}
|
||||
{{>innerModelEnum}}{{/isEnum}}{{#items.isEnum}}
|
||||
{{#items}}{{>innerModelEnum}}{{/items}}{{/items.isEnum}}{{/vars}}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
@ -8,7 +7,7 @@ using Sharpility.Base;
|
||||
using Sharpility.Extensions;
|
||||
using Sharpility.Util;
|
||||
|
||||
namespace {{packageName}}.Utils
|
||||
namespace {{packageName}}.{{packageContext}}.Utils
|
||||
{
|
||||
internal static class Parameters
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user