Question
Cognizant
CH
Last activity: 12 Feb 2017 20:00 EST
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.
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