openapi-processor / openapi-processor-gradle

openapi-processor gradle plugin
https://docs.openapiprocessor.io
Apache License 2.0
3 stars 1 forks source link

Fetch OpenAPI Spec from remote #21

Closed danielkocot closed 3 years ago

danielkocot commented 3 years ago

Hi,

by the way great effort so far. How can I make the 'processSpring' depend to another task that has to be done first? Because I would like to download the spec within build step.

Best, Daniel

hauner commented 3 years ago

Thanks :-)

in theory you should be able to use an http(s) url as apiPath. This worked for me on a simple remote api with $refs. This will probably not work if you need authorization.

I played a bit with gradle and creating a task dependency works like this:

tasks.register('foo') {
    doLast {
        println 'foo'
    }
}

afterEvaluate {
    tasks.processSpring.dependsOn('foo')
}

The plugin creates the processSpring task in an afterEvalute block. It looks like it is not visible outside/before afterEvaluate.

With all the lazy task creation I did not expect this. ;-)

danielkocot commented 3 years ago

If I set a url as value of apiPath I get an error message Cannot convert URL to a file. I will have a look at this task dependency thing. Thanks!