mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 12:20:51 +08:00
ajson, Automatic Update (#5412)
* [create-pull-request] automated change * Update zcl_abapgit_ajson.clas.locals_imp.abap * Update zcl_abapgit_ajson.clas.locals_imp.abap * update deps * skip Co-authored-by: larshp <larshp@users.noreply.github.com> Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
parent
8ca0a27ff1
commit
45fbfd0feb
|
@ -25,11 +25,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@abaplint/cli": "^2.85.46",
|
"@abaplint/cli": "^2.85.49",
|
||||||
"@abaplint/runtime": "^1.8.19",
|
"@abaplint/runtime": "^1.8.24",
|
||||||
"@abaplint/transpiler-cli": "^1.8.19",
|
"@abaplint/transpiler-cli": "^1.8.24",
|
||||||
"abapmerge": "^0.14.3",
|
"abapmerge": "^0.14.3",
|
||||||
"c8": "^7.11.0",
|
"c8": "^7.11.0",
|
||||||
"eslint": "^8.11.0"
|
"eslint": "^8.12.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1354,7 +1354,7 @@ CLASS lcl_abap_to_json IMPLEMENTATION.
|
||||||
" and rtti seems to cache type descriptions really well (https://github.com/sbcgua/benchmarks.git)
|
" and rtti seems to cache type descriptions really well (https://github.com/sbcgua/benchmarks.git)
|
||||||
" the structures will be repeated in real life
|
" the structures will be repeated in real life
|
||||||
|
|
||||||
ls_next_prefix-path = is_prefix-path && is_prefix-name && '/'.
|
ls_next_prefix-path = is_prefix-path && ls_root-name && '/'.
|
||||||
|
|
||||||
LOOP AT lt_comps ASSIGNING <c>.
|
LOOP AT lt_comps ASSIGNING <c>.
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ CLASS ltcl_camel_case DEFINITION FINAL FOR TESTING
|
||||||
METHODS:
|
METHODS:
|
||||||
to_abap FOR TESTING RAISING zcx_abapgit_ajson_error,
|
to_abap FOR TESTING RAISING zcx_abapgit_ajson_error,
|
||||||
to_json FOR TESTING RAISING zcx_abapgit_ajson_error,
|
to_json FOR TESTING RAISING zcx_abapgit_ajson_error,
|
||||||
|
to_json_nested_struc FOR TESTING RAISING zcx_abapgit_ajson_error,
|
||||||
to_json_first_lower FOR TESTING RAISING zcx_abapgit_ajson_error.
|
to_json_first_lower FOR TESTING RAISING zcx_abapgit_ajson_error.
|
||||||
|
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
@ -64,6 +65,36 @@ CLASS ltcl_camel_case IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD to_json_nested_struc.
|
||||||
|
|
||||||
|
DATA:
|
||||||
|
lo_ajson TYPE REF TO zcl_abapgit_ajson,
|
||||||
|
li_mapping TYPE REF TO zif_abapgit_ajson_mapping.
|
||||||
|
DATA:
|
||||||
|
BEGIN OF ls_result,
|
||||||
|
field_data TYPE string,
|
||||||
|
BEGIN OF struc_data,
|
||||||
|
field_more TYPE string,
|
||||||
|
END OF struc_data,
|
||||||
|
END OF ls_result.
|
||||||
|
|
||||||
|
li_mapping = zcl_abapgit_ajson_mapping=>create_camel_case( iv_first_json_upper = abap_false ).
|
||||||
|
|
||||||
|
ls_result-field_data = 'field_value'.
|
||||||
|
ls_result-struc_data-field_more = 'field_more'.
|
||||||
|
|
||||||
|
lo_ajson = zcl_abapgit_ajson=>create_empty( ii_custom_mapping = li_mapping ).
|
||||||
|
|
||||||
|
lo_ajson->set( iv_path = '/'
|
||||||
|
iv_val = ls_result ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = lo_ajson->stringify( )
|
||||||
|
exp = '{"fieldData":"field_value","strucData":{"fieldMore":"field_more"}}' ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD to_json_first_lower.
|
METHOD to_json_first_lower.
|
||||||
|
|
||||||
DATA:
|
DATA:
|
||||||
|
|
|
@ -170,6 +170,7 @@
|
||||||
{"object": "ZCL_ABAPGIT_AJSON_MAPPING", "class": "ltcl_camel_case", "method": "to_abap", "note": "secondary key fields? READ WITH KEY, Path not found @/FieldData"},
|
{"object": "ZCL_ABAPGIT_AJSON_MAPPING", "class": "ltcl_camel_case", "method": "to_abap", "note": "secondary key fields? READ WITH KEY, Path not found @/FieldData"},
|
||||||
{"object": "ZCL_ABAPGIT_AJSON_MAPPING", "class": "ltcl_camel_case", "method": "to_json"},
|
{"object": "ZCL_ABAPGIT_AJSON_MAPPING", "class": "ltcl_camel_case", "method": "to_json"},
|
||||||
{"object": "ZCL_ABAPGIT_AJSON_MAPPING", "class": "ltcl_camel_case", "method": "to_json_first_lower"},
|
{"object": "ZCL_ABAPGIT_AJSON_MAPPING", "class": "ltcl_camel_case", "method": "to_json_first_lower"},
|
||||||
|
{"object": "ZCL_ABAPGIT_AJSON_MAPPING", "class": "ltcl_camel_case", "method": "to_json_nested_struc"},
|
||||||
|
|
||||||
{"object": "ZCL_ABAPGIT_AJSON_MAPPING", "class": "ltcl_fields", "method": "to_json"},
|
{"object": "ZCL_ABAPGIT_AJSON_MAPPING", "class": "ltcl_fields", "method": "to_json"},
|
||||||
{"object": "ZCL_ABAPGIT_AJSON_MAPPING", "class": "ltcl_to_lower", "method": "to_json"},
|
{"object": "ZCL_ABAPGIT_AJSON_MAPPING", "class": "ltcl_to_lower", "method": "to_json"},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user