> For the complete documentation index, see llms.txt.
Skip to main content

Check out Port for yourself ➜ 

Swagger UI

The Swagger UI property is used to import and display OpenAPI and/or AsyncAPI specification files within an entity in Port.

Using this property will automatically create an additional tab in each entity page, displaying the specification files in Swagger UI format. Within this tab, you will be able to perform HTTP calls to the spec target directly from Port.

The following is an example of a Swagger UI tab in an entity page:

Entity page Swagger UI tab with API endpoints

Common usage​

Use Swagger UI properties to display API contracts alongside your services, such as:

  • OpenAPI specifications for HTTP APIs.
  • AsyncAPI specifications for event-driven services.
  • API documentation ingested from a repository or specification URL.

OpenAPI​

The examples below use version 2.29.0 of the Terraform and Pulumi providers. Configure your provider first, then run one example at a time in its own project. Each example creates a blueprint; use distinct identifiers when you combine examples.

Definition​

When using the URL format, Port will query the provided URL for the OpenAPI spec and expects a JSON OpenAPI spec

CORS configuration

When using URL for the open-api display, make sure that your server allows cross-origin (CORS) requests from Port:

  • EU region: app.port.io
  • US region: app.us.port.io

To serve the OpenAPI spec from an AWS S3 bucket, add a CORS policy to the bucket that allows requests from both app.port.io and app.us.port.io. Check out the AWS documentation for more information.

{
"myOpenApi": {
"title": "My Open API",
"type": "string",
"format": "url",
"spec": "open-api",
"description": "Open-API Prop"
}
}

Example​

Here is how the Swagger tab in the specific entity page appears when an OpenAPI spec is provided:

Mock Port API specification rendered in the entity OpenAPI tab with action endpoints

AsyncAPI​

Definition​

When using the URL format, Port will query the provided URL for the AsyncAPI spec and expects a JSON AsyncAPI spec

CORS configuration

When using URL for the async-api display, make sure that your server allows cross-origin (CORS) requests from Port:

  • EU region: app.port.io
  • US region: app.us.port.io

To serve the AsyncAPI spec from an AWS S3 bucket, add a CORS policy to the bucket that allows requests from both app.port.io and app.us.port.io. Check out the AWS documentation for more information.

{
"myAsyncApi": {
"title": "My Async API",
"type": "string",
"format": "url",
"spec": "async-api",
"description": "async-api Prop"
}
}

Example​

Here is how the Swagger tab in the specific entity page appears when an AsyncAPI spec is provided:

Account Service specification rendered in the entity AsyncAPI tab with user signup payload details