larshp / abap-swagger Goto Github PK
View Code? Open in Web Editor NEWExpose ABAP REST services with Swagger/openapi spec
License: MIT License
Expose ABAP REST services with Swagger/openapi spec
License: MIT License
both for inbound and outbound values?
eg: language, time, date, uom
will require new structure instead of the currently used RT_META
move to $ref
I need this repo primarily to use abapgitserver.
I have issues when trying to clone the Swagger Repo via AbapGit.
The objects are not created in the system.
The download completes without a problem, also there are no exceptions thrown in the debugger.
Other repos, like ABAP2XLSX, were successfully installed in our system.
Is there any setting or naming convention to follow?
Following solutions were tested:
Hello Team,
I am very delightful to know about this open source project and it is quite useful for ABAPers who are working on SAP REST services as a provider to outside world. Thanks and much appreciated.
However, I am wondering is there any way to leverage to REST services developed using SEGW transaction in SAP to run and test the service directly through Swaggger UI by IIB/.Net (non-SAP) developers in order to create client interface out of it.
I would appreciate if someone point me to the discussion if it was already closed to verify once.
Thanks, Naresh
ZCL_SWAG->FROM_INPUT uses an object which is not available in my system. Can we downgrade it to an alternative which doesn't use it?
CALL TRANSFORMATION demo_json_xml_to_upper
SOURCE XML lv_cdata
RESULT XML lo_writer.
due to swagger-api/swagger-ui#2760
workaround is to add the host in the swagger spec json
Hi @larshp ,
I would like to suggest you to create a "latest" tag.
By doing this, it's easier to get the repository in zip file instead of cloning the project on the computer, then making a ZIP file to import the project on another SAP which has no access to GitHub.
Thanks a lot for Library.
Kindly regards,
Nicolas D. @neooblaster
Hi @larshp,
I am unable to use Local Class Variables in my class due to RETURNING Parameters restriction. With RETURNING addition, only Data Dictionary Types can be declared.
When i changed it to allow EXPORTING Parameters, it allowed me to use local class variables.
Now, the problem is, the local types are not interpreted correctly in the BUILD_PARAMETERS method.
For example, i have a method that takes KUNNR as input and TT_OUTPUT as output.
So, it gives a DUMP because BUILD_PARAMETERS reads TT_OUTPUT as string, whereas my method is expecting a table type.
To make it work, i had to convert it to JSON string and pass it as output.
Any advice will be appreciated
The current implementation builds definitions/models as following:
definitions: {
TY_STRUCTURE: {
type: "object",
properties: {
DATA: {
type: "object",
properties: {
FOO: {
type: "string"
},
BAR: {
type: "string"
}
}
}
}
}
}
There ist always a bracket with "DATA:", then "type: "object""
When I look at the swagger specification
https://swagger.io/specification/v2/
and the swagger petstore sample, i cannot find any DATA bracket.
Would it be better it it was like this?
definitions: {
TY_STRUCTURE: {
type: "object",
properties: {
FOO: {
type: "string"
},
BAR: {
type: "string"
}
}
}
}
}
}
What do you think?
Now that we have a great
ABAP OpenAPI Client Generator in ABAP
Is it planned to "upgrade" the coding to serve OPEN API 3.0 instead of Swagger 2.0?
Regards,
Jens
somehow the method implementations should have a possibility to set the http status code?
The import with abapGit fails. The document zdemo_json_xml_to_upper.xlst.source.xml produces the runtime error cx_sy_ref_is_initial.
The "abapGit" tag in this document is missing.
The stack trace is attached:
error_abapgit.txt
looks like http://petstore.swagger.io/ has been updated
UPDATE: hmm, looks like the CORS handling has been changed, which makes it difficult
currently it is just an integer
in swagger spec/service
Hi there,
I stumbled over this awesome repo while I was searching for a better way to put some more info to my recent REST-Service. Unfortunately I'm struggling a little bit to get things to work.
I use the CL_REST_HTTP_HANDLER class and created multiple handler classes which are attached to a CL_REST_ROUTER via certain paths and that's where my problem starts. I question myself - Is there a way to generate a spec for multiple paths/classes at once? (considering the use CL_REST_HTTP_HANDLER and CL_REST_ROUTER )
Best regards,
Michael
Is there a way to read out sap parameter descriptions and show them in swagger ui?
Hi there!
I tried to assign a technical User in SICF to enable external Users to see the Page and authorize via the button if they want to test, but in Debugging I always see the technical User in sy-uname. So if the User needs to Log On with his SAP User to reach the Page, the Authorize Button is not really needed. Is there a way to remove the button?
regards,
Alex
I am trying to register different handler classes for one url path.
The reason is that I want to implement different versions of same class in one swagger ui
and include version (v2, v3) in path.
If the different classes have methods with the same name I get a "duplicated mapping key".
Do you have any idea? What can I do?
looks like the content type is "text/html" for json, should it be Content-Type: application/json instead?
also useful for performance analysis and debugging
optional query parameters are set as required in specification
Hi Lars,
The spec hyperlink is not working anymore.
It is directing to about:blank
Attached is my spec doc
swagger: '2.0'
host: 'sdev4.sapr3.ad.davey-tree.com:8400'
info:
version: 1.0.0
title: Davey Web Services
description: Davey Web Services REST functions
basePath: /sap/bc/zvci_repository
tags:
- name: ZVCI Web Services
description: Everything about ZVCI Web Services
schemes:
- https
consumes:
- application/json
produces:
- application/json
paths:
/swag/get_tickt_details:
get:
tags:
- ZVCI Web Services
summary: Get Ticket Details
description: ''
parameters:
- name: TICKETNO
in: query
description: ''
type: string
required: true
produces:
- application/json
responses:
'200':
description: successful operation
'500':
description: error
/swag/get_customer_texts:
get:
tags:
- ZVCI Web Services
summary: Get Customer Texts
description: ''
parameters:
- name: IV_KUNNR
in: query
description: ''
type: string
required: true
produces:
- application/json
responses:
'200':
description: successful operation
'500':
description: error
definitions: {}
In the current implementation exceptions of the handler method have to be of type zcx_swag.
The only limitiation for using methods as handler methods is that they should ony have one returning parameter.
I think it would be better to catch cx_root so that we also can use handler methods throwing non zx_swag exceptions.
`
TRY.
CALL METHOD <ls_meta>-obj->(<ls_meta>-meta-handler)
PARAMETER-TABLE lt_parameters.
CATCH zcx_swag INTO lx_swag.
mi_server->response->set_cdata( |{ lx_swag->status_code }, { lx_swag->get_text( ) }| ).
mi_server->response->set_status( code = lx_swag->status_code reason = lx_swag->get_text( ) ).
RETURN.
ENDTRY.
`
@larshp What do you think?
Hi @larshp
Suppose, we have a Parent SICF Node and several child nodes under it. And if we run the swagger.html extension on the parent node, we should be able to see all the web services below it.( Similar to http://petstore.swagger.io/) . How to achieve that?
While using 2 tag descripotions with externalDoc for the first one there is a closing bracket missing
at the end of the second description (before ] bracket)
"name":"contacts_controller",
"description":"Kontakte"
,
"externalDocs": { "description":"Blackmans Page",
"url":"http://blackmancc.io" }
}
,
{
"name":"test",
"description":"Test"
],
so it is possible to inherit and overwrite/load
dump if the handler method does not have any input or output/returning parameters
SELECT * FROM seosubcodf
INTO TABLE ls_meta-parameters
WHERE clsname = ls_meta-classname
AND cmpname = ls_meta-meta-handler
AND sconame NOT LIKE 'ZCX_%'
ORDER BY PRIMARY KEY.
ASSERT sy-subrc = 0.
in CALL TRANSFORMATION it requires a name, the name can be removed in the json text, and added on the inbound side
Is this an intentional exclusion that they are not mapped in MAP_ELEMENT method of ZCL_SWAG_MAP_TYPE?
Hi larshp,
I saw some tests are failling (7.51)
"test" test method on zcl_swag
"char" method on swag_map_type
Overall the coverage is not that good too...
Hi Lars,
I am unable to decide the list of classes that i have to implement and in which flow to make it work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.