-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Items missing from Schema with array type #64
Comments
I assume it needs to handle arrays in --- a/lib/generateMarkdown.js
+++ b/lib/generateMarkdown.js
@@ -221,6 +221,8 @@ function getSchemaMarkdown(schema, fileName, headerLevel, suppressWarnings, sche
var title = defaultValue(schema.title, suppressWarnings ? '' : 'WETZEL_WARNING: title not defined');
md += createPropertiesDetails(schema, title, headerLevel + 1, knownTypes, autoLink);
md += createExamples(schema, headerLevel + 1);
+ } else if (schemaType === 'array') {
+ md += 'Add information about the array constraints and types here'
}
return md; That does go to the right place in the Markdown, though I don't know exactly how you'd like it formatted; perhaps something like for animation channels? |
Sounds great, but I would love to reuse the same code that generates this for arrays that are object properties. A quick glance doesn't make it look like the code is easily reusable, which is a shame. But I don't think we would want two separate implementations of this feature, if that's avoidable. |
Yeah. I hacked this into my current copy so I could at least get a couple links, but it's copied and modified from elsewhere. Not pretty. diff --git a/lib/generateMarkdown.js b/lib/generateMarkdown.js
index 961381c..365b15f 100644
--- a/lib/generateMarkdown.js
+++ b/lib/generateMarkdown.js
@@ -221,6 +221,28 @@ function getSchemaMarkdown(schema, fileName, headerLevel, suppressWarnings, sche
var title = defaultValue(schema.title, suppressWarnings ? '' : 'WETZEL_WARNING: title not defined');
md += createPropertiesDetails(schema, title, headerLevel + 1, knownTypes, autoLink);
md += createExamples(schema, headerLevel + 1);
+ } else if (schemaType === 'array') {
+ var summary = getPropertySummary(schema, knownTypes, autoLink);
+ var eachElementInTheArrayMust = 'Each element in the array' + style.mustKeyword
+
+ if (schema.items) {
+ var itemSum = getPropertySummary(schema.items, knownTypes, autoLink)
+ md += style.bulletItem(style.propertyDetails('Type') + ': ' + itemSum.formattedType, 0);
+ if (schema.uniqueItems) {
+ md += style.bulletItem(eachElementInTheArrayMust + 'be unique.', 1);
+ }
+ }
+
+ // Schema reference
+ if (embedMode === enums.embedMode.referenceIncludeDocument) {
+ md += style.bulletItem(style.bold('JSON schema') + ': ' + style.getSchemaEmbedLink(fileName, schema)) + '\n';
+ } else if (defined(schemaRelativeBasePath)) {
+ if (!schemaRelativeBasePath.endsWith('/')) {
+ schemaRelativeBasePath += '/';
+ }
+ md += style.bulletItem(style.bold('JSON schema') + ': ' + style.getLinkMarkdown(fileName, schemaRelativeBasePath.replace(/\\/g, '/') + fileName)) + '\n';
+ }
+
}
return md; |
Hi, I'm using your library to make my documentation and I ran into this issue. Is this going to be fixed anytime soon? Thanks! |
I have a JSON schema named
things.schema.json
that looks like this:It references
thing.schema.json
, which looks like this:Then I run wetzel like so:
The resulting file looks like this:
Note that the Things reference at the bottom is missing any information about the items. The same is true even if I set
"items": { "type": "string" }
; the resulting Markdown is simply:If I add
minItems
uniqueItems
, or any of the rest, none of it appears, either. Shouldn't there be more details on what constitutes an an array schema?The text was updated successfully, but these errors were encountered: