Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,5 @@ workflows:
filters: *filter-only-master
context: sem-rel-json-schema-tools
requires:
- hold
- build
- test
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"typescript": "^3.9.6"
},
"dependencies": {
"@json-schema-tools/dereferencer": "^1.0.15",
"@json-schema-tools/transpiler": "^1.2.1",
"lodash": "^4.17.15",
"node-typescript-compiler": "^2.1.2"
Expand Down
11 changes: 10 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { camelCase, snakeCase, upperFirst } from "lodash";
import * as fs from "fs";
import { promisify } from "util";
import { JSONMetaSchema } from "@json-schema-tools/meta-schema";
import Dereferencer from "@json-schema-tools/dereferencer";

const readFile = promisify(fs.readFile);
const writeFile = promisify(fs.writeFile);
Expand Down Expand Up @@ -119,7 +120,15 @@ export const prepare: PluginFunction = async (pluginConfig, context): Promise<bo
throw new SemanticReleaseError("The schema must have a title", "ENOTITLE", "Schema requires a title");
}

const transpiler = new Transpiler(schema);
let dereffedSchema;
try {
const dereffer = new Dereferencer(schema);
dereffedSchema = await dereffer.resolve();
} catch (e) {
throw new SemanticReleaseError(e.message);
}

const transpiler = new Transpiler(dereffedSchema);

if (!pluginConfig.languages || pluginConfig.languages.ts) {
await generateTs(transpiler, schema, outpath);
Expand Down