You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When viewing this with Swagger UI or Redoc, the type field's example is just "string", which is quite confusing if you don't know what the actual type should be.
I've looked over the rest_polymorphic extension source code and I think that a potential change would be to update the resource_type_schema to something like:
Where resource_type is a new argument to the build_typed_component() method.
I'm not sure if this is the right approach, I've also tried fixing this using the @extend_schema_serializer decorator, but as mentioned in #649 it is not straight forward and I didn't get too far.
I'd appreciate any insight on how to go about this, thanks!
The text was updated successfully, but these errors were encountered:
Hi, I think I get your point but you leave out an important detail. The Typed components are not used in isolation. They are always paired with a discriminator, which kind of indirectly specifies what is supposed to be used:
Also, there is not really a good (and portable) way to describe a "fixed" values in OpenAPI 3.0. I think this was made easier in 3.1. This would be the basic requirement to ever consider changing anything.
Describing this as an example value might sneak it into the SwaggerUI but this does not seem to be too dependable.
Currently the rest_polymorphic extension generates OAS components looking like this:
When viewing this with Swagger UI or Redoc, the
type
field's example is just"string"
, which is quite confusing if you don't know what the actual type should be.I've looked over the rest_polymorphic extension source code and I think that a potential change would be to update the resource_type_schema to something like:
Where
resource_type
is a new argument to thebuild_typed_component()
method.I'm not sure if this is the right approach, I've also tried fixing this using the
@extend_schema_serializer
decorator, but as mentioned in #649 it is not straight forward and I didn't get too far.I'd appreciate any insight on how to go about this, thanks!
The text was updated successfully, but these errors were encountered: