Skip to Content

JSON Schema for CSN?

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.


Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Nov 06, 2019 at 12:29 PM


    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 07, 2019 at 01:05 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.