Azure / Azure/azure-sdk-tools

[TSV][BUG]TspValidate returns a silent error if a `validate()` function returns `{ success: false}`.

Open
#13,123 1 comment 1 reaction 3 assignees Claimed by @lirenhe View on GitHub
Automation Tool bug
Dominant language
C#
Stars
135
Forks
260
Avg merge
3d 1h
Merged PRs (30d)
144

Description

### API Spec link

https://github.com/azure-rest-api-specs/eng/tools

### API Spec version

0

### Describe the bug

Currently the validate function returns:

```typescript
protected abstract validate(config: any): RuleResult;

export interface RuleResult {
readonly success: boolean;
readonly stdOutput?: string;
readonly errorOutput?: string;
}
```

The problem here is that if a `validate()` function returns `{success:false}` then the validation fails with no diagnostic.

Two possible solutions have been proposed:

```typescript
export interface RuleResult {
readonly success: boolean;
readonly reason: string; // success or failure reason
}
```

or

```typescript
RuleResult = {success: true; } | {success: false; reason: string };
```

### Expected behavior

Validation failures always have an error attached to them.

### Actual behavior

Validation failures sometimes don't have an error message

### Reproduction Steps

See above.

### Environment

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.