Skip to content
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

Exception when using array that has enums specifying order of elements in an array #219

Closed
Dr-Irv opened this issue Apr 13, 2020 · 2 comments
Assignees

Comments

@Dr-Irv
Copy link

Dr-Irv commented Apr 13, 2020

What did you do

jsonschema2md -e json -d foo -o docs

(File mod.json in directory foo)

What did you expect to happen

No errors

What happened

Got a stack trace:

loading 1 schemas
writing schemas
writing schemas to c:\Code\NBCU\GitRepo\SpringBootServant\NBCU Python Servant\out
writing README
building readme
writing documentation
generating markdown
(node:6660) UnhandledPromiseRejectionWarning: TypeError: Cannot convert object to primitive value
    at constraints.push.schema.(anonymous function).map.value (C:\Anaconda3\node_modules\@adobe\jsonschema2md\lib\markdownBuilder.js:554:31)
    at Proxy.map (<anonymous>)
    at makeconstraintssection (C:\Anaconda3\node_modules\@adobe\jsonschema2md\lib\markdownBuilder.js:552:34)
    at Object.entries.map (C:\Anaconda3\node_modules\@adobe\jsonschema2md\lib\markdownBuilder.js:729:14)
    at Array.map (<anonymous>)
    at makeproplist (C:\Anaconda3\node_modules\@adobe\jsonschema2md\lib\markdownBuilder.js:719:54)
    at makeproperties (C:\Anaconda3\node_modules\@adobe\jsonschema2md\lib\markdownBuilder.js:833:12)
    at foldl (C:\Anaconda3\node_modules\@adobe\jsonschema2md\lib\markdownBuilder.js:857:10)
    at each (C:\Anaconda3\node_modules\@adobe\jsonschema2md\node_modules\ferrum\src\sequence.js:1014:12)
    at curry (C:\Anaconda3\node_modules\@adobe\jsonschema2md\node_modules\ferrum\src\sequence.js:604:5)
(node:6660) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6660) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
c:\Code\NBCU\GitRepo\SpringBootServant\NBCU Python Servant\docs\README.md created

What's your environment

  • Operating System: Window s10
  • node.js version: 10.13.0

Do you have example files:

For this schema

{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$id": "file://foo/mod.json",
  "title": "MI",
  "description": "Specification for input JSON",
  "type": "object",
  "properties": {
    "columns": {
      "title": "Columns",
      "enum": [["P", "M"]],
      "type": "array"
    }
  },
  "required": ["columns"]
}

No markdown is produced.

Note - it seems the issue is that the schema we created is specifying that there is an array with values in a specified order. This is valid JSON Schema.

@trieloff trieloff added the bug label Apr 14, 2020
@trieloff
Copy link
Collaborator

Thanks for the bug report and example schema. This should be an easy fix.

@trieloff trieloff self-assigned this Apr 14, 2020
@trieloff trieloff mentioned this issue Apr 14, 2020
trieloff pushed a commit that referenced this issue Apr 14, 2020
## [4.1.1](v4.1.0...v4.1.1) (2020-04-14)

### Bug Fixes

* **deps:** npm audit fix ([b13ab35](b13ab35))
* **enum:** fix doc generation for enums that contain arrays ([667a106](667a106)), closes [#219](#219)
@trieloff
Copy link
Collaborator

🎉 This issue has been resolved in version 4.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants