-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack Overflow occurs with cyclic component links in OpenAPI Spec #34
Comments
Thanks! This is indeed a bug / design problem - it did not occur to us that people would express 'infinite nesting' of schemas, so we eagerly generate example array items for the corpus. Since this is probably not a very quickly-fixable thing, my guidance for now would be to express the depth limit as part of the API specification (assuming arbitrarily deep subsubsub(...)subcategories are not a use case you actually use). So you could define schemas for Subcategory and Subsubcategory, where the latter does not have the 'subcategories' field, and it would work. "components": {
"schemas": {
"Category": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "Electronics"
},
"subcategories": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Subcategory"
}
}
}
}
"Subcategory": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "Electronics"
},
"subcategories": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Subsubcategory"
}
}
}
}
"Subsubcategory": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "Electronics"
}
}
}
}
} |
Yea, i already did that. The problem is that I encountered it on a project with 12k lines :) I think until this is fixed it is worth writing about it at least in the documentation. |
Describe the bug
When trying to generate the initial corpus for openapi with cyclic links li in request body
Versions:
To Reproduce
Given an OpenAPI specification with cyclic links in the request body:
To reproduce the error, run:
Expected behavior
Proper handling of cyclic links in request bodies or guidance on how to manage cyclic links in the corpus generation process.
The text was updated successfully, but these errors were encountered: