Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove use of cl_abap_enumdescr #83

Merged
merged 3 commits into from
Apr 26, 2022
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
12 changes: 0 additions & 12 deletions src/zcl_aff_writer_json_schema.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -763,12 +763,6 @@ CLASS zcl_aff_writer_json_schema IMPLEMENTATION.
ELSEIF abap_doc-enumvalues_link IS NOT INITIAL.
set_enum_properties( element_description->type_kind ).
result = enum_values.
ELSEIF element_description IS INSTANCE OF cl_abap_enumdescr.
DATA(enum_description) = CAST cl_abap_enumdescr( element_description ).
LOOP AT enum_description->members ASSIGNING FIELD-SYMBOL(<member>).
DATA(formatted_name) = apply_formatting( CONV #( <member>-name ) ).
APPEND formatted_name TO result.
ENDLOOP.
ELSE.
IF get_json_type_from_description( element_description ) = zif_aff_writer=>type_info-boolean.
RETURN.
Expand Down Expand Up @@ -799,12 +793,6 @@ CLASS zcl_aff_writer_json_schema IMPLEMENTATION.
ENDLOOP.
ELSEIF abap_doc-enumvalues_link IS NOT INITIAL.
result = enum_descriptions.
ELSEIF element_description IS INSTANCE OF cl_abap_enumdescr.
DATA(enum_description) = CAST cl_abap_enumdescr( element_description ).
LOOP AT enum_description->members ASSIGNING FIELD-SYMBOL(<member>).
DATA(description) = map_and_format_name( CONV #( <member>-name ) ).
APPEND description TO result.
ENDLOOP.
ELSE.
element_description->get_ddic_fixed_values(
RECEIVING
Expand Down
10 changes: 2 additions & 8 deletions src/zcl_aff_writer_json_schema.clas.testclasses.abap
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ CLASS ltcl_json_writer IMPLEMENTATION.

METHOD enum_element.
* base type / base structure/ ohne (integer)
* ABAP enums are not supported and hence treated as string with maxLength 30
TYPES:
BEGIN OF ENUM category,
general ##NEEDED,
Expand All @@ -53,14 +54,7 @@ CLASS ltcl_json_writer IMPLEMENTATION.
( | "$schema": "{ zcl_aff_writer_json_schema=>c_schema_specification }",| )
( | "$id": "{ schema_id }",| )
( ` "type": "string",` )
( ` "enum": [` )
( ` "general",` )
( ` "classicBadi"` )
( ` ],` )
( ` "enumDescriptions": [` )
( ` "general",` )
( ` "classicBadi"` )
( ` ]` )
( ` "maxLength": 30` )
( `}` )
( ) ).
zcl_aff_tools_unit_test_helper=>assert_equals_ignore_spaces( act_data = act_schema exp_data = exp_schema ).
Expand Down