@vkontakte/api-schema-typescript-generator 0.11.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/constants.js
CHANGED
|
@@ -154,7 +154,6 @@ class APITypingsGenerator {
|
|
|
154
154
|
let imports = {};
|
|
155
155
|
let codeBlocks = [];
|
|
156
156
|
const properties = this.getObjectProperties(object);
|
|
157
|
-
const requiredProperties = utils_1.arrayToMap(object.required);
|
|
158
157
|
const codeBlock = new TypeCodeBlock_1.TypeCodeBlock({
|
|
159
158
|
type: TypeCodeBlock_1.TypeScriptCodeTypes.Interface,
|
|
160
159
|
refName: object.name,
|
|
@@ -176,7 +175,7 @@ class APITypingsGenerator {
|
|
|
176
175
|
name: property.name,
|
|
177
176
|
description: [property.description, description].join(constants_1.newLineChar),
|
|
178
177
|
value,
|
|
179
|
-
isRequired: helpers_1.isPatternProperty(property.name) ||
|
|
178
|
+
isRequired: helpers_1.isPatternProperty(property.name) || property.isRequired,
|
|
180
179
|
});
|
|
181
180
|
});
|
|
182
181
|
return {
|
|
@@ -94,9 +94,6 @@ function generateTypeString(object, objects, options = {}) {
|
|
|
94
94
|
codeBlocks = [...codeBlocks, ...newCodeBlocks];
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
else if (object.type) {
|
|
98
|
-
return generateBaseType(object, options);
|
|
99
|
-
}
|
|
100
97
|
else if (object.ref) {
|
|
101
98
|
const refName = helpers_1.getObjectNameByRef(object.ref);
|
|
102
99
|
switch (refName) {
|
|
@@ -134,6 +131,9 @@ function generateTypeString(object, objects, options = {}) {
|
|
|
134
131
|
}
|
|
135
132
|
}
|
|
136
133
|
}
|
|
134
|
+
else if (object.type) {
|
|
135
|
+
return generateBaseType(object, options);
|
|
136
|
+
}
|
|
137
137
|
return {
|
|
138
138
|
codeBlocks,
|
|
139
139
|
imports,
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from '../helpers';
|
|
16
16
|
import { CodeBlocksArray, GeneratorResultInterface } from './BaseCodeBlock';
|
|
17
17
|
import { TypeCodeBlock, TypeScriptCodeTypes } from './TypeCodeBlock';
|
|
18
|
-
import {
|
|
18
|
+
import { isObject, sortArrayAlphabetically, uniqueArray } from '../utils';
|
|
19
19
|
import {
|
|
20
20
|
baseAPIParamsInterfaceName,
|
|
21
21
|
baseBoolIntRef,
|
|
@@ -229,7 +229,6 @@ export class APITypingsGenerator {
|
|
|
229
229
|
let codeBlocks: CodeBlocksArray = [];
|
|
230
230
|
|
|
231
231
|
const properties = this.getObjectProperties(object);
|
|
232
|
-
const requiredProperties = arrayToMap(object.required);
|
|
233
232
|
|
|
234
233
|
const codeBlock = new TypeCodeBlock({
|
|
235
234
|
type: TypeScriptCodeTypes.Interface,
|
|
@@ -261,7 +260,7 @@ export class APITypingsGenerator {
|
|
|
261
260
|
name: property.name,
|
|
262
261
|
description: [property.description, description].join(newLineChar),
|
|
263
262
|
value,
|
|
264
|
-
isRequired: isPatternProperty(property.name) ||
|
|
263
|
+
isRequired: isPatternProperty(property.name) || property.isRequired,
|
|
265
264
|
});
|
|
266
265
|
});
|
|
267
266
|
|
|
@@ -134,8 +134,6 @@ export function generateTypeString(
|
|
|
134
134
|
imports = { ...imports, ...newImports };
|
|
135
135
|
codeBlocks = [...codeBlocks, ...newCodeBlocks];
|
|
136
136
|
}
|
|
137
|
-
} else if (object.type) {
|
|
138
|
-
return generateBaseType(object, options);
|
|
139
137
|
} else if (object.ref) {
|
|
140
138
|
const refName = getObjectNameByRef(object.ref);
|
|
141
139
|
|
|
@@ -174,6 +172,8 @@ export function generateTypeString(
|
|
|
174
172
|
}
|
|
175
173
|
}
|
|
176
174
|
}
|
|
175
|
+
} else if (object.type) {
|
|
176
|
+
return generateBaseType(object, options);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
return {
|