yaschema-api
Advanced tools
Comparing version
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.anyStringSerializableTypeSchema = void 0; | ||
const yaschema_1 = require("yaschema"); | ||
exports.anyStringSerializableTypeSchema = yaschema_1.schema.oneOf4(yaschema_1.schema.number().setAllowedSerializationForms(['number', 'string']), yaschema_1.schema.boolean().setAllowedSerializationForms(['boolean', 'string']), yaschema_1.schema.string(), yaschema_1.schema.object({ isStringSerializable: yaschema_1.schema.boolean(true) })); | ||
//# sourceMappingURL=AnyStringSerializableType.js.map |
@@ -17,2 +17,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./any-request-schemas.js"), exports); | ||
__exportStar(require("./any-response-schema.js"), exports); | ||
__exportStar(require("./AnyBody.js"), exports); | ||
@@ -19,0 +21,0 @@ __exportStar(require("./AnyHeaders.js"), exports); |
@@ -1,4 +0,5 @@ | ||
export type AnyStringSerializableType = string | number | boolean | { | ||
export declare const anyStringSerializableTypeSchema: import("yaschema").Schema<string | number | boolean | ({ | ||
isStringSerializable: true; | ||
}; | ||
} & Partial<{}>)>; | ||
export type AnyStringSerializableType = typeof anyStringSerializableTypeSchema.valueType; | ||
//# sourceMappingURL=AnyStringSerializableType.d.ts.map |
@@ -0,1 +1,3 @@ | ||
export * from './any-request-schemas.js'; | ||
export * from './any-response-schema.js'; | ||
export * from './AnyBody.js'; | ||
@@ -2,0 +4,0 @@ export * from './AnyHeaders.js'; |
{ | ||
"name": "yaschema-api", | ||
"version": "3.8.0", | ||
"version": "3.8.1", | ||
"description": "Yet another API", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
import { schema } from 'yaschema'; | ||
import { makeHttpApi } from '../type-makers/make-http-api.js'; | ||
import { anyReqBodySchema, anyReqHeadersSchema, anyReqParamsSchema, anyReqQuerySchema } from '../types/any-request-schemas.js'; | ||
import { checkRequestValidation } from '../utils/check-request-validation.js'; | ||
const anyStringSerializableTypeSchema = schema.oneOf3( | ||
schema.number().setAllowedSerializationForms(['number', 'string']), | ||
schema.boolean().setAllowedSerializationForms(['boolean', 'string']), | ||
schema.string().allowEmptyString() | ||
); | ||
const anyReqHeadersSchema = schema.record(schema.string(), anyStringSerializableTypeSchema).optional(); | ||
const anyReqParamsSchema = schema.record(schema.string(), anyStringSerializableTypeSchema).optional(); | ||
const anyReqQuerySchema = schema | ||
.record(schema.string(), schema.oneOf(anyStringSerializableTypeSchema, schema.array({ items: anyStringSerializableTypeSchema }))) | ||
.optional(); | ||
const anyReqBodySchema = schema.any().allowNull().optional(); | ||
const api = makeHttpApi({ | ||
@@ -20,0 +8,0 @@ method: 'POST', |
import { schema } from 'yaschema'; | ||
import { makeHttpApi } from '../type-makers/make-http-api.js'; | ||
import { anyResBodySchema, anyResHeadersSchema, anyResStatusSchema } from '../types/any-response-schema.js'; | ||
import { checkResponseValidation } from '../utils/check-response-validation.js'; | ||
const anyStringSerializableTypeSchema = schema.oneOf3( | ||
schema.number().setAllowedSerializationForms(['number', 'string']), | ||
schema.boolean().setAllowedSerializationForms(['boolean', 'string']), | ||
schema.string().allowEmptyString() | ||
); | ||
const anyResStatusSchema = schema.number(); | ||
const anyResHeadersSchema = schema.record(schema.string(), anyStringSerializableTypeSchema).optional(); | ||
const anyResBodySchema = schema.any().allowNull().optional(); | ||
const api = makeHttpApi({ | ||
@@ -17,0 +8,0 @@ method: 'POST', |
@@ -1,1 +0,9 @@ | ||
export type AnyStringSerializableType = string | number | boolean | { isStringSerializable: true }; | ||
import { schema } from 'yaschema'; | ||
export const anyStringSerializableTypeSchema = schema.oneOf4( | ||
schema.number().setAllowedSerializationForms(['number', 'string']), | ||
schema.boolean().setAllowedSerializationForms(['boolean', 'string']), | ||
schema.string(), | ||
schema.object({ isStringSerializable: schema.boolean(true) }) | ||
); | ||
export type AnyStringSerializableType = typeof anyStringSerializableTypeSchema.valueType; |
@@ -0,1 +1,3 @@ | ||
export * from './any-request-schemas.js'; | ||
export * from './any-response-schema.js'; | ||
export * from './AnyBody.js'; | ||
@@ -2,0 +4,0 @@ export * from './AnyHeaders.js'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
165518
6.59%364
4%2067
4.39%