kevin-smets / caml Goto Github PK
View Code? Open in Web Editor NEWCascading / hierarchical YAML configuration
License: MIT License
Cascading / hierarchical YAML configuration
License: MIT License
Constructs like the following:
arr: [
'one',
'http://two'
]
Causes parsing errors: throw new Error('Key contains incomplete quoted section: "' + line + '"');
# cat test.yml
foo:
'baz.qux':
- lorem
- ipsum
// caml -d . -f test
{ foo: { '\'baz': { 'qux\'': [ 'lorem', 'ipsum' ] } } }
Oriniginally submitted by @asgoth - the sanitise step is too eager. Using comments after a property causes the property to disappear, e.g.
path:
to:
some: "value" # some explanation what this does
other: "value"
Results in
{
path: {
to: {
other: "value"
}
}
}
Property some is gone.
Workaround: Keep your comments on a dedicated line
Sometimes it is needed to merge arrays, e.g. when you want to expand a default list of types.
Maybe the following syntax could be used:
files:
+: *baseFiles
- "path/to/file1"
- "path/to/file2"
Error output is not really helpful:
$ caml
Flag '-i' or '--input' is mandatory. e.g. --input a b c, cascades a.yml, b.yml and c.yml.
The -i
flag doesn't exist anymore, should be -f
or --files
Regex /[",'].*\..*[",']:/
matches stuff like the following yaml file incorrectly:
'"this is": a': test
In yaml:
> require('js-yaml').safeLoad(require('fs').readFileSync('test.yml'))
{ '"this.is": a': 'test' }
In caml:
$ caml -f test
/usr/local/lib/node_modules/caml/node_modules/yaml-js/lib/scanner.js:504
throw new exports.ScannerError(null, null, 'mapping values are not allowed here', this.get_mark());
^
mapping values are not allowed here
on line 1, column 15
at ScannerError.YAMLError [as constructor] (/usr/local/lib/node_modules/caml/node_modules/yaml-js/lib/errors.js:70:46)
at ScannerError.MarkedYAMLError [as constructor] (/usr/local/lib/node_modules/caml/node_modules/yaml-js/lib/errors.js:90:45)
at new ScannerError (/usr/local/lib/node_modules/caml/node_modules/yaml-js/lib/scanner.js:23:49)
at Constructor.__dirname.Scanner.Scanner.fetch_value (/usr/local/lib/node_modules/caml/node_modules/yaml-js/lib/scanner.js:504:19)
at Constructor.__dirname.Scanner.Scanner.fetch_more_tokens (/usr/local/lib/node_modules/caml/node_modules/yaml-js/lib/scanner.js:214:21)
at Constructor.__dirname.Scanner.Scanner.check_token (/usr/local/lib/node_modules/caml/node_modules/yaml-js/lib/scanner.js:115:14)
at Constructor.__dirname.Parser.Parser.parse_block_mapping_key (/usr/local/lib/node_modules/caml/node_modules/yaml-js/lib/parser.js:421:16)
at Constructor.__dirname.Parser.Parser.check_event (/usr/local/lib/node_modules/caml/node_modules/yaml-js/lib/parser.js:61:48)
at Constructor.__dirname.Composer.Composer.compose_mapping_node (/usr/local/lib/node_modules/caml/node_modules/yaml-js/lib/composer.js:143:20)
at Constructor.__dirname.Composer.Composer.compose_node (/usr/local/lib/node_modules/caml/node_modules/yaml-js/lib/composer.js:91:21)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.