1 | import { ApplicationConfig } from '@loopback/core';
|
2 | import { OASEnhancer, OpenApiSpec } from '@loopback/openapi-v3';
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | export declare class ConsolidationEnhancer implements OASEnhancer {
|
37 | readonly config?: ApplicationConfig | undefined;
|
38 | name: string;
|
39 | disabled: boolean;
|
40 | constructor(config?: ApplicationConfig | undefined);
|
41 | modifySpec(spec: OpenApiSpec): OpenApiSpec;
|
42 | /**
|
43 | * Recursively search OpenApiSpec PathsObject for SchemaObjects with title
|
44 | * property. Moves reusable schema bodies to #/components/schemas and replace
|
45 | * with json pointer. It handles title collisions with schema body comparision.
|
46 | */
|
47 | private consolidateSchemaObjects;
|
48 | private recursiveWalk;
|
49 | /**
|
50 | * Carry out schema consolidation after tree traversal. If 'title' property
|
51 | * set then we consider current schema for consolidation. SchemaObjects with
|
52 | * properties (and title set) are moved to #/components/schemas/<title> and
|
53 | * replaced with ReferenceObject.
|
54 | *
|
55 | * Features:
|
56 | * - name collision protection
|
57 | *
|
58 | * @param schema - current schema element to process
|
59 | * @param parentPath - path object to parent
|
60 | * @param spec - subject OpenApi specification
|
61 | */
|
62 | private processSchema;
|
63 | private getRefSchema;
|
64 | private patchRef;
|
65 | private patchPath;
|
66 | private ifConsolidationCandidate;
|
67 | private isTraversable;
|
68 | }
|