UNPKG

fluid-oas

Version:

Build declarative OpenApiv3.* specifications.

1,844 lines 90.2 kB
/** * @fieldType string * @serializedName description * @methodName addDescription */ export function withDescription(Base) { return class extends Base { _description; addDescription(val) { const copy = Object.create(this); copy._description = val; return copy; } toJSON() { const json = super.toJSON(); if (this._description !== undefined) { Object.defineProperty(json, "description", { value: this._description, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName summary * @methodName addSummary */ export function withSummary(Base) { return class extends Base { _summary; addSummary(val) { const copy = Object.create(this); copy._summary = val; return copy; } toJSON() { const json = super.toJSON(); if (this._summary !== undefined) { Object.defineProperty(json, "summary", { value: this._summary, enumerable: true, }); } return json; } }; } /** * @fieldType boolean * @serializedName allowReserved * @methodName addAllowReserved */ export function withAllowReserved(Base) { return class extends Base { _allowReserved; addAllowReserved(val) { const copy = Object.create(this); copy._allowReserved = val; return copy; } toJSON() { const json = super.toJSON(); if (this._allowReserved !== undefined) { Object.defineProperty(json, "allowReserved", { value: this._allowReserved, enumerable: true, }); } return json; } }; } /** * @fieldType boolean * @serializedName deprecated * @methodName addDeprecated */ export function withDeprecated(Base) { return class extends Base { _deprecated; addDeprecated(val) { const copy = Object.create(this); copy._deprecated = val; return copy; } toJSON() { const json = super.toJSON(); if (this._deprecated !== undefined) { Object.defineProperty(json, "deprecated", { value: this._deprecated, enumerable: true, }); } return json; } }; } /** * @fieldType boolean * @serializedName required * @methodName addRequired */ export function withRequired(Base) { return class extends Base { _required; addRequired(val) { const copy = Object.create(this); copy._required = val; return copy; } toJSON() { const json = super.toJSON(); if (this._required !== undefined) { Object.defineProperty(json, "required", { value: this._required, enumerable: true, }); } return json; } }; } /** * @fieldType boolean * @serializedName nullable * @methodName addNullable */ export function withNullable(Base) { return class extends Base { _nullable; addNullable(val) { const copy = Object.create(this); copy._nullable = val; return copy; } toJSON() { const json = super.toJSON(); if (this._nullable !== undefined) { Object.defineProperty(json, "nullable", { value: this._nullable, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName name * @methodName addName */ export function withName(Base) { return class extends Base { _name; addName(val) { const copy = Object.create(this); copy._name = val; return copy; } toJSON() { const json = super.toJSON(); if (this._name !== undefined) { Object.defineProperty(json, "name", { value: this._name, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName namespace * @methodName addNamespace */ export function withNamespace(Base) { return class extends Base { _namespace; addNamespace(val) { const copy = Object.create(this); copy._namespace = val; return copy; } toJSON() { const json = super.toJSON(); if (this._namespace !== undefined) { Object.defineProperty(json, "namespace", { value: this._namespace, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName prefix * @methodName addPrefix */ export function withPrefix(Base) { return class extends Base { _prefix; addPrefix(val) { const copy = Object.create(this); copy._prefix = val; return copy; } toJSON() { const json = super.toJSON(); if (this._prefix !== undefined) { Object.defineProperty(json, "prefix", { value: this._prefix, enumerable: true, }); } return json; } }; } /** * @fieldType boolean * @serializedName wrapped * @methodName addWrapped */ export function withWrapped(Base) { return class extends Base { _wrapped; addWrapped(val) { const copy = Object.create(this); copy._wrapped = val; return copy; } toJSON() { const json = super.toJSON(); if (this._wrapped !== undefined) { Object.defineProperty(json, "wrapped", { value: this._wrapped, enumerable: true, }); } return json; } }; } /** * @fieldType boolean * @serializedName attribute * @methodName addAttribute */ export function withAttribute(Base) { return class extends Base { _attribute; addAttribute(val) { const copy = Object.create(this); copy._attribute = val; return copy; } toJSON() { const json = super.toJSON(); if (this._attribute !== undefined) { Object.defineProperty(json, "attribute", { value: this._attribute, enumerable: true, }); } return json; } }; } /** * @fieldType string|unknown * @serializedName value * @methodName addValue */ export function withValue(Base) { return () => { return class extends Base { _value; addValue(val) { const copy = Object.create(this); copy._value = val; return copy; } toJSON() { const json = super.toJSON(); if (this._value !== undefined) { Object.defineProperty(json, "value", { value: this._value, enumerable: true, }); } return json; } }; }; } /** * @fieldType string * @serializedName format * @methodName addFormat */ export function withFormat(Base) { return () => { return class extends Base { _format; addFormat(val) { const copy = Object.create(this); copy._format = val; return copy; } toJSON() { const json = super.toJSON(); if (this._format !== undefined) { Object.defineProperty(json, "format", { value: this._format, enumerable: true, }); } return json; } }; }; } /** * @fieldType T * @serializedName default * @methodName addDefault */ export function withDefault(Base) { return () => { return class extends Base { _default; addDefault(val) { const copy = Object.create(this); copy._default = val; return copy; } toJSON() { const json = super.toJSON(); if (this._default !== undefined) { Object.defineProperty(json, "default", { value: this._default, enumerable: true, }); } return json; } }; }; } /** * @fieldType "apiKey"|"http"|"mutualTLS"|"oauth2"|"openIdConnect" * @serializedName type * @methodName addType */ export function withType(Base) { return () => { return class extends Base { _type; addType(val) { const copy = Object.create(this); copy._type = val; return copy; } toJSON() { const json = super.toJSON(); if (this._type !== undefined) { Object.defineProperty(json, "type", { value: this._type, enumerable: true, }); } return json; } }; }; } /** * @fieldType T * @serializedName in * @methodName addIn */ export function withIn(Base) { return () => { return class extends Base { _in; addIn(val) { const copy = Object.create(this); copy._in = val; return copy; } toJSON() { const json = super.toJSON(); if (this._in !== undefined) { Object.defineProperty(json, "in", { value: this._in, enumerable: true, }); } return json; } }; }; } /** * @fieldType Map<string,string> * @serializedName mapping * @methodName addMappings */ export function withMapping(Base) { return class extends Base { _mapping; addMappings(mappings) { const copy = Object.create(this); copy._mapping = new Map(this._mapping); for (const key in mappings) { const k = key; copy._mapping.set(k, mappings[k]); } return copy; } toJSON() { const json = super.toJSON(); if (this._mapping) { const mappings = {}; this._mapping.forEach((val, key) => { mappings[key] = val; }); Object.defineProperty(json, "mapping", { value: mappings, enumerable: true, }); } return json; } }; } /** * @fieldType Map<string,OpenApiExample|OpenApiReferenceObject> * @serializedName examples * @methodName addExamples */ export function withExamples(Base) { return class extends Base { _examples; addExamples(mappings) { const copy = Object.create(this); copy._examples = new Map(this._examples); for (const key in mappings) { const k = key; copy._examples.set(k, mappings[k]); } return copy; } toJSON() { const json = super.toJSON(); if (this._examples) { const mappings = {}; this._examples.forEach((val, key) => { mappings[key] = val; }); Object.defineProperty(json, "examples", { value: mappings, enumerable: true, }); } return json; } }; } /** * @fieldType Map<OpenApiExtensionString,OpenApiSchema|OpenApiReferenceObject> * @serializedName extensions * @methodName addExtensions */ export function withExtensions(Base) { return class extends Base { _extensions; addExtensions(mappings) { const copy = Object.create(this); copy._extensions = new Map(this._extensions); for (const key in mappings) { const k = key; copy._extensions.set(k, mappings[k]); } return copy; } toJSON() { const json = super.toJSON(); if (this._extensions) { const mappings = {}; this._extensions.forEach((val, key) => { mappings[key] = val; }); Object.defineProperty(json, "extensions", { value: mappings, enumerable: true, }); } return json; } }; } /** * @fieldType number * @serializedName maximum * @methodName addMaximum */ export function withMaximum(Base) { return class extends Base { _maximum; addMaximum(val) { const copy = Object.create(this); copy._maximum = val; return copy; } toJSON() { const json = super.toJSON(); if (this._maximum !== undefined) { Object.defineProperty(json, "maximum", { value: this._maximum, enumerable: true, }); } return json; } }; } /** * @fieldType number * @serializedName minimum * @methodName addMinimum */ export function withMinimum(Base) { return class extends Base { _minimum; addMinimum(val) { const copy = Object.create(this); copy._minimum = val; return copy; } toJSON() { const json = super.toJSON(); if (this._minimum !== undefined) { Object.defineProperty(json, "minimum", { value: this._minimum, enumerable: true, }); } return json; } }; } /** * @fieldType number * @serializedName exclusiveMinimum * @methodName addExclusiveMin */ export function withExclusiveMinimum(Base) { return class extends Base { _exclusiveMinimum; addExclusiveMin(val) { const copy = Object.create(this); copy._exclusiveMinimum = val; return copy; } toJSON() { const json = super.toJSON(); if (this._exclusiveMinimum !== undefined) { Object.defineProperty(json, "exclusiveMinimum", { value: this._exclusiveMinimum, enumerable: true, }); } return json; } }; } /** * @fieldType number * @serializedName exclusiveMaximum * @methodName addExclusiveMax */ export function withExclusiveMaximum(Base) { return class extends Base { _exclusiveMaximum; addExclusiveMax(val) { const copy = Object.create(this); copy._exclusiveMaximum = val; return copy; } toJSON() { const json = super.toJSON(); if (this._exclusiveMaximum !== undefined) { Object.defineProperty(json, "exclusiveMaximum", { value: this._exclusiveMaximum, enumerable: true, }); } return json; } }; } /** * @fieldType boolean * @serializedName exclusiveMinimum * @methodName addExclusiveMin */ export function withExclusiveMinimumBoolean(Base) { return class extends Base { _exclusiveMinimum; addExclusiveMin(val) { const copy = Object.create(this); copy._exclusiveMinimum = val; return copy; } toJSON() { const json = super.toJSON(); if (this._exclusiveMinimum !== undefined) { Object.defineProperty(json, "exclusiveMinimum", { value: this._exclusiveMinimum, enumerable: true, }); } return json; } }; } /** * @fieldType boolean * @serializedName exclusiveMaximum * @methodName addExclusiveMax */ export function withExclusiveMaximumBoolean(Base) { return class extends Base { _exclusiveMaximum; addExclusiveMax(val) { const copy = Object.create(this); copy._exclusiveMaximum = val; return copy; } toJSON() { const json = super.toJSON(); if (this._exclusiveMaximum !== undefined) { Object.defineProperty(json, "exclusiveMaximum", { value: this._exclusiveMaximum, enumerable: true, }); } return json; } }; } /** * @fieldType number * @serializedName multipleOf * @methodName addMultiple */ export function withMultipleOf(Base) { return class extends Base { _multipleOf; addMultiple(val) { const copy = Object.create(this); copy._multipleOf = val; return copy; } toJSON() { const json = super.toJSON(); if (this._multipleOf !== undefined) { Object.defineProperty(json, "multipleOf", { value: this._multipleOf, enumerable: true, }); } return json; } }; } /** * @fieldType RegExp * @serializedName pattern * @methodName addPattern */ export function withPattern(Base) { return class extends Base { _pattern; addPattern(val) { const copy = Object.create(this); copy._pattern = val; return copy; } toJSON() { const json = super.toJSON(); if (this._pattern) { Object.defineProperty(json, "pattern", { value: this._pattern.source, enumerable: true, }); } return json; } }; } /** * @fieldType number * @serializedName minLength * @methodName addMinLength */ export function withMinLength(Base) { return class extends Base { _minLength; addMinLength(val) { const copy = Object.create(this); copy._minLength = val; return copy; } toJSON() { const json = super.toJSON(); if (this._minLength !== undefined) { Object.defineProperty(json, "minLength", { value: this._minLength, enumerable: true, }); } return json; } }; } /** * @fieldType number * @serializedName maxLength * @methodName addMaxLength */ export function withMaxLength(Base) { return class extends Base { _maxLength; addMaxLength(val) { const copy = Object.create(this); copy._maxLength = val; return copy; } toJSON() { const json = super.toJSON(); if (this._maxLength !== undefined) { Object.defineProperty(json, "maxLength", { value: this._maxLength, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName url * @methodName addUrl */ export function withURL(Base) { return class extends Base { _url; addUrl(val) { const copy = Object.create(this); copy._url = val; return copy; } toJSON() { const json = super.toJSON(); if (this._url !== undefined) { Object.defineProperty(json, "url", { value: this._url, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName propertyName * @methodName addPropertyName */ export function withPropertyName(Base) { return class extends Base { _propertyName; addPropertyName(val) { const copy = Object.create(this); copy._propertyName = val; return copy; } toJSON() { const json = super.toJSON(); if (this._propertyName !== undefined) { Object.defineProperty(json, "propertyName", { value: this._propertyName, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName scheme * @methodName addScheme */ export function withScheme(Base) { return class extends Base { _scheme; addScheme(val) { const copy = Object.create(this); copy._scheme = val; return copy; } toJSON() { const json = super.toJSON(); if (this._scheme !== undefined) { Object.defineProperty(json, "scheme", { value: this._scheme, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName bearerFormat * @methodName addBearerFormat */ export function withBearerFormat(Base) { return class extends Base { _bearerFormat; addBearerFormat(val) { const copy = Object.create(this); copy._bearerFormat = val; return copy; } toJSON() { const json = super.toJSON(); if (this._bearerFormat !== undefined) { Object.defineProperty(json, "bearerFormat", { value: this._bearerFormat, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName authorizationUrl * @methodName addAuthorizationUrl */ export function withAuthorizationURL(Base) { return class extends Base { _authorizationUrl; addAuthorizationUrl(val) { const copy = Object.create(this); copy._authorizationUrl = val; return copy; } toJSON() { const json = super.toJSON(); if (this._authorizationUrl !== undefined) { Object.defineProperty(json, "authorizationUrl", { value: this._authorizationUrl, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName tokenUrl * @methodName addTokenUrl */ export function withTokenURL(Base) { return class extends Base { _tokenUrl; addTokenUrl(val) { const copy = Object.create(this); copy._tokenUrl = val; return copy; } toJSON() { const json = super.toJSON(); if (this._tokenUrl !== undefined) { Object.defineProperty(json, "tokenUrl", { value: this._tokenUrl, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName refreshUrl * @methodName addRefreshUrl */ export function withRefreshURL(Base) { return class extends Base { _refreshUrl; addRefreshUrl(val) { const copy = Object.create(this); copy._refreshUrl = val; return copy; } toJSON() { const json = super.toJSON(); if (this._refreshUrl !== undefined) { Object.defineProperty(json, "refreshUrl", { value: this._refreshUrl, enumerable: true, }); } return json; } }; } /** * @fieldType Map<string,string> * @serializedName scopes * @methodName addScopes */ export function withScopes(Base) { return class extends Base { _scopes; addScopes(mappings) { const copy = Object.create(this); copy._scopes = new Map(this._scopes); for (const key in mappings) { const k = key; copy._scopes.set(k, mappings[k]); } return copy; } toJSON() { const json = super.toJSON(); if (this._scopes) { const mappings = {}; this._scopes.forEach((val, key) => { mappings[key] = val; }); Object.defineProperty(json, "scopes", { value: mappings, enumerable: true, }); } return json; } }; } /** * @fieldType OpenApiDocumentation * @serializedName externalDocs * @methodName addExternalDocs */ export function withExternalDocs(Base) { return class extends Base { _externalDocs; addExternalDocs(val) { const copy = Object.create(this); copy._externalDocs = val; return copy; } toJSON() { const json = super.toJSON(); if (this._externalDocs !== undefined) { Object.defineProperty(json, "externalDocs", { value: this._externalDocs, enumerable: true, }); } return json; } }; } /** * @fieldType OpenApiOAuthFlow * @serializedName implicit * @methodName addImplicit */ export function withImplicit(Base) { return class extends Base { _implicit; addImplicit(val) { const copy = Object.create(this); copy._implicit = val; return copy; } toJSON() { const json = super.toJSON(); if (this._implicit !== undefined) { Object.defineProperty(json, "implicit", { value: this._implicit, enumerable: true, }); } return json; } }; } /** * @fieldType OpenApiOAuthFlow * @serializedName password * @methodName addPassword */ export function withPassword(Base) { return class extends Base { _password; addPassword(val) { const copy = Object.create(this); copy._password = val; return copy; } toJSON() { const json = super.toJSON(); if (this._password !== undefined) { Object.defineProperty(json, "password", { value: this._password, enumerable: true, }); } return json; } }; } /** * @fieldType OpenApiOAuthFlow * @serializedName clientCredentials * @methodName addClientCredentials */ export function withClientCredentials(Base) { return class extends Base { _clientCredentials; addClientCredentials(val) { const copy = Object.create(this); copy._clientCredentials = val; return copy; } toJSON() { const json = super.toJSON(); if (this._clientCredentials !== undefined) { Object.defineProperty(json, "clientCredentials", { value: this._clientCredentials, enumerable: true, }); } return json; } }; } /** * @fieldType OpenApiOAuthFlow * @serializedName authorizationCode * @methodName addAuthorizationCode */ export function withAuthorizationCode(Base) { return class extends Base { _authorizationCode; addAuthorizationCode(val) { const copy = Object.create(this); copy._authorizationCode = val; return copy; } toJSON() { const json = super.toJSON(); if (this._authorizationCode !== undefined) { Object.defineProperty(json, "authorizationCode", { value: this._authorizationCode, enumerable: true, }); } return json; } }; } /** * @fieldType OpenApiSchema|OpenApiReferenceObject * @serializedName schema * @methodName addSchema */ export function withSchema(Base) { return class extends Base { _schema; addSchema(val) { const copy = Object.create(this); copy._schema = val; return copy; } toJSON() { const json = super.toJSON(); if (this._schema !== undefined) { Object.defineProperty(json, "schema", { value: this._schema, enumerable: true, }); } return json; } }; } /** * @fieldType OpenApiOAuthFlows * @serializedName flows * @methodName addFlows */ export function withFlows(Base) { return class extends Base { _flows; addFlows(val) { const copy = Object.create(this); copy._flows = val; return copy; } toJSON() { const json = super.toJSON(); if (this._flows !== undefined) { Object.defineProperty(json, "flows", { value: this._flows, enumerable: true, }); } return json; } }; } /** * @fieldType any * @serializedName example * @methodName addExample */ export function withExample(Base) { return class extends Base { _example; addExample(val) { const copy = Object.create(this); copy._example = val; return copy; } toJSON() { const json = super.toJSON(); if (this._example !== undefined) { Object.defineProperty(json, "example", { value: this._example, enumerable: true, }); } return json; } }; } /** * @fieldType OpenApiSchema|OpenApiReferenceObject * @serializedName items * @methodName addItems */ export function withItems(Base) { return class extends Base { _items; addItems(val) { const copy = Object.create(this); copy._items = val; return copy; } toJSON() { const json = super.toJSON(); if (this._items !== undefined) { Object.defineProperty(json, "items", { value: this._items, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName openIdConnectUrl * @methodName addOpenIdConnectUrl */ export function withOpenIdConnectURL(Base) { return class extends Base { _openIdConnectUrl; addOpenIdConnectUrl(val) { const copy = Object.create(this); copy._openIdConnectUrl = val; return copy; } toJSON() { const json = super.toJSON(); if (this._openIdConnectUrl !== undefined) { Object.defineProperty(json, "openIdConnectUrl", { value: this._openIdConnectUrl, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName externalValue * @methodName addExternalValue */ export function withExternalValue(Base) { return class extends Base { _externalValue; addExternalValue(val) { const copy = Object.create(this); copy._externalValue = val; return copy; } toJSON() { const json = super.toJSON(); if (this._externalValue !== undefined) { Object.defineProperty(json, "externalValue", { value: this._externalValue, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName title * @methodName addTitle */ export function withTitle(Base) { return class extends Base { _title; addTitle(val) { const copy = Object.create(this); copy._title = val; return copy; } toJSON() { const json = super.toJSON(); if (this._title !== undefined) { Object.defineProperty(json, "title", { value: this._title, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName version * @methodName addVersion */ export function withVersion(Base) { return class extends Base { _version; addVersion(val) { const copy = Object.create(this); copy._version = val; return copy; } toJSON() { const json = super.toJSON(); if (this._version !== undefined) { Object.defineProperty(json, "version", { value: this._version, enumerable: true, }); } return json; } }; } /** * @fieldType number * @serializedName minItems * @methodName addMinItems */ export function withMinItems(Base) { return class extends Base { _minItems; addMinItems(val) { const copy = Object.create(this); copy._minItems = val; return copy; } toJSON() { const json = super.toJSON(); if (this._minItems !== undefined) { Object.defineProperty(json, "minItems", { value: this._minItems, enumerable: true, }); } return json; } }; } /** * @fieldType number * @serializedName maxItems * @methodName addMaxItems */ export function withMaxItems(Base) { return class extends Base { _maxItems; addMaxItems(val) { const copy = Object.create(this); copy._maxItems = val; return copy; } toJSON() { const json = super.toJSON(); if (this._maxItems !== undefined) { Object.defineProperty(json, "maxItems", { value: this._maxItems, enumerable: true, }); } return json; } }; } /** * @fieldType Map<string,OpenApiSchema|OpenApiReferenceObject> * @serializedName properties * @methodName addProperties */ export function withProperties(Base) { return class extends Base { _properties; addProperties(mappings) { const copy = Object.create(this); copy._properties = new Map(this._properties); for (const key in mappings) { const k = key; copy._properties.set(k, mappings[k]); } return copy; } toJSON() { const json = super.toJSON(); if (this._properties) { const mappings = {}; this._properties.forEach((val, key) => { mappings[key] = val; }); Object.defineProperty(json, "properties", { value: mappings, enumerable: true, }); } return json; } }; } /** * @fieldType Map<string,OpenApiSchema|OpenApiReferenceObject> * @serializedName patternProperties * @methodName addPatternProperties */ export function withPatternProperties(Base) { return class extends Base { _patternProperties; addPatternProperties(mappings) { const copy = Object.create(this); copy._patternProperties = new Map(this._patternProperties); for (const key in mappings) { const k = key; copy._patternProperties.set(k, mappings[k]); } return copy; } toJSON() { const json = super.toJSON(); if (this._patternProperties) { const mappings = {}; this._patternProperties.forEach((val, key) => { mappings[key] = val; }); Object.defineProperty(json, "patternProperties", { value: mappings, enumerable: true, }); } return json; } }; } /** * @fieldType T * @serializedName enum * @methodName addEnums */ export function withEnum(Base) { return () => { return class extends Base { _enum; addEnums(val) { const copy = Object.create(this); copy._enum = val; return copy; } toJSON() { const json = super.toJSON(); if (this._enum !== undefined) { Object.defineProperty(json, "enum", { value: this._enum, enumerable: true, }); } return json; } }; }; } /** * @fieldType string * @serializedName style * @methodName addStyle */ export function withStyle(Base) { return () => { return class extends Base { _style; addStyle(val) { const copy = Object.create(this); copy._style = val; return copy; } toJSON() { const json = super.toJSON(); if (this._style !== undefined) { Object.defineProperty(json, "style", { value: this._style, enumerable: true, }); } return json; } }; }; } /** * @fieldType boolean * @serializedName explode * @methodName addExplode */ export function withExplode(Base) { return class extends Base { _explode; addExplode(val) { const copy = Object.create(this); copy._explode = val; return copy; } toJSON() { const json = super.toJSON(); if (this._explode !== undefined) { Object.defineProperty(json, "explode", { value: this._explode, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName contentType * @methodName addContentType */ export function withContentType(Base) { return class extends Base { _contentType; addContentType(val) { const copy = Object.create(this); copy._contentType = val; return copy; } toJSON() { const json = super.toJSON(); if (this._contentType !== undefined) { Object.defineProperty(json, "contentType", { value: this._contentType, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName operationRef * @methodName addOperationRef */ export function withOperationRef(Base) { return class extends Base { _operationRef; addOperationRef(val) { const copy = Object.create(this); copy._operationRef = val; return copy; } toJSON() { const json = super.toJSON(); if (this._operationRef !== undefined) { Object.defineProperty(json, "operationRef", { value: this._operationRef, enumerable: true, }); } return json; } }; } /** * @fieldType string * @serializedName operationId * @methodName addOperationId */ export function withOperationId(Base) { return class extends Base { _operationId; addOperationId(val) { const copy = Object.create(this); copy._operationId = val; return copy; } toJSON() { const json = super.toJSON(); if (this._operationId !== undefined) { Object.defineProperty(json, "operationId", { value: this._operationId, enumerable: true, }); } return json; } }; } /** * @fieldType Map<string,OpenApiHeader|OpenApiReferenceObject> * @serializedName headers * @methodName addHeaders */ export function withHeaders(Base) { return class extends Base { _headers; addHeaders(mappings) { const copy = Object.create(this); copy._headers = new Map(this._headers); for (const key in mappings) { const k = key; copy._headers.set(k, mappings[k]); } return copy; } toJSON() { const json = super.toJSON(); if (this._headers) { const mappings = {}; this._headers.forEach((val, key) => { mappings[key] = val; }); Object.defineProperty(json, "headers", { value: mappings, enumerable: true, }); } return json; } }; } /** * @fieldType Map<OpenApiMediaContentType,OpenApiMediaType> * @serializedName content * @methodName addContents */ export function withContent(Base) { return class extends Base { _content; addContents(mappings) { const copy = Object.create(this); copy._content = new Map(this._content); for (const key in mappings) { const k = key; copy._content.set(k, mappings[k]); } return copy; } toJSON() { const json = super.toJSON(); if (this._content) { const mappings = {}; this._content.forEach((val, key) => { mappings[key] = val; }); Object.defineProperty(json, "content", { value: mappings, enumerable: true, }); } return json; } }; } /** * @fieldType Map<string,OpenApiEncoding> * @serializedName encoding * @methodName addEncodings */ export function withEncoding(Base) { return class extends Base { _encoding; addEncodings(mappings) { const copy = Object.create(this); copy._encoding = new Map(this._encoding); for (const key in mappings) { const k = key; copy._encoding.set(k, mappings[k]); } return copy; } toJSON() { const json = super.toJSON(); if (this._encoding) { const mappings = {}; this._encoding.forEach((val, key) => { mappings[key] = val; }); Object.defineProperty(json, "encoding", { value: mappings, enumerable: true, }); } return json; } }; } /** * @fieldType Map<string,OpenApiPathItem> * @serializedName callback * @methodName addCallback */ export function withCallback(Base) { return class extends Base { _callback; addCallback(mappings) { const copy = Object.create(this); copy._callback = new Map(this._callback); for (const key in mappings) { const k = key; copy._callback.set(k, mappings[k]); } return copy; } toJSON() { const json = super.toJSON(); if (this._callback) { const mappings = {}; this._callback.forEach((val, key) => { mappings[key] = val; }); Object.defineProperty(json, "callback", { value: mappings, enumerable: true, }); } return json; } }; } /** * @fieldType Map<string,OpenApiServerVariable> * @serializedName variables * @methodName addVariables */ export function withVariables(Base) { return class extends Base { _variables; addVariables(mappings) { const copy = Object.create(this); copy._variables = new Map(this._variables); for (const key in mappings) { const k = key; copy._variables.set(k, mappings[k]); } return copy; } toJSON() { const json = super.toJSON(); if (this._variables) { const mappings = {}; this._variables.forEach((val, key) => { mappings[key] = val; }); Object.defineProperty(json, "variables", { value: mappings, enumerable: true, }); } return json; } }; } /** * @fieldType Map<string,OpenApiLink> * @serializedName links * @methodName addLinks */ export function withLinks(Base) { return class extends Base { _links; addLinks(mappings) { const copy = Object.create(this); copy._links = new Map(this._links); for (const key in mappings) { const k = key; copy._links.set(k, mappings[k]); } return copy; } toJSON() { const json = super.toJSON(); if (this._links) { const mappings = {}; this._links.forEach((val, key) => { mappings[key] = val; }); Object.defineProperty(json, "links", { value: mappings, enumerable: true, }); } return json; } }; } /** * @fieldType OpenApiServer * @serializedName server * @methodName addServer */ export function withServer(Base) { return class extends Base { _server; addServer(val) { const copy = Object.create(this); copy._server = val; return copy; } toJSON() { const json = super.toJSON(); if (this._server !== undefined) { Object.defineProperty(json, "server", { value: this._server, enumerable: true, }); } return json; } }; } /** * @fieldType Map<string,OpenApiCallback|OpenApiReferenceObject> * @serializedName callbacks * @methodName addCallbacks */ export function withCallbacks(Base) { return class extends Base { _callbacks; addCallbacks(mappings) { const copy = Object.create(this); copy._callbacks = new Map(this._callbacks); for (const key in mappings) { const k = key; copy._callbacks.set(k, mappings[k]); } return copy; } toJSON() { const json = super.toJSON(); if (this._callbacks) { const mappings = {}; this._callbacks.forEach((val, key) => { mappings[key] = val; }); Object.defineProperty(json, "callbacks", { value: mappings, enumerable: true, }); } return json; } }; } /** * @fieldType Map<string,string> * @serializedName parameters * @methodName addParametersLiteral */ export function withParametersPrimitive(Base) { return class extends Base { _parameters; addParametersLiteral(mappings) { const copy = Object.create(this); copy._parameters = new Map(this._parameters); for (const key in mappings) { const k = key; copy._parameters.set(k, mappings[k]); } return copy; } toJSON() { const json = super.toJSON(); if (this._parameters) { const mappings = {}; this._parameters.forEach((val, key) => { mappings[key] = val; }); Object.defineProperty(json, "parameters", { va