Closed tfranzel closed 4 years ago
Hi @tfranzel. Sorry in advance. I have a lot of work at my job and on the side right now. That's the reason why I haven't reviewed and merged any PRs so far. To be honest, I didn't expect that people will use this library. In the near future, I'll try to allocate some time to merge and set up CI. Thanks.
Thank you for replying so quickly. Glad to hear that and i'm absolutely fine with that. Once released these things develop a life of their own :smile: i'm gonna leave the issue open for others who might be wondering.
FYI: django-rest-polymorphic
is now supported by our DRF OpenAPI3 schema generation tool https://github.com/tfranzel/drf-spectacular
@tfranzel , the autogenerated doc seems to be missing the resourcetype
field.
@vaibhavhrt cannot confirm your statement. This is always added as propertyName
. If you change the default resource_type_field_name
, it is is naturally different.
It's there in the schema, but not in request/response body. While creating objects we need to send the resourcetype
field too in request body.
@vaibhavhrt it is part of the generated component. That component is referenced both in requests and response bodies. no need to have it there explicitly. This approach works without issue for both swagger-ui ad swagger-codegen.
@tfranzel Right, if you look at the schema on Swagger UI, it shows only one field in request body, i.e. company_name
, but to be able to create an object our request needs to be something like this:
{
"company_name": "string",
"resourcetype": "LegalPerson" // or "NaturalPerson"
}
We can figure out that we need to send resourcetype
field by looking at the schema tab, but most of the time the person looking at the doc is someone who is working on the frontend, and they just look at the request/response body.
I see your point. It is a design choice by swagger-ui though. Looking at the schema, its clearly recognized as a polymorphic model. We have no simple way of influencing the choice of the example value there (except for providing explicit examples that can be selected via dropdown). I think they just use the first entry of the oneOf
for that.
Hi, thank you for this awesome extension to DRF and django-polymorphic. we use it extensively!
Given that there has been no signal for quite some time, i'm wondering whether this repo is unmaintained. @apirobot would you mind telling us the current status?
is there a chance of merging #21 and resolving the other open issues?
Thanks