Skip to content

Commit

Permalink
add support for consts
Browse files Browse the repository at this point in the history
yanick committed Aug 8, 2018
1 parent 71b3a49 commit 5228956
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -135,7 +135,7 @@ const highlight = false;
});

Handlebars.registerHelper('primitive', function(schema, options) {
if(schema.type && schema.type != "object" && schema.type != "array" || schema.enum) {
if(schema.type && schema.type != "object" && schema.type != "array" || schema.enum || schema.const) {
return withType(this, options, true)
}
});
@@ -200,6 +200,9 @@ const highlight = false;
if(!schema.type && !hideAny) {
schema.__type="any";
}
if (schema.const) {
schema.__type=schema.const;
}
if(schema.format) {
schema.__type=schema.format;
}

0 comments on commit 5228956

Please sign in to comment.