Fix package reference bug
This commit is contained in:
@@ -4,11 +4,13 @@ namespace Generator.Daos;
|
||||
|
||||
public abstract class AbstractDao
|
||||
{
|
||||
protected readonly ConfigManager ConfManager;
|
||||
|
||||
protected readonly ConfigManager _confManager;
|
||||
protected readonly string _spec;
|
||||
|
||||
protected AbstractDao(ConfigManager confManager, string spec)
|
||||
{
|
||||
ConfManager = confManager;
|
||||
_confManager = confManager;
|
||||
_spec = spec;
|
||||
}
|
||||
|
||||
protected AbstractDao(ConfigManager confManager) : this(confManager, confManager.GetDefArgs().SpecIdentifier)
|
||||
|
||||
@@ -6,14 +6,14 @@ namespace Generator.Daos;
|
||||
|
||||
public class CredentialsDao : AbstractDao
|
||||
{
|
||||
public string Username => ConfManager.Credentials.Username;
|
||||
public string Password => ConfManager.Credentials.Password;
|
||||
public string Username => _confManager.Credentials.Username;
|
||||
public string Password => _confManager.Credentials.Password;
|
||||
|
||||
public CredentialsDao(ConfigManager confManager)
|
||||
: base(confManager, confManager.GetDefArgs().SpecIdentifier)
|
||||
{
|
||||
}
|
||||
|
||||
public PackageDeletion GetPackageDeletion() => ConfManager.Credentials.ToPackageDeletion();
|
||||
public PackageDeletion GetPackageDeletion() => _confManager.Credentials.ToPackageDeletion();
|
||||
|
||||
}
|
||||
@@ -17,7 +17,7 @@ public class DotnetDao : AbstractDao
|
||||
|
||||
public DotnetConfig GetDotnetGenerate(GenerationType type, ISpecFile file)
|
||||
{
|
||||
var config = ConfManager.Dotnet.Map(ConfManager, file);
|
||||
var config = _confManager.Dotnet.Map(_confManager, file);
|
||||
config.Type = type;
|
||||
return config ;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ namespace Generator.Daos;
|
||||
|
||||
public class EnvironmentDao : AbstractDao
|
||||
{
|
||||
public Location ApiFolder() => new ([ConfManager.GetBase().LocalRoot, ConfManager.GetGeneral().ApiFolder]);
|
||||
public Location ApiFolder() => new ([_confManager.GetBase().LocalRoot, _confManager.GetGeneral().ApiFolder]);
|
||||
|
||||
public string Invite => ConfManager.GetBase().Invite;
|
||||
public string Invite => _confManager.GetBase().Invite;
|
||||
|
||||
public EnvironmentDao(ConfigManager confManager) : base(confManager)
|
||||
{ }
|
||||
|
||||
@@ -13,7 +13,7 @@ public class JavaDao : AbstractDao
|
||||
public JavaDao(ConfigManager confManager) : base(confManager)
|
||||
{ }
|
||||
|
||||
public JavaConfig GetJavaGenerate(ISpecFile file) => ConfManager.Java.Map(ConfManager, file);
|
||||
public JavaConfig GetJavaGenerate(ISpecFile file) => _confManager.Java.Map(_confManager, file);
|
||||
|
||||
public JavaPublish GetJavaPublish(GenerationType type, ISpecFile file)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ public class JavascriptDao : AbstractDao
|
||||
public JavascriptDao(ConfigManager confManager) : base(confManager, confManager.GetDefArgs().SpecIdentifier)
|
||||
{ }
|
||||
|
||||
public JavascriptConfig GetJavascript(ISpecFile file) => ConfManager.Javascript.Map(ConfManager, file);
|
||||
public JavascriptConfig GetJavascript(ISpecFile file) => _confManager.Javascript.Map(_confManager, file);
|
||||
|
||||
public JavascriptPublish GetJavascriptPublish(GenerationType type, ISpecFile file)
|
||||
{
|
||||
|
||||
@@ -13,11 +13,12 @@ public class OpenApiDao : AbstractDao
|
||||
|
||||
public Location ConfigOf(string spec) => GetOpenApi(true, spec).SpecConfig;
|
||||
|
||||
public OpenApiConfig GetOpenApi(bool isLocal, string file)
|
||||
public OpenApiConfig GetOpenApi(bool isLocal, string specPath)
|
||||
{
|
||||
var items = file.Split("/");
|
||||
var o = ConfManager.OpenApi.Map(ConfManager, items[0], items[1]);
|
||||
o.AddRoot(ConfManager.GetRoot(isLocal));
|
||||
specPath = specPath ?? _spec;
|
||||
string[] items = specPath.Split("/");
|
||||
OpenApiConfig o = _confManager.OpenApi.Map(_confManager, items[0], items[1]);
|
||||
o.AddRoot(_confManager.GetRoot(isLocal));
|
||||
return o;
|
||||
}
|
||||
}
|
||||
@@ -12,12 +12,12 @@ public class TemplateDao : AbstractDao
|
||||
|
||||
public PlantUmlExport PlantUml(ISpecFile file)
|
||||
{
|
||||
var config = ConfManager.Templates.Map();
|
||||
var config = _confManager.Templates.Map();
|
||||
return new PlantUmlExport
|
||||
{
|
||||
LocalRoot = ConfManager.GetBase().LocalRoot,
|
||||
LocalRoot = _confManager.GetBase().LocalRoot,
|
||||
Template = config.PlantUml,
|
||||
Output = ConfManager.GetGeneral().ApiFolder.ConcatenateWith([file.Folder, $"{file.Name}.puml"])
|
||||
Output = _confManager.GetGeneral().ApiFolder.ConcatenateWith([file.Folder, $"{file.Name}.puml"])
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user