cancel
Showing results for 
Search instead for 
Did you mean: 

JSON Schema for CSN?

martin_jonsson
Participant

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

Accepted Solutions (1)

Accepted Solutions (1)

chgeo
Advisor
Advisor

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

Answers (1)

Answers (1)

martin_jonsson
Participant
0 Kudos

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.

chgeo
Advisor
Advisor
0 Kudos

I see. Which compile times do you perceive at the moment, and how big is the model?

At the moment, we work on performance improvements in the compiler, so things should anyways get faster.