webextensions-schema
Version:
Programmatically consume the WebExtensions Schema JSON files
63 lines (62 loc) • 1.56 kB
TypeScript
export interface SchemaRaw {
[key: string]: NamespaceSchema[];
}
export interface SchemaNamespaces {
[key: string]: NamespaceSchema[];
}
export interface Schema {
raw: SchemaRaw;
namespaces: SchemaNamespaces;
}
export interface WebExtensionsSchemaOptions {
tag?: string;
}
export interface NamespaceSchema {
namespace: string;
description?: string;
allowedContexts: string[];
types?: TypeSchema[];
$import?: string;
functions?: TypeSchema[];
properties?: Indexable<TypeSchema>;
events?: TypeSchema[];
permissions?: string[];
}
export interface NameDesc {
name: string;
description: string;
}
export declare type Enum = string | NameDesc;
export interface TypeSchema {
id?: string;
name?: string;
$ref?: string;
$extend?: string;
$import?: string;
parameters?: TypeSchema[];
extraParameters?: TypeSchema[];
deprecated?: boolean | string;
unsupported?: boolean;
returns?: TypeSchema;
description?: string;
optional?: boolean;
functions?: TypeSchema[];
events?: TypeSchema[];
properties?: Indexable<TypeSchema>;
patternProperties?: Indexable<TypeSchema>;
choices?: TypeSchema[];
enum?: Enum[];
type?: string;
isInstanceOf?: string;
additionalProperties?: TypeSchema;
minItems?: number;
maxItems?: number;
items?: TypeSchema;
value?: unknown;
async?: true | 'callback';
converterTypeOverride?: string;
converterAdditionalType?: string;
}
export interface Indexable<V> {
[k: string]: V;
}