Any way of using properties from application.yml as schema example?
See original GitHub issueI’m trying to set an example for an endpoint schema, but I’d like to keep the example in a property files, like application.yml. Is there any way of using it in the example?
I tried the following code, but it didn’t work:
@Operation(summary = "Something something")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successful operation",
content = @Content(schema = @Schema(example = "${swagger.examples.fooApi}")))
})
@GetMapping(path = "/foo/{bar}", produces = APIVersions.API_VERSION_V1)
public ResponseEntity getFoo(@PathVariable("bar") @LogParameter final String bar) {
return ResponseEntity.ok(this.fooService.getFoo(bar));
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
Spring YAML Configuration - Baeldung
Spring profiles help enable Spring Applications to define different properties for different environments. Let's take a look at a simple YAML ...
Read more >Database application.yml for Spring boot ... - Stack Overflow
I've got the project set up with an application.properties file, but would like to make the switch over to an application.yml file. However...
Read more >Working with application properties in Spring Boot - Dev Genius
So that's a basic way of using application properties with YAML. But what about sharing application properties with different settings. For example, if...
Read more >Common Application Properties - Spring
Name Description Default...
spring.cassandra.config Location of the configuration file to use.
spring.cassandra.controlconnection.timeout Timeout to use for control queries. 5s
spring.cassandra.keyspace‑name Keyspace name to use.
Read more >Spring Boot YAML example - Mkyong.com
Spring Boot YAML example · 1. YAML and Properties. application.yml. logging: level: org.springframework: ERROR com. · 2. Project Structure.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’d be interested in a way to load detailed operation descriptions (containing markdown) from yaml, something like:
@Operation(summary = "This API will do something.", description = "${springdoc.operation-descriptions.myOperation}")
This would keep the controller class less polluted when providing a detailed, formatted description.
Thanks.
Fantastic news. Thank you for adding support.