Failed to construct 'URL': Invalid URL
Subject: Import Failure: "Failed to construct 'URL'" Error with Valid Exported JSON
Description:
I am encountering an import error when trying to re-import a JSON file that was previously exported from DrawDB.
Error Message:
Uncaught (in promise) TypeError: Failed to construct 'URL': Invalid URL at Object.resolveUrl2 [as resolveUrl] (jsonschema.js?v=852b6613:324:39) at Validator2.validate (jsonschema.js?v=852b6613:1138:26) at jsonDiagramIsValid (validateSchema.js:5:26) at loadJsonData (ImportDiagram.jsx:54:12) at reader.onload (ImportDiagram.jsx:173:49) Problem Details:
The JSON file was originally exported from DrawDB and has not been manually modified.
The file validates as correct JSON syntax through external validators (JSONLint).
Crucially, the JSON file contains no explicit URL fields (e.g., no url, host, ip, or linkfields), which makes the error puzzling.
The error occurs during the JSON Schema validation step (jsonschema.js), suggesting an internal validation rule may be incorrectly applied to a non-URL data field.
Steps to Reproduce:
Export a diagram to JSON from DrawDB.
Attempt to re-import the same JSON file.
The import fails with the above error.
Request:
Could you please investigate why the JSON Schema validator is attempting to parse a non-URL field as a URL? This appears to be a bug where a validation rule for "format": "uri"is being triggered by standard data.
Thank you for your assistance.
can u please share an example where the issue occurs
1.Create a new MySQL table relationship
2.Export as a JSON file
3.Create New and Import the newly created JSON file
Can I work on this issue
Thanks for your interest! I'm just the one who raised the issue, so I'll let the maintainers decide. @1ilit
@MeetD99 sure
@ZX828 the import seems to work correctly for me, has this already been fixed? @1ilit
haven't fixed it and cant reproduce it either. can you attach the json youre trying to import
https://www.drawdb.app/editor
I created a new table relationship on the page https://www.drawdb.app/editor and then exported a .json file. Then, I opened a new page and tried to import the .json file I just exported, but the import button was unavailable.
Still works perfectly for me, can you share a sreen recorded video, please? @ZX828
https://github.com/user-attachments/assets/d3b46319-17b1-409f-9aea-b57739afd20d
@MeetD99
Hi @1ilit @MeetD99, I'd like to help investigate this issue. I can see it's been challenging to reproduce. I have some ideas about the JSON schema validation that might help. Would it be okay if I take a look at the code and share my findings?
@7vignesh yeah please go ahead
Hi @1ilit,
Sorry for the confusion - I created some orphaned commits (328cebc, 7ef42eb, fe7fbbd) while testing issue #561. Could you clean them up when you get a chance?
Hi @1ilit, I’ve already fixed this issue locally — could you please assign it to me so I can open the PR?