docs: oas (#197)

Adds OpenAPI specification of Storefront and Admin APIs.
Updates docs project.
This commit is contained in:
Sebastian Rindom
2021-03-10 11:51:54 +01:00
committed by GitHub
parent 975de99ee7
commit 8edb32c742
240 changed files with 23592 additions and 419 deletions
@@ -0,0 +1,30 @@
const fs = require("fs").promises;
const path = require("path");
class FixtureWriter {
constructor() {
const resolvedPath = path.resolve("./docs/api/fixtures.json");
const existing = require(resolvedPath);
this.toWrite_ = existing.resources;
this.resolvedPath_ = resolvedPath;
}
addFixture(key, data) {
this.toWrite_ = {
...this.toWrite_,
[key]: data,
};
}
async execute() {
const toSet = {
resources: this.toWrite_,
};
const s = JSON.stringify(toSet, null, 2);
return await fs.writeFile(this.resolvedPath_, s);
}
}
const instance = new FixtureWriter();
export default instance;