cancel
Showing results for 
Search instead for 
Did you mean: 

Generating Swagger from SAP Gateway?

07-01-2020 3:45 PM
5129 views 10 comments
0 Likes
SAP Managed Tags
Subscribe

I've setup swagger docs for SAP Gateway services using https://inspector.swagger.io/builder and https://app.swaggerhub.com/

However, the free plan is very limited (3 Public API's), plus the URL is set at app.swaggerhub.com.

Is there any way the Swagger doc be generated in SAP using the same URL as the Gateway service?

0 Likes

Accepted Solutions (0)

Answers (2)

Answers (2)

gregorw
SAP Mentor
SAP Mentor

Please check out: ABAP OpenAPI UI v1 released! from 8d8214c7f9734f45be69f95cc0d5aeee. I found it using https://cse.google.com/cse?cx=013447253335410278659:k8ob9ipscwg&q=open+api+gateway

former_member239819
Participant
0 Likes

I checked out ABAP OpenAPI but got the following error using the test service...

Failed to load API definition.

Errors

Hide

Fetch error

Internal Server Error openapi.json?service=ZGW_OPENAPI_TEST_SRV&version=0001&group=&repository=

gregorw
SAP Mentor
SAP Mentor
0 Likes

Please file an incident with details at https://gitlab.com/geertjanklaps/abap-openapi-ui/-/issues. Maybe you haven't activated the SICF service? Have you checked the developer tools in your browser?

geert-janklaps
SAP Mentor
SAP Mentor
0 Likes

I agree with Gregor, looks like the odata service is not active (don't think that gets activated automatically when importing the solution).

Did you try using a service that was already activated in your system? If not, feel free to log an issue in the gitlab repository. (be sure to mention as much information as possible, like system release, e.g. screenshots of the ST22 dump if there are any, ....)

If you find the solution to your problem and are able to solve it by changing the code, pull requests are always appreciated!

former_member239819
Participant
0 Likes

Checked ST22 and the error is:

Error in the ABAP application program.

The current ABAP program “ZCL_GW_OPENAPI================CP” had to be
terminated because it found a
statement that could not be executed.
In include “ZCL_GW_OPENAPI_METADATA_V2====CM005 “, in line 99 of program
“ZCL_GW_OPENAPI_METADATA_V2====CP “, the following syntax errors
have occurred:
Method “SET_METADATA_ACCESS_INFO” is unknown or PROTECTED or PRIVATE.

This is in line 99 of the _READ_METADATA method of ZCL_GW_OPENAPI_METADATA_V2

* Initialize metadata access
lo_transaction_handler->set_metadata_access_info(
iv_load_last_modified_only = abap_false
iv_is_busi_data_request = abap_false
iv_do_cache_handshake = abap_true ).

Line 88 sets up lo_transaction_hander…

* Initialize NetWeaver Gateway transaction handler
DATA(lo_transaction_handler) = /iwfnd/cl_transaction_handler=>get_transaction_handler( ).

The issue is set_metadata_access_info isn’t defined as a method.

Is there a workaround?

Netweaver Version: 7.5 SP05

I'll also raise an issue in Gitlab

pfefferf
Active Contributor
0 Likes

Ok, directly with SAP tools there is no option yet (to my knowledge). But there exists the odata-openapi tooling which allows you the conversion of OData v4 metadata to an OpenAPI v3 (or v2) file.

If you have OData v2 metadata, this will be converted first to OData v2 and then to OpenAPI automatically.

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Likes

Florian is right. There is currently no option yet to get an OpenAPI description for an OData service that you have developed on the ABAP platform.

former_member239819
Participant
0 Likes

Will SAP Cloud Plaform do it via API Management?