outline icon indicating copy to clipboard operation
outline copied to clipboard

JSON import silently discards parts of documents that are invalid

Open HalfVoxel opened this issue 6 months ago • 3 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

This is not related to configuring Outline

  • [x] The issue is not related to self-hosting config

Current Behavior

When importing a json file that has a raw text node outside a paragraph, it seems large parts of the document are ignored.

{
                "type": "doc",
                "content": [
                    {
                        "type": "paragraph",
                        "content": [
                            {
                                "type": "text",
                                "text": "Some paragraph with some text."
                            }
                        ]
                    },
                    {
                        "type": "text",
                        "text": "Wow! Such text"
                    }
                ]
            }

This will get imported to an empty page with no errors of any kind.

Image

Expected Behavior

An error message saying that it doesn't match the schema or something.

Steps To Reproduce

Import the attached file export.zip

Environment

- Outline: 0.84.0
- Browser: Firefox

Anything else?

I know the json import is somewhat internal. But it's very nice to write importers for it, as the current markdown parser is kinda limited in what it can import (no embeds, notices inside table cells, or highlighted text, for example).

Ensuring that a successful import actually means that outline understood the whole document is quite useful in my opinion.

HalfVoxel avatar Jul 07 '25 09:07 HalfVoxel

Similarly, images that are not children of a paragraph node seem to be silently ignored.

HalfVoxel avatar Jul 07 '25 10:07 HalfVoxel

hey @tommoor, I think we can setup some fairly simple schema validation on the backend for this. But from what I can find there is no defined schema for the imported JSON data.

salihudickson avatar Oct 05 '25 20:10 salihudickson