Skip to content

Commit a506cb8

Browse files
committed
fixes #1048 - streamline data-type separator rendering in schemas
1 parent 6657485 commit a506cb8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/utils/schema-utils.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function getTypeInfo(schema) {
4141
const schemaNode = schema.$ref.substring(n + 1);
4242
dataType = `{recursive: ${schemaNode}} `;
4343
} else if (schema.type) {
44-
dataType = Array.isArray(schema.type) ? schema.type.join(schema.length === 2 ? ' or ' : '┃') : schema.type;
44+
dataType = Array.isArray(schema.type) ? schema.type.join('┃') : schema.type;
4545
if (schema.format || schema.enum || schema.const) {
4646
dataType = dataType.replace('string', schema.enum ? 'enum' : schema.const ? 'const' : schema.format);
4747
}
@@ -813,7 +813,7 @@ export function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
813813
});
814814
let multiPrimitiveTypes;
815815
if (primitiveType.length > 0) {
816-
subSchema.type = primitiveType.join(primitiveType.length === 2 ? ' or ' : '┃');
816+
subSchema.type = primitiveType.join('┃');
817817
multiPrimitiveTypes = getTypeInfo(subSchema);
818818
if (complexTypes.length === 0) {
819819
return `${multiPrimitiveTypes?.html || ''}`;
@@ -866,7 +866,7 @@ export function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
866866
obj['::description'] = generateMarkdownForArrayAndObjectDescription(schema, level);
867867
obj['::type'] = 'object';
868868
if ((Array.isArray(schema.type) && schema.type.includes('null')) || schema.nullable) {
869-
obj['::dataTypeLabel'] = 'object or null';
869+
obj['::dataTypeLabel'] = 'object null';
870870
obj['::nullable'] = true;
871871
}
872872
obj['::deprecated'] = schema.deprecated || false;
@@ -889,7 +889,7 @@ export function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
889889
obj['::description'] = generateMarkdownForArrayAndObjectDescription(schema, level);
890890
obj['::type'] = 'array';
891891
if ((Array.isArray(schema.type) && schema.type.includes('null')) || schema.nullable) {
892-
obj['::dataTypeLabel'] = 'array or null';
892+
obj['::dataTypeLabel'] = 'array null';
893893
obj['::nullable'] = true;
894894
}
895895
obj['::deprecated'] = schema.deprecated || false;

0 commit comments

Comments
 (0)