-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Generation: types
generation contains application
boilerplate.
#215
Comments
This is intended behavior, as this is used by AppController ( I didn't think of the possibility of having multiple service on the same package, firstly because there would be multiple AppController and multiple UserController that would collide with each other, secondly because I did the Or I can add it to the documentation, but it wouldn't help your case. Maybe I should duplicate the code and put it with each controller ? I'll think about it in the next days, but I think the merge with {app/user} controller may be the most suitable solution. Any suggestion is welcomed :) |
Basically, in our project we are trying to follow the Domain-Driven Design; this means pretty strict separation of domain entities, infrastructure code and DTOs. We are generating DTOs from specs, and generating Handlers from spec in another part of the package structure. Moreover, atm we do have our own handlers already written; the idea right now is to change types to the types from the spec, and align the spec between producer and consumer services (owned by different people). It does make sense to me therefore to have the |
I makes much more sense to me now ! I'll refactor things to match your case and I'll ask for your confirmation after that :) |
just a suggestion while i was checking out this project, if the above template refactor does happen, it might be worth exposing some sort of interface to be able to marshal to and from the types from the brokers message ie. and that way avro/protobuf support could technically be shimmed out messages:
userSignedUp:
payload:
schemaFormat: 'application/vnd.apache.avro;version=1.9.0'
x-go-type: UserSignedUpAvro
x-go-type-import:
path: abc.xyz/repo/events/codegen
and then within my That way somebody would be able to "bring" their own types outside of json schema |
I suppose this is more of an open question / discussion issue. Right now, when
asyncapi-codegen -g types
is run, there's much more then just types that is being generated:Is this intended behaviour? We are actively using type generation from
oapi-codegen
to create DTOs from specs; the problem with the approach above is two-fold:controller
.My suggestion would be either to remove generation of that code on
-g types
calls, or to explicitly add that to the documentation. This way it will be clear that the target generated files cannot be in the same directory.The text was updated successfully, but these errors were encountered: