Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified JsonPreprocessor/JsonPreprocessor.pdf
Binary file not shown.
70 changes: 70 additions & 0 deletions packagedoc/additional_docs/The JSONP format.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1191,5 +1191,75 @@ \section{Implicite creation of dictionaries}
{'paramA': 'ABC', 'subKey': 'ABC', 'testdict': {'subKey': {'subKey': {'paramA': 'DEF'}}}}
\end{pythonlog}

\vspace{2ex}

\textbf{Reference to existing keys}

It is possible to use parameters to refer to \textit{already existing} keys.

\begin{pythoncode}
{
// <data structure created implicitly>
${testdict.subKey_1.subKey_2.subKey_3} : "ABC",

// <string parameter with name of an existing key>
"keyName_3" : "subKey_3",

// <parameter used to refer to an existing key>
${testdict.subKey_1.subKey_2.${keyName_3}} : "XYZ"
}
\end{pythoncode}

\vspace{2ex}

\textbf{Outcome:}

\begin{pythonlog}
{'keyName_3': 'subKey_3',
'testdict': {'subKey_1': {'subKey_2': {'subKey_3': 'XYZ'}}}}
\end{pythonlog}

\vspace{2ex}

Parameters cannot be used to create new keys.

\begin{pythoncode}
{
// <data structure created implicitly>
${testdict.subKey_1.subKey_2.subKey_3} : "ABC",

// <string parameter with name of a not existing key>
"keyName_4" : "subKey_4",

// <usage of keyName\_4 is not possible here>
${testdict.subKey_1.subKey_2.subKey_3.${keyName_4}} : "XYZ"
}
\end{pythoncode}

\vspace{2ex}

\textbf{Outcome is the following error:}

\begin{pythonlog}
"The implicit creation of data structures based on nested parameter is not supported ..."
\end{pythonlog}

The same error will happen in case of the standard notation is used:

\begin{pythoncode}
{
// <usage of keyName\_4 is not possible here>
${testdict}['subKey_1']['subKey_2']['subKey_3'][${keyName_4}] : "XYZ"
}
\end{pythoncode}









% --------------------------------------------------------------------------------------------------------------

9 changes: 5 additions & 4 deletions test/testfiles/jpp-test_config_1002.jsonp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
"paramD" : "D",
"paramE" : "E",
${testdict_3.paramD.paramE.paramD} : {"E" : 5},
${testdict_3.paramD.paramE.paramD}[${paramE}] : {"F" : 6} // if not implicit, usage of parameters for key names is allowed
//
// needs to be clarified (currently throws an implicit creation error)
// ${testdict_4} : {},
// ${testdict_4}[${paramD}] : {"G" : 7}
// usage of parameters allowed only in case of a key with this name already exists



${testdict_3.paramD.paramE.paramD}[${paramE}] : {"F" : 6} // ${paramE} is accepted because the value is "E" and a key with this name already exists
}

2 changes: 1 addition & 1 deletion test/testfiles/jpp-test_config_1051.jsonp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

{
"testdict" : {"A" : 1},
"name" : "C",
"name" : "C",
${testdict.B.${name}} : 2
}

2 changes: 1 addition & 1 deletion test/testfiles/jpp-test_config_1052.jsonp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

{
"testdict" : {"A" : 1},
"name" : "C",
"name" : "C",
${testdict}['${name}']['${name}'] : 2
}

2 changes: 1 addition & 1 deletion test/testfiles/jpp-test_config_1053.jsonp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//**************************************************************************

{
"name" : "C",
"name" : "C",
"testdict2" : {"B" : 2},
${somethingnotexisting.${testdict2}}['${name}'] : 4
}
Expand Down
2 changes: 1 addition & 1 deletion test/testfiles/jpp-test_config_1054.jsonp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//**************************************************************************

{
"name" : "C",
"name" : "C",
"testdict" : {"B" : 2},
${testdict.${testdict}}['${name}'] : 4
}
Expand Down
2 changes: 1 addition & 1 deletion test/testfiles/jpp-test_config_1055.jsonp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//**************************************************************************

{
"name" : "C",
"name" : "C",
"testlist" : ["B", 2],
${testlist.${testlist}}['${name}'] : 4
}
Expand Down
2 changes: 1 addition & 1 deletion test/testfiles/jpp-test_config_1056.jsonp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

{
"testdict" : {"A" : 1},
"name" : "C",
"name" : "C",
${testdict.${name}}['${name}'] : 5
}

2 changes: 1 addition & 1 deletion test/testfiles/jpp-test_config_1057.jsonp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

{
"testdict" : {"A" : 1},
"name" : "C",
"name" : "C",
${testdict}[${name}][${name}] : 4
}

1 change: 1 addition & 0 deletions test/testfiles/jpp-test_config_1058.jsonp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//**************************************************************************

{
"testdict" : {"A" : 1},
"name" : "C",
Expand Down