danieleteti / delphimvcframework

DMVCFramework (for short) is a popular and powerful framework for WEB API in Delphi. Supports RESTful and JSON-RPC WEB APIs development.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MVCSwagResponses isArray bug

st1gok opened this issue · comments

Hi!
I`m used RC5.
If set first method MVCSwagResponses isArray=true then all methods next following him also return array, even if they set isArray=false.

And otherwise if first method MVCSwagResponses isArray=false then all next methods also return not array.

Example:

[MVCPath('/profiles')]
[MVCSwagSummary('Profile', 'List all profiles', 'getProfiles')]
[MVCSwagResponses(200, 'Success', TProfile, True)]
[MVCSwagResponses(500, 'Internal Server Error')]
[MVCHTTPMethod([httpGET])]
procedure GetProfiles;

[MVCPath('/profiles/($uid)/activation')]
[MVCHTTPMethod([httpPOST])]
[MVCSwagParam(plPath, 'uid', 'profile id', ptInteger)]
[MVCSwagResponses(200, 'Success', TProfile)]
[MVCSwagResponses(500, 'Internal Server Error')]
[MVCSwagSummary('Profile', 'activate profile from device', 'activateProfiles')]
procedure Activation(uid: String);

[MVCPath('/profiles')]
[MVCSwagParam(plBody, 'entity', 'Profile object', TProfile)]
[MVCSwagSummary('Profile', 'Create or update profile', 'createProfile')]
[MVCSwagResponses(201, 'Success', TProfile)]
[MVCSwagResponses(500, 'Internal Server Error')]
[MVCHTTPMethod([httpPOST])]
procedure CreateProfile();

Does this happend also in the latest RC?

In RC6 same behavior. In result swagger.json is being created next Model:

"definitions": {
"Profile": {
"type": "array",
"items": {
"type": "object",
"required": [
"uid",
"carId"
],
"properties": {
"uid": {
"type": "string",
"description": "profile id"
},
"carId": {
"type": "string",
"description": "car id in navigation system"
},
"date": {
"type": "integer",
"description": "date in timestanp"
},
"token": {
"type": "string",
"description": "fcm token"
}
}
}
}
}

And all methods ref to her

OK, thank you. We'll look at this.

I identified the cause of this error. I'm already working on it.