Something went wrong. Try again.
mirror of github.com/PrefectHQ/fastmcp
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223"""Shared fixtures for openapi_new utilities tests."""
import pytest
@pytest.fixturedef basic_openapi_30_spec(): """Basic OpenAPI 3.0 spec for testing.""" return { "openapi": "3.0.0", "info": {"title": "Test API", "version": "1.0.0"}, "servers": [{"url": "https://api.example.com"}], "paths": { "/users/{id}": { "get": { "operationId": "get_user", "summary": "Get user by ID", "parameters": [ { "name": "id", "in": "path", "required": True, "schema": {"type": "integer"}, } ], "responses": { "200": { "description": "User retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": {"type": "integer"}, "name": {"type": "string"}, }, } } }, } }, } } }, }
@pytest.fixturedef basic_openapi_31_spec(): """Basic OpenAPI 3.1 spec for testing.""" return { "openapi": "3.1.0", "info": {"title": "Test API", "version": "1.0.0"}, "servers": [{"url": "https://api.example.com"}], "paths": { "/users/{id}": { "get": { "operationId": "get_user", "summary": "Get user by ID", "parameters": [ { "name": "id", "in": "path", "required": True, "schema": {"type": "integer"}, } ], "responses": { "200": { "description": "User retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": {"type": "integer"}, "name": {"type": "string"}, }, } } }, } }, } } }, }
@pytest.fixturedef collision_spec(): """OpenAPI spec with parameter name collisions.""" return { "openapi": "3.0.0", "info": {"title": "Collision Test API", "version": "1.0.0"}, "paths": { "/users/{id}": { "put": { "operationId": "update_user", "parameters": [ { "name": "id", "in": "path", "required": True, "schema": {"type": "integer"}, } ], "requestBody": { "required": True, "content": { "application/json": { "schema": { "type": "object", "properties": { "id": {"type": "integer"}, "name": {"type": "string"}, }, "required": ["name"], } } }, }, "responses": {"200": {"description": "Updated"}}, } } }, }
@pytest.fixturedef deepobject_spec(): """OpenAPI spec with deepObject parameter style.""" return { "openapi": "3.0.0", "info": {"title": "DeepObject Test API", "version": "1.0.0"}, "paths": { "/search": { "get": { "operationId": "search", "parameters": [ { "name": "filter", "in": "query", "required": False, "style": "deepObject", "explode": True, "schema": { "type": "object", "properties": { "category": {"type": "string"}, "price": { "type": "object", "properties": { "min": {"type": "number"}, "max": {"type": "number"}, }, }, }, }, } ], "responses": {"200": {"description": "Search results"}}, } } }, }
@pytest.fixturedef complex_spec(): """Complex OpenAPI spec with multiple parameter types.""" return { "openapi": "3.0.0", "info": {"title": "Complex API", "version": "1.0.0"}, "paths": { "/items/{id}": { "patch": { "operationId": "update_item", "parameters": [ { "name": "id", "in": "path", "required": True, "schema": {"type": "string"}, }, { "name": "version", "in": "query", "required": False, "schema": {"type": "integer", "default": 1}, }, { "name": "X-Client-Version", "in": "header", "required": False, "schema": {"type": "string"}, }, ], "requestBody": { "required": True, "content": { "application/json": { "schema": { "type": "object", "properties": { "title": {"type": "string"}, "description": {"type": "string"}, "tags": { "type": "array", "items": {"type": "string"}, }, }, "required": ["title"], } } }, }, "responses": {"200": {"description": "Item updated"}}, } } }, }