Skip to content

Allows for defining OpenAPI documentation outside of the classes being documented

Notifications You must be signed in to change notification settings

daniel-frak/springdoc-openapi-externalized-documentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Springdoc OpenAPI Externalized Documentation library

Code Soapbox logo

Introduction

This library is an extension for Springdoc OpenAPI and allows for defining OpenAPI 3.0 specification outside of the classes being documented.

Its main purpose is to allow documentation of domain model classes (such as value objects, enums) as part of the OpenAPI specification, while maintaining their separation.

While it was developed with Springdoc OpenAPI in mind, you can apply this solution to any Spring Boot OpenAPI library based on Spring Core.

Getting Started

  1. Add a dependency on springdoc-openapi-externalized-documentation:
<dependency>
    <groupId>com.danielfrak.code</groupId>
    <artifactId>springdoc-openapi-externalized-documentation</artifactId>
    <version>1.0.0</version>
</dependency>
  1. Create an empty class and annotate it with @ExternalizedSchema:
import com.danielfrak.code.springdoc.openapi.externalizeddocs.ExternalizedSchema;
import io.swagger.v3.oas.annotations.media.Schema;
import pl.nc.datapresenter.data.articles.domain.ArticleType;

@ExternalizedSchema(source = MyValueObject.class, schema = @Schema(
    implementation = String.class,
    example = "Example value",
    description = "Some description"
))
public class MyValueObjectDocs {
}

@ExternalizedSchema fields

  • source - the class to document
  • schema - a @io.swagger.v3.oas.annotations.media.Schema annotation to apply to the source class

About

Allows for defining OpenAPI documentation outside of the classes being documented

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages