Skip to content

Incorrect OpenAPI Types for RestSession #108

@zhelezkov

Description

@zhelezkov

Hey all,

I’ve noticed a discrepancy between the OpenAPI-generated types for the RestSession and the actual runtime behavior. This causes confusion and potential type safety issues for TypeScript users.

Repro:

const sandbox = await sdk.sandboxes.resume('');
const restSession = await sandbox.createRestSession();
const shell = await restSession.shell.create({});
console.log(shell);

Expected (according to types)

{
  data: shell.SuccessResponse & {
    result?: shell.OpenShellDto;
  };
  error: undefined;
} | {
  data: undefined;
  error: shell.ErrorResponse & {
    error?: shell.CommonError;
  };
} & {
  request: Request;
  response: Response;
}

Actual response

{
  "status": 0,
  "method": "shell/create",
  "result": {
    "shellId": "REDACTED",
    "shellType": "TERMINAL",
    "ownerUsername": "pitcher-host",
    "name": "Terminal",
    "status": "RUNNING",
    "exitCode": null,
    "isSystemShell": false,
    "buffer": [ "" ]
  },
  "id": 0
}

Issue

The actual response is a plain object and is not wrapped in a data or error field. Also, request and response fields are not present as indicated by the type.

Let me know if I can help provide more details!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions