Skip to content

Commit ed98568

Browse files
authored
feat: Show pattern regex (#115)
1 parent 65b78a9 commit ed98568

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

library/src/containers/Schemas/SchemaProperties.tsx

+13-5
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,20 @@ const schemaPropertiesAccessors: Array<TableAccessor<SchemaElement>> = [
4949
el => {
5050
const enumElements = getEnumHTMLElements(el.schema);
5151
return (
52-
el.schema.content.description && (
53-
<div>
52+
<div>
53+
{el.schema.content.description && (
5454
<Markdown>{el.schema.content.description}</Markdown>
55-
{enumElements.length > 0 && <div>Enum: {enumElements}</div>}
56-
</div>
57-
)
55+
)}
56+
{enumElements.length > 0 && <div>Enum: {enumElements}</div>}
57+
{el.schema.content.pattern && (
58+
<div>
59+
Must Match{' '}
60+
<span className={bemClasses.element(`pattern`)}>
61+
{el.schema.content.pattern}
62+
</span>
63+
</div>
64+
)}
65+
</div>
5866
);
5967
},
6068
];

library/src/styles/fiori.css

+10
Original file line numberDiff line numberDiff line change
@@ -1255,3 +1255,13 @@
12551255
padding: 0 0.5rem;
12561256
color: #f6993f;
12571257
}
1258+
1259+
.asyncapi__pattern {
1260+
line-height: 2;
1261+
background-color: #794acf;
1262+
font-weight: bold;
1263+
border-radius: 0.25rem;
1264+
margin-left: 0.25rem;
1265+
padding: 0 0.5rem;
1266+
color: #fff;
1267+
}

0 commit comments

Comments
 (0)