Is there any intentional limit to the number of lines in a JSON variable definition?

0 votes
asked May 3, 2021 in Question / help by anonymous

trying to define a JSON variable in oder to provide data to the pre-processing, I hit some unexpeted behavior,  whenever the totla count of lines in the definition exceeds 100.

Example:

@startuml
title test
!$JsonData = {
 "1":"line 1",
 "2":"line 2" }
@enduml

works as expected ... until I have 101 lines in there. Actually, defining the same data on a single line will also work as expected -displaying nothing . 

However, if there are more than 100 lines, using PlantUML 1.2021.5 I get the same output as if just putting

 

@startuml
title test
 "101":"line 101" }
@enduml

... effectively leading to errors, as soon as any actual diagram definition ist following. 
Seems the parser works only for 100 lines - is there a reason for that?

 Thanks in advance and best regards
 

1 Answer

0 votes
answered May 3, 2021 by The-Lu (64,340 points)

Hello A., and PlantUML team,

It seems that is the same issue here: 


After some search on the code, It seems there is a constraint:

for (int i = 0; i < 100; i++)

See: Line 79 of CodeIteratorAffectation.java
 

@PlantUML team:

Regards,
Th.

commented May 4, 2021 by anonymous

@The-Lu Thanks for the quick clarification! yes

@PlantUML Team I do support both requests smiley

commented May 20, 2021 by The-Lu (64,340 points)

Hello all,

FYI, the limitation was lifted in the last version V1.2021.6 (14 May, 2021);

from:

for (int i = 0; i < 100; i++)

to:

for (int i = 0; i < 9999; i++)


Thanks to PlantUML team,
Regards,
Th.

commented May 21, 2021 by anonymous

Sounds good to me, should be large enough for most practical use cases in the wild. Thanks a lot!

The Limitation might be worth a mentioning in the docs, too. 

(in fact, once the loadJSON functionality is considered to be implemented, this might strike again)

As an addendum… putting the JSON definition on a single line, I.e. leaving out any syntactically irrelevant line breaks, does avoid the problem too - at least for my use case. It’s neither convincing nor convenient, though wink

Best regards and thanks again

...