on 11-05-2019 12:35 PM
Is there a json schema for CSN available somewhere? I'm generating from an external data model and being able to validate the model would come in very handy.
/Martin
Hi,
there is no json schema available outside of the compiler, however, you can make use of the Node.js API for compiler or the cds command line to have your model validated.
For CLI, see this snippet, which uses 'cds compile' to call the compiler. It would fail in case of an invalid CSN.
echo '{ "definitions": { "myservice": { "kind": "service" } } }' > csn.json
cds compile csn.json
Similarly, you can use cds.compile from a Node.js script.
Regards, Christian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Christian. Thank you for your quick answer.
I'm using the cds.compile at the moment and it does absolutely validate. It is just that my model is gigantic and quickly fix simple syntax errors would have been really nice. Now I scale the model down and run like that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.