Skip to content

Commit

Permalink
feat: allow the specification of a namespace via the generator options (
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinEberhardt authored Mar 5, 2023
1 parent 26d42ce commit fd35929
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 7 deletions.
6 changes: 6 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"namespace": {
"default": "OpenApiForge",
"description": "The namespace for the generated classes."
}
}
2 changes: 1 addition & 1 deletion partials/namespace.handlebars
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#if infoTitle}}namespace {{toClassName infoTitle}}{{else}}namespace OpenApiForge{{/if}}
namespace {{_options.[generator.namespace]}}
2 changes: 1 addition & 1 deletion template/ApiClient.cs.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ using System.Web;
/// </summary>
{{#if info.description}}{{docComment info.description}}{{/if}}
{{#if info.version}}/// <version>{{info.version}}</version>{{/if}}
{{>namespace info.title}} {
{{>namespace}} {

public class ApiClient{{_tag.name}} : IApiClient{{_tag.name}}
{
Expand Down
2 changes: 1 addition & 1 deletion template/ApiModel.cs.handlebars
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;

{{>namespace info.title}} {
{{>namespace}} {

{{#each components.schemas}}
{{> model}}
Expand Down
2 changes: 1 addition & 1 deletion template/Configuration.cs.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Text;

{{>namespace info.title}} {
{{>namespace}} {

public class Configuration
{
Expand Down
2 changes: 1 addition & 1 deletion template/IApiClient.cs.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using System.Threading.Tasks;
/// </summary>
{{#if info.description}}{{docComment info.description}}{{/if}}
{{#if info.version}}/// <version>{{info.version}}</version>{{/if}}
{{>namespace info.title}} {
{{>namespace}} {

public interface IApiClient{{_tag.name}}
{
Expand Down
2 changes: 1 addition & 1 deletion template/Info.cs.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Text;

{{>namespace info.title}} {
{{>namespace}} {

public static class Info
{
Expand Down
2 changes: 1 addition & 1 deletion template/Startup.cs.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using System.Linq;
using System.Net.Http;
using Microsoft.Extensions.DependencyInjection;

{{>namespace info.title}} {
{{>namespace}} {

public static class Startup
{
Expand Down

0 comments on commit fd35929

Please sign in to comment.