Complete the code to add the SpringDoc OpenAPI dependency in Maven's <dependencies> section.
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>[1]</artifactId>
<version>1.7.0</version>
</dependency>The correct artifactId to add SpringDoc OpenAPI UI support is springdoc-openapi-ui.
Complete the annotation to define OpenAPI documentation metadata in a Spring Boot application.
@[1] @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
The annotation @OpenAPIDefinition defines global OpenAPI metadata and supports documentation generation in SpringDoc.
Fix the error in the OpenAPI info bean definition by completing the missing method call.
import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.OpenAPI; @Bean public OpenAPI customOpenAPI() { return new OpenAPI() .info(new Info().title("My API").version([1])); }
The version must be a string, so it should be passed as "1.0".
Fill both blanks to configure the OpenAPI bean with a description and contact email.
import io.swagger.v3.oas.models.info.Contact; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.OpenAPI; @Bean public OpenAPI apiInfo() { return new OpenAPI() .info(new Info() .description([1]) .contact(new Contact().email([2]))); }
The description is a string describing the API, and the contact email is a string email address.
Fill all three blanks to create a SpringDoc OpenAPI bean with title, version, and license name.
import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.License; import io.swagger.v3.oas.models.OpenAPI; @Bean public OpenAPI openApiConfig() { return new OpenAPI() .info(new Info() .title([1]) .version([2]) .license(new License().name([3]))); }
The title is a string naming the API, version is a string version number, and license name is a string naming the license.