fix bugs
This commit is contained in:
parent
4df56bb5f0
commit
9fa88e9821
|
|
@ -66,6 +66,11 @@ class ConfigRepository {
|
||||||
|
|
||||||
static ConfigRepository? _cachedConfig;
|
static ConfigRepository? _cachedConfig;
|
||||||
|
|
||||||
|
/// 设置缓存配置(仅用于测试)
|
||||||
|
static void setCachedConfig(ConfigRepository config) {
|
||||||
|
_cachedConfig = config;
|
||||||
|
}
|
||||||
|
|
||||||
/// 同步加载配置(用于向后兼容或必须同步的场景)
|
/// 同步加载配置(用于向后兼容或必须同步的场景)
|
||||||
/// 为默认配置路径启用缓存
|
/// 为默认配置路径启用缓存
|
||||||
static ConfigRepository loadSync([String? configPath]) {
|
static ConfigRepository loadSync([String? configPath]) {
|
||||||
|
|
|
||||||
|
|
@ -79,8 +79,9 @@ generation:
|
||||||
// Force a reload of the static config by accessing it.
|
// Force a reload of the static config by accessing it.
|
||||||
// This is a bit of a hack due to the static nature of SwaggerConfig and StringHelper.
|
// This is a bit of a hack due to the static nature of SwaggerConfig and StringHelper.
|
||||||
// A better approach would be to pass the config explicitly or mock the static dependencies.
|
// A better approach would be to pass the config explicitly or mock the static dependencies.
|
||||||
ConfigRepository.loadSync(configFile
|
// Load config and set it as cached so static accessors pick it up
|
||||||
.path); // Ensure the config is loaded for the static accessor
|
final config = ConfigRepository.loadSync(configFile.path);
|
||||||
|
ConfigRepository.setCachedConfig(config);
|
||||||
|
|
||||||
expect(StringHelper.generateClassName('User'), 'SUser');
|
expect(StringHelper.generateClassName('User'), 'SUser');
|
||||||
expect(StringHelper.generateClassName('model'), 'SModel');
|
expect(StringHelper.generateClassName('model'), 'SModel');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue