refactor: Use openapi for recipe endpoint types and in frontend (#3548)

This commit is contained in:
Jarrod Sibbison
2025-07-21 19:40:13 +10:00
committed by GitHub
parent a996227381
commit d085126709
10 changed files with 863 additions and 132 deletions
+412
View File
@@ -499,6 +499,112 @@
]
}
},
"/recipes/create": {
"post": {
"tags": [
"Recipe Management"
],
"summary": "Create a Recipe configuration from the current session",
"operationId": "create_recipe",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateRecipeRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Recipe created successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateRecipeResponse"
}
}
}
},
"400": {
"description": "Bad request"
},
"412": {
"description": "Precondition failed - Agent not available"
},
"500": {
"description": "Internal server error"
}
}
}
},
"/recipes/decode": {
"post": {
"tags": [
"Recipe Management"
],
"operationId": "decode_recipe",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DecodeRecipeRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Recipe decoded successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DecodeRecipeResponse"
}
}
}
},
"400": {
"description": "Bad request"
}
}
}
},
"/recipes/encode": {
"post": {
"tags": [
"Recipe Management"
],
"operationId": "encode_recipe",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EncodeRecipeRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Recipe encoded successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EncodeRecipeResponse"
}
}
}
},
"400": {
"description": "Bad request"
}
}
}
},
"/schedule/create": {
"post": {
"tags": [
@@ -945,6 +1051,32 @@
}
}
},
"Author": {
"type": "object",
"properties": {
"contact": {
"type": "string",
"nullable": true
},
"metadata": {
"type": "string",
"nullable": true
}
}
},
"AuthorRequest": {
"type": "object",
"properties": {
"contact": {
"type": "string",
"nullable": true
},
"metadata": {
"type": "string",
"nullable": true
}
}
},
"ConfigKey": {
"type": "object",
"required": [
@@ -1131,6 +1263,60 @@
}
}
},
"CreateRecipeRequest": {
"type": "object",
"required": [
"messages",
"title",
"description"
],
"properties": {
"activities": {
"type": "array",
"items": {
"type": "string"
},
"nullable": true
},
"author": {
"allOf": [
{
"$ref": "#/components/schemas/AuthorRequest"
}
],
"nullable": true
},
"description": {
"type": "string"
},
"messages": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Message"
}
},
"title": {
"type": "string"
}
}
},
"CreateRecipeResponse": {
"type": "object",
"properties": {
"error": {
"type": "string",
"nullable": true
},
"recipe": {
"allOf": [
{
"$ref": "#/components/schemas/Recipe"
}
],
"nullable": true
}
}
},
"CreateScheduleRequest": {
"type": "object",
"required": [
@@ -1154,6 +1340,28 @@
}
}
},
"DecodeRecipeRequest": {
"type": "object",
"required": [
"deeplink"
],
"properties": {
"deeplink": {
"type": "string"
}
}
},
"DecodeRecipeResponse": {
"type": "object",
"required": [
"recipe"
],
"properties": {
"recipe": {
"$ref": "#/components/schemas/Recipe"
}
}
},
"EmbeddedResource": {
"type": "object",
"required": [
@@ -1172,6 +1380,28 @@
}
}
},
"EncodeRecipeRequest": {
"type": "object",
"required": [
"recipe"
],
"properties": {
"recipe": {
"$ref": "#/components/schemas/Recipe"
}
}
},
"EncodeRecipeResponse": {
"type": "object",
"required": [
"deeplink"
],
"properties": {
"deeplink": {
"type": "string"
}
}
},
"Envs": {
"type": "object",
"additionalProperties": {
@@ -1951,6 +2181,137 @@
}
}
},
"Recipe": {
"type": "object",
"description": "A Recipe represents a personalized, user-generated agent configuration that defines\nspecific behaviors and capabilities within the Goose system.\n\n# Fields\n\n## Required Fields\n* `version` - Semantic version of the Recipe file format (defaults to \"1.0.0\")\n* `title` - Short, descriptive name of the Recipe\n* `description` - Detailed description explaining the Recipe's purpose and functionality\n* `Instructions` - Instructions that defines the Recipe's behavior\n\n## Optional Fields\n* `prompt` - the initial prompt to the session to start with\n* `extensions` - List of extension configurations required by the Recipe\n* `context` - Supplementary context information for the Recipe\n* `activities` - Activity labels that appear when loading the Recipe\n* `author` - Information about the Recipe's creator and metadata\n* `parameters` - Additional parameters for the Recipe\n* `response` - Response configuration including JSON schema validation\n\n# Example\n\n\nuse goose::recipe::Recipe;\n\n// Using the builder pattern\nlet recipe = Recipe::builder()\n.title(\"Example Agent\")\n.description(\"An example Recipe configuration\")\n.instructions(\"Act as a helpful assistant\")\n.build()\n.expect(\"Missing required fields\");\n\n// Or using struct initialization\nlet recipe = Recipe {\nversion: \"1.0.0\".to_string(),\ntitle: \"Example Agent\".to_string(),\ndescription: \"An example Recipe configuration\".to_string(),\ninstructions: Some(\"Act as a helpful assistant\".to_string()),\nprompt: None,\nextensions: None,\ncontext: None,\nactivities: None,\nauthor: None,\nsettings: None,\nparameters: None,\nresponse: None,\nsub_recipes: None,\n};\n",
"required": [
"title",
"description"
],
"properties": {
"activities": {
"type": "array",
"items": {
"type": "string"
},
"nullable": true
},
"author": {
"allOf": [
{
"$ref": "#/components/schemas/Author"
}
],
"nullable": true
},
"context": {
"type": "array",
"items": {
"type": "string"
},
"nullable": true
},
"description": {
"type": "string"
},
"extensions": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ExtensionConfig"
},
"nullable": true
},
"instructions": {
"type": "string",
"nullable": true
},
"parameters": {
"type": "array",
"items": {
"$ref": "#/components/schemas/RecipeParameter"
},
"nullable": true
},
"prompt": {
"type": "string",
"nullable": true
},
"response": {
"allOf": [
{
"$ref": "#/components/schemas/Response"
}
],
"nullable": true
},
"settings": {
"allOf": [
{
"$ref": "#/components/schemas/Settings"
}
],
"nullable": true
},
"sub_recipes": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SubRecipe"
},
"nullable": true
},
"title": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
"RecipeParameter": {
"type": "object",
"required": [
"key",
"input_type",
"requirement",
"description"
],
"properties": {
"default": {
"type": "string",
"nullable": true
},
"description": {
"type": "string"
},
"input_type": {
"$ref": "#/components/schemas/RecipeParameterInputType"
},
"key": {
"type": "string"
},
"requirement": {
"$ref": "#/components/schemas/RecipeParameterRequirement"
}
}
},
"RecipeParameterInputType": {
"type": "string",
"enum": [
"string",
"number",
"boolean",
"date",
"file"
]
},
"RecipeParameterRequirement": {
"type": "string",
"enum": [
"required",
"optional",
"user_prompt"
]
},
"RedactedThinkingContent": {
"type": "object",
"required": [
@@ -2004,6 +2365,14 @@
}
]
},
"Response": {
"type": "object",
"properties": {
"json_schema": {
"nullable": true
}
}
},
"Role": {
"oneOf": [
{
@@ -2273,6 +2642,49 @@
}
}
},
"Settings": {
"type": "object",
"properties": {
"goose_model": {
"type": "string",
"nullable": true
},
"goose_provider": {
"type": "string",
"nullable": true
},
"temperature": {
"type": "number",
"format": "float",
"nullable": true
}
}
},
"SubRecipe": {
"type": "object",
"required": [
"name",
"path"
],
"properties": {
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"sequential_when_repeated": {
"type": "boolean"
},
"values": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"nullable": true
}
}
},
"SummarizationRequested": {
"type": "object",
"required": [