fluid-oas
Version:
Build declarative OpenApiv3.* specifications.
20 lines (19 loc) • 800 B
JavaScript
import { withExtensions, withNullable, withExample, withExternalDocs, withDescription, withEnum, withDefault, withExamples, withReadOnly, withWriteOnly, } from "../common";
export class Root {
toJSON() {
return {};
}
override(overrideVal) {
const copy = Object.create(this);
copy.toJSON = () => JSON.stringify(overrideVal);
return copy;
}
}
// Base Class which all OpenApi Definitions will inherit.
const _Base = withExtensions(Root);
export class Base extends _Base {
}
// Some Mixins are HOF generic functions allowing for maximum flexibility.
const _SchemaBase = withDefault(withEnum(withNullable(withWriteOnly(withReadOnly(withExamples(withExample(withExternalDocs(withDescription(Base))))))))())();
export class SchemaBase extends _SchemaBase {
}