cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to access custom tag

SOLVED
Highlighted
Occasional Visitor

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 {{vendorExtensions.x-responseEntity}}.

Its printing noting.
How can I access the custom tag?

 

i have added both of these filed for reference the input API def ( see line number 6,7& 32 ) and apiController.mustache (line number 55 to 66). Only hard coded values  are getting printed. 

 

Can you please help to understand, why I am unable to access the custom tag and how can I do it?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Staff

Re: Unable to access custom tag

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());
}
}

 

View solution in original post

1 REPLY 1
Highlighted
Staff

Re: Unable to access custom tag

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());
}
}

 

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors