-
Notifications
You must be signed in to change notification settings - Fork 601
Bogus Models generated in schema #595
Comments
Is swagger-codegen expected to work with the schemas that django-rest-swagger 2.* produces? I'd hate to be wasting my time here, and I've seen some passing comments suggesting that response schemas are required for the codegen client to correctly build models. I've not dug in to verify whether that's true though. |
If I were to guess, I'd say that the following part of the generated schema... ...
"in" : "body",
"name" : "data",
"required" : false,
"schema" : {
... ...is probably the reason for generating a bunch of "data" models. Now, I have no idea whether or not CoreAPI is generating the correct Swagger schema, or if this issue has already been fixed. I'm not familiar enough with either specifications to be able to make that judgement call. |
@paultiplady This field is set by the openapi-codec and, I don't think there is any particular reason why this field couldn't be named after the serializer. See https://github.com/core-api/python-openapi-codec/blob/master/openapi_codec/encode.py#L167. Feel free to open an issue on the codec repo / propose a pull request there and reference this issue. Thanks. |
Thanks for digging in -- hadn't realized that much was generated in the CoreAPI code. I'll chase this down on the CoreAPI side. |
I'm trying to use swagger-codegen to generate a Python client from my django-rest-swagger schema (django-rest-swagger==2.0.7, djangorestframework==3.5.3).
I am getting a lot of models named
Data*
, and no client models related to my actual API models.For an example of an endpoint that's being rendered incorrectly, the following CoreAPI endpoint:
Renders to this path in the swagger.json:
Note the
"in": "body", "name": "data"
in the generated swagger JSON.The output model has the correct fields, but incorrect name:
Any suggestions for what might be going wrong, or requests for further diags to collect?
The text was updated successfully, but these errors were encountered: