Skip to content

Commit

Permalink
Merge pull request #11 from MobileTeleSystems/feature/base_template
Browse files Browse the repository at this point in the history
Fix call base template
  • Loading branch information
genusP authored Oct 23, 2024
2 parents e863d83 + 48135e9 commit d682f32
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/ApiCodeGenerator.OpenApi/DefaultTemplateFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,8 @@ public ITemplate CreateTemplate(string language, string template, object model)
{
if (model is Fluid.TemplateContext templateContext)
{
var currentTemplate = (string)templateContext.AmbientValues["__template"];
var currentTemplate = ((string)templateContext.AmbientValues["__template"]).TrimEnd('!');
template = template.Substring(0, template.Length - BASE_TMPL_SUFFIX.Length);
if (!template.EndsWith("!"))
{
template += "!";
}

providers = providers.SkipWhile(p => currentTemplate != p.GetFullName(template, language)).Skip(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public TestTemplateProvider(string templateText)

public string? GetFullName(string name, string language)
{
return name == "Class" || name == "Class!"
return name == "Class"
? $"{_providerKey}.{name}"
: null;
}
Expand Down

0 comments on commit d682f32

Please sign in to comment.