Is it possible to pass API from some url to openapi-generator in gradle?

Viewed 417

I have some consumed.yaml API and now for generating classes with openapi-generator gradle plugin - i need to store this consumed.yaml file in my spring boot project. Short example of gradle task i use:

task clientApiGenerate(type: GenerateTask) {
    generatorName = "jaxrs-cxf-client"
    inputSpec = "path/to/consumed.yaml"
    ...
}

So the question - can i use URL for downloading API file, for example, from gitlab and then use it in this line:
inputSpec = "path/to/consumed.yaml"

The following versions are currently in use, but can be changed, if necessary:

  • gradle: 6.8.3
  • openapi-generator gradle plugin: 5.3.0
1 Answers

Looks like it's possible, as in this example bellow. Didn't tried it for myself. However it's simpler to have spec along implementation, but that depends on situation :)

Related