Skip to content
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

Support url for inputFile #167

Open
rverma-nikiai opened this issue Apr 3, 2019 · 1 comment
Open

Support url for inputFile #167

rverma-nikiai opened this issue Apr 3, 2019 · 1 comment

Comments

@rverma-nikiai
Copy link

Describe the feature

swagger-codegen-cli allows to pass an url for input file specifications and can generate over that. Swagger maven codegen plugin supports the same so as open api plugin.

Why do you want the feature?

This will bring feature parity and is very useful in generating client directly from public definition urls.

@LangInteger
Copy link

LangInteger commented Sep 2, 2020

Before this feature is done, some work arounds are available to match this requirement

task downloadSomething(type: MyDownload) {
    sourceUrl = 'http://20.20.20.66:32601/v2/api-docs?group=Default'
    target = new File('petstore.yaml')
}

generateSwaggerCode.dependsOn downloadSomething

class MyDownload extends DefaultTask {
    @Input
    String sourceUrl

    @OutputFile
    File target

    @TaskAction
    void download() {
        ant.get(src: sourceUrl, dest: target)
    }
}

swaggerSources {
    petstore {
        inputFile = file('petstore.yaml')
        code {
            language = 'spring'
        }
    }
}

Reference: https://stackoverflow.com/questions/17123606/how-to-download-external-files-in-gradle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants