Documenting RESTful APIs

duration 20 minutes

Prerequisites:

Explore how to document and filter RESTful APIs from code or static files by using MicroProfile OpenAPI.

What you’ll learn

You will learn how to document and filter RESTful APIs from annotations, POJOs, and static OpenAPI files by using MicroProfile OpenAPI.

The OpenAPI specification, previously known as the Swagger specification, defines a standard interface for documenting and exposing RESTful APIs. This specification allows both humans and computers to understand or process the functionalities of services without requiring direct access to underlying source code or documentation. The MicroProfile OpenAPI specification provides a set of Java interfaces and programming models that allow Java developers to natively produce OpenAPI v3 documents from their JAX-RS applications.

You will document the RESTful APIs of the provided inventory service, which serves two endpoints, inventory/systems and inventory/properties. These two endpoints function the same way as in the other MicroProfile guides.

Before you proceed, note that the 1.0 version of the MicroProfile OpenAPI specification does not define how the /openapi endpoint may be partitioned in the event of multiple JAX-RS applications running on the same server. In other words, you must stick to one JAX-RS application per server instance as the behaviour for handling multiple applications is currently undefined.

Getting started

The fastest way to work through this guide is to clone the Git repository and use the projects that are provided inside:

git clone https://github.com/openliberty/guide-microprofile-openapi.git
cd guide-microprofile-openapi

The start directory contains the starting project that you will build upon.

The finish directory contains the finished project that you will build.

Try what you’ll build

The finish directory in the root of this guide contains the finished application. Give it a try before you proceed.

To try out the application, first go to the finish directory and run the following Maven goal to build the application and deploy it to Open Liberty:

cd finish
mvn liberty:run

After you see the following message, your application server is ready:

The defaultServer server is ready to run a smarter planet.

Next, point your browser to the http://localhost:9080/openapi URL and you’ll see the RESTful APIs of the inventory service. You can also point to the http://localhost:9080/openapi/ui URL for a more interactive view of the deployed APIs. This UI is built from the Open Source Swagger UI and renders the generated /openapi document into a very user friendly page.

After you are finished checking out the application, stop the Open Liberty server by pressing CTRL+C in the command-line session where you ran the server. Alternatively, you can run the liberty:stop goal from the finish directory in another shell session:

mvn liberty:stop

Generating the OpenAPI document for the inventory service

You can generate an OpenAPI document in various ways. First, because all JAX-RS annotations are processed by default, you can augment your existing JAX-RS annotations with OpenAPI annotations to enrich your APIs with a minimal amount of work. Second, you can use a set of predefined models to manually create all elements of the OpenAPI tree. Finally, you can filter various elements of the OpenAPI tree, changing them to your liking or removing them entirely.

Navigate to the start directory to begin.

When you run Open Liberty in development mode, known as dev mode, the server listens for file changes and automatically recompiles and deploys your updates whenever you save a new change. Run the following goal to start Open Liberty in dev mode:

mvn liberty:dev

After you see the following message, your application server in dev mode is ready:

Press the Enter key to run tests on demand.

Dev mode holds your command-line session to listen for file changes. Open another command-line session to continue, or open the project in your editor.

Because the JAX-RS framework handles basic API generation for JAX-RS annotations, a skeleton OpenAPI tree will be generated from the inventory service. You can use this tree as a starting point and augment it with annotations and code to produce a complete OpenAPI document.

Now, point to the http://localhost:9080/openapi URL to see the generated OpenAPI tree. You can also point to the http://localhost:9080/openapi/ui URL for a more interactive view of the APIs.

Augmenting the existing JAX-RS annotations with OpenAPI annotations

Because all JAX-RS annotations are processed by default, you can augment the existing code with OpenAPI annotations without needing to rewrite portions of the OpenAPI document that are already covered by the JAX-RS framework.

Update the InventoryResource class.
src/main/java/io/openliberty/guides/inventory/InventoryResource.java

Add OpenAPI @APIResponses, @Operation and @Parameter annotations to the two JAX-RS methods, getPropertiesForHost() and listContents().

