diff --git a/static/openapi.yaml b/static/openapi.yaml index f065741..5671c20 100644 --- a/static/openapi.yaml +++ b/static/openapi.yaml @@ -1,13 +1,15 @@ openapi: 3.0.0 info: title: SLOP API - description: A SLOP pattern implementation with dynamic model endpoints + description: A SLOP pattern implementation with dynamic model endpoints, tools, memory, resources, and payment simulation. version: 1.0.0 + servers: - - url: https://slop.unturf.com - description: Local development server - url: http://localhost:31337 - description: Local development server + description: Local development SLOP server + - url: https://slop.unturf.com + description: Production unturf. SLOP server + paths: /chat: post: @@ -112,8 +114,14 @@ paths: application/json: schema: $ref: '#/components/schemas/MemoryListResponse' + '503': + description: Memory lock timeout + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' post: - summary: Store a key-value pair + summary: Store a key-value pair in memory tags: - Memory requestBody: @@ -129,9 +137,21 @@ paths: application/json: schema: $ref: '#/components/schemas/MemoryStoreResponse' + '400': + description: Missing key or value + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '503': + description: Memory lock timeout + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' /memory/{key}: get: - summary: Retrieve a value by key + summary: Retrieve a value by key from memory tags: - Memory parameters: @@ -147,6 +167,12 @@ paths: application/json: schema: $ref: '#/components/schemas/MemoryGetResponse' + '503': + description: Memory lock timeout + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' delete: summary: Delete a memory key tags: @@ -170,9 +196,15 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + '503': + description: Memory lock timeout + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' /resources: get: - summary: List available resources + summary: List all available resources tags: - Resources responses: @@ -184,7 +216,10 @@ paths: $ref: '#/components/schemas/ResourcesResponse' /resources/{resource_id}: get: - summary: Get a specific resource + summary: Get a specific resource or nested resources by prefix + description: | + Retrieves a resource by its exact ID. If no exact match is found, performs a prefix search + (e.g., `/resources/foo` returns all resources under `foo/` like `foo/bar` and `foo/baz`). tags: - Resources parameters: @@ -193,15 +228,63 @@ paths: required: true schema: type: string + description: The ID of the resource or a prefix for nested resources (e.g., "foo" for "foo/bar"). responses: '200': - description: Resource content + description: Resource content or list of nested resources content: application/json: schema: - $ref: '#/components/schemas/ResourceResponse' + oneOf: + - $ref: '#/components/schemas/ResourceResponse' # Exact match + - $ref: '#/components/schemas/ResourcesResponse' # Prefix search + examples: + exactMatch: + summary: Exact resource match + value: + id: "hello" + content: "Hello, SLOP!" + prefixMatch: + summary: Nested resources via prefix search + value: + resources: + - id: "foo/bar" + content: "Nested Foo Bar" + - id: "foo/baz" + content: "Nested Foo Baz" '404': - description: Resource not found + description: No resource or nested resources found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + put: + summary: Update or create a resource + description: Updates an existing resource or creates a new one if it doesn’t exist. + tags: + - Resources + parameters: + - name: resource_id + in: path + required: true + schema: + type: string + description: The ID of the resource to update or create. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ResourceUpdateRequest' + responses: + '200': + description: Resource updated or created successfully + content: + application/json: + schema: + $ref: '#/components/schemas/ResourceUpdateResponse' + '400': + description: Missing content field content: application/json: schema: @@ -372,6 +455,25 @@ components: required: - id - content + ResourceUpdateRequest: + type: object + properties: + content: + type: string + description: The content to set for the resource. + required: + - content + ResourceUpdateResponse: + type: object + properties: + status: + type: string + enum: [updated] + resource: + $ref: '#/components/schemas/ResourceResponse' + required: + - status + - resource PayRequest: type: object properties: @@ -397,4 +499,4 @@ components: error: type: string required: - - error + - error \ No newline at end of file