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

CLI: do not error when non-YAML file present in directory #69

Open
nmiyake opened this issue Aug 17, 2018 · 0 comments
Open

CLI: do not error when non-YAML file present in directory #69

nmiyake opened this issue Aug 17, 2018 · 0 comments
Labels

Comments

@nmiyake
Copy link
Contributor

nmiyake commented Aug 17, 2018

When running the CLI with a directory as input, it failed with the following:

➜  bin ./conjure compile inner-in/ out.json 
Exception in thread "main" unacceptable character '' (0x0) special characters are not allowed
in "'reader'", position 0
	at com.fasterxml.jackson.dataformat.yaml.snakeyaml.reader.StreamReader.checkPrintable(StreamReader.java:93)
	at com.fasterxml.jackson.dataformat.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:192)
	at com.fasterxml.jackson.dataformat.yaml.snakeyaml.reader.StreamReader.<init>(StreamReader.java:60)
	at com.fasterxml.jackson.dataformat.yaml.YAMLParser.<init>(YAMLParser.java:154)
	at com.fasterxml.jackson.dataformat.yaml.YAMLFactory._createParser(YAMLFactory.java:420)
	at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createParser(YAMLFactory.java:306)
	at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createParser(YAMLFactory.java:14)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2691)
	at com.palantir.conjure.parser.ConjureParser$RecursiveParser.parseInternal(ConjureParser.java:105)
	at com.palantir.conjure.parser.ConjureParser$RecursiveParser.parse(ConjureParser.java:90)
	at com.palantir.conjure.parser.ConjureParser.parse(ConjureParser.java:60)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
	at com.palantir.conjure.defs.Conjure.parse(Conjure.java:35)
	at com.palantir.conjure.cli.ConjureCli.generate(ConjureCli.java:61)
	at com.palantir.conjure.cli.ConjureCli.main(ConjureCli.java:40)

At first, it was not at all clear what was going on. After further investigation, I determined that the issue was that the directory contained a .DS_Store file:

➜  bin ls -la inner-in 
total 24
drwxr-xr-x  4 nmiyake  nmiyake   128 Aug 17 10:26 .
drwxr-xr-x@ 9 nmiyake  nmiyake   288 Aug 17 10:26 ..
-rw-r--r--@ 1 nmiyake  nmiyake  6148 Aug 17 10:26 .DS_Store
-rw-r--r--@ 1 nmiyake  nmiyake   252 Aug 17 10:24 in.conjure.yml
➜  bin rm inner-in/.DS_Store 
➜  bin ./conjure compile ./inner-in out.json

2 issues here:

  • The failure message should include the path of the file that fails to parse
  • When processing a directory, the CLI should either:
    • Only include YAML files in the directory (.yml)
    • Ignore invisible files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants