Skip to content

Commit ce22585

Browse files
authored
Merge pull request #271 from Xarno/release/2.2
#270 Fixes Rendering of const elements without type
2 parents 13db783 + 8bc6074 commit ce22585

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/utils/schema-utils.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ export function getTypeInfo(parameter, options = { includeNulls: false, enableEx
1919
let format = schema.format || schema.items?.format || '';
2020
if (schema.circularReference) {
2121
dataType = `{recursive: ${schema.circularReference.name}} `;
22-
} else if (schema.type) {
22+
} else if (schema.type || schema.const) {
23+
if (!schema.type && schema.const) {
24+
schema.type = 'const';
25+
}
2326
const arraySchema = Array.isArray(schema.type) ? schema.type : (typeof schema.type === 'string' ? schema.type.split('┃') : schema.type);
2427
dataType = Array.isArray(arraySchema) ? arraySchema.filter((s) => s !== 'null' || options.includeNulls).join('┃') : schema.type;
2528
['string', 'number'].forEach(type => {

0 commit comments

Comments
 (0)