Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow the specification of a namespace via the generator options #47

Merged
merged 1 commit into from
Mar 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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