fix(mgmt): pass sharedScripts to design-time template $ref validation (#259)
This commit is contained in:
@@ -590,9 +590,23 @@ public class ManagementActor : ReceiveActor
|
||||
var schemaLibrary = sharedSchemas.ToDictionary(s => s.Name, s => s.SchemaJson, StringComparer.Ordinal);
|
||||
Func<string, string?> resolveSchemaRef = name => schemaLibrary.GetValueOrDefault(name);
|
||||
|
||||
// #259: also pass shared scripts so a dangling $ref in a SHARED script's schema is
|
||||
// caught at design-time (not only on the deploy path). Mirror the deploy-path mapping
|
||||
// in FlatteningPipeline: SharedScript entity → ResolvedScript (name + schema fields).
|
||||
var sharedScriptEntities = await repo.GetAllSharedScriptsAsync();
|
||||
var resolvedSharedScripts = sharedScriptEntities
|
||||
.Select(s => new Commons.Types.Flattening.ResolvedScript
|
||||
{
|
||||
CanonicalName = s.Name,
|
||||
Code = s.Code,
|
||||
ParameterDefinitions = s.ParameterDefinitions,
|
||||
ReturnDefinition = s.ReturnDefinition
|
||||
})
|
||||
.ToList();
|
||||
|
||||
// Run full validation pipeline (collisions, script compilation, trigger refs, bindings)
|
||||
var validationService = new TemplateEngine.Validation.ValidationService();
|
||||
var validationResult = validationService.Validate(flatConfig, resolveSchemaRef: resolveSchemaRef);
|
||||
var validationResult = validationService.Validate(flatConfig, resolvedSharedScripts, resolveSchemaRef: resolveSchemaRef);
|
||||
|
||||
// Also detect naming collisions across the inheritance/composition graph
|
||||
var svc = sp.GetRequiredService<TemplateService>();
|
||||
|
||||
Reference in New Issue
Block a user