UNPKG

1.9 kBTypeScriptView Raw
1/**
2 * A module providing helper functions that are useful when
3 * generating languages bindings and documentation.
4 */
5import { JsonSchema } from '../JsonSchema';
6/**
7 * Read the schemas from `public/*.schema.json` and dereference
8 * any inline references.
9 */
10export declare function readSchemas(glob?: string | string[]): Promise<JsonSchema[]>;
11/**
12 * Get the 'primitive' schemas
13 */
14export declare function filterPrimitiveSchemas(schemas: JsonSchema[]): JsonSchema[];
15/**
16 * Get the 'interface' schemas (i.e. not union schema, not property schemas) which are
17 * usually translated into `interface`s, `class`es or similar for the language.
18 *
19 * Types are sorted topologically so that schemas come before
20 * any of their descendants.
21 */
22export declare function filterInterfaceSchemas(schemas: JsonSchema[]): JsonSchema[];
23/**
24 * Get the union types from the schemas
25 */
26export declare function filterUnionSchemas(schemas: JsonSchema[]): JsonSchema[];
27/**
28 * Get enumeration schemas
29 */
30export declare function filterEnumSchemas(schemas: JsonSchema[]): JsonSchema[];
31/**
32 * Interface for properties giving a little
33 * more information on each property to be used in code generation
34 */
35interface Property {
36 name: string;
37 schema: JsonSchema;
38 inherited: boolean;
39 override: boolean;
40 optional: boolean;
41}
42/**
43 * Get properties for a schema.
44 *
45 * Properties are arranged in groups according to required (or not)
46 * and inherited (or not).
47 */
48export declare function getSchemaProperties(schema: JsonSchema): {
49 all: Property[];
50 inherited: Property[];
51 own: Property[];
52 required: Property[];
53 optional: Property[];
54};
55/**
56 * Create a header for a language bindings file
57 */
58export declare function autogeneratedHeader(generateCommand: string, generator: string, commentDelimiter: string): string;
59export {};