prism
prism copied to clipboard
Error: Schema size exceeded
Hello,
I am getting Error: Schema size exceeded
And I can't figure out why.
repro script here
const { getHttpOperationsFromSpec } = require('@stoplight/prism-cli/dist/operations');
const { createClientFromOperations } = require('@stoplight/prism-http/dist/client');
(async function main () {
let operations = await getHttpOperationsFromSpec('src/mocks/swagger.json');
operations = operations.filter(operation => operation.path === '/api/candidate-role')
console.log('operations', operations)
const client = createClientFromOperations(operations, {
mock: true,
});
client.get('/api/candidate-role').then(console.log);
})();
swagger schema here: https://prod.betterleap-api.com/api-docs-0001-json
Thanks
@EdVinyard can you try to reproduce?
I've reproduced this issue. We're bumping into a limit hard-coded into json-schema-sampler
that limits the number of "nodes" in the response to 1000: https://github.com/stoplightio/json-schema-sampler/blob/master/src/traverse.js#L20
Switching Prism into dynamic mock mode gives me a different error, so I suggest we need to:
- (at least) return a much more descriptive error, and
- (probably) identify exactly what it is about this schema that breaks our mock generation.
Hello,
I am working on generating mocks for openapi specifications for which sometimes have a very large response schema and I also get the error:
{
"type": "https://stoplight.io/prism/errors#UNKNOWN",
"title": "Schema size exceeded",
"status": 500,
"detail": ""
}
Are there any open working lines in order to modify by configuration these default values that are currently hardcoded? https://github.com/stoplightio/json-schema-sampler/blob/master/src/json-schema-sampler.js#L6
I urgently need a solution to this problem and will probably work on a fork as long as the configuration of these values is not enabled.
Thanks!
Todo:
- Improve error messaging
- Create CLI parameter for expanding the node limit
Hey team! Please add your planning poker estimate with Zenhub @chohmann @EdVinyard @daniel-white @brendarearden
Caught the same behavior
json schema sample is now doing
Schema size exceeded: over ${options.startingTicks} properties. For more info, visit https://docs.stoplight.io/docs/platform/zumkfdc16oypw-json-schema-editor#generate-examples
@ryotrellim is this a message we want for prism as well?
@hainessss @leonovi @hernanpis-inditex
can you please provide us with a spec document that has this problem? thanks!
This triggers it for me
https://docs.medusajs.com/api/store -> spec
docker-compose.yml
services:
mock_store:
# https://docs.medusajs.com/api/store
image: stoplight/prism:4
command: >
mock -p 4010 --host 0.0.0.0
https://docs.medusajs.com/redocusaurus/plugin-redoc-0.yaml
/store/carts/1
{
"type": "https://stoplight.io/prism/errors#UNKNOWN",
"title": "Schema size exceeded",
"status": 500,
"detail": ""
}
saving spec for future plugin-redoc-0.yaml.txt
Unfortunately, i won't be able to provide a schema ☹️. But perhaps i will be able to make a scheme manually, with the same level of nesting and the count of nodes, if there is time.
Attempt to fix Prism build problem due to Stoplight's fork of HTTPbin used during the build: https://github.com/stoplightio/httpbin/pull/4