cybertk / csonschema-cli

MIT License
0 stars 0 forks source link

Global types #3

Open johnprice99 opened 9 years ago

johnprice99 commented 9 years ago

Looks like this hasn't been worked on in a while, but could be exactly what I need to use - however I can't seem to work out how to use the global types option (if it has even been implemented?)

I have tried csonschema File.cson --types Global.cson but i keep getting back that my type is not defined, which leads me to believe it's not reading the Global file?

cybertk commented 9 years ago

Could you post more detail?

johnprice99 commented 9 years ago

Sure, so I have this as my GlobalDefs.cson file:

$defs:
  $_:
    url:
      $raw:
        type: 'string'
        format: 'url'

And this is my Test.cson file:

redirect: 'url'

Then when running the tool from the command line I get this output:

$ csonschema Test.cson -t GlobalDefs.cson
[Error: Type is not defined: url]
$ csonschema Test.cson --types GlobalDefs.cson
[Error: Type is not defined: url]

Hopefully that's enough, but if not let me know (I could just be using the flag incorrectly)

Thanks

cybertk commented 9 years ago

Your usage is correct.

I have looked through the code, the -t option has not been implemented.

cybertk commented 9 years ago

It's easy to implement this options, I think we just need parse cli options to underling csonschema lib.