Repository navigation
Add the Derived Property Element and its example - #156
Draft
jwrosewell wants to merge 4 commits into
Draft
jwrosewell wants to merge 4 commits into
jwrosewell wants to merge 4 commits into
Conversation
Adds the tests for a new pipeline.derivedproperty module and a new developer example, before the code they test. The module is the Derived Property Element of the specification, which produces new properties from the properties other elements in the Pipeline produce, following rules written in a YAML or JSON script. The derived-properties repository is added as the submodule pipeline/derived-properties, at cc30638. Its scripts folder holds the built-in scripts the package ships, and its tests folder holds the case files and rejection cases every language runs. SharedCasesTests runs both, and BuiltInScriptTests fails when BuiltInScript and the scripts folder differ. The other tests cover reading YAML by the YAML 1.2 core schema, so yes stays a string, the conversion of source values, the Pipeline check, the no value message, the logging, the metadata and building from a configuration file. ExampleTests and FindOutMoreTests run the example. The two modules are added to pipeline/pom.xml, the developer examples pom and ci/packages.json, and SnakeYAML is named in the dependency management of pipeline/pom.xml. The tests do not compile until the code follows.
pipeline.derivedproperty is the Derived Property Element of the specification. It is a Flow Element rather than an Aspect Engine, holds no data file, makes no network request and accepts no evidence. Every instance writes into the Element Data under the key derived, as every Translation Engine shares translation. DerivedPropertyElementBuilder takes scripts shipped in the package (BuiltInScript), files on disk with wildcards in the file name, and text from code, and a configuration file names it as DerivedPropertyElement with the Scripts and ScriptFiles build parameters. Each script is parsed with the compose API of SnakeYAML, so every node keeps its line, and plain scalars are resolved by the YAML 1.2 core schema. The validator follows tools/validate.mjs in the derived-properties repository, with the same paths and messages, and reports every fault in every script at once. Per request the element reads each source property once, converts it to the type the script infers without coercing loosely, then runs the checks and the rules. Where a source property is not available the output has no value, using the existing AspectPropertyValue mechanism, and the message names every property that could not be read, in the wording of tools/evaluate.mjs. A request with no Element Data under a key a script reads is logged once per script. When the Pipeline adds the element it checks that some element lists each source property, without judging where that element sits, and that no two Derived Property Elements produce the same property. The developer example builds one Pipeline in code, with a script held as text and a script read from a file beside the example, and the same Pipeline from a configuration file, and shows the message a caller sees when a source property is not available. It ends with a Find out more section.
…ccepts
The tests made each pattern with Path.resolve("*.yaml"), and Windows
refuses a path that holds a wildcard with InvalidPathException, so three
DerivedPropertyElementConfigurationTests failed in every Windows job of
full build 43667464820. The element itself splits a pattern with
File.getName and File.getParentFile and was not affected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the Derived Property Element, which computes property values from properties other elements have produced by following a script, with its example and the shared cases as its tests (EX-19 to EX-22 of the conformance check). Closes #110. The full description follows once the full build on the head has finished.