Skip to content
FeedbackDashboard

Get diagnostics for a build

builds.diagnostics.list(strbuild_id, DiagnosticListParams**kwargs) -> SyncPage[BuildDiagnostic]
get/v0/builds/{buildId}/diagnostics

Get the list of diagnostics for a given build.

If no language targets are specified, diagnostics for all languages are returned.

ParametersExpand Collapse
build_id: str

Build ID

cursor: Optional[str]

Pagination cursor from a previous response

limit: Optional[float]

Maximum number of diagnostics to return, defaults to 100 (maximum: 100)

exclusiveMinimum0
maximum100
severity: Optional[Literal["fatal", "error", "warning", "note"]]

Includes the given severity and above (fatal > error > warning > note).

Accepts one of the following:
"fatal"
"error"
"warning"
"note"
targets: Optional[str]

Optional comma-delimited list of language targets to filter diagnostics by

ReturnsExpand Collapse
class BuildDiagnostic:
code: str

The kind of diagnostic.

ignored: bool

Whether the diagnostic is ignored in the Stainless config.

level: Literal["fatal", "error", "warning", "note"]

The severity of the diagnostic.

Accepts one of the following:
"fatal"
"error"
"warning"
"note"
message: str

A description of the diagnostic.

more: Optional[BuildDiagnosticMore]
Accepts one of the following:
class Markdown:
markdown: str
type: Literal["markdown"]
class Raw:
raw: str
type: Literal["raw"]
config_ref: Optional[str]

A JSON pointer to a relevant field in the Stainless config.

oas_ref: Optional[str]

A JSON pointer to a relevant field in the OpenAPI spec.

Get diagnostics for a build
import os
from stainless_v0 import Stainless

client = Stainless(
    api_key=os.environ.get("STAINLESS_API_KEY"),  # This is the default and can be omitted
)
page = client.builds.diagnostics.list(
    build_id="buildId",
)
page = page.data[0]
print(page.code)
{
  "data": [
    {
      "code": "code",
      "ignored": true,
      "level": "fatal",
      "message": "message",
      "more": {
        "markdown": "markdown",
        "type": "markdown"
      },
      "config_ref": "config_ref",
      "oas_ref": "oas_ref"
    }
  ],
  "has_more": true,
  "next_cursor": "next_cursor"
}
Returns Examples
{
  "data": [
    {
      "code": "code",
      "ignored": true,
      "level": "fatal",
      "message": "message",
      "more": {
        "markdown": "markdown",
        "type": "markdown"
      },
      "config_ref": "config_ref",
      "oas_ref": "oas_ref"
    }
  ],
  "has_more": true,
  "next_cursor": "next_cursor"
}