@opra/common
Version:
Opra common package
35 lines (34 loc) • 1.01 kB
JavaScript
import { omitUndefined } from '@jsopen/objects';
import { OpraSchema } from '../../schema/index.js';
import { DocumentElement } from '../common/document-element.js';
import { HttpMediaType } from './http-media-type.js';
/**
* @class HttpRequestBody
*/
export class HttpRequestBody extends DocumentElement {
description;
content = [];
required;
maxContentSize;
immediateFetch;
partial;
allowPatchOperators;
keepKeyFields;
allowNullOptionals;
constructor(owner) {
super(owner);
}
toJSON(options) {
return omitUndefined({
description: this.description,
required: this.required,
maxContentSize: this.maxContentSize,
content: this.content.length
? this.content.map(x => x.toJSON(options))
: [],
partial: this.partial,
allowPatchOperators: this.allowPatchOperators,
allowNullOptionals: this.allowNullOptionals,
});
}
}