Question

6
Replies
921
Views
AttilaDonath Member since 2016 9 posts
Cognizant
Posted: 3 years ago
Last activity: 3 years 7 months ago
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
Share this page LinkedIn