Skip to content

Add support for schema pattern attribute #32

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Sep 20, 2018
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
145 changes: 77 additions & 68 deletions dist/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/bundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/bundle.min.js.map

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions dist/style.css

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

2 changes: 1 addition & 1 deletion dist/style.min.css

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

5 changes: 5 additions & 0 deletions src/json-schema-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default class JSONSchemaView {
this.schema.default ||
this.schema.minLength ||
this.schema.maxLength ||
this.schema.pattern ||
this.schema.enum)
);

Expand Down Expand Up @@ -142,6 +143,10 @@ export default class JSONSchemaView {
<span class="range maxLength">maxLength:${this.schema.maxLength}</span>
`}

${_if(!this.isCollapsed && this.schema.pattern)`
<span class="pattern">pattern:${this.schema.pattern}</span>
`}

${_if(this.schema.description && !this.isCollapsed)`
<div class="inner description">${this.schema.description}</div>
`}
Expand Down
2 changes: 1 addition & 1 deletion src/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
color: @required-color;
}

.format, .enums {
.format, .enums, .pattern {
color: @text-color
}

Expand Down