Question

6
Replies
973
Views
Close popover
Attila Donath (AttilaDonath)
Cognizant
Pega Lead System Architect
Cognizant
CH
AttilaDonath Member since 2016 10 posts
Cognizant
Posted: January 27, 2017
Last activity: February 12, 2017
Closed
Solved

Pega API Swagger document is corrupted

Hi,

While trying to use the default Pega API Swagger document for client library generation, I noticed that the file has some errors (Pega version: 7.2.1).

I downloaded the JSON file from:
[my domain]/prweb/PRRestService/unauthenticatedAPI/v1/docs

And pasted the content to the online Swagger editor:
http://editor.swagger.io/#/

The errors and warnings are:

1.) The file containes wrong references to definitions:

e.g. "$ref": "Error" instead of the correct "$ref": "#/definitions/Error"

2.) There were type definitions used together with $ref:

e.g.

... {
        "type": "array",
        "$ref": "#/definitions/CaseTypesResponse"
}

In that case "type" is ignored and it generates a warning.

3.) The definiton "Content" has no properties defined.

That causes the generated Swagger API client (Swagger Code Generator, Python language) to return an empty dict for cases' content as the generated model class has no properties.
I suggest to simply use

"content": {
    "type": "object"
}

instead of

"content": {
    "$ref": "Content"
}

if the content should be a flexible object.

Please correct the Swagger definition in a later release.
I attached the original file (docs.json) and the one modified by me (docs_fixed.json). (I had to suffix the files with ".txt" so that I can upload them.)

Thanks,
Attila

Moderation Team has archived post,
Close popover This thread is closed to future replies. Content and links will no longer be updated. If you have the same/similar Question, please write a new Question.