Schema size error while example rendering
Dear colleagues, I'm trying to generate the example preview over OpenAPI 3.0.x specification and getting an error:
Example cannot be created for this schema Error: Schema size exceeded
The API response body for this example contains an array of objects with such a structure:
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Quote"
This Quote object is rather big - about 80 parameters, some of them with nested objects. The whole list is near the 250 parameters. If I'm rendering only a single Quote schema object, an example generates correctly, but for the collection in the endpoint view falls.
In smaller specifications, this array example works well. E.g., for this case:
/user:
get:
summary: Get users list
operationId: getUser
responses:
"200":
description: User Created
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/User"
with this body:
components:
schemas:
User:
title: User
type: object
properties:
id:
type: integer
description: Unique identifier for the given user.
firstName:
type: string
lastName:
type: string
email:
type: string
format: email
dateOfBirth:
type: string
format: date
example: '1997-10-31'
emailVerified:
type: boolean
description: Set to true if the user's email has been verified.
createDate:
type: string
format: date
description: The date that the user was created.
required:
- id
- firstName
- lastName
- email
- emailVerified
Elements generates this example:
[
{
"id": 0,
"firstName": "string",
"lastName": "string",
"email": "[email protected]",
"dateOfBirth": "1997-10-31",
"emailVerified": true,
"createDate": "2019-08-24"
}
]
Could you, please help, how can I increase this limit/schema size?
Hi Same issue with my GUI as well, the example as below Well, here is an example of a payload for the blueprint simple_launch API endpoint. I don't know that the payload will look like for launching a marketplace item. That's the purpose of this ticket.
Payload for blueprint simple_launch api endpoint - (json)
{ "spec": { "app_profile_reference": { "kind": "app_profile", "name": "Default", "uuid": "64b87432-97f7-403c-8ee9-ba7cebea13ac" }, "app_description": "Test of api provisioning", "app_name": "SMS_API_test_QA", "runtime_editables": { "variable_list": [ { "description": "", "uuid": "b7986349-527f-4050-8135-780bc90f97e2", "value": { "value": "[email protected]" }, "context": "app_profile.Default.variable", "type": "LOCAL", "name": "recipient" }, { "description": "", "uuid": "474ef81b-959c-4a30-9072-0155b576cde3", "value": { "value": "US" }, "context": "app_profile.Default.variable", "type": "LOCAL", "name": "geography" } ] } } }
Shows

Our customers are escalating this issue, whats the workaround to load this example?
@teluren Can you please share the OpenAPI file for this?
Hi Naumen, to save time I am attaching the API definitions for my issue.
In bug triage, it was decided to address this via better documentation of allowable schema size
Thanks for the update, Mathew. Once the documentation is complete, please share the link here, so that I can share it with my customers.
Hello, @mnaumanali94, @matthewsac. My apology for the long reply. Unfortunately, I can't share my full Quote model because of our security.
If you have found the root cause by @smitabh84 example, may I ask you to add the config parameter for the schema size? Or just tell the point in code where to find for our developer, please?
Is this error good? If not I will change words as you see fit.
Hi @eadamsatx, Could you, please, give some more details? You've exceeded the possible maximum limit of the schema, up to 1000 attributes? If yes, this seems good, we don't have such massive objects yet.
@teluren That is correct- 1000 attributes was the maximum example size. Last week, we raised that to 6000. If you are running into this error, it's likely that you have a long chain of references in the model you're returning.
@pamgoodrich Can you document this somewhere that I can link to from the error message?
Can you please share the documentation link here?
@eadamsatx
We added this here: https://docs.stoplight.io/docs/platform/zumkfdc16oypw-json-schema-editor#generate-examples
is this the section? It still shows 1000 and more.
Can you please clarify if the 6000 and more changes are done? or still not merged?
Can you please help me understand how do I get to know my current Schema property size in the YAML shared above? And as this is an existing setup what can we do to not show this error on the GUI for schemas with more than 6k properties? Any workaround?