ePages-de / restdocs-api-spec

Adds API specification support to Spring REST Docs
MIT License
391 stars 103 forks source link

Share common attributes of extensions in the same class #231

Open 3ric-T opened 1 year ago

3ric-T commented 1 year ago

When using all three extensions porvided by this plugin, configuration often looks like:

openapi {
    title = project.name
    description = project.description.toString()
    version = project.version.toString()
    format = "yaml"
}

openapi3 {
    title = project.name
    description = project.description.toString()
    version = project.version.toString()
    format = "yaml"
}

postman {
    title = project.name
    description = project.description.toString()
    version = project.version.toString()
}

As openapi and openapi3 share the same base class, above code could be factorized:

configure( listOf( openapi, openapi3 )) {
    title = project.name
    description = project.description.toString()
    version = project.version.toString()
    format = "yaml"
}

But unfortunately it cannot be applied to postman extension.

It should be useful that all those three extensions share their common attributes in the same class, in order to ease the configuration step.