ts-openapi-codegen 2.0.0-beta.1 → 2.0.0-beta.2
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/README.md +71 -55
- package/README.rus.md +71 -54
- package/dist/cli/index.js +2 -1
- package/dist/common/Consts.d.ts.map +1 -1
- package/dist/common/Consts.js +2 -1
- package/dist/common/TRawOptions.d.ts +2 -1
- package/dist/common/TRawOptions.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.js +8 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.js +7 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{UnifiedOptionsVersioned → AllVersionedSchemas}/UnifiedOptionsSchemaV1.js +2 -2
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts +7 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts.map +1 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.js +42 -0
- package/dist/common/VersionedSchema/CommonSchemas.d.ts +1 -0
- package/dist/common/VersionedSchema/CommonSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/CommonSchemas.js +8 -1
- package/dist/common/defaultOptions.d.ts.map +1 -1
- package/dist/common/defaultOptions.js +2 -1
- package/dist/common/utils/__tests__/convertArrayToObject.test.js +5 -6
- package/dist/common/utils/convertArrayToObject.d.ts.map +1 -1
- package/dist/common/utils/convertArrayToObject.js +1 -2
- package/dist/core/OpenApiClient.d.ts.map +1 -1
- package/dist/core/OpenApiClient.js +6 -4
- package/dist/core/WriteClient.d.ts +3 -12
- package/dist/core/WriteClient.d.ts.map +1 -1
- package/dist/core/WriteClient.js +20 -22
- package/dist/core/__tests__/WriteClient.test.js +6 -1
- package/dist/core/types/enums/ValidationLibrary.enum.d.ts +8 -0
- package/dist/core/types/enums/ValidationLibrary.enum.d.ts.map +1 -0
- package/dist/core/types/enums/ValidationLibrary.enum.js +11 -0
- package/dist/core/utils/__mocks__/templates.d.ts.map +1 -1
- package/dist/core/utils/__mocks__/templates.js +4 -0
- package/dist/core/utils/__tests__/writeClientSchemas.test.js +2 -0
- package/dist/core/utils/precompileTemplates.js +6 -0
- package/dist/core/utils/registerHandlebarHelpers.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarHelpers.js +74 -0
- package/dist/core/utils/registerHandlebarTemplates.d.ts +6 -0
- package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarTemplates.js +84 -0
- package/dist/core/utils/writeClientSchemas.d.ts +2 -0
- package/dist/core/utils/writeClientSchemas.d.ts.map +1 -1
- package/dist/core/utils/writeClientSchemas.js +14 -2
- package/dist/templatesCompiled/client/joi/exportSchema.d.ts +11 -0
- package/dist/templatesCompiled/client/joi/exportSchema.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/exportSchema.js +71 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchema.d.ts +22 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchema.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchema.js +129 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaArray.d.ts +16 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaArray.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaArray.js +84 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaComposition.d.ts +18 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaComposition.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaComposition.js +96 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaDictionary.d.ts +14 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaDictionary.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaDictionary.js +72 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaEnum.d.ts +14 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaEnum.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaEnum.js +74 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaGeneric.d.ts +35 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaGeneric.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaGeneric.js +201 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaInterface.d.ts +14 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaInterface.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaInterface.js +50 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaReference.d.ts +9 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaReference.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaReference.js +25 -0
- package/dist/templatesCompiled/client/jsonschema/exportSchema.d.ts +11 -0
- package/dist/templatesCompiled/client/jsonschema/exportSchema.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/exportSchema.js +69 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchema.d.ts +22 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchema.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchema.js +129 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaArray.d.ts +16 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaArray.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaArray.js +74 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaComposition.d.ts +16 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaComposition.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaComposition.js +84 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaDictionary.d.ts +13 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaDictionary.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaDictionary.js +56 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaEnum.d.ts +12 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaEnum.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaEnum.js +49 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaGeneric.d.ts +29 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaGeneric.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaGeneric.js +175 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface.d.ts +15 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface.js +63 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaReference.d.ts +9 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaReference.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaReference.js +25 -0
- package/dist/templatesCompiled/client/yup/exportSchema.d.ts +11 -0
- package/dist/templatesCompiled/client/yup/exportSchema.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/exportSchema.js +73 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchema.d.ts +22 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchema.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchema.js +129 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaArray.d.ts +16 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaArray.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaArray.js +84 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaComposition.d.ts +18 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaComposition.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaComposition.js +96 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaDictionary.d.ts +14 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaDictionary.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaDictionary.js +72 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaEnum.d.ts +14 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaEnum.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaEnum.js +74 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaGeneric.d.ts +34 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaGeneric.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaGeneric.js +201 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaInterface.d.ts +14 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaInterface.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaInterface.js +50 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaReference.d.ts +9 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaReference.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaReference.js +25 -0
- package/dist/templatesCompiled/client/zod/exportSchema.d.ts +11 -0
- package/dist/templatesCompiled/client/zod/exportSchema.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/exportSchema.js +67 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchema.d.ts +22 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchema.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchema.js +129 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaArray.d.ts +14 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaArray.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaArray.js +65 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaComposition.d.ts +15 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaComposition.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaComposition.js +70 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaDictionary.d.ts +12 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaDictionary.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaDictionary.js +53 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaEnum.d.ts +15 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaEnum.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaEnum.js +86 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaGeneric.d.ts +34 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaGeneric.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaGeneric.js +193 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaInterface.d.ts +14 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaInterface.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaInterface.js +50 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaReference.d.ts +9 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaReference.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaReference.js +25 -0
- package/package.json +12 -3
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.d.ts +0 -3
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.d.ts.map +0 -1
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.js +0 -28
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.d.ts.map +0 -1
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.d.ts +0 -3
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.d.ts.map +0 -1
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.js +0 -10
- /package/dist/common/VersionedSchema/{UnifiedOptionsVersioned → AllVersionedSchemas}/UnifiedOptionsSchemaV1.d.ts +0 -0
|
@@ -126,6 +126,43 @@ const typeIntersection_1 = __importDefault(require("../../templatesCompiled/clie
|
|
|
126
126
|
const typeReference_1 = __importDefault(require("../../templatesCompiled/client/partials/typeReference"));
|
|
127
127
|
const typeUnion_1 = __importDefault(require("../../templatesCompiled/client/partials/typeUnion"));
|
|
128
128
|
const registerHandlebarHelpers_1 = require("./registerHandlebarHelpers");
|
|
129
|
+
const ValidationLibrary_enum_1 = require("../types/enums/ValidationLibrary.enum");
|
|
130
|
+
const exportSchema_2 = __importDefault(require("../../templatesCompiled/client/zod/exportSchema"));
|
|
131
|
+
const zodSchema_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchema"));
|
|
132
|
+
const zodSchemaInterface_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaInterface"));
|
|
133
|
+
const zodSchemaEnum_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaEnum"));
|
|
134
|
+
const zodSchemaArray_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaArray"));
|
|
135
|
+
const zodSchemaDictionary_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaDictionary"));
|
|
136
|
+
const zodSchemaGeneric_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaGeneric"));
|
|
137
|
+
const zodSchemaReference_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaReference"));
|
|
138
|
+
const zodSchemaComposition_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaComposition"));
|
|
139
|
+
const exportSchema_3 = __importDefault(require("../../templatesCompiled/client/yup/exportSchema"));
|
|
140
|
+
const yupSchema_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchema"));
|
|
141
|
+
const yupSchemaInterface_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaInterface"));
|
|
142
|
+
const yupSchemaEnum_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaEnum"));
|
|
143
|
+
const yupSchemaArray_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaArray"));
|
|
144
|
+
const yupSchemaDictionary_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaDictionary"));
|
|
145
|
+
const yupSchemaGeneric_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaGeneric"));
|
|
146
|
+
const yupSchemaReference_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaReference"));
|
|
147
|
+
const yupSchemaComposition_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaComposition"));
|
|
148
|
+
const exportSchema_4 = __importDefault(require("../../templatesCompiled/client/joi/exportSchema"));
|
|
149
|
+
const joiSchema_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchema"));
|
|
150
|
+
const joiSchemaInterface_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaInterface"));
|
|
151
|
+
const joiSchemaEnum_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaEnum"));
|
|
152
|
+
const joiSchemaArray_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaArray"));
|
|
153
|
+
const joiSchemaDictionary_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaDictionary"));
|
|
154
|
+
const joiSchemaGeneric_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaGeneric"));
|
|
155
|
+
const joiSchemaReference_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaReference"));
|
|
156
|
+
const joiSchemaComposition_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaComposition"));
|
|
157
|
+
const exportSchema_5 = __importDefault(require("../../templatesCompiled/client/jsonschema/exportSchema"));
|
|
158
|
+
const jsonschemaSchema_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchema"));
|
|
159
|
+
const jsonschemaSchemaInterface_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface"));
|
|
160
|
+
const jsonschemaSchemaEnum_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchemaEnum"));
|
|
161
|
+
const jsonschemaSchemaArray_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchemaArray"));
|
|
162
|
+
const jsonschemaSchemaDictionary_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchemaDictionary"));
|
|
163
|
+
const jsonschemaSchemaGeneric_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchemaGeneric"));
|
|
164
|
+
const jsonschemaSchemaReference_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchemaReference"));
|
|
165
|
+
const jsonschemaSchemaComposition_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchemaComposition"));
|
|
129
166
|
/**
|
|
130
167
|
* Read all the Handlebar templates that we need and return on wrapper object
|
|
131
168
|
* so we can easily access the templates in out generator / write functions.
|
|
@@ -145,6 +182,10 @@ function registerHandlebarTemplates(root) {
|
|
|
145
182
|
exports: {
|
|
146
183
|
model: Handlebars.template(exportModel_1.default),
|
|
147
184
|
schema: Handlebars.template(exportSchema_1.default),
|
|
185
|
+
zodSchema: Handlebars.template(exportSchema_2.default),
|
|
186
|
+
yupSchema: Handlebars.template(exportSchema_3.default),
|
|
187
|
+
joiSchema: Handlebars.template(exportSchema_4.default),
|
|
188
|
+
jsonSchemaSchema: Handlebars.template(exportSchema_5.default),
|
|
148
189
|
service: Handlebars.template(exportService_1.default),
|
|
149
190
|
},
|
|
150
191
|
core: {
|
|
@@ -231,5 +272,48 @@ function registerHandlebarTemplates(root) {
|
|
|
231
272
|
Handlebars.registerPartial('axios/getResponseHeader', Handlebars.template(getResponseHeader_1.default));
|
|
232
273
|
Handlebars.registerPartial('axios/sendRequest', Handlebars.template(sendRequest_1.default));
|
|
233
274
|
Handlebars.registerPartial('axios/request', Handlebars.template(request_1.default));
|
|
275
|
+
// Register Zod partials if validationLibrary is ZOD
|
|
276
|
+
if (root?.validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.ZOD) {
|
|
277
|
+
Handlebars.registerPartial('zodSchema', Handlebars.template(zodSchema_1.default));
|
|
278
|
+
Handlebars.registerPartial('zodSchemaInterface', Handlebars.template(zodSchemaInterface_1.default));
|
|
279
|
+
Handlebars.registerPartial('zodSchemaEnum', Handlebars.template(zodSchemaEnum_1.default));
|
|
280
|
+
Handlebars.registerPartial('zodSchemaArray', Handlebars.template(zodSchemaArray_1.default));
|
|
281
|
+
Handlebars.registerPartial('zodSchemaDictionary', Handlebars.template(zodSchemaDictionary_1.default));
|
|
282
|
+
Handlebars.registerPartial('zodSchemaGeneric', Handlebars.template(zodSchemaGeneric_1.default));
|
|
283
|
+
Handlebars.registerPartial('zodSchemaReference', Handlebars.template(zodSchemaReference_1.default));
|
|
284
|
+
Handlebars.registerPartial('zodSchemaComposition', Handlebars.template(zodSchemaComposition_1.default));
|
|
285
|
+
}
|
|
286
|
+
// Register Yup partials if validationLibrary is YUP
|
|
287
|
+
if (root?.validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.YUP) {
|
|
288
|
+
Handlebars.registerPartial('yupSchema', Handlebars.template(yupSchema_1.default));
|
|
289
|
+
Handlebars.registerPartial('yupSchemaInterface', Handlebars.template(yupSchemaInterface_1.default));
|
|
290
|
+
Handlebars.registerPartial('yupSchemaEnum', Handlebars.template(yupSchemaEnum_1.default));
|
|
291
|
+
Handlebars.registerPartial('yupSchemaArray', Handlebars.template(yupSchemaArray_1.default));
|
|
292
|
+
Handlebars.registerPartial('yupSchemaDictionary', Handlebars.template(yupSchemaDictionary_1.default));
|
|
293
|
+
Handlebars.registerPartial('yupSchemaGeneric', Handlebars.template(yupSchemaGeneric_1.default));
|
|
294
|
+
Handlebars.registerPartial('yupSchemaReference', Handlebars.template(yupSchemaReference_1.default));
|
|
295
|
+
Handlebars.registerPartial('yupSchemaComposition', Handlebars.template(yupSchemaComposition_1.default));
|
|
296
|
+
}
|
|
297
|
+
// Register Joi partials if validationLibrary is JOI
|
|
298
|
+
if (root?.validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.JOI) {
|
|
299
|
+
Handlebars.registerPartial('joiSchema', Handlebars.template(joiSchema_1.default));
|
|
300
|
+
Handlebars.registerPartial('joiSchemaInterface', Handlebars.template(joiSchemaInterface_1.default));
|
|
301
|
+
Handlebars.registerPartial('joiSchemaEnum', Handlebars.template(joiSchemaEnum_1.default));
|
|
302
|
+
Handlebars.registerPartial('joiSchemaArray', Handlebars.template(joiSchemaArray_1.default));
|
|
303
|
+
Handlebars.registerPartial('joiSchemaDictionary', Handlebars.template(joiSchemaDictionary_1.default));
|
|
304
|
+
Handlebars.registerPartial('joiSchemaGeneric', Handlebars.template(joiSchemaGeneric_1.default));
|
|
305
|
+
Handlebars.registerPartial('joiSchemaReference', Handlebars.template(joiSchemaReference_1.default));
|
|
306
|
+
Handlebars.registerPartial('joiSchemaComposition', Handlebars.template(joiSchemaComposition_1.default));
|
|
307
|
+
}
|
|
308
|
+
if (root.validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.JSONSCHEMA) {
|
|
309
|
+
Handlebars.registerPartial('jsonschemaSchema', Handlebars.template(jsonschemaSchema_1.default));
|
|
310
|
+
Handlebars.registerPartial('jsonschemaSchemaInterface', Handlebars.template(jsonschemaSchemaInterface_1.default));
|
|
311
|
+
Handlebars.registerPartial('jsonschemaSchemaEnum', Handlebars.template(jsonschemaSchemaEnum_1.default));
|
|
312
|
+
Handlebars.registerPartial('jsonschemaSchemaArray', Handlebars.template(jsonschemaSchemaArray_1.default));
|
|
313
|
+
Handlebars.registerPartial('jsonschemaSchemaDictionary', Handlebars.template(jsonschemaSchemaDictionary_1.default));
|
|
314
|
+
Handlebars.registerPartial('jsonschemaSchemaGeneric', Handlebars.template(jsonschemaSchemaGeneric_1.default));
|
|
315
|
+
Handlebars.registerPartial('jsonschemaSchemaReference', Handlebars.template(jsonschemaSchemaReference_1.default));
|
|
316
|
+
Handlebars.registerPartial('jsonschemaSchemaComposition', Handlebars.template(jsonschemaSchemaComposition_1.default));
|
|
317
|
+
}
|
|
234
318
|
return templates;
|
|
235
319
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HttpClient } from '../types/enums/HttpClient.enum';
|
|
2
|
+
import { ValidationLibrary } from '../types/enums/ValidationLibrary.enum';
|
|
2
3
|
import type { Model } from '../types/shared/Model.model';
|
|
3
4
|
import { WriteClient } from '../WriteClient';
|
|
4
5
|
import { Templates } from './registerHandlebarTemplates';
|
|
@@ -15,6 +16,7 @@ interface IWriteClientSchemas {
|
|
|
15
16
|
outputSchemasPath: string;
|
|
16
17
|
httpClient: HttpClient;
|
|
17
18
|
useUnionTypes: boolean;
|
|
19
|
+
validationLibrary?: ValidationLibrary;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* Generate Schemas using the Handlebar template and write to disk.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeClientSchemas.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientSchemas.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD;;;;;;GAMG;AACH,UAAU,mBAAmB;IACzB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"writeClientSchemas.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientSchemas.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD;;;;;;GAMG;AACH,UAAU,mBAAmB;IACzB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4CvG"}
|
|
@@ -5,6 +5,7 @@ const fs_1 = require("fs");
|
|
|
5
5
|
const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
|
|
6
6
|
const format_1 = require("../../common/utils/format");
|
|
7
7
|
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
8
|
+
const ValidationLibrary_enum_1 = require("../types/enums/ValidationLibrary.enum");
|
|
8
9
|
/**
|
|
9
10
|
* Generate Schemas using the Handlebar template and write to disk.
|
|
10
11
|
* @param models Array of Models to write
|
|
@@ -14,8 +15,18 @@ const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
|
14
15
|
* @param useUnionTypes Use union types instead of enums
|
|
15
16
|
*/
|
|
16
17
|
async function writeClientSchemas(options) {
|
|
17
|
-
const { models, templates, outputSchemasPath, httpClient, useUnionTypes } = options;
|
|
18
|
+
const { models, templates, outputSchemasPath, httpClient, useUnionTypes, validationLibrary } = options;
|
|
18
19
|
this.logger.info('The recording of model validation schema files begins.');
|
|
20
|
+
// Choose template based on validation library
|
|
21
|
+
const schemaTemplate = validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.ZOD
|
|
22
|
+
? templates.exports.zodSchema
|
|
23
|
+
: validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.YUP
|
|
24
|
+
? templates.exports.yupSchema
|
|
25
|
+
: validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.JOI
|
|
26
|
+
? templates.exports.joiSchema
|
|
27
|
+
: validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.JSONSCHEMA
|
|
28
|
+
? templates.exports.jsonSchemaSchema
|
|
29
|
+
: templates.exports.schema;
|
|
19
30
|
for (const model of models) {
|
|
20
31
|
const modelFolderPath = model?.path;
|
|
21
32
|
const dir = (0, pathHelpers_1.dirNameHelper)(modelFolderPath);
|
|
@@ -26,10 +37,11 @@ async function writeClientSchemas(options) {
|
|
|
26
37
|
}
|
|
27
38
|
const file = (0, pathHelpers_1.resolveHelper)(outputSchemasPath, `${modelFolderPath}Schema.ts`);
|
|
28
39
|
this.logger.info(`The recording of the file data begins: ${file}`);
|
|
29
|
-
const templateResult =
|
|
40
|
+
const templateResult = schemaTemplate({
|
|
30
41
|
...model,
|
|
31
42
|
httpClient,
|
|
32
43
|
useUnionTypes,
|
|
44
|
+
validationLibrary,
|
|
33
45
|
});
|
|
34
46
|
const formattedValue = await (0, format_1.format)(templateResult);
|
|
35
47
|
await fileSystemHelpers_1.fileSystemHelpers.writeFile(file, formattedValue);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"1": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
3
|
+
"2": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
4
|
+
"3": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
5
|
+
compiler: (string | number)[];
|
|
6
|
+
main: (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
7
|
+
usePartial: boolean;
|
|
8
|
+
useData: boolean;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=exportSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exportSchema.d.ts","sourceRoot":"","sources":["../../../../src/templatesCompiled/client/joi/exportSchema.ts"],"names":[],"mappings":";;;;;;;;;AAMA,wBAkEmC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// This is an automatically generated file for the hbs template.
|
|
4
|
+
// You don't need to change it, run npm run build:hbs to update it.
|
|
5
|
+
/* istanbul ignore file */
|
|
6
|
+
/* tslint: disable */
|
|
7
|
+
/* eslint: disable */
|
|
8
|
+
// @ts-nocheck
|
|
9
|
+
exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
10
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
12
|
+
return parent[propertyName];
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
};
|
|
16
|
+
return ((stack1 = lookupProperty(helpers, "each").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "imports"), { "name": "each", "hash": {}, "fn": container.program(2, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 6, "column": 9 } } })) != null ? stack1 : "");
|
|
17
|
+
}, "2": function (container, depth0, helpers, partials, data) {
|
|
18
|
+
var stack1, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
20
|
+
return parent[propertyName];
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
};
|
|
24
|
+
return "import { "
|
|
25
|
+
+ ((stack1 = container.lambda(container.strict(depth0, "name", { "start": { "line": 5, "column": 12 }, "end": { "line": 5, "column": 16 } }), depth0)) != null ? stack1 : "")
|
|
26
|
+
+ "Schema"
|
|
27
|
+
+ ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "alias"), { "name": "if", "hash": {}, "fn": container.program(3, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 5, "column": 25 }, "end": { "line": 5, "column": 66 } } })) != null ? stack1 : "")
|
|
28
|
+
+ " } from '"
|
|
29
|
+
+ ((stack1 = lookupProperty(helpers, "normalizePath").call(alias1, lookupProperty(depth0, "path"), { "name": "normalizePath", "hash": {}, "data": data, "loc": { "start": { "line": 5, "column": 75 }, "end": { "line": 5, "column": 99 } } })) != null ? stack1 : "")
|
|
30
|
+
+ "';\n";
|
|
31
|
+
}, "3": function (container, depth0, helpers, partials, data) {
|
|
32
|
+
var stack1;
|
|
33
|
+
return " as "
|
|
34
|
+
+ ((stack1 = container.lambda(container.strict(depth0, "alias", { "start": { "line": 5, "column": 45 }, "end": { "line": 5, "column": 50 } }), depth0)) != null ? stack1 : "")
|
|
35
|
+
+ "Schema";
|
|
36
|
+
}, "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
37
|
+
var stack1, alias1 = container.strict, alias2 = container.lambda, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
38
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
39
|
+
return parent[propertyName];
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
};
|
|
43
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "header"), depth0, { "name": "header", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
|
|
44
|
+
+ "\n"
|
|
45
|
+
+ ((stack1 = lookupProperty(helpers, "if").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "imports"), { "name": "if", "hash": {}, "fn": container.program(1, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 7, "column": 7 } } })) != null ? stack1 : "")
|
|
46
|
+
+ "\nimport Joi from 'joi';\n\nexport const "
|
|
47
|
+
+ ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 11, "column": 16 }, "end": { "line": 11, "column": 20 } }), depth0)) != null ? stack1 : "")
|
|
48
|
+
+ "Schema = "
|
|
49
|
+
+ ((stack1 = container.invokePartial(lookupProperty(partials, "joiSchema"), depth0, { "name": "joiSchema", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
|
|
50
|
+
+ ";\n\nexport type "
|
|
51
|
+
+ ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 13, "column": 15 }, "end": { "line": 13, "column": 19 } }), depth0)) != null ? stack1 : "")
|
|
52
|
+
+ " = Joi.SchemaValue<typeof "
|
|
53
|
+
+ ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 13, "column": 51 }, "end": { "line": 13, "column": 55 } }), depth0)) != null ? stack1 : "")
|
|
54
|
+
+ "Schema>;\n\nexport function validate"
|
|
55
|
+
+ ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 15, "column": 27 }, "end": { "line": 15, "column": 31 } }), depth0)) != null ? stack1 : "")
|
|
56
|
+
+ "(data: unknown): { value: "
|
|
57
|
+
+ ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 15, "column": 63 }, "end": { "line": 15, "column": 67 } }), depth0)) != null ? stack1 : "")
|
|
58
|
+
+ "; error?: undefined } | { value?: undefined; error: Joi.ValidationError } {\n const result = "
|
|
59
|
+
+ ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 16, "column": 22 }, "end": { "line": 16, "column": 26 } }), depth0)) != null ? stack1 : "")
|
|
60
|
+
+ "Schema.validate(data);\n if (result.error) {\n return { error: result.error };\n }\n return { value: result.value as "
|
|
61
|
+
+ ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 20, "column": 39 }, "end": { "line": 20, "column": 43 } }), depth0)) != null ? stack1 : "")
|
|
62
|
+
+ " };\n}\n\nexport function validate"
|
|
63
|
+
+ ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 23, "column": 27 }, "end": { "line": 23, "column": 31 } }), depth0)) != null ? stack1 : "")
|
|
64
|
+
+ "Sync(data: unknown): "
|
|
65
|
+
+ ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 23, "column": 58 }, "end": { "line": 23, "column": 62 } }), depth0)) != null ? stack1 : "")
|
|
66
|
+
+ " {\n const { value, error } = "
|
|
67
|
+
+ ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 24, "column": 32 }, "end": { "line": 24, "column": 36 } }), depth0)) != null ? stack1 : "")
|
|
68
|
+
+ "Schema.validate(data);\n if (error) {\n throw error;\n }\n return value as "
|
|
69
|
+
+ ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 28, "column": 23 }, "end": { "line": 28, "column": 27 } }), depth0)) != null ? stack1 : "")
|
|
70
|
+
+ ";\n}";
|
|
71
|
+
}, "usePartial": true, "useData": true };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"1": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
3
|
+
"3": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
4
|
+
"4": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
5
|
+
"6": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
6
|
+
"7": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
7
|
+
"9": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
8
|
+
"10": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
9
|
+
"12": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
10
|
+
"13": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
11
|
+
"15": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
12
|
+
"16": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
13
|
+
"17": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
14
|
+
"18": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
15
|
+
"20": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
16
|
+
compiler: (string | number)[];
|
|
17
|
+
main: (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
18
|
+
usePartial: boolean;
|
|
19
|
+
useData: boolean;
|
|
20
|
+
};
|
|
21
|
+
export default _default;
|
|
22
|
+
//# sourceMappingURL=joiSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"joiSchema.d.ts","sourceRoot":"","sources":["../../../../../src/templatesCompiled/client/joi/partials/joiSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAMA,wBAuImC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// This is an automatically generated file for the hbs template.
|
|
4
|
+
// You don't need to change it, run npm run build:hbs to update it.
|
|
5
|
+
/* istanbul ignore file */
|
|
6
|
+
/* tslint: disable */
|
|
7
|
+
/* eslint: disable */
|
|
8
|
+
// @ts-nocheck
|
|
9
|
+
exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
10
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
12
|
+
return parent[propertyName];
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
};
|
|
16
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "joiSchemaInterface"), depth0, { "name": "joiSchemaInterface", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
17
|
+
}, "3": function (container, depth0, helpers, partials, data) {
|
|
18
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
20
|
+
return parent[propertyName];
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
};
|
|
24
|
+
return ((stack1 = lookupProperty(helpers, "equals").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "export"), "enum", { "name": "equals", "hash": {}, "fn": container.program(4, data, 0), "inverse": container.program(6, data, 0), "data": data, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 19, "column": 0 } } })) != null ? stack1 : "");
|
|
25
|
+
}, "4": function (container, depth0, helpers, partials, data) {
|
|
26
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
27
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
28
|
+
return parent[propertyName];
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
};
|
|
32
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "joiSchemaEnum"), depth0, { "name": "joiSchemaEnum", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
33
|
+
}, "6": function (container, depth0, helpers, partials, data) {
|
|
34
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
35
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
36
|
+
return parent[propertyName];
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
};
|
|
40
|
+
return ((stack1 = lookupProperty(helpers, "equals").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "export"), "array", { "name": "equals", "hash": {}, "fn": container.program(7, data, 0), "inverse": container.program(9, data, 0), "data": data, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 19, "column": 0 } } })) != null ? stack1 : "");
|
|
41
|
+
}, "7": function (container, depth0, helpers, partials, data) {
|
|
42
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
43
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
44
|
+
return parent[propertyName];
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
47
|
+
};
|
|
48
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "joiSchemaArray"), depth0, { "name": "joiSchemaArray", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
49
|
+
}, "9": function (container, depth0, helpers, partials, data) {
|
|
50
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
51
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
52
|
+
return parent[propertyName];
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
};
|
|
56
|
+
return ((stack1 = lookupProperty(helpers, "equals").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "export"), "dictionary", { "name": "equals", "hash": {}, "fn": container.program(10, data, 0), "inverse": container.program(12, data, 0), "data": data, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 19, "column": 0 } } })) != null ? stack1 : "");
|
|
57
|
+
}, "10": function (container, depth0, helpers, partials, data) {
|
|
58
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
59
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
60
|
+
return parent[propertyName];
|
|
61
|
+
}
|
|
62
|
+
return undefined;
|
|
63
|
+
};
|
|
64
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "joiSchemaDictionary"), depth0, { "name": "joiSchemaDictionary", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
65
|
+
}, "12": function (container, depth0, helpers, partials, data) {
|
|
66
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
67
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
68
|
+
return parent[propertyName];
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
};
|
|
72
|
+
return ((stack1 = lookupProperty(helpers, "equals").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "export"), "any-of", { "name": "equals", "hash": {}, "fn": container.program(13, data, 0), "inverse": container.program(15, data, 0), "data": data, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 19, "column": 0 } } })) != null ? stack1 : "");
|
|
73
|
+
}, "13": function (container, depth0, helpers, partials, data) {
|
|
74
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
75
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
76
|
+
return parent[propertyName];
|
|
77
|
+
}
|
|
78
|
+
return undefined;
|
|
79
|
+
};
|
|
80
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "joiSchemaComposition"), depth0, { "name": "joiSchemaComposition", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
81
|
+
}, "15": function (container, depth0, helpers, partials, data) {
|
|
82
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
83
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
84
|
+
return parent[propertyName];
|
|
85
|
+
}
|
|
86
|
+
return undefined;
|
|
87
|
+
};
|
|
88
|
+
return ((stack1 = lookupProperty(helpers, "equals").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "export"), "all-of", { "name": "equals", "hash": {}, "fn": container.program(13, data, 0), "inverse": container.program(16, data, 0), "data": data, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 19, "column": 0 } } })) != null ? stack1 : "");
|
|
89
|
+
}, "16": function (container, depth0, helpers, partials, data) {
|
|
90
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
91
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
92
|
+
return parent[propertyName];
|
|
93
|
+
}
|
|
94
|
+
return undefined;
|
|
95
|
+
};
|
|
96
|
+
return ((stack1 = lookupProperty(helpers, "equals").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "export"), "one-of", { "name": "equals", "hash": {}, "fn": container.program(13, data, 0), "inverse": container.program(17, data, 0), "data": data, "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 19, "column": 0 } } })) != null ? stack1 : "");
|
|
97
|
+
}, "17": function (container, depth0, helpers, partials, data) {
|
|
98
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
99
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
100
|
+
return parent[propertyName];
|
|
101
|
+
}
|
|
102
|
+
return undefined;
|
|
103
|
+
};
|
|
104
|
+
return ((stack1 = lookupProperty(helpers, "equals").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "export"), "reference", { "name": "equals", "hash": {}, "fn": container.program(18, data, 0), "inverse": container.program(20, data, 0), "data": data, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 19, "column": 0 } } })) != null ? stack1 : "");
|
|
105
|
+
}, "18": function (container, depth0, helpers, partials, data) {
|
|
106
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
107
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
108
|
+
return parent[propertyName];
|
|
109
|
+
}
|
|
110
|
+
return undefined;
|
|
111
|
+
};
|
|
112
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "joiSchemaReference"), depth0, { "name": "joiSchemaReference", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
113
|
+
}, "20": function (container, depth0, helpers, partials, data) {
|
|
114
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
115
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
116
|
+
return parent[propertyName];
|
|
117
|
+
}
|
|
118
|
+
return undefined;
|
|
119
|
+
};
|
|
120
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "joiSchemaGeneric"), depth0, { "name": "joiSchemaGeneric", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
121
|
+
}, "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
122
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
123
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
124
|
+
return parent[propertyName];
|
|
125
|
+
}
|
|
126
|
+
return undefined;
|
|
127
|
+
};
|
|
128
|
+
return ((stack1 = lookupProperty(helpers, "equals").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "export"), "interface", { "name": "equals", "hash": {}, "fn": container.program(1, data, 0), "inverse": container.program(3, data, 0), "data": data, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 19, "column": 11 } } })) != null ? stack1 : "");
|
|
129
|
+
}, "usePartial": true, "useData": true };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"1": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
3
|
+
"2": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
4
|
+
"4": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
5
|
+
"5": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
6
|
+
"7": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
7
|
+
"9": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
8
|
+
"11": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
9
|
+
"13": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
10
|
+
"15": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
11
|
+
compiler: (string | number)[];
|
|
12
|
+
main: (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
13
|
+
useData: boolean;
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
16
|
+
//# sourceMappingURL=joiSchemaArray.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"joiSchemaArray.d.ts","sourceRoot":"","sources":["../../../../../src/templatesCompiled/client/joi/partials/joiSchemaArray.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAMA,wBAoFiB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// This is an automatically generated file for the hbs template.
|
|
4
|
+
// You don't need to change it, run npm run build:hbs to update it.
|
|
5
|
+
/* istanbul ignore file */
|
|
6
|
+
/* tslint: disable */
|
|
7
|
+
/* eslint: disable */
|
|
8
|
+
// @ts-nocheck
|
|
9
|
+
exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
10
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
12
|
+
return parent[propertyName];
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
};
|
|
16
|
+
return ((stack1 = lookupProperty(helpers, "isBasicType").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "link"), { "name": "isBasicType", "hash": {}, "fn": container.program(2, data, 0), "inverse": container.program(4, data, 0), "data": data, "loc": { "start": { "line": 1, "column": 30 }, "end": { "line": 1, "column": 178 } } })) != null ? stack1 : "");
|
|
17
|
+
}, "2": function (container, depth0, helpers, partials, data) {
|
|
18
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
20
|
+
return parent[propertyName];
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
};
|
|
24
|
+
return ((stack1 = lookupProperty(helpers, "joiBaseSchema").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(lookupProperty(depth0, "link"), "base"), { "name": "joiBaseSchema", "hash": {}, "data": data, "loc": { "start": { "line": 1, "column": 51 }, "end": { "line": 1, "column": 78 } } })) != null ? stack1 : "");
|
|
25
|
+
}, "4": function (container, depth0, helpers, partials, data) {
|
|
26
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
27
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
28
|
+
return parent[propertyName];
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
};
|
|
32
|
+
return ((stack1 = lookupProperty(helpers, "if").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(lookupProperty(depth0, "link"), "alias"), { "name": "if", "hash": {}, "fn": container.program(5, data, 0), "inverse": container.program(7, data, 0), "data": data, "loc": { "start": { "line": 1, "column": 86 }, "end": { "line": 1, "column": 162 } } })) != null ? stack1 : "");
|
|
33
|
+
}, "5": function (container, depth0, helpers, partials, data) {
|
|
34
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
35
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
36
|
+
return parent[propertyName];
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
};
|
|
40
|
+
return ((stack1 = container.lambda(container.strict(lookupProperty(depth0, "link"), "alias", { "start": { "line": 1, "column": 107 }, "end": { "line": 1, "column": 117 } }), depth0)) != null ? stack1 : "")
|
|
41
|
+
+ "Schema";
|
|
42
|
+
}, "7": function (container, depth0, helpers, partials, data) {
|
|
43
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
44
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
45
|
+
return parent[propertyName];
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
};
|
|
49
|
+
return ((stack1 = container.lambda(container.strict(lookupProperty(depth0, "link"), "type", { "start": { "line": 1, "column": 137 }, "end": { "line": 1, "column": 146 } }), depth0)) != null ? stack1 : "")
|
|
50
|
+
+ "Schema";
|
|
51
|
+
}, "9": function (container, depth0, helpers, partials, data) {
|
|
52
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
53
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
54
|
+
return parent[propertyName];
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
};
|
|
58
|
+
return ((stack1 = lookupProperty(helpers, "joiBaseSchema").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "base"), { "name": "joiBaseSchema", "hash": {}, "data": data, "loc": { "start": { "line": 1, "column": 186 }, "end": { "line": 1, "column": 208 } } })) != null ? stack1 : "");
|
|
59
|
+
}, "11": function (container, depth0, helpers, partials, data) {
|
|
60
|
+
var stack1;
|
|
61
|
+
return ".min("
|
|
62
|
+
+ ((stack1 = container.lambda(container.strict(depth0, "minItems", { "start": { "line": 1, "column": 240 }, "end": { "line": 1, "column": 248 } }), depth0)) != null ? stack1 : "")
|
|
63
|
+
+ ")";
|
|
64
|
+
}, "13": function (container, depth0, helpers, partials, data) {
|
|
65
|
+
var stack1;
|
|
66
|
+
return ".max("
|
|
67
|
+
+ ((stack1 = container.lambda(container.strict(depth0, "maxItems", { "start": { "line": 1, "column": 283 }, "end": { "line": 1, "column": 291 } }), depth0)) != null ? stack1 : "")
|
|
68
|
+
+ ")";
|
|
69
|
+
}, "15": function (container, depth0, helpers, partials, data) {
|
|
70
|
+
return ".allow(null)";
|
|
71
|
+
}, "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
72
|
+
var stack1, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
73
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
74
|
+
return parent[propertyName];
|
|
75
|
+
}
|
|
76
|
+
return undefined;
|
|
77
|
+
};
|
|
78
|
+
return "Joi.array().items("
|
|
79
|
+
+ ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "link"), { "name": "if", "hash": {}, "fn": container.program(1, data, 0), "inverse": container.program(9, data, 0), "data": data, "loc": { "start": { "line": 1, "column": 18 }, "end": { "line": 1, "column": 215 } } })) != null ? stack1 : "")
|
|
80
|
+
+ ")"
|
|
81
|
+
+ ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "minItems"), { "name": "if", "hash": {}, "fn": container.program(11, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 1, "column": 216 }, "end": { "line": 1, "column": 259 } } })) != null ? stack1 : "")
|
|
82
|
+
+ ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "maxItems"), { "name": "if", "hash": {}, "fn": container.program(13, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 1, "column": 259 }, "end": { "line": 1, "column": 302 } } })) != null ? stack1 : "")
|
|
83
|
+
+ ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "isNullable"), { "name": "if", "hash": {}, "fn": container.program(15, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 1, "column": 302 }, "end": { "line": 1, "column": 339 } } })) != null ? stack1 : "");
|
|
84
|
+
}, "useData": true };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"1": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
3
|
+
"2": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
4
|
+
"3": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
5
|
+
"5": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
6
|
+
"7": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
7
|
+
"8": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
8
|
+
"9": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
9
|
+
"10": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
10
|
+
"11": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
11
|
+
"13": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
12
|
+
compiler: (string | number)[];
|
|
13
|
+
main: (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
14
|
+
usePartial: boolean;
|
|
15
|
+
useData: boolean;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
18
|
+
//# sourceMappingURL=joiSchemaComposition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"joiSchemaComposition.d.ts","sourceRoot":"","sources":["../../../../../src/templatesCompiled/client/joi/partials/joiSchemaComposition.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAMA,wBAgGmC"}
|