InventoryResource.java

  1// tag::copyright[]
  2/*******************************************************************************
  3 * Copyright (c) 2017, 2020 IBM Corporation and others.
  4 * All rights reserved. This program and the accompanying materials
  5 * are made available under the terms of the Eclipse Public License v1.0
  6 * which accompanies this distribution, and is available at
  7 * http://www.eclipse.org/legal/epl-v10.html
  8 *
  9 * Contributors:
 10 *     IBM Corporation - Initial implementation
 11 *******************************************************************************/
 12// end::copyright[]
 13package io.openliberty.guides.inventory;
 14
 15import java.util.Properties;
 16import javax.enterprise.context.RequestScoped;
 17import javax.inject.Inject;
 18import javax.ws.rs.GET;
 19import javax.ws.rs.Path;
 20import javax.ws.rs.PathParam;
 21import javax.ws.rs.Produces;
 22import javax.ws.rs.core.MediaType;
 23import javax.ws.rs.core.Response;
 24
 25import org.eclipse.microprofile.openapi.annotations.Operation;
 26import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
 27import org.eclipse.microprofile.openapi.annotations.media.Content;
 28import org.eclipse.microprofile.openapi.annotations.media.Schema;
 29import org.eclipse.microprofile.openapi.annotations.parameters.Parameter;
 30import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
 31import org.eclipse.microprofile.openapi.annotations.responses.APIResponses;
 32import io.openliberty.guides.inventory.model.InventoryList;
 33
 34@RequestScoped
 35@Path("/systems")
 36public class InventoryResource {
 37
 38    @Inject
 39    InventoryManager manager;
 40
 41    @GET
 42    @Path("/{hostname}")
 43    @Produces(MediaType.APPLICATION_JSON)
 44    // tag::APIResponses[]
 45    // tag::host-property[]
 46    @APIResponses(
 47        value = {
 48            // tag::APIResponse[]
 49            @APIResponse(
 50                responseCode = "404",
 51                description = "Missing description",
 52                content = @Content(mediaType = "text/plain")),
 53            // end::APIResponse[]
 54            @APIResponse(
 55                responseCode = "200",
 56                description = "JVM system properties of a particular host.",
 57                // tag::Content[]
 58                content = @Content(mediaType = "application/json",
 59                // end::Content[]
 60                // tag::Schema[]
 61                schema = @Schema(implementation = Properties.class))) })
 62                // end::Schema[]
 63    // end::APIResponses[]
 64    // tag::Operation[]
 65    @Operation(
 66        summary = "Get JVM system properties for particular host",
 67        description = "Retrieves and returns the JVM system properties from the system "
 68        + "service running on the particular host.")
 69    // end::Operation[]
 70    // end::host-property[]
 71    public Response getPropertiesForHost(
 72        // tag::Parameter[]
 73        @Parameter(
 74            description = "The host for whom to retrieve the JVM system properties for.",
 75            required = true,
 76            example = "foo",
 77            schema = @Schema(type = SchemaType.STRING))
 78        // end::Parameter[]
 79        @PathParam("hostname") String hostname) {
 80        // Get properties for host
 81        Properties props = manager.get(hostname);
 82        if (props == null) {
 83            return Response.status(Response.Status.NOT_FOUND)
 84                           .entity("{ \"error\" : "
 85                                   + "\"Unknown hostname " + hostname
 86                                   + " or the resource may not be "
 87                                   + "running on the host machine\" }")
 88                           .build();
 89        }
 90
 91        //Add to inventory to host
 92        manager.add(hostname, props);
 93        return Response.ok(props).build();
 94    }
 95
 96    @GET
 97    @Produces(MediaType.APPLICATION_JSON)
 98    // tag::listContents[]
 99    @APIResponse(
100        responseCode = "200",
101        description = "host:properties pairs stored in the inventory.",
102        content = @Content(
103            mediaType = "application/json",
104            schema = @Schema(
105                type = SchemaType.OBJECT,
106                implementation = InventoryList.class)))
107    @Operation(
108        summary = "List inventory contents.",
109        description = "Returns the currently stored host:properties pairs in the "
110        + "inventory.")
111    // end::listContents[]
112    public InventoryList listContents() {
113        return manager.list();
114    }
115
116}
117// end::APIResponses[]

Clearly, there are many more OpenAPI annotations now, so let’s break them down:

AnnotationDescription

@APIResponses

A container for multiple responses from an API operation. This annotation is optional, but it can be helpful to organize a method with multiple responses.

@APIResponse

Describes a single response from an API operation.

@Content

Provides a schema and examples for a particular media type.

@Schema

Defines the input and output data types.

@Operation

Describes a single API operation on a path.

@Parameter

Describes a single operation parameter.

Since the Open Liberty server was started in development mode at the beginning of the guide, your changes were automatically picked up. Refresh the http://localhost:9080/openapi URL to see the updated OpenAPI tree. The two endpoints at which your JAX-RS methods are served are now more meaningful:

/inventory/systems/{hostname}:
  get:
    summary: Get JVM system properties for particular host
    description: Retrieves and returns the JVM system properties from the system
      service running on the particular host.
    operationId: getPropertiesForHost
    parameters:
    - name: hostname
      in: path
      description: The host for whom to retrieve the JVM system properties for.
      required: true
      schema:
        type: string
      example: foo
    responses:
      404:
        description: Missing description
        content:
          text/plain: {}
      200:
        description: JVM system properties of a particular host.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Properties'
/inventory/systems:
  get:
    summary: List inventory contents.
    description: Returns the currently stored host:properties pairs in the inventory.
    operationId: listContents
    responses:
      200:
        description: host:properties pairs stored in the inventory.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InventoryList'

OpenAPI annotations can also be added to POJOs to describe what they represent. Currently, your OpenAPI document doesn’t have a very meaningful description of the InventoryList POJO and hence it’s very difficult to tell exactly what that POJO is used for. To describe the InventoryList POJO in more detail, augment the src/main/java/io/openliberty/guides/inventory/model/InventoryList.java file with some OpenAPI annotations.

Update the InventoryList class.
src/main/java/io/openliberty/guides/inventory/model/InventoryList.java

Add OpenAPI @Schema annotations to the InventoryList class and the systems variable.

InventoryList.java

 1// tag::copyright[]
 2/*******************************************************************************
 3 * Copyright (c) 2017, 2020 IBM Corporation and others.
 4 * All rights reserved. This program and the accompanying materials
 5 * are made available under the terms of the Eclipse Public License v1.0
 6 * which accompanies this distribution, and is available at
 7 * http://www.eclipse.org/legal/epl-v10.html
 8 *
 9 * Contributors:
10 *     IBM Corporation - Initial implementation
11 *******************************************************************************/
12// end::copyright[]
13package io.openliberty.guides.inventory.model;
14
15import java.util.List;
16import org.eclipse.microprofile.openapi.annotations.media.Schema;
17
18// tag::InventoryList[]
19@Schema(name="InventoryList", description="POJO that represents the inventory contents.")
20// end::InventoryList[]
21// tag::InventoryListClass[]
22public class InventoryList {
23
24    // tag::Systems[]
25    @Schema(required = true)
26    // end::Systems[]
27    private List<SystemData> systems;
28
29    public InventoryList(List<SystemData> systems) {
30        this.systems = systems;
31    }
32
33    public List<SystemData> getSystems() {
34        return systems;
35    }
36
37    public int getTotal() {
38        return systems.size();
39    }
40}
41// end::InventoryListClass[]

Likewise, annotate the src/main/java/io/openliberty/guides/inventory/model/SystemData.java POJO, which is referenced in the InventoryList class.

Update the SystemData class.
src/main/java/io/openliberty/guides/inventory/model/SystemData.java

Add OpenAPI @Schema annotations to the SystemData class, the hostname variable and the properties variable.

SystemData.java

 1// tag::copyright[]
 2/*******************************************************************************
 3 * Copyright (c) 2017, 2020 IBM Corporation and others.
 4 * All rights reserved. This program and the accompanying materials
 5 * are made available under the terms of the Eclipse Public License v1.0
 6 * which accompanies this distribution, and is available at
 7 * http://www.eclipse.org/legal/epl-v10.html
 8 *
 9 * Contributors:
10 *     IBM Corporation - Initial implementation
11 *******************************************************************************/
12// end::copyright[]
13package io.openliberty.guides.inventory.model;
14
15import java.util.Properties;
16import org.eclipse.microprofile.openapi.annotations.media.Schema;
17
18// tag::SystemData[]
19@Schema(name="SystemData", description="POJO that represents a single inventory entry.")
20// end::SystemData[]
21public class SystemData {
22
23    // tag::Hostname[]
24    @Schema(required = true)
25    // end::Hostname[]
26    private final String hostname;
27
28    // tag::Properties[]
29    @Schema(required = true)
30    // end::Properties[]
31    private final Properties properties;
32
33    public SystemData(String hostname, Properties properties) {
34        this.hostname = hostname;
35        this.properties = properties;
36    }
37
38    public String getHostname() {
39        return hostname;
40    }
41
42    public Properties getProperties() {
43        return properties;
44    }
45
46    @Override
47    public boolean equals(Object host) {
48        if (host instanceof SystemData) {
49            return hostname.equals(((SystemData) host).getHostname());
50        }
51        return false;
52    }
53}

Refresh the http://localhost:9080/openapi URL to see the updated OpenAPI tree:

components:
  schemas:
    InventoryList:
      required:
      - systems
      type: object
      properties:
        systems:
          type: array
          items:
            $ref: '#/components/schemas/SystemData'
        total:
          type: integer
      description: POJO that represents the inventory contents.
    SystemData:
      required:
      - hostname
      - properties
      type: object
      properties:
        hostname:
          type: string
        properties:
          type: object
          additionalProperties:
            type: string
      description: POJO that represents a single inventory entry.
    Properties:
      type: object
      additionalProperties:
        type: string

Filtering the OpenAPI tree elements

Filtering of certain elements and fields of the generated OpenAPI document can be done by using the OASFilter interface.

Create the InventoryOASFilter class.
src/main/java/io/openliberty/guides/inventory/filter/InventoryOASFilter.java

InventoryOASFilter.java

 1// tag::copyright[]
 2/*******************************************************************************
 3 * Copyright (c) 2018, 2020 IBM Corporation and others.
 4 * All rights reserved. This program and the accompanying materials
 5 * are made available under the terms of the Eclipse Public License v1.0
 6 * which accompanies this distribution, and is available at
 7 * http://www.eclipse.org/legal/epl-v10.html
 8 *
 9 * Contributors:
10 *     IBM Corporation - Initial implementation
11 *******************************************************************************/
12// end::copyright[]
13package io.openliberty.guides.inventory.filter;
14
15import java.util.Arrays;
16import java.util.Collections;
17
18import org.eclipse.microprofile.openapi.OASFactory;
19import org.eclipse.microprofile.openapi.OASFilter;
20import org.eclipse.microprofile.openapi.models.OpenAPI;
21import org.eclipse.microprofile.openapi.models.info.License;
22import org.eclipse.microprofile.openapi.models.info.Info;
23import org.eclipse.microprofile.openapi.models.responses.APIResponse;
24import org.eclipse.microprofile.openapi.models.servers.Server;
25import org.eclipse.microprofile.openapi.models.servers.ServerVariable;
26
27public class InventoryOASFilter implements OASFilter {
28
29  @Override
30  // tag::filterAPIResponse[]
31  public APIResponse filterAPIResponse(APIResponse apiResponse) {
32    if ("Missing description".equals(apiResponse.getDescription())) {
33      apiResponse.setDescription("Invalid hostname or the system service may not "
34          + "be running on the particular host.");
35    }
36    return apiResponse;
37  }
38  // end::filterAPIResponse[]
39
40  @Override
41  // tag::filterOpenAPI[]
42  // tag::OpenAPI[]
43  public void filterOpenAPI(OpenAPI openAPI) {
44  // end::OpenAPI[]
45    // tag::oasfactory[]
46    openAPI.setInfo(
47        OASFactory.createObject(Info.class).title("Inventory App").version("1.0")
48                  .description(
49                      "App for storing JVM system properties of various hosts.")
50                  .license(
51                      OASFactory.createObject(License.class)
52                                .name("Eclipse Public License - v 1.0").url(
53                                    "https://www.eclipse.org/legal/epl-v10.html")));
54
55    openAPI.addServer(
56        OASFactory.createServer()
57                  .url("http://localhost:{port}")
58                  .description("Simple Open Liberty.")
59                  .variables(Collections.singletonMap("port",
60                                 OASFactory.createServerVariable()
61                                           .defaultValue("9080")
62                                           .description("Server HTTP port."))));
63    // end::oasfactory[]
64  }
65  // end::filterOpenAPI[]
66
67}

The filterAPIResponse() method allows filtering of APIResponse elements. When you override this method, it will be called once for every APIResponse element in the OpenAPI tree. In this case, you are matching the 404 response that is returned by the /inventory/systems/{hostname} endpoint and setting the previously missing description. To remove an APIResponse element or another filterable element, simply return null.

The filterOpenAPI() method allows filtering of the singleton OpenAPI element. Unlike other filter methods, when you override filterOpenAPI(), it is called only once as the last method for a particular filter. Hence, make sure that it doesn’t override any other filter operations that are called before it. Your current OpenAPI document doesn’t provide much information on the application itself or on what server and port it runs on. This information is usually provided in the info and servers elements, which are currently missing. Use the OASFactory class to manually set these and other elements of the OpenAPI tree from the org.eclipse.microprofile.openapi.models package. The OpenAPI element is the only element that cannot be removed since that would mean removing the whole OpenAPI tree.

Each filtering method is called once for each corresponding element in the model tree. You can think of each method as a callback for various key OpenAPI elements.

Before you can use the filter class that you created, you need to create the microprofile-config.properties file.

Create the configuration file.
src/main/webapp/META-INF/microprofile-config.properties

microprofile-config.properties

1# tag::Scan[]
2mp.openapi.scan.disable = true
3# end::Scan[]
4# tag::Config[]
5mp.openapi.filter = io.openliberty.guides.inventory.filter.InventoryOASFilter
6# end::Config[]

This configuration file is picked up automatically by MicroProfile Config and registers your filter by passing in the fully qualified name of the filter class into the mp.openapi.filter property.

Refresh the http://localhost:9080/openapi URL to see the updated OpenAPI tree:

info:
  title: Inventory App
  description: App for storing JVM system properties of various hosts.
  license:
    name: Eclipse Public License - v 1.0
    url: https://www.eclipse.org/legal/epl-v10.html
  version: 1.0.0
servers:
- url: http://localhost:{port}
  description: Simple Open Liberty.
  variables:
    port:
      default: "9080"
      description: Server HTTP port.
404:
  description: Invalid hostname or the system service may not be running on
    the particular host.
  content:
    text/plain: {}

For more information about which elements you can filter, see the MicroProfile API.

To learn more about MicroProfile Config, visit the MicroProfile Config GitHub repository and try one of the MicroProfile Config guides.

Using pregenerated OpenAPI documents

As an alternative to generating the OpenAPI model tree from code, you can provide a valid pregenerated OpenAPI document to describe your APIs. This document must be named openapi with a yml, yaml, or json extension and be placed under the META-INF directory. Depending on the scenario, the document might be fully or partially complete. If the document is fully complete, then you can disable annotation scanning entirely by setting the mp.openapi.scan.disable MicroProfile Config property to true. If the document is partially complete, then you can augment it with code.

You can find a complete OpenAPI document in the src/main/webapp/META-INF/openapi.yaml file. This document is the same as your current OpenAPI document with additional APIs for the /inventory/properties endpoint. To make use of this document, open this document in your favorite text editor and uncomment all of its lines.

Update the OpenAPI document file.
src/main/webapp/META-INF/openapi.yaml

Uncomment all the lines in the openapi.yaml file.

openapi.yaml

 1openapi: 3.0.0
 2info:
 3  title: Inventory App
 4  description: App for storing JVM system properties of various hosts.
 5  license:
 6    name: Eclipse Public License - v 1.0
 7    url: https://www.eclipse.org/legal/epl-v10.html
 8  version: 1.0.0
 9servers:
