Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkg/cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,22 +536,26 @@ func getDiagnostics(ctx context.Context, cmd *cli.Command, cc *apiCommandContext
configPath := cc.workspaceConfig.StainlessConfig
if cmd.IsSet("stainless-config") {
configPath = cmd.String("stainless-config")
} else if configPath == "" {
return nil, fmt.Errorf("You must provide a stainless configuration file with `--config /path/to/stainless.yml` or run this command from an initialized workspace.")
}

stainlessConfig, err := os.ReadFile(configPath)
if err != nil {
return nil, err
return nil, fmt.Errorf("Could not read your stainless configuration file:\n%w", err)
}
specParams.Source.StainlessConfig = string(stainlessConfig)

oasPath := cc.workspaceConfig.OpenAPISpec
if cmd.IsSet("openapi-spec") {
oasPath = cmd.String("openapi-spec")
} else if oasPath == "" {
return nil, fmt.Errorf("You must provide an OpenAPI specification with `--oas /path/to/openapi.json` or run this command from an initialized workspace.")
}

openAPISpec, err := os.ReadFile(oasPath)
if err != nil {
return nil, err
return nil, fmt.Errorf("Could not read your stainless configuration file:\n%w", err)
}
specParams.Source.OpenAPISpec = string(openAPISpec)

Expand Down
8 changes: 3 additions & 5 deletions pkg/cmd/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,10 @@ func (m lintModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}

func (m lintModel) View() string {
if m.error != nil {
return fmt.Sprintf("Error: %s\n", m.error)
}

var content string
if m.diagnostics == nil {
if m.error != nil {
content = "Linting failed!"
} else if m.diagnostics == nil {
content = m.spinner.View() + " Linting"
} else {
content = ViewDiagnosticsPrint(m.diagnostics, -1)
Expand Down