question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Any way of using properties from application.yml as schema example?

See original GitHub issue

I’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:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
edgeofoblivioncommented, Dec 17, 2019

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.

0reactions
johnheitorcommented, Dec 17, 2019

Fantastic news. Thank you for adding support.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found