Skip to content

Creating templates is confusingly documented #276

Description

@philsturgeon

There are a lot of ways to get started with openapi-generator, and none of them seem to make it particularly easy to make your own template. I wouldn't consider creating a template to be advanced usage, I'd expect most people want to build their own, as generated code by somebody else usually fits like a borrowed suit.

As such it should be super duper clear how to go about making one, and after going thorugh the docs and trying things for almost two hours I'm not there.

Description

The customization docs say its easy, but dont really say what to do.

screen shot 2018-06-10 at 2 06 22 pm

I've cloned openapu-generator and im using this command:

java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
	-i ./specs/API.yml \
	-t ./templates/ \
	-g foo \
	-o ./out/foo

Inside ./templates/ is foo which is copied from ruby, but that doesn't seem to exist:

Can't load config class with name 'foo'
Available:
ada
ada-server

I tried putting the repo next to all the other templates in modules/openapi-generator/src/main/resources/ too and no dice.

Maybe the instructions here could be a little more explict, as I think whoever wrote it is very familiar with how things work already.

openapi-generator version

3.0.0

Command line used for generation
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
	-i ./specs/API.yml \
	-t ./templates/ \
	-g foo \
	-o ./out/foo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions