jsonschema2md
jsonschema2md copied to clipboard
ERR_INVALID_ARG_TYPE: The "path" argument must be of type string. Received undefined
Expected Behaviour
Converts JSON schema to MD.
Actual Behaviour
The following error is thrown:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:371:5)
at validateString (node:internal/validators:119:11)
at Object.parse (node:path:913:5)
at Object.get (node_modules\@adobe\jsonschema2md\lib\schemaProxy.js:123:27)
at Function.values (<anonymous>)
at reducer (node_modules\@adobe\jsonschema2md\lib\traverseSchema.js:42:23)
at Array.reduce (<anonymous>)
at reducer (\node_modules\@adobe\jsonschema2md\lib\traverseSchema.js:36:41)
at Array.reduce (<anonymous>)
at reducer (node_modules\@adobe\jsonschema2md\lib\traverseSchema.js:42:39) {
code: 'ERR_INVALID_ARG_TYPE'
Reproduce Scenario (including but not limited to)
Steps to Reproduce
Running with jsonschema2md -d input -o output
JSON Schema:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"ItemLink": {
"properties": {
"allowedSuccessors": {
"items": {
"type": "string"
},
"type": "array"
},
"class": {
"type": "string"
}
},
"type": "object"
},
"ItemLinkOptions": {
"properties": {
"allowedLinks": {
"items": {
"$ref": "#/definitions/ItemLink"
},
"type": "array"
},
"maxIncoming": {
"type": "number"
},
"maxOutgoing": {
"type": "number"
}
},
"type": "object"
}
},
"properties": {
"id": {
"type": "string"
},
"items": {
"items": {
"anyOf": [
{
"$ref": "#/definitions/ItemLink"
}
]
},
"type": "array"
},
"version": {
"type": "string"
}
},
"type": "object"
}
Platform and Version
Windows 10
Having the same problem on OSX.
+1 Windows 10
As a temporal solution you can use an explicit local URI in your $ref
's, pointing to the same file.
So in your schema, instead of:
"$ref": "#/definitions/ItemLink"
Try:
"$ref": "./xxx.schema.json/#/definitions/ItemLink"
This is not ideal, and having no explicit URI should work per spec, but I'm not familiar enough with this library to know when it broke or how to fix it in a PR.
Blocked by #395
I have the same issue whenever I use a $ref
.
(Running on Ubuntu)
Same here, probably because the Schema director is expecting multiple schemas. Maybe a workaround to develop is to be able to give in input just a single schema file instead of a schema directory ?
This can be solved by adding to your schema an $id with the path to itself from the root of the project.
Seams to be an ugly workaround which does not lead to portable code
Having the same problem on OSX.
@trieloff i see #395 is merged. Is it possible to progress a fix?
@trieloff a fix would be highly appreciated.
Still getting this with v7.1.5, any updates?
Year passed, still totally unusable. Nice!
This can be solved by adding to your schema an $id with the path to itself from the root of the project.
As gloaysa mentioned, this can be solved by adding an $id
to your schema; the value can be any string that uniquely identifies it, not necessarily the path to itself.
Same issue here
Any update on this issue? I'm having the same problem and the "$id" workaround unfortunately is not an option