OpenAPI
With Port, you can import and display OpenAPI specification files as Swagger UI tabs.
By using a special Open API Blueprint property, Port will display the Swagger UI matching the spec file provided in the specific entity page. In addition, it will also provide advanced functionality such as performing HTTP calls to the spec target directly from Port.
Definitionโ
- URL
- Object
When using the URL format, Port will query the provided URL for the OpenAPI spec and expects a JSON OpenAPI spec
When using URL for the open-api
display please make sure that your server allows cross-origin (CORS) requests from app.getport.io
- API
- Terraform
{
"myOpenApi": {
"title": "My Open API",
"type": "string",
"format": "url",
"spec": "open-api",
"description": "Open-API Prop"
}
}
resource "port-labs_blueprint" "myBlueprint" {
# ...blueprint properties
properties {
identifier = "myOpenApi"
title = "My Open Api"
required = false
type = "string"
format = "url"
spec = "open-api"
}
}
When using the object type, you will have to provide the full JSON OpenAPI spec as an object to the entity
- API
- Terraform
{
"myOpenApi": {
"title": "My Open API",
"type": "object",
"spec": "open-api",
"description": "Open-API Prop"
}
}
resource "port-labs_blueprint" "myBlueprint" {
# ...blueprint properties
properties {
identifier = "myOpenApi"
title = "My Open Api"
required = false
type = "object"
spec = "open-api"
}
}
Exampleโ
Here is how the Swagger tab in the specific entity page appears when an OpenAPI spec is provided: