-
Notifications
You must be signed in to change notification settings - Fork 8
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
Incorrect go code generated #23
Comments
Thanks for your issue, I just quickly reviewed your questions. Q: I usually use generators only for DTOs Q: Is it a good idea to use tags for names? Regarding the code-generation issue, I need some time to review it. |
Just looked deeper and found some issues, will look into it. |
Tags issue fixed in v1.31, also there are some issues with anonymous slices and maps. Also, found that you have a 5XX status code, so it won't work anyway. |
Thank you for your effort I will try it. I also found another swagger that panicked your code so I will try it with the new version. Yes, you are right the "5XX" is not correct - the API is not mine and I wrote email about this a week ago. Also about properties without types. |
Hello again,
or even empty type declaration for DepositLayout
I uploaded the swagger to swaggerhub to check these types and it looks OK. However, I used
So, the swagger-codegen-cli-v3 used only last item from "allOf construction, instead merge two object definitions together.
I uploaded swagger to swaggerhub.com and DepositLayout is shown complete with all properties. But when I clicked to download go client, the structure DepositLayout is the same as from swagger-codegen-cli-v3. So, the schema of OCS is a tough nut to crack.... Currently I have to give up my usual approach (generate model only objects from swagger to extra package to keep them sync with swagger) and I generate model using swagger-codegen-cli-v3 to extra directory in the project and manually copying selected part to my model. I would prefer to generate model via go-oas3, because I run swagger-codegen-cli-v3 using docker to keep my environment java free, but there is no easy way to format go file with syntax errors produced by go-oas3. |
Hello, sorry for the delayed response (I've missed notification somehow). |
Actually, "allOf" feature supported - https://github.com/mikekonan/go-oas3/blob/main/generator/type.go#L60, but I'm now sure it works properly with objects, need to check it. |
Hello,
I read about this project in go subredit and I like the idea of go generator from swagger.
I tried to check it on a little bit complicated API (https://openapi3.ocs.io/browse/index.html) I have to deal with (I'm not an author of API, just consumer).
It fails with:
The output is not quite clear (because it failed during formatting operation, but the generated code printed on stdout is suspicious. For example:
For the first sight it looks like using the first item from "tags" as the name of function without sanitizing. Is it good idea to use tags for names?
And maybe one more question: I usually use generators only for DTOs. The openapi-tool generator has the option to generate only model, without router. I think it should be fine to have the same option here as well. Sometimes go-chi is not desired router or other reason.
The text was updated successfully, but these errors were encountered: