Repository navigation
Support OpenAPI Specification in API Platform #3396
Replies: 3 comments
Implementation ApproachDB Design
CREATE TABLE IF NOT EXISTS api_documents (
uuid VARCHAR(40) PRIMARY KEY,
artifact_uuid VARCHAR(40) NOT NULL,
organization_uuid VARCHAR(40) NOT NULL,
type VARCHAR(20) NOT NULL,
handle VARCHAR(40) NOT NULL,
display_name VARCHAR(255) NOT NULL,
file_name VARCHAR(255),
content_type VARCHAR(100),
content BLOB NOT NULL,
data_version VARCHAR(20) NOT NULL DEFAULT '1.0',
created_by VARCHAR(255),
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_by VARCHAR(255),
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (artifact_uuid) REFERENCES artifacts(uuid) ON DELETE CASCADE,
FOREIGN KEY (organization_uuid) REFERENCES organizations(uuid) ON DELETE CASCADE
);
REST API DesignThe following endpoints will be added:
Needs Clarification
|
Key Design Decisions
1. The This remains the live source for API operations and operation-level policies. It is used for:
"operations": [
{
"name": "getPetById",
"description": "Find pet by ID",
"request": {
"method": "GET",
"path": "/pet/{petId}",
"policies": [
{
"executionCondition": "request.header.x-custom == 'enabled'",
"name": "SET_HEADER",
"params": {
"key": "MyHeader",
"value": "MyValue"
},
"version": "v1"
}
]
}
}
]2. The OpenAPI spec — schemas, request/response models, parameters, and anything the Try-out page needs. It is used for:
🔴 It was decided in the discussion that these two sources are allowed to drift and will not always be in sync.
To support the Try-out feature, there should be an OpenAPI spec for each deployment, since users should be able to try out operations against a specific deployment rather than against the operations in the working copy.
|
UpdateFollowing points were discussed and verified during the Design Discussion. API creation via
|
Uh oh!
There was an error while loading. Please reload this page.
Problem
API Platform currently allows users to create REST APIs by attaching individual resources as
operationsto the API create request payload. There's no way to create an API by providing a complete OpenAPI spec, or to retrieve or update that spec afterward.In the REST API creation flow (Import API Contract, Import from URL, Design from Scratch), an API definition is generated client-side and shown in the UI, but it is never persisted.
Persisting the API definition is now required to support directly publishing APIs to the API Portal via API Platform [1].
Solution Overview
[1]. #3242
All reactions