10- url: http://localhost:{port}
11  description: Simple Open Liberty.
12  variables:
13    port:
14      default: "9080"
15      description: Server HTTP port.
16paths:
17  /inventory/systems:
18    get:
19      summary: List inventory contents.
20      description: Returns the currently stored host:properties pairs in the inventory.
21      operationId: listContents
22      responses:
23        200:
24          description: host:properties pairs stored in the inventory.
25          content:
26            application/json:
27              schema:
28                $ref: '#/components/schemas/InventoryList'
29  /inventory/systems/{hostname}:
30    get:
31      summary: Get JVM system properties for particular host
32      description: Retrieves and returns the JVM system properties from the system
33        service running on the particular host.
34      operationId: getPropertiesForHost
35      parameters:
36      - name: hostname
37        in: path
38        description: The host for whom to retrieve the JVM system properties for.
39        required: true
40        schema:
41          type: string
42        example: foo
43      responses:
44        404:
45          description: Invalid hostname or the system service may not be running on
46            the particular host.
47          content:
48            text/plain: {}
49        200:
50          description: JVM system properties of a particular host.
51          content:
52            application/json:
53              schema:
54                $ref: '#/components/schemas/Properties'
55  /inventory/properties:
56    get:
57      operationId: getProperties
58      responses:
59        200:
60          description: JVM system properties of the host running this service.
61          content:
62            application/json:
63              schema:
64                type: object
65                additionalProperties:
66                  type: string
67components:
68  schemas:
69    InventoryList:
70      required:
71      - systems
72      type: object
73      properties:
74        systems:
75          type: array
76          items:
77            $ref: '#/components/schemas/SystemData'
78        total:
79          type: integer
80      description: POJO that represents the inventory contents.
81    SystemData:
82      required:
83      - hostname
84      - properties
85      type: object
86      properties:
87        hostname:
88          type: string
89        properties:
90          type: object
91          additionalProperties:
92            type: string
93      description: POJO that represents a single inventory entry.
94    Properties:
95      type: object
96      additionalProperties:
97        type: string

Since this document is complete, you can also add the mp.openapi.scan.disable property and set it to true in the src/main/webapp/META-INF/microprofile-config.properties file.

Update the configuration file.
src/main/webapp/META-INF/microprofile-config.properties

Add and set the mp.openapi.scan.disable property to true.

microprofile-config.properties

1# tag::Scan[]
2mp.openapi.scan.disable = true
3# end::Scan[]
4# tag::Config[]
5mp.openapi.filter = io.openliberty.guides.inventory.filter.InventoryOASFilter
6# end::Config[]

Refresh the http://localhost:9080/openapi URL to see the updated OpenAPI tree:

/inventory/properties:
  get:
    operationId: getProperties
    responses:
      200:
        description: JVM system properties of the host running this service.
        content:
          application/json:
            schema:
              type: object
              additionalProperties:
                type: string

Testing the service

No automated tests are provided to verify the correctness of the generated OpenAPI document. Manually verify the document by visiting the http://localhost:9080/openapi or the http://localhost:9080/openapi/ui URL.

A few tests are included for you to test the basic functionality of the inventory service. If a test failure occurs, then you might have introduced a bug into the code. These tests will run automatically as a part of the integration test suite.

Running the tests

Because you started Open Liberty in dev mode, press the enter/return key to run the tests.

You will see the following output:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running it.io.openliberty.guides.system.SystemEndpointIT
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.4 sec - in it.io.openliberty.guides.system.SystemEndpointIT
Running it.io.openliberty.guides.inventory.InventoryEndpointIT
[WARNING ] Interceptor for {http://client.inventory.guides.openliberty.io/}SystemClient has thrown exception, unwinding now
Could not send Message.
[err] The specified host is unknown: java.net.UnknownHostException: UnknownHostException invoking http://badhostname:9080/inventory/properties: badhostname
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.264 sec - in it.io.openliberty.guides.inventory.InventoryEndpointIT

Results :

Tests run: 4, Failures: 0, Errors: 0, Skipped: 0

The warning and error messages are expected and result from a request to a bad or an unknown hostname. This request is made in the testUnknownHost() test from the InventoryEndpointIT integration test.

When you are done checking out the service, exit dev mode by pressing CTRL+C in the command-line session where you ran the server, or by typing q and then pressing the enter/return key.

Great work! You’re done!

You have just documented and filtered the APIs of the inventory service from both the code and a static file by using MicroProfile OpenAPI in Open Liberty.

Feel free to try one of the related MicroProfile guides. They demonstrate additional technologies that you can learn and expand on top of what you built here.

For more in-depth examples of MicroProfile OpenAPI, try one of the demo applications available in the MicroProfile OpenAPI GitHub repository.

Guide Attribution

Documenting RESTful APIs by Open Liberty is licensed under CC BY-ND 4.0

Copied to clipboard
Copy code block
Copy file contents

Prerequisites:

Nice work! Where to next?

What did you think of this guide?

Extreme Dislike Dislike Like Extreme Like

What could make this guide better?

Raise an issue to share feedback

Create a pull request to contribute to this guide

Need help?

Ask a question on Stack Overflow

Like Open Liberty? Star our repo on GitHub.

Star