Forum Discussion

trumpvsbiden's avatar
trumpvsbiden
Frequent Visitor
5 years ago

Unable to access custom tag

Hello Guys, This question is for Swagger Codegen, In the info section of API Spec I added custom tag "x-EnableEureka: true." If I am trying to access this custom tag in apiController.mustache as {{...
  • hugomario's avatar
    5 years ago

    Hello,

     

    Right now, there is not a way to access Info object vendor extensions from templates. I have created a PR to fix that https://github.com/swagger-api/swagger-codegen/pull/10557

     

    If you are using codegen as a dependency in your project, you could override method

    DefaultGenerator.configureSwaggerInfo

     for something like:

    protected void configureSwaggerInfo() {
    if (info.getVendorExtensions() != null && !info.getVendorExtensions().isEmpty()) {
    config.additionalProperties().put("info-extensions", info.getVendorExtensions());
    }
    }