Ask a Question

Data model definition?

jnazander
New Member

Data model definition?

Why doesn't Swagger Inspector generate the date model definition for API responses? Is it a bug or just not implemented?

 

Correct definition:

 

                "responses": {
                    "200": {
                        "description": "successful operation",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/Pet"
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid status value"
                    }
                },

Swagger Inspector generated code:

 

      responses:
        default:
          description: Definition generated from Swagger Inspector
13 REPLIES 13

Hi,

 

Yes, we do limit this, and we discovered this was what Vineeth was running into as well. For requests and responses over 4KB, we do NOT save the request or response in either the history or for use when creating the API Definition.

 

We can certainly consider adding a feature to allow larger responses and requests for definition creation.

 

Do you have a size limit recommendation? (I'd think you wouldn't want the definition to have thousands of lines of example responses.)

 

Thanks for the feedback!

Shannon Wallace
Product Manager
SmartBear Software

4K limit seems reasonable on examples, but having a large data set shouldn't prevent the model creation. I just pulled FB data and there was a lot of repeating data in arrays. The model would be the same size regardless of the array size. Also, it would be nice to get some type of message or comment in the generated file that about why the example and models are missing.

I've followed the advice in this post and limited my json response to < 4K but all I see for the model in the API in SwaggerHub is: 

 

content:
application/json; charset=utf-8:
schema:
type: string
examples: {}

 

My json response is:

 

[
{
"EventCode": "eventcode123",
"EventDate": "/Date(2030050800000+0100)/",
"EventId": "1181270",
"EventName": "Phoenix Demo Event",
"EventTypeId": null,
"FundraiserAddressCountry": "United States of America",
"FundraiserAddressCounty": "AK",
"FundraiserAddressLine1": "Chunxi Street",
"FundraiserAddressLine2": "",
"FundraiserAddressLine3": null,
"FundraiserAddressPostcode": "51000",
"FundraiserAddressTown": "Chengdu",
"FundraiserAllowFurtherContact": true,
"FundraiserEmailAddress": "account0103015940@null.activenetwork.com",
"FundraiserFirstName": "First name",
"FundraiserLastName": "Last name",
"FundraiserTitle": "None",
"FundraiserUserId": "72401033",
"FundraisingPageCreated": "/Date(1546473600000+0000)/",
"FundraisingPageExpiry": "/Date(2038003200000+0100)/",
"FundraisingPageId": "11536596",
"FundraisingPageStatus": "Active",
"FundraisingPageTarget": 0,
"FundraisingPageTitle": "title20190103020109",
"FundraisingPageUrl": "https://www.justgiving.com/fundraising/https://www.justgiving.com/fundraising/page0103015940",
"ThirdPartyGivingPartner": 0,
"ThirdPartyGivingProcessorId": "37c3e4dd-cd06-e811-80f2-3863bb358f68"
}
]

 

Any further advise much appreciated.

 

UPDATE: I've just tested with much smaller and simpler JSON and still no response model defitnition other than sting:

JSON was: {name:"steve",postcode:"HP159JH"}

I am still having this issue seeing no data model definition. I used the Star Wars API to test it out just like in the Online Tutorials. I am seeing a successful response but still no data model. Is there something that I need to do or an options to check to get it? Any help would be greatly appriecated!

cancel
Showing results for 
Search instead for 
Did you mean: