source: node_modules/@swagger-api/apidom-reference/es/bundle/strategies/openapi-3-1/index.mjs@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 845 bytes
Line 
1import stampit from 'stampit';
2import { mediaTypes, isOpenApi3_1Element } from '@swagger-api/apidom-ns-openapi-3-1';
3import BundleStrategy from "../BundleStrategy.mjs";
4// eslint-disable-next-line @typescript-eslint/naming-convention
5const 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});
25export default OpenApi3_1BundleStrategy;
Note: See TracBrowser for help on using the repository browser.