Skip to content
FeedbackDashboard

Get diagnostics for a build

client.Builds.Diagnostics.List(ctx, buildID, query) (*Page[BuildDiagnostic], error)
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
buildID string

Build ID

query BuildDiagnosticListParams
Cursor param.Field[string]optional

Pagination cursor from a previous response

Limit param.Field[float64]optional

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

exclusiveMinimum0
maximum100
Severity param.Field[BuildDiagnosticListParamsSeverity]optional

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

const BuildDiagnosticListParamsSeverityFatal BuildDiagnosticListParamsSeverity = "fatal"
const BuildDiagnosticListParamsSeverityError BuildDiagnosticListParamsSeverity = "error"
const BuildDiagnosticListParamsSeverityWarning BuildDiagnosticListParamsSeverity = "warning"
const BuildDiagnosticListParamsSeverityNote BuildDiagnosticListParamsSeverity = "note"
Targets param.Field[string]optional

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

ReturnsExpand Collapse
type BuildDiagnostic struct{…}
Code string

The kind of diagnostic.

Ignored bool

Whether the diagnostic is ignored in the Stainless config.

Level BuildDiagnosticLevel

The severity of the diagnostic.

Accepts one of the following:
const BuildDiagnosticLevelFatal BuildDiagnosticLevel = "fatal"
const BuildDiagnosticLevelError BuildDiagnosticLevel = "error"
const BuildDiagnosticLevelWarning BuildDiagnosticLevel = "warning"
const BuildDiagnosticLevelNote BuildDiagnosticLevel = "note"
Message string

A description of the diagnostic.

Accepts one of the following:
type BuildDiagnosticMoreMarkdown struct{…}
Markdown string
Type Markdown
type BuildDiagnosticMoreRaw struct{…}
Raw string
Type Raw
ConfigRef stringoptional

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

OasRef stringoptional

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

Get diagnostics for a build
package main

import (
  "context"
  "fmt"

  "github.com/stainless-api/stainless-api-go"
  "github.com/stainless-api/stainless-api-go/option"
)

func main() {
  client := stainless.NewClient(
    option.WithAPIKey("My API Key"),
  )
  page, err := client.Builds.Diagnostics.List(
    context.TODO(),
    "buildId",
    stainless.BuildDiagnosticListParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "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"
}