Module org.eclipse.microprofile.openapi
Package org.eclipse.microprofile.openapi

# Interface OASFilter

public interface OASFilter
This interface allows application developers to filter different parts of the OpenAPI model tree. A common scenario is to dynamically augment (update or remove) OpenAPI elements based on the environment that the application is currently in. The registration of this filter is controlled by setting the key mp.openapi.filter using one of the configuration sources specified in MicroProfile Config. The value is the fully qualified name of the filter implementation, which needs to be visible to the application's classloader.

## Method Summary

Modifier and Type
Method
Description
`default APIResponse`
`filterAPIResponse(APIResponse apiResponse)`
Allows filtering of a particular APIResponse.
`default Callback`
`filterCallback(Callback callback)`
Allows filtering of a particular Callback.
`default Header`
`filterHeader(Header header)`
Allows filtering of a particular Header.
`default Link`
`filterLink(Link link)`
Allows filtering of a particular Link.
`default void`
`filterOpenAPI(OpenAPI openAPI)`
Allows filtering of the singleton OpenAPI element.
`default Operation`
`filterOperation(Operation operation)`
Allows filtering of a particular Operation.
`default Parameter`
`filterParameter(Parameter parameter)`
Allows filtering of a particular Parameter.
`default PathItem`
`filterPathItem(PathItem pathItem)`
Allows filtering of a particular PathItem.
`default RequestBody`
`filterRequestBody(RequestBody requestBody)`
Allows filtering of a particular RequestBody.
`default Schema`
`filterSchema(Schema schema)`
Allows filtering of a particular Schema.
`default SecurityScheme`
`filterSecurityScheme(SecurityScheme securityScheme)`
Allows filtering of a particular SecurityScheme.
`default Server`
`filterServer(Server server)`
Allows filtering of a particular Server.
`default Tag`
`filterTag(Tag tag)`
Allows filtering of a particular Tag.

## Method Details

### filterPathItem

default PathItem filterPathItem(PathItem pathItem)
Allows filtering of a particular PathItem. Implementers of this method can choose to update the given PathItem, pass it back as-is, or return null if removing this PathItem.

Parameters:
  `pathItem` - the current PathItem element
Returns:
  the PathItem to be used or null

### filterOperation

default Operation filterOperation(Operation operation)
Allows filtering of a particular Operation. Implementers of this method can choose to update the given Operation, pass it back as-is, or return null if removing this Operation.

Parameters:
  `operation` - the current Operation element
Returns:
  the Operation to be used or null

### filterParameter

default Parameter filterParameter(Parameter parameter)
Allows filtering of a particular Parameter. Implementers of this method can choose to update the given Parameter, pass it back as-is, or return null if removing this Parameter.

Parameters:
  `parameter` - the current Parameter element
Returns:
  the Parameter to be used or null

### filterHeader

default Header filterHeader(Header header)
Allows filtering of a particular Header. Implementers of this method can choose to update the given Header, pass it back as-is, or return null if removing this Header.

Parameters:
  `header` - the current Header element
Returns:
  the Header to be used or null

### filterRequestBody

default RequestBody filterRequestBody(RequestBody requestBody)
Allows filtering of a particular RequestBody. Implementers of this method can choose to update the given RequestBody, pass it back as-is, or return null if removing this RequestBody.

Parameters:
  `requestBody` - the current RequestBody element
Returns:
  the RequestBody to be used or null

### filterAPIResponse

default APIResponse filterAPIResponse(APIResponse apiResponse)
Allows filtering of a particular APIResponse. Implementers of this method can choose to update the given APIResponse, pass it back as-is, or return null if removing this APIResponse.

Parameters:
  `apiResponse` - the current APIResponse element
Returns:
  the APIResponse to be used or null

### filterSchema

default Schema filterSchema(Schema schema)
Allows filtering of a particular Schema. Implementers of this method can choose to update the given Schema, pass it back as-is, or return null if removing this Schema.

Parameters:
  `schema` - the current Schema element
Returns:
  the Schema to be used or null

### filterSecurityScheme

default SecurityScheme filterSecurityScheme(SecurityScheme securityScheme)
Allows filtering of a particular SecurityScheme. Implementers of this method can choose to update the given SecurityScheme, pass it back as-is, or return null if removing this SecurityScheme.

Parameters:
  `securityScheme` - the current SecurityScheme element
Returns:
  the SecurityScheme to be used or null

### filterServer

default Server filterServer(Server server)
Allows filtering of a particular Server. Implementers of this method can choose to update the given Server, pass it back as-is, or return null if removing this Server.

Parameters:
  `server` - the current Server element
Returns:
  the Server to be used or null

### filterTag

default Tag filterTag(Tag tag)
Allows filtering of a particular Tag. Implementers of this method can choose to update the given Tag, pass it back as-is, or return null if removing this Tag.

Parameters:
  `tag` - the current Tag element
Returns:
  the Tag to be used or null

### filterLink

default Link filterLink(Link link)
Allows filtering of a particular Link. Implementers of this method can choose to update the given Link, pass it back as-is, or return null if removing this Link.

Parameters:
  `link` - the current Link element
Returns:
  the Link to be used or null

### filterCallback

default Callback filterCallback(Callback callback)
Allows filtering of a particular Callback. Implementers of this method can choose to update the given Callback, pass it back as-is, or return null if removing this Callback.

Parameters:
  `callback` - the current Callback element
Returns:
  the Callback to be used or null

### filterOpenAPI

default void filterOpenAPI(OpenAPI openAPI)
Allows filtering of the singleton OpenAPI element. Implementers of this method can choose to update this element, or do nothing if no change is required. Note that one cannot remove this element from the model tree, hence the return type of void. This is the last method called for a given filter, therefore it symbolizes the end of processing by the vendor framework.

Parameters:
  `openAPI` - the current OpenAPI element