How to use the @jsii/spec.Stability.Stable function in @jsii/spec

To help you get started, we’ve selected a few @jsii/spec examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / jsii / packages / jsii-diff / lib / index.ts View on Github external
export function compareAssemblies(original: reflect.Assembly, updated: reflect.Assembly, options: ComparisonOptions = {}): Mismatches {
  const mismatches = new Mismatches({
    defaultStability: options.defaultExperimental ? Stability.Experimental : Stability.Stable
  });

  const context = { ...options, mismatches };

  compareClasses(original, updated, context);
  compareInterfaces(original, updated, context);
  compareEnums(original, updated, context);

  return context.mismatches;
}
github aws / jsii / packages / jsii-diff / lib / diagnostics.ts View on Github external
function level(mis: ApiMismatch) {
    if (skipFilter.has(mis.violationKey)) { return DiagLevel.Skipped; }
    if (mis.stability === Stability.Stable || (mis.stability === Stability.Experimental && experimentalErrors)) { return DiagLevel.Error; }
    return DiagLevel.Warning;
  }
}
github aws / jsii / packages / jsii-reflect / lib / tree.ts View on Github external
function describeStability(thing: Documentable, options: TypeSystemTreeOptions) {
  if (!options.stabilities) { return ''; }

  switch (thing.docs.stability) {
    case Stability.Stable: return ` (${colors.green('stable')})`;
    case Stability.Experimental: return ` (${colors.yellow('experimental')})`;
    case Stability.Deprecated: return ` (${colors.red('deprecated')})`;
  }

  return '';
}
github aws / jsii / packages / jsii-reflect / lib / docs.ts View on Github external
}

  public get summary(): string {
    return this.docs.summary ?? '';
  }

  public get remarks(): string {
    return this.docs.remarks ?? '';
  }
}

const stabilityPrecedence = {
  [Stability.Deprecated]: 0,
  [Stability.Experimental]: 1,
  [Stability.External]: 2,
  [Stability.Stable]: 3,
};

function lowestStability(a?: Stability, b?: Stability): Stability | undefined {
  if (a === undefined) { return b; }
  if (b === undefined) { return a; }
  return stabilityPrecedence[a] < stabilityPrecedence[b] ? a : b;
}