O'Reilly logo

Hands-On Enterprise Java Microservices with Eclipse MicroProfile by Scott Stark, Antoine Sabot-Durand, Pavol Loffay, Jeff Mesnil, Heiko W. Rupp, Cesar Saavedra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using a filter for updates

To update or remove certain elements and fields of the OpenAPI document, you can use a filter. The OASFilter (https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/OASFilter.java) interface allows you to receive callbacks for various OpenAPI elements. It allows you to override the methods you care about. You can create an implementation of this interface and register it using the mp.openapi.filter configuration key.

Here's an example of what its definition would look like in META-INF/microprofile-config.properties:

mp.openapi.filter=com.mypackage.MyFilter

A registered filter is called once for each model element. For example, the filterPathItem method is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required