-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
definitions
property in swagger.json contains only stubs
#77
Comments
Hi, If you can tell me what the "definitions" should look like, or how to generate them from the models, I can merge them in the swagger. |
I will get back to you shortly on this. |
Hello, I have been doing some research, and I like the idea of using marshmallow/marshmallow-sqlalchemy for json serialization, and marshmallow-jsonschema for json-schema generation (which would be used to populate the I am currently looking into how to wire this up in SAFRS. I would appreciate your insight into this. Thank you. |
Using marshmallow-sqlalchemy would be a good idea, but quite a big change. I started with safrs before marshmallow-sqlalchemy existed, so I never used sqlalchemy for safrs, but this would be a better choice if I'd have to start over now, there's also https://github.com/marshmallow-code/marshmallow-jsonapi that could be used for jsonapi serialization, but I haven't used that either because originally, I didn't use jsonapi in safrs v1 and I just added jsonapi functionality along the way. I think OAS "definitions" can be generated from the sqla models directly though. I'm just not familiar with the OAS definitions object. If you'd find the time to integrate marshmallow-sqlalchemy, I'd be very happy to accept patches, but this may require quite a lot of work. I actually wanted to rewrite safrs using different libraries (marshmallow, flasgger, webargs), but since this would take at least a couple of weeks work, I never got around actually doing this. Mainly because all the functionality I need does work now. |
I've added some more models to the "definitions". |
Hi @thomaxxl , |
Helllo Olivier, I forgot about this and I will look into it when I find some time the coming weeks. I'm not too familiar with using OAS to generate client code. I prefer to use a jsonapi client library to query the api. In my experience, generated code is hard to manage, but your use case may be different. |
Hi Thomas and thanks for your quick answer. |
Hello,
I noticed that the
definitions
property in the generated swagger.json seems to contain only stub objects, with a singledata
property of type string. This is problematic, because clients generated with swagger-codegen read thedefinitions
property to generate model code on the client. This is particularly important for typed languages. It would be better if thedefinitions
object were to contain complete JSON schemas for each endpoint.Is this in-scope for the project? if I were to contribute it, would you accept a patch?
Thank you for looking into this.
The text was updated successfully, but these errors were encountered: