-
Notifications
You must be signed in to change notification settings - Fork 35
OpenAPI codec does not support definitions for nested objects #37
Comments
I fixed that for my local branch, now a bit messy, when I'm done with clean-up and all the corner cases, I'll come up with the PR. |
If I understand correctly encode.py should be able to receive a coreschema.schemas.Schema object and return a dictionary as defined in the link above. I wrote a function that does that to add the objects definitions in swagger, it is not complete but it meet my needs for now, it may be used as an initial commit to start supporting this, if you think this may be accepted into the project I can prepare a PR |
@tomchristie, I'm really sorry for being kinda annoying, but would you mind to take a look at the PR. |
@xxmatyuk you may check what I wrote here: https://github.com/tovmeod/drf-swagger-missing I didn't prepare a PR, but we can compare notes. If I understood correctly you are trying to autogenerate the definitions inside the encoder, my approach was that the document should already have a list of definitions, which in my case it was the user which defined manually, but they could as well be automatic, or a combination I'm using the definitions for reference in the responses, so for now I am writing them manually and passing them to the Document object, the document object shouldn't care how the definitions list was created, much less the encoder. Can you explain the logic of what you wrote? how are the definitions generated? what about field descriptions? |
@tovmeod sorry for such a long delay answering to you. I'll clarify each step, but so far, you should not perform any manual steps creating definitions, but I'll be clear on that later on. |
I made a function that create definitions using the serializer from each view, each serializer have two definitions, read and write, since there are read_only fields and also write_only fields |
Came here to post this bug. Will look at the PR next week to see if it solves our use-case. |
@richard-reece I still want to make it, since I came up with the PR, so please wait a bit. Will finish this weekend. |
According to official spec, there's definitions objects.
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#definitionsObject
As a result of absence of definitions it's not possible to use references in generated schema.
The text was updated successfully, but these errors were encountered: