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