Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-DIAG-032

The built-in engine refuses what needs a URL, a library or more than 1 MiB

When a built-in diagram needs a URL, a library, a theme read from a folder or more than 1 MiB of source, or the built-in engine fails, the page SHALL show one message that says why, with the useJar hint where it applies, instead of a picture, and fetch or load nothing.

Step 1 of path 2 in StRS-MDOKFSTUDIO-DIAG-006: from “The document holds a PlantUML diagram” to “A message says why there is no picture”.

Part of StRS-MDOKFSTUDIO-DIAG-007, outside the paths drawn on its map.

Scenarios 7

The situations the tests check; open one to read it.

nominalLibrary include
Givena diagram with an include of the C4 library name in angle brackets on line 3
Whenthe page draws it
Thenwhen a built-in diagram has a line starting with !includeurl, !includedef or !import, an include of a URL or of a library name in angle brackets, or a !theme with from, the page shows one message naming the directive and its line and the useJar hint instead of a picture and sets data-render-state to unavailable
here the message names that directive and line 3 and the useJar hint, there is no picture, the state is unavailable, and the source disclosure keeps the text
the engine is not run and no previewPlantUmlInclude message is sent
boundaryDirectives that are refused before the engine
InputOutcome
a line starting with !includeurl, !includedef or !importthe message naming the directive and its line, state unavailable; the engine is not run and the host is not asked for a file
an include of a URL, or of a library name in angle bracketsthe same message, state unavailable; no engine run and no host request
a !theme with fromthe same message, state unavailable; no engine run and no host request
a source with CRLF line endings and an indented !includeurl line on line 2the message names line 2
a diagram with an include of a local file onlynot refused: the file is asked of the host and the engine runs (see SwRS-MDOKFSTUDIO-DIAG-046)
refusalLoaders of the built-in engine refuse
InputOutcome
the engine asks for a library URL (a standard-library bundle) or an optional script such as emojithe loader answers with an error saying it is not available in the built-in PlantUML engine; no script tag is added and nothing is fetched
the engine globals after installationno standard-library base address is set, so no remote server is named
a diagram renderer created without a host; the engine asks for a local filethe request is refused with a reason naming the file
a page that has no connection to the editor; an include request is dispatchedthe request is answered with the reason that the page has no connection to the editor; no file text reaches the engine
a loader request of kind theme (a !theme read from a folder or a URL, even if the pre-scan did not catch the directive)the loader answers with an error saying the theme is not available in the built-in PlantUML engine; no theme file is read
the same theme refusal during a renderthe diagram shows the include failure message with the failure reason as its message, state error, and the result is not kept
refusalUnsupported directive inside an included file
Givenan included local file with an include of a library name on line 2
Whenthe diagram is drawn
Thenthe diagram shows the unavailable message naming the directive, line 2, the file name and the useJar hint, and the state is unavailable
the refusal is not kept: the diagram drawn again after the file was fixed runs the engine again with the new file text
refusalEngine failure shows its reason
InputOutcome
the engine rejects a diagram (syntax error) with a reasonthe message reads "The built-in PlantUML engine could not render this diagram: " followed by the reason as plain text and the useJar hint, no picture, state error, and the source is kept
a reason beginning with java.lang.IllegalStateException followed by a colonthe class prefix is removed
an empty reasonthe text unknown error is used
the engine throwsthe same message with the thrown message as the reason, state error
boundarySource of 1 MiB
InputOutcome
a diagram source of 1,048,577 characters (over 1 MiB)"The PlantUML source exceeds the 1 MiB preview limit." appears, the state is unavailable and the engine is not run
a diagram source of exactly 1,048,576 charactersthe engine runs normally
nominalMessages use the error style
InputOutcome
a PlantUML diagram that shows a messagethe paragraph of class myst-plantuml-error uses --studio-errorForeground (fallback #f14c4c) and italic text
a theme without --studio-errorForegroundthe fallback red is used

Implemented in 2

Tested by 3

Known limits (6)

Replaces

SwRS-MDOKFSTUDIO-DIAG-033The library loaders of the built-in engine refuse every request superseded superseded by SwRS-MDOKFSTUDIO-DIAG-032 Markdown file
SwRS-MDOKFSTUDIO-DIAG-034The file loader refuses local files without a render or a host superseded superseded by SwRS-MDOKFSTUDIO-DIAG-032 Markdown file
SwRS-MDOKFSTUDIO-DIAG-035A theme read from a folder is refused superseded superseded by SwRS-MDOKFSTUDIO-DIAG-032 Markdown file
SwRS-MDOKFSTUDIO-DIAG-036Unsupported directives inside included files name the file superseded superseded by SwRS-MDOKFSTUDIO-DIAG-032 Markdown file
SwRS-MDOKFSTUDIO-DIAG-037A built-in engine failure shows its reason superseded superseded by SwRS-MDOKFSTUDIO-DIAG-032 Markdown file
SwRS-MDOKFSTUDIO-DIAG-038The built-in engine refuses a source over 1 MiB superseded superseded by SwRS-MDOKFSTUDIO-DIAG-032 Markdown file
SwRS-MDOKFSTUDIO-DIAG-082PlantUML messages use the error style superseded superseded by SwRS-MDOKFSTUDIO-DIAG-032 Markdown file
SwRS-MDOKFSTUDIO-DIAG-112Unsupported directives never reach the engine or the host superseded superseded by SwRS-MDOKFSTUDIO-DIAG-032 Markdown file