Validate a typed Cloud request

Check a project, member, source, or workspace request locally and inspect its typed request preview with Altifigence CLI.

Use Altifigence CLI 0.1.9 on Linux to validate a typed request document and review its method, path, headers, and body.

Prepare the request

Save this example as request.json:

{
  "schema": "altifigence.dds.cloud-request.v1",
  "orgId": "11111111-1111-4111-8111-111111111111",
  "action": {
    "type": "project-create",
    "body": {
      "name": "Counter",
      "slug": "counter"
    }
  }
}

For organizations, omit orgId and projectId. For project-list and project-create, include orgId. For project-get, project-update, project-delete and every member, source and workspace action, include both orgId and projectId. Use lowercase UUIDs in the v1–5 format.

For member-add, member-update and member-remove, add the member's userId to action. member-add and member-update also take role: owner, editor or viewer. For a workspace action, put the workspace operation inside action.request.

Validate and inspect the preview

alti --json ide cloud contract --request request.json

Exit status 0 reports a valid contract. The example produces this JSON result:

{
  "schema": "altifigence.dds.cloud-contract.v1",
  "status": "contract-only",
  "validated": true,
  "executed": false,
  "authorizationChecked": false,
  "authorization": {
    "kind": "native-cli-pkce",
    "clientId": "altifigencecli",
    "productId": "altifigence-cli",
    "selectedOrganizationRequired": true,
    "genericCloudTokenAccepted": false
  },
  "request": {
    "method": "POST",
    "path": "/v1/native/orgs/11111111-1111-4111-8111-111111111111/projects",
    "headers": {
      "Content-Type": "application/json"
    },
    "body": {
      "name": "Counter",
      "slug": "counter"
    }
  }
}

Review request.method, request.path, and request.body. The receipt records local validation with status: "contract-only", executed: false, and authorizationChecked: false.

To read the same document from standard input, use:

alti --json ide cloud contract --request - < request.json

Correct a rejected request

An empty project name produces this result with exit status 2:

{
  "schema": "altifigence.dds.cloud-receipt.v1",
  "ok": false,
  "executed": false,
  "error": {
    "code": "INVALID_PROJECT_BODY"
  }
}

Change the name to a nonempty value such as Counter, save the document, and run the validation command again.

For CLOUD_IDENTITY_SCOPE_MISMATCH, match orgId and projectId to the action. For example, remove projectId from a project-create request and validate again. For INVALID_CLOUD_IDENTITY, supply a lowercase UUID in the v1–5 format.

For INVALID_CLOUD_CONTRACT, check JSON syntax and the request field names. For UNSUPPORTED_CLOUD_CONTRACT, set schema to altifigence.dds.cloud-request.v1. Keep each document within 1402200 bytes.

CLI first success