mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 04:08:27 +08:00
ajson, Automatic Update (#5689)
This commit is contained in:
parent
d0e2314bad
commit
15df1fd539
|
@ -26,9 +26,9 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@abaplint/cli": "^2.91.9",
|
||||
"@abaplint/runtime": "^2.0.71",
|
||||
"@abaplint/transpiler-cli": "^2.0.71",
|
||||
"@abaplint/database-sqlite": "^2.0.58",
|
||||
"@abaplint/runtime": "^2.0.72",
|
||||
"@abaplint/transpiler-cli": "^2.0.72",
|
||||
"@abaplint/database-sqlite": "^2.0.72",
|
||||
"abapmerge": "^0.14.7",
|
||||
"c8": "^7.11.3",
|
||||
"eslint": "^8.19.0"
|
||||
|
|
|
@ -7,6 +7,7 @@ CLASS zcl_abapgit_ajson DEFINITION
|
|||
INTERFACES zif_abapgit_ajson .
|
||||
|
||||
ALIASES:
|
||||
is_empty FOR zif_abapgit_ajson~is_empty,
|
||||
exists FOR zif_abapgit_ajson~exists,
|
||||
members FOR zif_abapgit_ajson~members,
|
||||
get FOR zif_abapgit_ajson~get,
|
||||
|
@ -462,6 +463,11 @@ CLASS zcl_abapgit_ajson IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD zif_abapgit_ajson~is_empty.
|
||||
rv_yes = boolc( lines( mt_json_tree ) = 0 ).
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD zif_abapgit_ajson~keep_item_order.
|
||||
mv_keep_item_order = abap_true.
|
||||
ri_json = me.
|
||||
|
|
|
@ -2953,6 +2953,7 @@ CLASS ltcl_integrated DEFINITION
|
|||
METHODS item_order_integrated FOR TESTING RAISING zcx_abapgit_ajson_error.
|
||||
METHODS chaining FOR TESTING RAISING zcx_abapgit_ajson_error.
|
||||
METHODS push_json FOR TESTING RAISING zcx_abapgit_ajson_error.
|
||||
METHODS is_empty FOR TESTING RAISING zcx_abapgit_ajson_error.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
@ -3258,6 +3259,22 @@ CLASS ltcl_integrated IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD is_empty.
|
||||
|
||||
DATA li_cut TYPE REF TO zif_abapgit_ajson.
|
||||
|
||||
li_cut = zcl_abapgit_ajson=>create_empty( ).
|
||||
|
||||
cl_abap_unit_assert=>assert_true( li_cut->is_empty( ) ).
|
||||
|
||||
li_cut->set(
|
||||
iv_path = '/x'
|
||||
iv_val = '123' ).
|
||||
|
||||
cl_abap_unit_assert=>assert_false( li_cut->is_empty( ) ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
**********************************************************************
|
||||
|
|
|
@ -4,6 +4,9 @@ CLASS zcl_abapgit_ajson_utilities DEFINITION
|
|||
|
||||
PUBLIC SECTION.
|
||||
|
||||
CLASS-METHODS new
|
||||
RETURNING
|
||||
VALUE(ro_instance) TYPE REF TO zcl_abapgit_ajson_utilities.
|
||||
METHODS diff
|
||||
IMPORTING
|
||||
!iv_json_a TYPE string OPTIONAL
|
||||
|
@ -36,6 +39,17 @@ CLASS zcl_abapgit_ajson_utilities DEFINITION
|
|||
VALUE(rv_sorted) TYPE string
|
||||
RAISING
|
||||
zcx_abapgit_ajson_error .
|
||||
METHODS is_equal
|
||||
IMPORTING
|
||||
!iv_json_a TYPE string OPTIONAL
|
||||
!iv_json_b TYPE string OPTIONAL
|
||||
!ii_json_a TYPE REF TO zif_abapgit_ajson OPTIONAL
|
||||
!ii_json_b TYPE REF TO zif_abapgit_ajson OPTIONAL
|
||||
RETURNING
|
||||
VALUE(rv_yes) TYPE abap_bool
|
||||
RAISING
|
||||
zcx_abapgit_ajson_error .
|
||||
|
||||
PROTECTED SECTION.
|
||||
|
||||
PRIVATE SECTION.
|
||||
|
@ -277,6 +291,31 @@ CLASS zcl_abapgit_ajson_utilities IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD is_equal.
|
||||
|
||||
DATA li_ins TYPE REF TO zif_abapgit_ajson.
|
||||
DATA li_del TYPE REF TO zif_abapgit_ajson.
|
||||
DATA li_mod TYPE REF TO zif_abapgit_ajson.
|
||||
|
||||
diff(
|
||||
EXPORTING
|
||||
iv_json_a = iv_json_a
|
||||
iv_json_b = iv_json_b
|
||||
io_json_a = ii_json_a
|
||||
io_json_b = ii_json_b
|
||||
IMPORTING
|
||||
eo_insert = li_ins
|
||||
eo_delete = li_del
|
||||
eo_change = li_mod ).
|
||||
|
||||
rv_yes = boolc(
|
||||
li_ins->is_empty( ) = abap_true AND
|
||||
li_del->is_empty( ) = abap_true AND
|
||||
li_mod->is_empty( ) = abap_true ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD merge.
|
||||
|
||||
mo_json_a = normalize_input(
|
||||
|
@ -302,6 +341,11 @@ CLASS zcl_abapgit_ajson_utilities IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD new.
|
||||
CREATE OBJECT ro_instance.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD normalize_input.
|
||||
|
||||
IF boolc( iv_json IS INITIAL ) = boolc( io_json IS INITIAL ).
|
||||
|
|
|
@ -131,6 +131,7 @@ CLASS ltcl_json_utils DEFINITION
|
|||
METHODS json_diff_arrays FOR TESTING RAISING zcx_abapgit_ajson_error.
|
||||
METHODS json_merge FOR TESTING RAISING zcx_abapgit_ajson_error.
|
||||
METHODS json_sort FOR TESTING RAISING zcx_abapgit_ajson_error.
|
||||
METHODS is_equal FOR TESTING RAISING zcx_abapgit_ajson_error.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
@ -510,4 +511,33 @@ CLASS ltcl_json_utils IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD is_equal.
|
||||
|
||||
cl_abap_unit_assert=>assert_true(
|
||||
zcl_abapgit_ajson_utilities=>new( )->is_equal(
|
||||
ii_json_a = zcl_abapgit_ajson=>parse( '{"a":1,"b":2}' )
|
||||
ii_json_b = zcl_abapgit_ajson=>parse( '{"a":1,"b":2}' ) ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_true(
|
||||
zcl_abapgit_ajson_utilities=>new( )->is_equal(
|
||||
iv_json_a = '{"a":1,"b":2}'
|
||||
iv_json_b = '{"a":1,"b":2}' ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_false(
|
||||
zcl_abapgit_ajson_utilities=>new( )->is_equal(
|
||||
iv_json_a = '{"a":1,"b":2}'
|
||||
iv_json_b = '{"a":1,"b":3}' ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_false(
|
||||
zcl_abapgit_ajson_utilities=>new( )->is_equal(
|
||||
iv_json_a = '{"a":1,"b":2}'
|
||||
iv_json_b = '{"a":1,"b":2,"c":3}' ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_false(
|
||||
zcl_abapgit_ajson_utilities=>new( )->is_equal(
|
||||
iv_json_a = '{"a":1,"b":2,"c":3}'
|
||||
iv_json_b = '{"a":1,"b":2}' ) ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
INTERFACE zif_abapgit_ajson
|
||||
PUBLIC.
|
||||
|
||||
CONSTANTS version TYPE string VALUE 'v1.1.4'. "#EC NOTEXT
|
||||
CONSTANTS version TYPE string VALUE 'v1.1.6'. "#EC NOTEXT
|
||||
CONSTANTS origin TYPE string VALUE 'https://github.com/sbcgua/ajson'. "#EC NOTEXT
|
||||
CONSTANTS license TYPE string VALUE 'MIT'. "#EC NOTEXT
|
||||
|
||||
|
@ -56,6 +56,10 @@ INTERFACE zif_abapgit_ajson
|
|||
|
||||
" METHODS ex.reader
|
||||
|
||||
METHODS is_empty
|
||||
RETURNING
|
||||
VALUE(rv_yes) TYPE abap_bool.
|
||||
|
||||
METHODS exists
|
||||
IMPORTING
|
||||
iv_path TYPE string
|
||||
|
|
|
@ -103,6 +103,7 @@
|
|||
{"object": "ZCL_ABAPGIT_AJSON", "class": "ltcl_serializer_test", "method": "escape", "note": "ASSERT failed, ??"},
|
||||
|
||||
{"object": "ZCL_ABAPGIT_AJSON_UTILITIES", "class": "ltcl_json_utils", "method": "json_diff_arrays", "note": "infinite loop"},
|
||||
{"object": "ZCL_ABAPGIT_AJSON_UTILITIES", "class": "ltcl_json_utils", "method": "is_equal", "note": "infinite loop"},
|
||||
|
||||
{"object": "ZCL_ABAPGIT_TRANSPORT_OBJECTS", "class": "ltcl_transport_objects", "method": "should_add_all_local_files", "note": "??"},
|
||||
{"object": "ZCL_ABAPGIT_TRANSPORT_OBJECTS", "class": "ltcl_transport_objects", "method": "should_delete_all_related", "note": "??"},
|
||||
|
|
Loading…
Reference in New Issue
Block a user