1

Is it possible to skip generation of specific files using asyncapi-generator?

I am using the Go generator but I only need the payload.go. Right now it always generates all files:

handlers.go payloads.go publishers.go router.go server.go subscribers.go

The command I am using is:

$ docker run --rm -it \
-v ${PWD}/asyncapi.yaml:/app/asyncapi.yml \
-v ${PWD}/output:/app/output \
asyncapi/generator -o /app/output /app/asyncapi.yml @asyncapi/go-watermill-template --force-write
Jonathan R
  • 3,652
  • 3
  • 22
  • 40

1 Answers1

3

You cannot selectively generate only selected files yet. I encourage you to join the related discussion on GitHub

From what I understand is that you are interested only in models generation. So maybe you should just use directly the Modelina tool that is used there in go-watermill-template.

Modelina is already integrated with AsyncAPI CLI and you can do asyncapi generate models golang asyncapi.yml

Lukasz Gornicki
  • 609
  • 4
  • 12
  • is there a difference between this CLI and the one that is used in the Docker container asyncapi/generator? Because it seems like the commands differ. – Jonathan R Oct 13 '22 at 12:11
  • `asyncapi/generator` CLI will enter deprecation mode soon because we now want to have one `AsyncAPI CLI` for all: generation, conversion, and other stuff. But we will not remove existing docker images, so you can use them. Just at some point, we will stop updating them as `asyncapi/generator` will not have its standalone CLI. does it make sense? – Lukasz Gornicki Oct 17 '22 at 10:50
  • makes sense. but there is not yet a docker container for the `AsyncAPI CLI`, right? – Jonathan R Oct 17 '22 at 15:18
  • no docker yet, looking for help https://github.com/asyncapi/cli/issues/358. But check if you really need it. This time we want to provide as many alternative ways of installation as possible -> https://github.com/asyncapi/cli#installation – Lukasz Gornicki Oct 18 '22 at 11:15