Application and server configuration for testing the liberty OpenAPI UI.
The Liberty OpenAPI UI is an extended version of Swagger UI which makes a few adjustments. This test procedure tests that our modifications are present and that we haven't obviously broken anything.
If something looks wrong, it can be useful to compare how it's rendered in the online Swagger UI editor.
- Java 17 or later is required
- Build liberty locally with the changes you want to test
- Clone this repository
- In
gradle.properties
updateui.test.liberty.installDir
to point to thebuild.image/wlp
directory in your workspace so that the test runs on your locally built liberty - start the server and deploy the test application by running
./gradlew libertyStart
- UI Loads on https://localhost:9443/openapi/ui/
- Forced reload causes all resources to be reloaded
- OpenLiberty logo is at the top of the page
- No filter bar at the top of the page
- Top of the page has the title and description for the application but no links
-
OAS 3.0
icon surrounding colour is#5d8203
via element inspection - Footer is present
- Footer contains links for
Terms of service
,Test Author - Website
,Contact Test Author
,Example license
andDocs
- No
Valid
button in footer - Operation Details
- Expand
GET /{id}
-
id
parameter is marked* required
-
- Expand
- UI Loads on https://localhost:9444/openapi/ui/
- Forced reload causes all resources to be reloaded
- OpenLiberty logo is at the top of the page
- No filter bar at the top of the page
- Top of the page has the title, summary and description for the application but no links
-
OAS 3.1
icon surrounding colour is#5d8203
via element inspection - Footer is present
- Footer contains links for
Terms of service
,Test Author - Website
,Contact Test Author
,Apache 2.0
andDocs
- Apache 2.0 link works
- No
Valid
button in footer - Webhooks section below path operations is present
-
POST event
operation is listed as a webhook
-
- Two Server values in Server dropdown
- Select
HTTPS
server url - Expand
GET /{id}
operation-
id
parameter is marked* required
- Two responses -
200
and404
displayed - Change
media type
in drop down- Example changes from either JSON -> XML or XML->JSON
- Can switch between
Example Value
andSchema
- Attempt to provide an ID value and should be prohibited from doing so
- Click
Try Out
- Provide an ID value of
1
- Click
Execute
and get a-
200
response
-
- Change ID value to
0
- Click
Execute
-
404
response
-
- Provide an ID value of
-
- Expand
POST /private
- Padlock Icon is
Unlocked
- Click
Try Out
- Click execute
-
401
response
-
- Click execute
- Padlock Icon is
- Click
Authorize
and go tooauth
section - Provide
Client_id
mp-ui
- Provide
Client_secret
abc
- Select
test
scope - Click
authorize
- Login with user credentials
testuser
/testpassword
- click
allow once
- returned to the OpenAPI UI
- Login with user credentials
- Close modal
- All
/private*
operations now have a locked padlock - Expand
POST /private
- Click
Try Out
- Click
Execute
and get a200
response
- Click
- Click
- Expand
GET /apiKeyNeeded
- Padlock is
unlocked
- Description is
Get a random record
- Click Try Out
- Click Execute and get a
403
response
- Click Execute and get a
- Padlock is
- Click
Authorize
- Enter apikey
12345
- Click
Authorize
- Close modal
- Enter apikey
- Expand
GET /apiKeyNeeded
- Operation has a locked padlock
- Click
Try Out
- Click
Execute
and get a200
response
- Click
- UI loads https://localhost:9443/api/explorer/
- Forced reload causes all resources to be reloaded
- OpenLiberty logo is at the top of the page
- The Filter box is present at the top of the page
- Filter using
openapi-ui-test-app
(or any prefix of that) returns the operations - Filter using any other value returns no operations
- Top of the Page has
Liberty REST APIs
-
OAS3
icon surrounding colour is#5d8203
via element inspection - No
Valid
button in page footer - Two Server values in Server dropdown
- Select
HTTPS
server url - Expand
GET /openapi-ui-test-app/{id}
operation- Two responses -
200
and404
displayed - Change
Media type
in drop down- Example changes from either JSON -> XML or XML->JSON
- Can switch between
Example Value
andSchema
- Attempt to provide an ID value and should be prohibited from doing so
- Click
Try Out
- Provide an ID value of
1
- Click
Execute
and get a-
200
response
-
- Change ID value to
0
- Click
Execute
-
404
response
-
- Provide an ID value of
- Two responses -
- Expand
POST /openapi-ui-test-app/private
- Padlock Icon is
Unlocked
- Click
Try Out
- Click execute
-
401
response
- Padlock Icon is
- Click
Authorize
and go tooauth
section - Provide
Client_id
openapi-ui
- Provide
Client_secret
abc
- Select
test
scope - Click
authorize
- Login with user credentials
testuser
/testpassword
- click
allow once
- returned to the OpenAPI UI
- Login with user credentials
- Close modal
- All
/openapi-ui-test-app/private*
operations now have a locked padlock - Expand
POST /openapi-ui-test-app/private
- Click
Try Out
- Click
Execute
and get a200
response
- Click
- Expand
GET /openapi-ui-test-app/apiKeyNeeded
- Padlock is
unlocked
- Description is
Get a random record
- Click Try Out
- Click Execute and get a
403
response
- Click Execute and get a
- Padlock is
- Click
Authorize
- Enter apikey
12345
- Click
Authorize
- Close modal
- Enter apikey
- Expand
/openapi-ui-test-app/apiKeyNeeded
- Operation has a locked padlock
- Click
Try Out
- Click
Execute
and get a200
response
- Click
- UI loads on https://localhost:9443/ibm/api/explorer/ with credentials
testuser
/testpassword
- Forced reload causes all resources to be reloaded
- OpenLiberty logo is at the top of the page
- The Filter box is present at the top of the page
- Filter using
openapi-ui-test-app
(or any prefix of that) returns the operations - Filter using any other value returns no operations
- Top of the Page has
Liberty REST APIs
-
OAS 3.0
icon surrounding colour is#5d8203
via element inspection - No
Valid
button in page footer
- Test for mpOpenAPI (OpenAPI 3.0)
- Stop the server:
./gradlew :openapi-3.0:libertyStop
- Copy in the customization:
cp -r openapi-3.0/src/main/liberty/config/example-customization openapi-3.0/src/main/liberty/config/mpopenapi
- Start the server:
./gradlew :openapi-3.0:libertyStart
- Headerbar colour and logo has changed on https://localhost:9443/openapi/ui/ (may need to Shift-refresh)
- Stop the server:
- Test for mpOpenAPI (OpenAPI 3.0)
- Stop the server:
./gradlew :openapi-3.1:libertyStop
- Copy in the customization:
cp -r openapi-3.1/src/main/liberty/config/example-customization openapi-3.1/src/main/liberty/config/mpopenapi
- Start the server:
./gradlew :openapi-3.1:libertyStart
- Headerbar colour and logo has changed on https://localhost:9444/openapi/ui/ (may need to Shift-refresh)
- Stop the server:
- Test for
openapi-3.x
feature- Stop the server:
./gradlew :openapi-3.0:libertyStop
- Copy in the customization:
cp -r openapi-3.0/src/main/liberty/config/example-customization openapi-3.0/src/main/liberty/config/openapi-3.1
- Start the server:
./gradlew :openapi-3.0:libertyStart
- Headerbar colour and logo has changed on https://localhost:9443/api/explorer/ (may need to Shift-refresh)
- Stop the server:
- Stop both servers with
./gradlew libertyStop