laravel-openapi icon indicating copy to clipboard operation
laravel-openapi copied to clipboard

Generation hangs when schemas referencing each other

Open nandi95 opened this issue 2 years ago • 2 comments

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.

nandi95 avatar Aug 27 '21 15:08 nandi95

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.

nandi95 avatar May 17 '22 12:05 nandi95

Local webserver crashes and restarts with circular referenced schemas

dowmeister avatar Jun 15 '22 12:06 dowmeister