This repository was archived by the owner on Dec 25, 2024. It is now read-only.
This repository was archived by the owner on Dec 25, 2024. It is now read-only.
[BUG] ThisSchema.additionalProperties = ThisSchema causes StackOverflowError #2
Closed
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
ThisSchema.additionalProperties = ThisSchema causes StackOverflowError
When an object schema defines additionalProperties as itself we get a StackOverflowError
Sample spec
Player:
type: object
description: a model that includes a self reference this forces properties and additionalProperties
to be lazy loaded in python models because the Player class has not fully loaded when defining
properties + additionalProperties
properties:
name:
type: string
enemyPlayer:
$ref: '#/components/schemas/Player'
additionalProperties:
$ref: '#/components/schemas/Player'
This bug probably also exists for ArrayModels containing themself in items
openapi-generator version
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix
The overflow happens when creating example values for schemas. Build in the ability to detect a cycle where we return to a previously visited schema and and halt in teExampleValueRecursive
Metadata
Metadata
Assignees
Labels
No labels