UNPKG

fluid-oas

Version:

Build declarative OpenApiv3.* specifications.

22 lines (21 loc) 1.02 kB
import { withMultipleOf, withExclusiveMinimum, withExclusiveMaximum, withMaximum, withMinimum, withFormat, withExclusiveMinimumBoolean, withExclusiveMaximumBoolean, } from "../common"; import { SchemaBase } from "../lib/base"; const NumberBase = withMultipleOf(withExclusiveMaximumBoolean(withExclusiveMinimumBoolean(withExclusiveMinimum(withExclusiveMaximum(withMaximum(withMinimum((SchemaBase)))))))); const _NumberBaseImpl = withFormat(NumberBase)(); const _IntegerBaseImpl = withFormat(NumberBase)(); class _OpenApiNumber extends _NumberBaseImpl { toJSON() { const json = super.toJSON(); Object.defineProperty(json, "type", { value: "number", enumerable: true }); return json; } } class _OpenApiInteger extends _IntegerBaseImpl { toJSON() { const json = super.toJSON(); Object.defineProperty(json, "type", { value: "integer", enumerable: true }); return json; } } export const Number = new _OpenApiNumber(); export const Integer = new _OpenApiInteger();