Skip to content

Commit 9c6418c

Browse files
committed
feat: remove defined by from property table if not used
1 parent 8042b89 commit 9c6418c

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

templates/md/properties.ejs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,31 @@
44
* you may not use this file except in compliance with the License. You may obtain a copy
55
* of the License at http://www.apache.org/licenses/LICENSE-2.0
66
*/ %>
7-
# <%=title %> Properties
7+
# Properties
88

99
<% const hasDefault = _.keys(props).filter(property => _.has(props, property + '.default')).length > 0; %>
10+
<% const hasDefinition = _.keys(props).filter(property => _.has(props, property + '.$oSchema')).length > 0; %>
1011

11-
| Property | Type | Required | Nullable |<% if(hasDefault) { %> Default |<% } %> Defined by |
12-
|----------|------|----------|----------|<% if(hasDefault) { %>---------|<% } %>------------|
12+
| Property | Type | Required | Nullable |<% if(hasDefault) { %> Default |<% } %><% if(hasDefinition) { %> Defined by |<% } %>
13+
|----------|------|----------|----------|<% if(hasDefault) { %>---------|<% } %><% if(hasDefinition) { %>------------|<% } %>
1314
<% _.keys(props).sort().forEach(property => {
1415
const schema = props[property]; %>
1516
| [<%= property %>](#<%= propertiesSlugs[property] %>) | <%= schema.simpletype %> | <%= schema.isrequired === true ? "**Required**" : "Optional" %> | <%= schema.nullable === true ? "Yes" : "No" %> |<% if(hasDefault) { %> <% if (schema.default!==undefined) { %>`<%- JSON.stringify(schema.default) %>`<% } %> |<% } %> <%
16-
if (schema.$oSchema) {
17-
%>[<%= schema.$oSchema.$linkVal %>](<%= schema.$oSchema.$linkPath %>#<%= propertiesSlugs[property] %>)<%
18-
} else {
17+
if (schema.$oSchema) {
18+
%>[<%= schema.$oSchema.$linkVal %>](<%= schema.$oSchema.$linkPath %>#<%= propertiesSlugs[property] %>)<%
19+
} else {
1920
%><%= title %> (this schema)<% } %> |
2021
<%
2122
});
2223
%><% _.keys(pprops).forEach(property => {
2324
const schema = pprops[property]; %>
24-
| `<%= property.replace(':', '') %>` | <%= schema.simpletype %> | Pattern | <%= schema.nullable === true ? "Yes" : "No" %> |<% if(hasDefault) { %> <% if (schema.default!==undefined) { %>`<%- JSON.stringify(schema.default) %>`<% } %> |<% } %> <%
25-
if (schema.$oSchema) {
26-
%>[<%= schema.$oSchema.$linkVal %>](<%= schema.$oSchema.$linkPath %>#<%= property.replace(':', '').toLowerCase() %>)<%
27-
} else {
25+
| `<%= property.replace(':', '') %>` | <%= schema.simpletype %> | Pattern | <%= schema.nullable === true ? "Yes" : "No" %> |<% if(hasDefault) { %> <% if (schema.default!==undefined) { %>`<%- JSON.stringify(schema.default) %>`<% } %> |<% } %> <% if(hasDefinition) { %> <%
26+
if (schema.$oSchema) {
27+
%>[<%= schema.$oSchema.$linkVal %>](<%= schema.$oSchema.$linkPath %>#<%= property.replace(':', '').toLowerCase() %>)<%
28+
} else {
2829
%><%= title %> (this schema)<% } %> |
2930
<%
30-
});
31+
}});
3132
%><% if (additional!==false||additional===undefined) { %>
3233
| `*` | any | Additional | Yes | this schema *allows* additional properties |
33-
<% } %>
34+
<% } %>

0 commit comments

Comments
 (0)