main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
845 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import stampit from 'stampit';
|
---|
| 2 | import { mediaTypes, isOpenApi3_1Element } from '@swagger-api/apidom-ns-openapi-3-1';
|
---|
| 3 | import BundleStrategy from "../BundleStrategy.mjs";
|
---|
| 4 | // eslint-disable-next-line @typescript-eslint/naming-convention
|
---|
| 5 | const OpenApi3_1BundleStrategy = stampit(BundleStrategy, {
|
---|
| 6 | init() {
|
---|
| 7 | this.name = 'openapi-3-1';
|
---|
| 8 | },
|
---|
| 9 | methods: {
|
---|
| 10 | canBundle(file) {
|
---|
| 11 | var _file$parseResult;
|
---|
| 12 | // assert by media type
|
---|
| 13 | if (file.mediaType !== 'text/plain') {
|
---|
| 14 | return mediaTypes.includes(file.mediaType);
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | // assert by inspecting ApiDOM
|
---|
| 18 | return isOpenApi3_1Element((_file$parseResult = file.parseResult) === null || _file$parseResult === void 0 ? void 0 : _file$parseResult.result);
|
---|
| 19 | },
|
---|
| 20 | async bundle(file) {
|
---|
| 21 | return file.parseResult;
|
---|
| 22 | }
|
---|
| 23 | }
|
---|
| 24 | });
|
---|
| 25 | export default OpenApi3_1BundleStrategy; |
---|
Note:
See
TracBrowser
for help on using the repository browser.