Skip to main content

datacontract edit

Edit a data contract file in the Data Contract Editor (web UI). Starts a local web server that opens the Data Contract Editor for the given file. The editor is bundled with the CLI, so no internet access is required. Saving in the editor writes directly back to the local file. If a URL is given, you are asked whether to download a local copy, which is then edited. The server also acts as the editor's test runner: "Run test" in the editor executes the data contract tests locally against the servers defined in the data contract. Credentials for the data sources must be provided as environment variables, see https://cli.datacontract.com/testing The editor's AI assistant is enabled by setting DATACONTRACT_EDITOR_AI_ENDPOINT, together with DATACONTRACT_EDITOR_AI_API_KEY, DATACONTRACT_EDITOR_AI_MODEL, DATACONTRACT_EDITOR_AI_PROVIDER (openai or anthropic), and DATACONTRACT_EDITOR_AI_AUTH_HEADER (bearer, api-key, or x-api-key).

datacontract edit [OPTIONS] [LOCATION]
ArgumentDefaultDescription
[LOCATION]datacontract.yamlThe path of the data contract yaml to edit. If the file does not exist, you are asked whether to initialize a new data contract. If a URL is given, you are asked whether to download a local copy to edit.
OptionDefaultDescription
--port4243Bind socket to this port.
--host127.0.0.1Bind socket to this host. Hint: For running in docker, set it to 0.0.0.0
--editor-version—Version of the datacontract-editor npm package to load from the CDN, e.g. '0.1.9' or 'latest'. By default, the editor version bundled with the CLI is used (works offline).
--editor-assets-url—Base URL to load the Data Contract Editor assets (JS/CSS) from, e.g. a self-hosted editor build. Takes precedence over --editor-version.
--language—UI language of the editor, one of: en, de, sv, fr. By default, the editor is shown in English, and the language can be switched in the editor.
--open / --no-open--openOpen the editor in the default browser.
--debug / --no-debug—Enable debug logging
datacontract edit datacontract.yaml

Guide: Edit your Contract.