Skip to content

Reports Shared DataSets Endpoint does not work in the go client generated from swagger. #270

Open
@reynolga

Description

@reynolga

I'm not sure where the right place to put this issue - The endpoint /Reports({Id})/SharedDataSets does not work with the go client generated from the swagger file. The response models in the swagger file do not match the response from the rest endpoint.

Version Info:
"version": "2.0",
"title": "SQL Server 2017 Reporting Services REST API"

As an example:
The response json from the endpoint returns:
{
"@odata.context": "http://zzzzz.com/Reports/api/v2.0/$metadata#DataSets",
"value": [
{
"Id": "3asdfb1c-e85c-4006-a616-04a5asdf4",
"Name": "Client",
"Description": null,
"Path": "/Datasets/ClientID",
"Type": "DataSet",
"Hidden": false,
"Size": 0,
"ModifiedBy": null,
"ModifiedDate": "0001-01-01T00:00:00Z",
"CreatedBy": null,
"CreatedDate": "0001-01-01T00:00:00Z",
"ParentFolderId": null,
"IsFavorite": false,
"Roles": [],
"ContentType": null,
"Content": "",
"HasParameters": false,
"QueryExecutionTimeOut": 0
}
]
}

You can also see from the swagger documentation that the example does not match the actual response:
https://app.swaggerhub.com/apis/microsoft-rs/ssrs/2.0#/ under Get Reports({Id})/SharedDataSets
image

In the swagger I had to change the endpoint definition:
for - "/Reports({Id})/SharedDataSets":
From:
"responses": {
"200": {
"description": "Ok",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/DataSet"
}
}
},

To:
"responses": {
"200": {
"description": "Ok",
"schema": {
"$ref": "#/definitions/ODataReportSharedDataSets"
}

and - ODataReportSharedDataSets is
"ODataReportSharedDataSets": {
"type": "object",
"properties": {
"@odata.context": {
"type": "string"
},
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/DataSet"
}
}
}
},

because the result is nested in a value object.

Also, the DataSet item has a Catalog Item. This was also missing a Roles array that was being returned in the response but is not in the definition. I added to the CatalogItem
"Roles": {
"type": "array",
"description": "An array of Role objects that specifies the roles that are allowed to view the CatalogItem.",
"items": {
"$ref": "#/definitions/Role"
}
},

After these changes the client was able to marshal the json into the go objects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions