# Forge manifest validation

> Package used to parse and validate the `manifest.yml` file of Forge apps.

## How to use the library

Use it as follows:

```typescript
import { ProcessorBuilder, ValidationTypes } from '@forge/manifest';

const results = ProcessorBuilder.instance()
  .withValidation(ValidationTypes.FULL)
  .build()
  .process();

console.log(`Valid manifest ? ${results.success}`);
```

## Simple Trigger Scopes Validation

For validating trigger event scopes, use the simple validation API that only requires the event name and scopes:

```typescript
import { validateTriggerScopes } from '@forge/manifest';

// Simple: just pass event and scopes
const result = await validateTriggerScopes(
  'avi:jira:assigned:issue',
  ['read:jira-work']
);

if (!result.valid) {
  console.error(`Missing scopes: ${result.missingScopes.join(', ')}`);
}
```

This is useful for:
- External tools that need to verify scope requirements
- Any service that validates event-scope mappings

## How to check the errors

In case of an invalid `manifest.yml`, the following information will be populated:

```typescript
export interface ValidationError {
  message: string;
  reference: string;
  level: 'error' | 'warning';
  line?: number;
  column?: number;
}

export interface ManifestValidationResult {
  success: boolean;
  errors?: ValidationError[];
}
```

## Updating Manifest schemas
The schemas in this package are automatically updated from Shipyard daily. Any manual changes to these files will be reverted. Please raise a PR in [app-host-artifacts](https://bitbucket.org/atlassian/app-host-artifacts/src/master/) instead.