1
0
Fork 0

fix(config): validate state changes

This commit is contained in:
ssube 2020-08-15 18:58:19 -05:00
parent 272a566acb
commit 9a69044e18
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
6 changed files with 29 additions and 26 deletions

View File

@ -18,5 +18,4 @@ export interface ChangeSet
| --- | --- | --- |
| [adds](./cautious-journey.changeset.adds.md) | Array<LabelRef> | |
| [removes](./cautious-journey.changeset.removes.md) | Array<LabelRef> | |
| [requires](./cautious-journey.changeset.requires.md) | Array<LabelRef> | Required labels for this state change to occur. |

View File

@ -1,13 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [ChangeSet](./cautious-journey.changeset.md) &gt; [requires](./cautious-journey.changeset.requires.md)
## ChangeSet.requires property
Required labels for this state change to occur.
<b>Signature:</b>
```typescript
requires: Array<LabelRef>;
```

View File

@ -9,5 +9,5 @@ State changes that could occur to this value.
<b>Signature:</b>
```typescript
becomes: Array<ChangeSet>;
becomes: Array<StateChange>;
```

View File

@ -9,13 +9,13 @@ One of many values for a particular state.
<b>Signature:</b>
```typescript
export interface StateValue extends BaseLabel, ChangeSet
export interface StateValue extends BaseLabel
```
<b>Extends:</b> BaseLabel, [ChangeSet](./cautious-journey.changeset.md)
<b>Extends:</b> BaseLabel
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [becomes](./cautious-journey.statevalue.becomes.md) | Array&lt;[ChangeSet](./cautious-journey.changeset.md)<!-- -->&gt; | State changes that could occur to this value. |
| [becomes](./cautious-journey.statevalue.becomes.md) | Array&lt;StateChange&gt; | State changes that could occur to this value. |

View File

@ -42,6 +42,18 @@ definitions:
- $ref: "#/definitions/change-set"
- $ref: "#/definitions/base-label"
state-change:
allOf:
- $ref: "#/definitions/change-set"
- type: object
required:
- matches
properties:
matches:
items:
$ref: "#/definitions/label-ref"
state-label:
allOf:
- $ref: "#/definitions/change-set"
@ -62,6 +74,8 @@ definitions:
properties:
becomes:
type: array
items:
$ref: "#/definitions/state-change"
default: []
config:
@ -74,7 +88,6 @@ definitions:
type: string
name:
type: string
projects:
type: array
items:

View File

@ -16,11 +16,6 @@ export interface LabelRef {
export interface ChangeSet {
adds: Array<LabelRef>;
removes: Array<LabelRef>;
/**
* Required labels for this state change to occur.
*/
requires: Array<LabelRef>;
}
/**
@ -46,6 +41,11 @@ export interface BaseLabel extends ChangeSet {
* Label priority.
*/
priority: number;
/**
* Required labels for this state change to occur.
*/
requires: Array<LabelRef>;
}
/**
@ -53,14 +53,18 @@ export interface BaseLabel extends ChangeSet {
*/
export type FlagLabel = BaseLabel;
export interface StateChange extends ChangeSet {
matches: Array<LabelRef>;
}
/**
* One of many values for a particular state.
*/
export interface StateValue extends BaseLabel, ChangeSet {
export interface StateValue extends BaseLabel {
/**
* State changes that could occur to this value.
*/
becomes: Array<ChangeSet>;
becomes: Array<StateChange>;
}
/**