Skip to content

Commit

Permalink
feat: use file interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Vazha Omanashvili committed Aug 14, 2024
1 parent bcb5226 commit d98eb24
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/apidom-playground/src/playground/apidom.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
readFile,
resolveApiDOM as resolveApiDOMReferences,
dereferenceApiDOM as derefereceApiDOMReferences,
File,
} from '@swagger-api/apidom-reference';

const parser = new ApiDOMParser()
Expand All @@ -44,11 +45,9 @@ const service = {
return JSON.stringify(refract, undefined, 2);
},

async readFile(url) {
const buffer = await readFile(url, {});
const decoder = new TextDecoder();

return decoder.decode(buffer);
async readFile(uri) {
const buffer = await readFile(uri, {});
return new File({ uri, data: buffer }).toString();
},

async resolveApiDOM(apiDOM, { source, mediaType, baseURI }) {
Expand Down

0 comments on commit d98eb24

Please sign in to comment.