laravel-openapi
laravel-openapi copied to clipboard
Generation hangs when schemas referencing each other
When I'm defining my schemas and they're referencing each other the generation hangs. Consider the following example.
// UserSchema.php
return Schema::object('User')
->properties(
Schema::array('vehicles')->items(VehicleSchema::ref())->description('The related vehicles')->default(null),
)
// VehicleSchema.php
return Schema::object('Vehicle')
->properties(
Schema::object('user')->additionalProperties(UserSchema::ref())->description('The user relation')->default(null),
)
Both of these are implementing the Reusable interface.
Schema::object('user')->properties(UserSchema::ref())->nullable()->description('The vehicle owner'),
UserSchema::ref('user'),
Schema::object('user')->additionalProperties(UserSchema::ref())->nullable()->description('The vehicle owner'),
none of the baove solutions work either. Is this a bug @vyuldashev ?
Edit: self::ref()
also does not work.
Local webserver crashes and restarts with circular referenced schemas