Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation API changes to support linked template validation #745

Closed
5 tasks
StephenWeatherford opened this issue Jun 2, 2020 · 1 comment
Closed
5 tasks

Comments

@StephenWeatherford
Copy link
Contributor

StephenWeatherford commented Jun 2, 2020

Issues/Bugs

  • You should add an error if they specify both uri and relativePath
  • Bugs
    • contentVersion validation is not correct - seems to always think linked template is version 1.0.0.0
    • Not getting correct error info for parameter type mismatches in linked templates (see Teams thread). testcase tc06
  • Need to discuss:
    • What if the file isn't loaded yet?
    • Gracefully handle getting null content for deeply-nested linked templates (because we're starting out with only one level)

--

Consider the following template structure (attached here)

deepsimplemaster.json -> links to "deep/deep.json"
deepsimplemaster.params.json
deep/
deep.json -> links to "verydeep/verydeep.json"
verydeep/
verydeep.json

We call TemplateController.ProcessAndValidateTemplate, and it calls it back with these two paths:

  1. deep/deep.json
  2. verydeep/verydeep.json

Trouble is, verydeep/verydeep.json should be relative to deep.json's path, but our callback only gives us "verydeep/verydeep.json", and we don't know its parent path, so we can't correctly resolve verydeep.json's full path.

Requirements (DRAFT)

  • If possible, use a callback for errors from linked or nested template validations instead of throwing an exception
  • In the linkedFileDelegation callback and the error callback (or error responses), we need:
    • The full path of the parent template
    • The location in the parent template that references the linked template
    • The value of all parameters passed in to the linked template

Suggested callback signature

Task<string> linkedFileDelegation(DeploymentContext context);

interface DeploymentContext {
    int contextId; // Unique positive ID to label this context (only unique within a particular ProcessAndValidateTemplate call)

    // One of these is filled in, the other is null
    Uri templateLinkUri;
    Uri templateLinkRelativeUri;

    dictionary<string, any> parameterValues; // The resolved values for the parameters

    int parentContext; // Zero if the parent is the top-level template file
    int parentLine, parentColumn; // approximate location inside the parent template file where the linked (or nested?) template is referenced
}
@StephenWeatherford StephenWeatherford changed the title Validation API: Need way to resolve deeply-linked template paths Validation API (linkedFileDelegation callback): Need way to resolve deeply-linked template paths Jun 2, 2020
@StephenWeatherford
Copy link
Contributor Author

StephenWeatherford commented Jun 2, 2020

No description provided.

@StephenWeatherford StephenWeatherford changed the title Validation API (linkedFileDelegation callback): Need way to resolve deeply-linked template paths Validation API changes to support linked template validation Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants