diff --git a/packages/typed-openapi/src/generator.ts b/packages/typed-openapi/src/generator.ts index 1c02e8e..a023e75 100644 --- a/packages/typed-openapi/src/generator.ts +++ b/packages/typed-openapi/src/generator.ts @@ -137,6 +137,7 @@ const generateEndpointSchemaList = (ctx: GeneratorContext) => { file += `export type ${endpoint.meta.alias} = { method: "${endpoint.method.toUpperCase()}", path: "${endpoint.path}", + requestFormat: "${endpoint.requestFormat}", ${ endpoint.meta.hasParameters ? `parameters: { @@ -235,6 +236,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -244,6 +247,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/src/map-openapi-endpoints.ts b/packages/typed-openapi/src/map-openapi-endpoints.ts index 3ea81d9..94356fe 100644 --- a/packages/typed-openapi/src/map-openapi-endpoints.ts +++ b/packages/typed-openapi/src/map-openapi-endpoints.ts @@ -8,6 +8,7 @@ import { createRefResolver } from "./ref-resolver"; import { tsFactory } from "./ts-factory"; import { AnyBox, BoxRef, OpenapiSchemaConvertContext } from "./types"; import { pathToVariableName } from "./string-utils"; +import { match, P } from "ts-pattern"; const factory = tsFactory; @@ -25,6 +26,7 @@ export const mapOpenApiEndpoints = (doc: OpenAPIObject) => { operation, method: method as Method, path, + requestFormat: "json", response: openApiSchemaToTs({ schema: {}, ctx }), meta: { alias: getAlias({ path, method, operation } as Endpoint), @@ -83,12 +85,21 @@ export const mapOpenApiEndpoints = (doc: OpenAPIObject) => { ctx, }); } + + endpoint.requestFormat = match(matchingMediaType) + .with("application/octet-stream", () => "binary" as const) + .with("multipart/form-data", () => "form-data" as const) + .with("application/x-www-form-urlencoded", () => "form-url" as const) + .with(P.string.includes("json"), () => "json" as const) + .otherwise(() => "text" as const); } // Make parameters optional if all or some of them are not required if (params) { const t = createBoxFactory({}, ctx); - const filtered_params = ["query", "path", "header"] as Array>; + const filtered_params = ["query", "path", "header"] as Array< + keyof Pick + >; for (const k of filtered_params) { if (params[k] && lists[k].length) { @@ -165,6 +176,8 @@ export type EndpointParameters = { path?: Box | Record; }; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: AnyBox; @@ -175,6 +188,7 @@ export type Endpoint = { method: Method; path: string; parameters?: TConfig["parameters"]; + requestFormat: RequestFormat; meta: { alias: string; hasParameters: boolean; diff --git a/packages/typed-openapi/tests/generator.test.ts b/packages/typed-openapi/tests/generator.test.ts index 0e7b657..f492d33 100644 --- a/packages/typed-openapi/tests/generator.test.ts +++ b/packages/typed-openapi/tests/generator.test.ts @@ -51,6 +51,7 @@ describe("generator", () => { export type put_UpdatePet = { method: "PUT"; path: "/pet"; + requestFormat: "json"; parameters: { body: Schemas.Pet; }; @@ -59,6 +60,7 @@ describe("generator", () => { export type post_AddPet = { method: "POST"; path: "/pet"; + requestFormat: "json"; parameters: { body: Schemas.Pet; }; @@ -67,6 +69,7 @@ describe("generator", () => { export type get_FindPetsByStatus = { method: "GET"; path: "/pet/findByStatus"; + requestFormat: "json"; parameters: { query: Partial<{ status: "available" | "pending" | "sold" }>; }; @@ -75,6 +78,7 @@ describe("generator", () => { export type get_FindPetsByTags = { method: "GET"; path: "/pet/findByTags"; + requestFormat: "json"; parameters: { query: Partial<{ tags: Array }>; }; @@ -83,6 +87,7 @@ describe("generator", () => { export type get_GetPetById = { method: "GET"; path: "/pet/{petId}"; + requestFormat: "json"; parameters: { path: { petId: number }; }; @@ -91,6 +96,7 @@ describe("generator", () => { export type post_UpdatePetWithForm = { method: "POST"; path: "/pet/{petId}"; + requestFormat: "json"; parameters: { query: Partial<{ name: string; status: string }>; path: { petId: number }; @@ -100,6 +106,7 @@ describe("generator", () => { export type delete_DeletePet = { method: "DELETE"; path: "/pet/{petId}"; + requestFormat: "json"; parameters: { path: { petId: number }; header: Partial<{ api_key: string }>; @@ -109,6 +116,7 @@ describe("generator", () => { export type post_UploadFile = { method: "POST"; path: "/pet/{petId}/uploadImage"; + requestFormat: "binary"; parameters: { query: Partial<{ additionalMetadata: string }>; path: { petId: number }; @@ -120,12 +128,14 @@ describe("generator", () => { export type get_GetInventory = { method: "GET"; path: "/store/inventory"; + requestFormat: "json"; parameters: never; response: unknown; }; export type post_PlaceOrder = { method: "POST"; path: "/store/order"; + requestFormat: "json"; parameters: { body: Schemas.Order; }; @@ -134,6 +144,7 @@ describe("generator", () => { export type get_GetOrderById = { method: "GET"; path: "/store/order/{orderId}"; + requestFormat: "json"; parameters: { path: { orderId: number }; }; @@ -142,6 +153,7 @@ describe("generator", () => { export type delete_DeleteOrder = { method: "DELETE"; path: "/store/order/{orderId}"; + requestFormat: "json"; parameters: { path: { orderId: number }; }; @@ -150,6 +162,7 @@ describe("generator", () => { export type post_CreateUser = { method: "POST"; path: "/user"; + requestFormat: "json"; parameters: { body: Schemas.User; }; @@ -158,6 +171,7 @@ describe("generator", () => { export type post_CreateUsersWithListInput = { method: "POST"; path: "/user/createWithList"; + requestFormat: "json"; parameters: { body: Array; }; @@ -166,6 +180,7 @@ describe("generator", () => { export type get_LoginUser = { method: "GET"; path: "/user/login"; + requestFormat: "json"; parameters: { query: Partial<{ username: string; password: string }>; }; @@ -174,12 +189,14 @@ describe("generator", () => { export type get_LogoutUser = { method: "GET"; path: "/user/logout"; + requestFormat: "json"; parameters: never; response: unknown; }; export type get_GetUserByName = { method: "GET"; path: "/user/{username}"; + requestFormat: "json"; parameters: { path: { username: string }; }; @@ -188,6 +205,7 @@ describe("generator", () => { export type put_UpdateUser = { method: "PUT"; path: "/user/{username}"; + requestFormat: "json"; parameters: { path: { username: string }; @@ -198,6 +216,7 @@ describe("generator", () => { export type delete_DeleteUser = { method: "DELETE"; path: "/user/{username}"; + requestFormat: "json"; parameters: { path: { username: string }; }; @@ -259,6 +278,8 @@ describe("generator", () => { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; + type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -268,6 +289,7 @@ describe("generator", () => { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/map-openapi-endpoints.test.ts b/packages/typed-openapi/tests/map-openapi-endpoints.test.ts index 910dec3..64681db 100644 --- a/packages/typed-openapi/tests/map-openapi-endpoints.test.ts +++ b/packages/typed-openapi/tests/map-openapi-endpoints.test.ts @@ -1320,6 +1320,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/pet", + "requestFormat": "json", "response": { "type": "ref", "value": "Pet", @@ -1396,6 +1397,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/pet", + "requestFormat": "json", "response": { "type": "ref", "value": "Pet", @@ -1475,6 +1477,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/pet/findByStatus", + "requestFormat": "json", "response": { "type": "array", "value": "Array", @@ -1551,6 +1554,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/pet/findByTags", + "requestFormat": "json", "response": { "type": "array", "value": "Array", @@ -1626,6 +1630,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/pet/{petId}", + "requestFormat": "json", "response": { "type": "ref", "value": "Pet", @@ -1700,6 +1705,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/pet/{petId}", + "requestFormat": "json", "response": { "type": "keyword", "value": "unknown", @@ -1767,6 +1773,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/pet/{petId}", + "requestFormat": "json", "response": { "type": "keyword", "value": "unknown", @@ -1855,6 +1862,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/pet/{petId}/uploadImage", + "requestFormat": "binary", "response": { "type": "ref", "value": "ApiResponse", @@ -1898,6 +1906,7 @@ describe("map-openapi-endpoints", () => { }, "parameters": undefined, "path": "/store/inventory", + "requestFormat": "json", "response": { "type": "keyword", "value": "unknown", @@ -1959,6 +1968,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/store/order", + "requestFormat": "json", "response": { "type": "ref", "value": "Order", @@ -2023,6 +2033,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/store/order/{orderId}", + "requestFormat": "json", "response": { "type": "ref", "value": "Order", @@ -2072,6 +2083,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/store/order/{orderId}", + "requestFormat": "json", "response": { "type": "keyword", "value": "unknown", @@ -2136,6 +2148,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/user", + "requestFormat": "json", "response": { "type": "ref", "value": "User", @@ -2195,6 +2208,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/user/createWithList", + "requestFormat": "json", "response": { "type": "ref", "value": "User", @@ -2278,6 +2292,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/user/login", + "requestFormat": "json", "response": { "type": "keyword", "value": "string", @@ -2306,6 +2321,7 @@ describe("map-openapi-endpoints", () => { }, "parameters": undefined, "path": "/user/logout", + "requestFormat": "json", "response": { "type": "keyword", "value": "unknown", @@ -2369,6 +2385,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/user/{username}", + "requestFormat": "json", "response": { "type": "ref", "value": "User", @@ -2438,6 +2455,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/user/{username}", + "requestFormat": "json", "response": { "type": "keyword", "value": "unknown", @@ -2486,6 +2504,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/user/{username}", + "requestFormat": "json", "response": { "type": "keyword", "value": "unknown", @@ -2656,6 +2675,7 @@ describe("map-openapi-endpoints", () => { }, }, "path": "/users/{id}", + "requestFormat": "json", "response": { "type": "keyword", "value": "unknown", diff --git a/packages/typed-openapi/tests/snapshots/docker.openapi.client.ts b/packages/typed-openapi/tests/snapshots/docker.openapi.client.ts index 3235fa6..b16e82d 100644 --- a/packages/typed-openapi/tests/snapshots/docker.openapi.client.ts +++ b/packages/typed-openapi/tests/snapshots/docker.openapi.client.ts @@ -853,6 +853,7 @@ export namespace Endpoints { export type get_ContainerList = { method: "GET"; path: "/containers/json"; + requestFormat: "json"; parameters: { query: Partial<{ all: boolean; limit: number; size: boolean; filters: string }>; }; @@ -861,6 +862,7 @@ export namespace Endpoints { export type post_ContainerCreate = { method: "POST"; path: "/containers/create"; + requestFormat: "json"; parameters: { query: Partial<{ name: string; platform: string }>; @@ -872,6 +874,7 @@ export namespace Endpoints { export type get_ContainerInspect = { method: "GET"; path: "/containers/{id}/json"; + requestFormat: "json"; parameters: { query: Partial<{ size: boolean }>; path: { id: string }; @@ -907,6 +910,7 @@ export namespace Endpoints { export type get_ContainerTop = { method: "GET"; path: "/containers/{id}/top"; + requestFormat: "json"; parameters: { query: Partial<{ ps_args: string }>; path: { id: string }; @@ -916,6 +920,7 @@ export namespace Endpoints { export type get_ContainerLogs = { method: "GET"; path: "/containers/{id}/logs"; + requestFormat: "json"; parameters: { query: Partial<{ follow: boolean; @@ -933,6 +938,7 @@ export namespace Endpoints { export type get_ContainerChanges = { method: "GET"; path: "/containers/{id}/changes"; + requestFormat: "json"; parameters: { path: { id: string }; }; @@ -941,6 +947,7 @@ export namespace Endpoints { export type get_ContainerExport = { method: "GET"; path: "/containers/{id}/export"; + requestFormat: "json"; parameters: { path: { id: string }; }; @@ -949,6 +956,7 @@ export namespace Endpoints { export type get_ContainerStats = { method: "GET"; path: "/containers/{id}/stats"; + requestFormat: "json"; parameters: { query: Partial<{ stream: boolean; "one-shot": boolean }>; path: { id: string }; @@ -958,6 +966,7 @@ export namespace Endpoints { export type post_ContainerResize = { method: "POST"; path: "/containers/{id}/resize"; + requestFormat: "json"; parameters: { query: Partial<{ h: number; w: number }>; path: { id: string }; @@ -967,6 +976,7 @@ export namespace Endpoints { export type post_ContainerStart = { method: "POST"; path: "/containers/{id}/start"; + requestFormat: "json"; parameters: { query: Partial<{ detachKeys: string }>; path: { id: string }; @@ -976,6 +986,7 @@ export namespace Endpoints { export type post_ContainerStop = { method: "POST"; path: "/containers/{id}/stop"; + requestFormat: "json"; parameters: { query: Partial<{ signal: string; t: number }>; path: { id: string }; @@ -985,6 +996,7 @@ export namespace Endpoints { export type post_ContainerRestart = { method: "POST"; path: "/containers/{id}/restart"; + requestFormat: "json"; parameters: { query: Partial<{ signal: string; t: number }>; path: { id: string }; @@ -994,6 +1006,7 @@ export namespace Endpoints { export type post_ContainerKill = { method: "POST"; path: "/containers/{id}/kill"; + requestFormat: "json"; parameters: { query: Partial<{ signal: string }>; path: { id: string }; @@ -1003,6 +1016,7 @@ export namespace Endpoints { export type post_ContainerUpdate = { method: "POST"; path: "/containers/{id}/update"; + requestFormat: "json"; parameters: { path: { id: string }; @@ -1013,6 +1027,7 @@ export namespace Endpoints { export type post_ContainerRename = { method: "POST"; path: "/containers/{id}/rename"; + requestFormat: "json"; parameters: { query: { name: string }; path: { id: string }; @@ -1022,6 +1037,7 @@ export namespace Endpoints { export type post_ContainerPause = { method: "POST"; path: "/containers/{id}/pause"; + requestFormat: "json"; parameters: { path: { id: string }; }; @@ -1030,6 +1046,7 @@ export namespace Endpoints { export type post_ContainerUnpause = { method: "POST"; path: "/containers/{id}/unpause"; + requestFormat: "json"; parameters: { path: { id: string }; }; @@ -1038,6 +1055,7 @@ export namespace Endpoints { export type post_ContainerAttach = { method: "POST"; path: "/containers/{id}/attach"; + requestFormat: "json"; parameters: { query: Partial<{ detachKeys: string; @@ -1054,6 +1072,7 @@ export namespace Endpoints { export type get_ContainerAttachWebsocket = { method: "GET"; path: "/containers/{id}/attach/ws"; + requestFormat: "json"; parameters: { query: Partial<{ detachKeys: string; @@ -1070,6 +1089,7 @@ export namespace Endpoints { export type post_ContainerWait = { method: "POST"; path: "/containers/{id}/wait"; + requestFormat: "json"; parameters: { query: Partial<{ condition: "not-running" | "next-exit" | "removed" }>; path: { id: string }; @@ -1079,6 +1099,7 @@ export namespace Endpoints { export type delete_ContainerDelete = { method: "DELETE"; path: "/containers/{id}"; + requestFormat: "json"; parameters: { query: Partial<{ v: boolean; force: boolean; link: boolean }>; path: { id: string }; @@ -1088,6 +1109,7 @@ export namespace Endpoints { export type get_ContainerArchive = { method: "GET"; path: "/containers/{id}/archive"; + requestFormat: "json"; parameters: { query: { path: string }; path: { id: string }; @@ -1097,6 +1119,7 @@ export namespace Endpoints { export type put_PutContainerArchive = { method: "PUT"; path: "/containers/{id}/archive"; + requestFormat: "binary"; parameters: { query: { path: string; noOverwriteDirNonDir: string | undefined; copyUIDGID: string | undefined }; path: { id: string }; @@ -1108,6 +1131,7 @@ export namespace Endpoints { export type head_ContainerArchiveInfo = { method: "HEAD"; path: "/containers/{id}/archive"; + requestFormat: "json"; parameters: { query: { path: string }; path: { id: string }; @@ -1117,6 +1141,7 @@ export namespace Endpoints { export type post_ContainerPrune = { method: "POST"; path: "/containers/prune"; + requestFormat: "json"; parameters: { query: Partial<{ filters: string }>; }; @@ -1125,6 +1150,7 @@ export namespace Endpoints { export type get_ImageList = { method: "GET"; path: "/images/json"; + requestFormat: "json"; parameters: { query: Partial<{ all: boolean; filters: string; "shared-size": boolean; digests: boolean }>; }; @@ -1133,6 +1159,7 @@ export namespace Endpoints { export type post_ImageBuild = { method: "POST"; path: "/build"; + requestFormat: "binary"; parameters: { query: Partial<{ dockerfile: string; @@ -1169,6 +1196,7 @@ export namespace Endpoints { export type post_BuildPrune = { method: "POST"; path: "/build/prune"; + requestFormat: "json"; parameters: { query: Partial<{ "keep-storage": number; all: boolean; filters: string }>; }; @@ -1177,6 +1205,7 @@ export namespace Endpoints { export type post_ImageCreate = { method: "POST"; path: "/images/create"; + requestFormat: "text"; parameters: { query: Partial<{ fromImage: string; @@ -1196,6 +1225,7 @@ export namespace Endpoints { export type get_ImageInspect = { method: "GET"; path: "/images/{name}/json"; + requestFormat: "json"; parameters: { path: { name: string }; }; @@ -1204,6 +1234,7 @@ export namespace Endpoints { export type get_ImageHistory = { method: "GET"; path: "/images/{name}/history"; + requestFormat: "json"; parameters: { path: { name: string }; }; @@ -1219,6 +1250,7 @@ export namespace Endpoints { export type post_ImagePush = { method: "POST"; path: "/images/{name}/push"; + requestFormat: "json"; parameters: { query: Partial<{ tag: string }>; path: { name: string }; @@ -1229,6 +1261,7 @@ export namespace Endpoints { export type post_ImageTag = { method: "POST"; path: "/images/{name}/tag"; + requestFormat: "json"; parameters: { query: Partial<{ repo: string; tag: string }>; path: { name: string }; @@ -1238,6 +1271,7 @@ export namespace Endpoints { export type delete_ImageDelete = { method: "DELETE"; path: "/images/{name}"; + requestFormat: "json"; parameters: { query: Partial<{ force: boolean; noprune: boolean }>; path: { name: string }; @@ -1247,6 +1281,7 @@ export namespace Endpoints { export type get_ImageSearch = { method: "GET"; path: "/images/search"; + requestFormat: "json"; parameters: { query: { term: string; limit: number | undefined; filters: string | undefined }; }; @@ -1257,6 +1292,7 @@ export namespace Endpoints { export type post_ImagePrune = { method: "POST"; path: "/images/prune"; + requestFormat: "json"; parameters: { query: Partial<{ filters: string }>; }; @@ -1265,6 +1301,7 @@ export namespace Endpoints { export type post_SystemAuth = { method: "POST"; path: "/auth"; + requestFormat: "json"; parameters: { body: Schemas.AuthConfig; }; @@ -1273,30 +1310,35 @@ export namespace Endpoints { export type get_SystemInfo = { method: "GET"; path: "/info"; + requestFormat: "json"; parameters: never; response: Schemas.SystemInfo; }; export type get_SystemVersion = { method: "GET"; path: "/version"; + requestFormat: "json"; parameters: never; response: Schemas.SystemVersion; }; export type get_SystemPing = { method: "GET"; path: "/_ping"; + requestFormat: "json"; parameters: never; response: unknown; }; export type head_SystemPingHead = { method: "HEAD"; path: "/_ping"; + requestFormat: "json"; parameters: never; response: unknown; }; export type post_ImageCommit = { method: "POST"; path: "/commit"; + requestFormat: "json"; parameters: { query: Partial<{ container: string; @@ -1315,6 +1357,7 @@ export namespace Endpoints { export type get_SystemEvents = { method: "GET"; path: "/events"; + requestFormat: "json"; parameters: { query: Partial<{ since: string; until: string; filters: string }>; }; @@ -1323,6 +1366,7 @@ export namespace Endpoints { export type get_SystemDataUsage = { method: "GET"; path: "/system/df"; + requestFormat: "json"; parameters: { query: Partial<{ type: Array<"container" | "image" | "volume" | "build-cache"> }>; }; @@ -1337,6 +1381,7 @@ export namespace Endpoints { export type get_ImageGet = { method: "GET"; path: "/images/{name}/get"; + requestFormat: "json"; parameters: { path: { name: string }; }; @@ -1345,6 +1390,7 @@ export namespace Endpoints { export type get_ImageGetAll = { method: "GET"; path: "/images/get"; + requestFormat: "json"; parameters: { query: Partial<{ names: Array }>; }; @@ -1353,6 +1399,7 @@ export namespace Endpoints { export type post_ImageLoad = { method: "POST"; path: "/images/load"; + requestFormat: "text"; parameters: { query: Partial<{ quiet: boolean }>; }; @@ -1361,6 +1408,7 @@ export namespace Endpoints { export type post_ContainerExec = { method: "POST"; path: "/containers/{id}/exec"; + requestFormat: "json"; parameters: { path: { id: string }; @@ -1383,6 +1431,7 @@ export namespace Endpoints { export type post_ExecStart = { method: "POST"; path: "/exec/{id}/start"; + requestFormat: "json"; parameters: { path: { id: string }; @@ -1393,6 +1442,7 @@ export namespace Endpoints { export type post_ExecResize = { method: "POST"; path: "/exec/{id}/resize"; + requestFormat: "json"; parameters: { query: Partial<{ h: number; w: number }>; path: { id: string }; @@ -1402,6 +1452,7 @@ export namespace Endpoints { export type get_ExecInspect = { method: "GET"; path: "/exec/{id}/json"; + requestFormat: "json"; parameters: { path: { id: string }; }; @@ -1422,6 +1473,7 @@ export namespace Endpoints { export type get_VolumeList = { method: "GET"; path: "/volumes"; + requestFormat: "json"; parameters: { query: Partial<{ filters: string }>; }; @@ -1430,6 +1482,7 @@ export namespace Endpoints { export type post_VolumeCreate = { method: "POST"; path: "/volumes/create"; + requestFormat: "json"; parameters: { body: Schemas.VolumeCreateOptions; }; @@ -1438,6 +1491,7 @@ export namespace Endpoints { export type get_VolumeInspect = { method: "GET"; path: "/volumes/{name}"; + requestFormat: "json"; parameters: { path: { name: string }; }; @@ -1446,6 +1500,7 @@ export namespace Endpoints { export type put_VolumeUpdate = { method: "PUT"; path: "/volumes/{name}"; + requestFormat: "json"; parameters: { query: { version: number }; path: { name: string }; @@ -1457,6 +1512,7 @@ export namespace Endpoints { export type delete_VolumeDelete = { method: "DELETE"; path: "/volumes/{name}"; + requestFormat: "json"; parameters: { query: Partial<{ force: boolean }>; path: { name: string }; @@ -1466,6 +1522,7 @@ export namespace Endpoints { export type post_VolumePrune = { method: "POST"; path: "/volumes/prune"; + requestFormat: "json"; parameters: { query: Partial<{ filters: string }>; }; @@ -1474,6 +1531,7 @@ export namespace Endpoints { export type get_NetworkList = { method: "GET"; path: "/networks"; + requestFormat: "json"; parameters: { query: Partial<{ filters: string }>; }; @@ -1482,6 +1540,7 @@ export namespace Endpoints { export type get_NetworkInspect = { method: "GET"; path: "/networks/{id}"; + requestFormat: "json"; parameters: { query: Partial<{ verbose: boolean; scope: string }>; path: { id: string }; @@ -1491,6 +1550,7 @@ export namespace Endpoints { export type delete_NetworkDelete = { method: "DELETE"; path: "/networks/{id}"; + requestFormat: "json"; parameters: { path: { id: string }; }; @@ -1499,6 +1559,7 @@ export namespace Endpoints { export type post_NetworkCreate = { method: "POST"; path: "/networks/create"; + requestFormat: "json"; parameters: { body: { Name: string; @@ -1518,6 +1579,7 @@ export namespace Endpoints { export type post_NetworkConnect = { method: "POST"; path: "/networks/{id}/connect"; + requestFormat: "json"; parameters: { path: { id: string }; @@ -1528,6 +1590,7 @@ export namespace Endpoints { export type post_NetworkDisconnect = { method: "POST"; path: "/networks/{id}/disconnect"; + requestFormat: "json"; parameters: { path: { id: string }; @@ -1538,6 +1601,7 @@ export namespace Endpoints { export type post_NetworkPrune = { method: "POST"; path: "/networks/prune"; + requestFormat: "json"; parameters: { query: Partial<{ filters: string }>; }; @@ -1546,6 +1610,7 @@ export namespace Endpoints { export type get_PluginList = { method: "GET"; path: "/plugins"; + requestFormat: "json"; parameters: { query: Partial<{ filters: string }>; }; @@ -1554,6 +1619,7 @@ export namespace Endpoints { export type get_GetPluginPrivileges = { method: "GET"; path: "/plugins/privileges"; + requestFormat: "json"; parameters: { query: { remote: string }; }; @@ -1562,6 +1628,7 @@ export namespace Endpoints { export type post_PluginPull = { method: "POST"; path: "/plugins/pull"; + requestFormat: "json"; parameters: { query: { remote: string; name: string | undefined }; @@ -1573,6 +1640,7 @@ export namespace Endpoints { export type get_PluginInspect = { method: "GET"; path: "/plugins/{name}/json"; + requestFormat: "json"; parameters: { path: { name: string }; }; @@ -1581,6 +1649,7 @@ export namespace Endpoints { export type delete_PluginDelete = { method: "DELETE"; path: "/plugins/{name}"; + requestFormat: "json"; parameters: { query: Partial<{ force: boolean }>; path: { name: string }; @@ -1590,6 +1659,7 @@ export namespace Endpoints { export type post_PluginEnable = { method: "POST"; path: "/plugins/{name}/enable"; + requestFormat: "json"; parameters: { query: Partial<{ timeout: number }>; path: { name: string }; @@ -1599,6 +1669,7 @@ export namespace Endpoints { export type post_PluginDisable = { method: "POST"; path: "/plugins/{name}/disable"; + requestFormat: "json"; parameters: { query: Partial<{ force: boolean }>; path: { name: string }; @@ -1608,6 +1679,7 @@ export namespace Endpoints { export type post_PluginUpgrade = { method: "POST"; path: "/plugins/{name}/upgrade"; + requestFormat: "json"; parameters: { query: { remote: string }; path: { name: string }; @@ -1619,6 +1691,7 @@ export namespace Endpoints { export type post_PluginCreate = { method: "POST"; path: "/plugins/create"; + requestFormat: "text"; parameters: { query: { name: string }; }; @@ -1627,6 +1700,7 @@ export namespace Endpoints { export type post_PluginPush = { method: "POST"; path: "/plugins/{name}/push"; + requestFormat: "json"; parameters: { path: { name: string }; }; @@ -1635,6 +1709,7 @@ export namespace Endpoints { export type post_PluginSet = { method: "POST"; path: "/plugins/{name}/set"; + requestFormat: "json"; parameters: { path: { name: string }; @@ -1645,6 +1720,7 @@ export namespace Endpoints { export type get_NodeList = { method: "GET"; path: "/nodes"; + requestFormat: "json"; parameters: { query: Partial<{ filters: string }>; }; @@ -1653,6 +1729,7 @@ export namespace Endpoints { export type get_NodeInspect = { method: "GET"; path: "/nodes/{id}"; + requestFormat: "json"; parameters: { path: { id: string }; }; @@ -1661,6 +1738,7 @@ export namespace Endpoints { export type delete_NodeDelete = { method: "DELETE"; path: "/nodes/{id}"; + requestFormat: "json"; parameters: { query: Partial<{ force: boolean }>; path: { id: string }; @@ -1670,6 +1748,7 @@ export namespace Endpoints { export type post_NodeUpdate = { method: "POST"; path: "/nodes/{id}/update"; + requestFormat: "json"; parameters: { query: { version: number }; path: { id: string }; @@ -1681,12 +1760,14 @@ export namespace Endpoints { export type get_SwarmInspect = { method: "GET"; path: "/swarm"; + requestFormat: "json"; parameters: never; response: Schemas.Swarm; }; export type post_SwarmInit = { method: "POST"; path: "/swarm/init"; + requestFormat: "json"; parameters: { body: Partial<{ ListenAddr: string; @@ -1704,6 +1785,7 @@ export namespace Endpoints { export type post_SwarmJoin = { method: "POST"; path: "/swarm/join"; + requestFormat: "json"; parameters: { body: Partial<{ ListenAddr: string; @@ -1718,6 +1800,7 @@ export namespace Endpoints { export type post_SwarmLeave = { method: "POST"; path: "/swarm/leave"; + requestFormat: "json"; parameters: { query: Partial<{ force: boolean }>; }; @@ -1726,6 +1809,7 @@ export namespace Endpoints { export type post_SwarmUpdate = { method: "POST"; path: "/swarm/update"; + requestFormat: "json"; parameters: { query: { version: number; @@ -1741,12 +1825,14 @@ export namespace Endpoints { export type get_SwarmUnlockkey = { method: "GET"; path: "/swarm/unlockkey"; + requestFormat: "json"; parameters: never; response: Partial<{ UnlockKey: string }>; }; export type post_SwarmUnlock = { method: "POST"; path: "/swarm/unlock"; + requestFormat: "json"; parameters: { body: Partial<{ UnlockKey: string }>; }; @@ -1755,6 +1841,7 @@ export namespace Endpoints { export type get_ServiceList = { method: "GET"; path: "/services"; + requestFormat: "json"; parameters: { query: Partial<{ filters: string; status: boolean }>; }; @@ -1763,6 +1850,7 @@ export namespace Endpoints { export type post_ServiceCreate = { method: "POST"; path: "/services/create"; + requestFormat: "json"; parameters: { header: Partial<{ "X-Registry-Auth": string }>; body: Schemas.ServiceSpec & unknown; @@ -1772,6 +1860,7 @@ export namespace Endpoints { export type get_ServiceInspect = { method: "GET"; path: "/services/{id}"; + requestFormat: "json"; parameters: { query: Partial<{ insertDefaults: boolean }>; path: { id: string }; @@ -1781,6 +1870,7 @@ export namespace Endpoints { export type delete_ServiceDelete = { method: "DELETE"; path: "/services/{id}"; + requestFormat: "json"; parameters: { path: { id: string }; }; @@ -1789,6 +1879,7 @@ export namespace Endpoints { export type post_ServiceUpdate = { method: "POST"; path: "/services/{id}/update"; + requestFormat: "json"; parameters: { query: { version: number; registryAuthFrom: "spec" | "previous-spec" | undefined; rollback: string | undefined }; path: { id: string }; @@ -1800,6 +1891,7 @@ export namespace Endpoints { export type get_ServiceLogs = { method: "GET"; path: "/services/{id}/logs"; + requestFormat: "json"; parameters: { query: Partial<{ details: boolean; @@ -1817,6 +1909,7 @@ export namespace Endpoints { export type get_TaskList = { method: "GET"; path: "/tasks"; + requestFormat: "json"; parameters: { query: Partial<{ filters: string }>; }; @@ -1825,6 +1918,7 @@ export namespace Endpoints { export type get_TaskInspect = { method: "GET"; path: "/tasks/{id}"; + requestFormat: "json"; parameters: { path: { id: string }; }; @@ -1833,6 +1927,7 @@ export namespace Endpoints { export type get_TaskLogs = { method: "GET"; path: "/tasks/{id}/logs"; + requestFormat: "json"; parameters: { query: Partial<{ details: boolean; @@ -1850,6 +1945,7 @@ export namespace Endpoints { export type get_SecretList = { method: "GET"; path: "/secrets"; + requestFormat: "json"; parameters: { query: Partial<{ filters: string }>; }; @@ -1858,6 +1954,7 @@ export namespace Endpoints { export type post_SecretCreate = { method: "POST"; path: "/secrets/create"; + requestFormat: "json"; parameters: { body: Schemas.SecretSpec & unknown; }; @@ -1866,6 +1963,7 @@ export namespace Endpoints { export type get_SecretInspect = { method: "GET"; path: "/secrets/{id}"; + requestFormat: "json"; parameters: { path: { id: string }; }; @@ -1874,6 +1972,7 @@ export namespace Endpoints { export type delete_SecretDelete = { method: "DELETE"; path: "/secrets/{id}"; + requestFormat: "json"; parameters: { path: { id: string }; }; @@ -1882,6 +1981,7 @@ export namespace Endpoints { export type post_SecretUpdate = { method: "POST"; path: "/secrets/{id}/update"; + requestFormat: "json"; parameters: { query: { version: number }; path: { id: string }; @@ -1893,6 +1993,7 @@ export namespace Endpoints { export type get_ConfigList = { method: "GET"; path: "/configs"; + requestFormat: "json"; parameters: { query: Partial<{ filters: string }>; }; @@ -1901,6 +2002,7 @@ export namespace Endpoints { export type post_ConfigCreate = { method: "POST"; path: "/configs/create"; + requestFormat: "json"; parameters: { body: Schemas.ConfigSpec & unknown; }; @@ -1909,6 +2011,7 @@ export namespace Endpoints { export type get_ConfigInspect = { method: "GET"; path: "/configs/{id}"; + requestFormat: "json"; parameters: { path: { id: string }; }; @@ -1917,6 +2020,7 @@ export namespace Endpoints { export type delete_ConfigDelete = { method: "DELETE"; path: "/configs/{id}"; + requestFormat: "json"; parameters: { path: { id: string }; }; @@ -1925,6 +2029,7 @@ export namespace Endpoints { export type post_ConfigUpdate = { method: "POST"; path: "/configs/{id}/update"; + requestFormat: "json"; parameters: { query: { version: number }; path: { id: string }; @@ -1936,6 +2041,7 @@ export namespace Endpoints { export type get_DistributionInspect = { method: "GET"; path: "/distribution/{name}/json"; + requestFormat: "json"; parameters: { path: { name: string }; }; @@ -1944,6 +2050,7 @@ export namespace Endpoints { export type post_Session = { method: "POST"; path: "/session"; + requestFormat: "json"; parameters: never; response: unknown; }; @@ -2094,6 +2201,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -2103,6 +2212,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/docker.openapi.io-ts.ts b/packages/typed-openapi/tests/snapshots/docker.openapi.io-ts.ts index ab8ed25..fd6265d 100644 --- a/packages/typed-openapi/tests/snapshots/docker.openapi.io-ts.ts +++ b/packages/typed-openapi/tests/snapshots/docker.openapi.io-ts.ts @@ -1728,6 +1728,7 @@ export type get_ContainerList = t.TypeOf; export const get_ContainerList = t.type({ method: t.literal("GET"), path: t.literal("/containers/json"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ all: t.union([t.undefined, t.boolean]), @@ -1743,6 +1744,7 @@ export type post_ContainerCreate = t.TypeOf; export const post_ContainerCreate = t.type({ method: t.literal("POST"), path: t.literal("/containers/create"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ name: t.union([t.undefined, t.string]), @@ -1763,6 +1765,7 @@ export type get_ContainerInspect = t.TypeOf; export const get_ContainerInspect = t.type({ method: t.literal("GET"), path: t.literal("/containers/{id}/json"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ size: t.union([t.undefined, t.boolean]), @@ -1804,6 +1807,7 @@ export type get_ContainerTop = t.TypeOf; export const get_ContainerTop = t.type({ method: t.literal("GET"), path: t.literal("/containers/{id}/top"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ ps_args: t.union([t.undefined, t.string]), @@ -1822,6 +1826,7 @@ export type get_ContainerLogs = t.TypeOf; export const get_ContainerLogs = t.type({ method: t.literal("GET"), path: t.literal("/containers/{id}/logs"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ follow: t.union([t.undefined, t.boolean]), @@ -1843,6 +1848,7 @@ export type get_ContainerChanges = t.TypeOf; export const get_ContainerChanges = t.type({ method: t.literal("GET"), path: t.literal("/containers/{id}/changes"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -1855,6 +1861,7 @@ export type get_ContainerExport = t.TypeOf; export const get_ContainerExport = t.type({ method: t.literal("GET"), path: t.literal("/containers/{id}/export"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -1867,6 +1874,7 @@ export type get_ContainerStats = t.TypeOf; export const get_ContainerStats = t.type({ method: t.literal("GET"), path: t.literal("/containers/{id}/stats"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ stream: t.union([t.undefined, t.boolean]), @@ -1883,6 +1891,7 @@ export type post_ContainerResize = t.TypeOf; export const post_ContainerResize = t.type({ method: t.literal("POST"), path: t.literal("/containers/{id}/resize"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ h: t.union([t.undefined, t.number]), @@ -1899,6 +1908,7 @@ export type post_ContainerStart = t.TypeOf; export const post_ContainerStart = t.type({ method: t.literal("POST"), path: t.literal("/containers/{id}/start"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ detachKeys: t.union([t.undefined, t.string]), @@ -1914,6 +1924,7 @@ export type post_ContainerStop = t.TypeOf; export const post_ContainerStop = t.type({ method: t.literal("POST"), path: t.literal("/containers/{id}/stop"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ signal: t.union([t.undefined, t.string]), @@ -1930,6 +1941,7 @@ export type post_ContainerRestart = t.TypeOf; export const post_ContainerRestart = t.type({ method: t.literal("POST"), path: t.literal("/containers/{id}/restart"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ signal: t.union([t.undefined, t.string]), @@ -1946,6 +1958,7 @@ export type post_ContainerKill = t.TypeOf; export const post_ContainerKill = t.type({ method: t.literal("POST"), path: t.literal("/containers/{id}/kill"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ signal: t.union([t.undefined, t.string]), @@ -1961,6 +1974,7 @@ export type post_ContainerUpdate = t.TypeOf; export const post_ContainerUpdate = t.type({ method: t.literal("POST"), path: t.literal("/containers/{id}/update"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -1981,6 +1995,7 @@ export type post_ContainerRename = t.TypeOf; export const post_ContainerRename = t.type({ method: t.literal("POST"), path: t.literal("/containers/{id}/rename"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ name: t.string, @@ -1996,6 +2011,7 @@ export type post_ContainerPause = t.TypeOf; export const post_ContainerPause = t.type({ method: t.literal("POST"), path: t.literal("/containers/{id}/pause"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -2008,6 +2024,7 @@ export type post_ContainerUnpause = t.TypeOf; export const post_ContainerUnpause = t.type({ method: t.literal("POST"), path: t.literal("/containers/{id}/unpause"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -2020,6 +2037,7 @@ export type post_ContainerAttach = t.TypeOf; export const post_ContainerAttach = t.type({ method: t.literal("POST"), path: t.literal("/containers/{id}/attach"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ detachKeys: t.union([t.undefined, t.string]), @@ -2040,6 +2058,7 @@ export type get_ContainerAttachWebsocket = t.TypeOf; export const post_ContainerWait = t.type({ method: t.literal("POST"), path: t.literal("/containers/{id}/wait"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ condition: t.union([ @@ -2078,6 +2098,7 @@ export type delete_ContainerDelete = t.TypeOf; export const delete_ContainerDelete = t.type({ method: t.literal("DELETE"), path: t.literal("/containers/{id}"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ v: t.union([t.undefined, t.boolean]), @@ -2095,6 +2116,7 @@ export type get_ContainerArchive = t.TypeOf; export const get_ContainerArchive = t.type({ method: t.literal("GET"), path: t.literal("/containers/{id}/archive"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ path: t.string, @@ -2110,6 +2132,7 @@ export type put_PutContainerArchive = t.TypeOf; export const put_PutContainerArchive = t.type({ method: t.literal("PUT"), path: t.literal("/containers/{id}/archive"), + requestFormat: t.literal("binary"), parameters: t.type({ query: t.type({ path: t.string, @@ -2128,6 +2151,7 @@ export type head_ContainerArchiveInfo = t.TypeOf; export const post_ContainerPrune = t.type({ method: t.literal("POST"), path: t.literal("/containers/prune"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ filters: t.union([t.undefined, t.string]), @@ -2158,6 +2183,7 @@ export type get_ImageList = t.TypeOf; export const get_ImageList = t.type({ method: t.literal("GET"), path: t.literal("/images/json"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ all: t.union([t.undefined, t.boolean]), @@ -2173,6 +2199,7 @@ export type post_ImageBuild = t.TypeOf; export const post_ImageBuild = t.type({ method: t.literal("POST"), path: t.literal("/build"), + requestFormat: t.literal("binary"), parameters: t.type({ query: t.type({ dockerfile: t.union([t.undefined, t.string]), @@ -2213,6 +2240,7 @@ export type post_BuildPrune = t.TypeOf; export const post_BuildPrune = t.type({ method: t.literal("POST"), path: t.literal("/build/prune"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ "keep-storage": t.union([t.undefined, t.number]), @@ -2230,6 +2258,7 @@ export type post_ImageCreate = t.TypeOf; export const post_ImageCreate = t.type({ method: t.literal("POST"), path: t.literal("/images/create"), + requestFormat: t.literal("text"), parameters: t.type({ query: t.type({ fromImage: t.union([t.undefined, t.string]), @@ -2252,6 +2281,7 @@ export type get_ImageInspect = t.TypeOf; export const get_ImageInspect = t.type({ method: t.literal("GET"), path: t.literal("/images/{name}/json"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ name: t.string, @@ -2264,6 +2294,7 @@ export type get_ImageHistory = t.TypeOf; export const get_ImageHistory = t.type({ method: t.literal("GET"), path: t.literal("/images/{name}/history"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ name: t.string, @@ -2285,6 +2316,7 @@ export type post_ImagePush = t.TypeOf; export const post_ImagePush = t.type({ method: t.literal("POST"), path: t.literal("/images/{name}/push"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ tag: t.union([t.undefined, t.string]), @@ -2303,6 +2335,7 @@ export type post_ImageTag = t.TypeOf; export const post_ImageTag = t.type({ method: t.literal("POST"), path: t.literal("/images/{name}/tag"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ repo: t.union([t.undefined, t.string]), @@ -2319,6 +2352,7 @@ export type delete_ImageDelete = t.TypeOf; export const delete_ImageDelete = t.type({ method: t.literal("DELETE"), path: t.literal("/images/{name}"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ force: t.union([t.undefined, t.boolean]), @@ -2335,6 +2369,7 @@ export type get_ImageSearch = t.TypeOf; export const get_ImageSearch = t.type({ method: t.literal("GET"), path: t.literal("/images/search"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ term: t.string, @@ -2357,6 +2392,7 @@ export type post_ImagePrune = t.TypeOf; export const post_ImagePrune = t.type({ method: t.literal("POST"), path: t.literal("/images/prune"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ filters: t.union([t.undefined, t.string]), @@ -2372,6 +2408,7 @@ export type post_SystemAuth = t.TypeOf; export const post_SystemAuth = t.type({ method: t.literal("POST"), path: t.literal("/auth"), + requestFormat: t.literal("json"), parameters: t.type({ body: AuthConfig, }), @@ -2382,6 +2419,7 @@ export type get_SystemInfo = t.TypeOf; export const get_SystemInfo = t.type({ method: t.literal("GET"), path: t.literal("/info"), + requestFormat: t.literal("json"), parameters: t.never, response: SystemInfo, }); @@ -2390,6 +2428,7 @@ export type get_SystemVersion = t.TypeOf; export const get_SystemVersion = t.type({ method: t.literal("GET"), path: t.literal("/version"), + requestFormat: t.literal("json"), parameters: t.never, response: SystemVersion, }); @@ -2398,6 +2437,7 @@ export type get_SystemPing = t.TypeOf; export const get_SystemPing = t.type({ method: t.literal("GET"), path: t.literal("/_ping"), + requestFormat: t.literal("json"), parameters: t.never, response: t.unknown, }); @@ -2406,6 +2446,7 @@ export type head_SystemPingHead = t.TypeOf; export const head_SystemPingHead = t.type({ method: t.literal("HEAD"), path: t.literal("/_ping"), + requestFormat: t.literal("json"), parameters: t.never, response: t.unknown, }); @@ -2414,6 +2455,7 @@ export type post_ImageCommit = t.TypeOf; export const post_ImageCommit = t.type({ method: t.literal("POST"), path: t.literal("/commit"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ container: t.union([t.undefined, t.string]), @@ -2433,6 +2475,7 @@ export type get_SystemEvents = t.TypeOf; export const get_SystemEvents = t.type({ method: t.literal("GET"), path: t.literal("/events"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ since: t.union([t.undefined, t.string]), @@ -2447,6 +2490,7 @@ export type get_SystemDataUsage = t.TypeOf; export const get_SystemDataUsage = t.type({ method: t.literal("GET"), path: t.literal("/system/df"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ type: t.union([ @@ -2468,6 +2512,7 @@ export type get_ImageGet = t.TypeOf; export const get_ImageGet = t.type({ method: t.literal("GET"), path: t.literal("/images/{name}/get"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ name: t.string, @@ -2480,6 +2525,7 @@ export type get_ImageGetAll = t.TypeOf; export const get_ImageGetAll = t.type({ method: t.literal("GET"), path: t.literal("/images/get"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ names: t.union([t.undefined, t.array(t.string)]), @@ -2492,6 +2538,7 @@ export type post_ImageLoad = t.TypeOf; export const post_ImageLoad = t.type({ method: t.literal("POST"), path: t.literal("/images/load"), + requestFormat: t.literal("text"), parameters: t.type({ query: t.type({ quiet: t.union([t.undefined, t.boolean]), @@ -2504,6 +2551,7 @@ export type post_ContainerExec = t.TypeOf; export const post_ContainerExec = t.type({ method: t.literal("POST"), path: t.literal("/containers/{id}/exec"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -2529,6 +2577,7 @@ export type post_ExecStart = t.TypeOf; export const post_ExecStart = t.type({ method: t.literal("POST"), path: t.literal("/exec/{id}/start"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -2546,6 +2595,7 @@ export type post_ExecResize = t.TypeOf; export const post_ExecResize = t.type({ method: t.literal("POST"), path: t.literal("/exec/{id}/resize"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ h: t.union([t.undefined, t.number]), @@ -2562,6 +2612,7 @@ export type get_ExecInspect = t.TypeOf; export const get_ExecInspect = t.type({ method: t.literal("GET"), path: t.literal("/exec/{id}/json"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -2586,6 +2637,7 @@ export type get_VolumeList = t.TypeOf; export const get_VolumeList = t.type({ method: t.literal("GET"), path: t.literal("/volumes"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ filters: t.union([t.undefined, t.string]), @@ -2598,6 +2650,7 @@ export type post_VolumeCreate = t.TypeOf; export const post_VolumeCreate = t.type({ method: t.literal("POST"), path: t.literal("/volumes/create"), + requestFormat: t.literal("json"), parameters: t.type({ body: VolumeCreateOptions, }), @@ -2608,6 +2661,7 @@ export type get_VolumeInspect = t.TypeOf; export const get_VolumeInspect = t.type({ method: t.literal("GET"), path: t.literal("/volumes/{name}"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ name: t.string, @@ -2620,6 +2674,7 @@ export type put_VolumeUpdate = t.TypeOf; export const put_VolumeUpdate = t.type({ method: t.literal("PUT"), path: t.literal("/volumes/{name}"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ version: t.number, @@ -2638,6 +2693,7 @@ export type delete_VolumeDelete = t.TypeOf; export const delete_VolumeDelete = t.type({ method: t.literal("DELETE"), path: t.literal("/volumes/{name}"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ force: t.union([t.undefined, t.boolean]), @@ -2653,6 +2709,7 @@ export type post_VolumePrune = t.TypeOf; export const post_VolumePrune = t.type({ method: t.literal("POST"), path: t.literal("/volumes/prune"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ filters: t.union([t.undefined, t.string]), @@ -2668,6 +2725,7 @@ export type get_NetworkList = t.TypeOf; export const get_NetworkList = t.type({ method: t.literal("GET"), path: t.literal("/networks"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ filters: t.union([t.undefined, t.string]), @@ -2680,6 +2738,7 @@ export type get_NetworkInspect = t.TypeOf; export const get_NetworkInspect = t.type({ method: t.literal("GET"), path: t.literal("/networks/{id}"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ verbose: t.union([t.undefined, t.boolean]), @@ -2696,6 +2755,7 @@ export type delete_NetworkDelete = t.TypeOf; export const delete_NetworkDelete = t.type({ method: t.literal("DELETE"), path: t.literal("/networks/{id}"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -2708,6 +2768,7 @@ export type post_NetworkCreate = t.TypeOf; export const post_NetworkCreate = t.type({ method: t.literal("POST"), path: t.literal("/networks/create"), + requestFormat: t.literal("json"), parameters: t.type({ body: t.type({ Name: t.string, @@ -2732,6 +2793,7 @@ export type post_NetworkConnect = t.TypeOf; export const post_NetworkConnect = t.type({ method: t.literal("POST"), path: t.literal("/networks/{id}/connect"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -2748,6 +2810,7 @@ export type post_NetworkDisconnect = t.TypeOf; export const post_NetworkDisconnect = t.type({ method: t.literal("POST"), path: t.literal("/networks/{id}/disconnect"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -2764,6 +2827,7 @@ export type post_NetworkPrune = t.TypeOf; export const post_NetworkPrune = t.type({ method: t.literal("POST"), path: t.literal("/networks/prune"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ filters: t.union([t.undefined, t.string]), @@ -2778,6 +2842,7 @@ export type get_PluginList = t.TypeOf; export const get_PluginList = t.type({ method: t.literal("GET"), path: t.literal("/plugins"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ filters: t.union([t.undefined, t.string]), @@ -2790,6 +2855,7 @@ export type get_GetPluginPrivileges = t.TypeOf; export const get_GetPluginPrivileges = t.type({ method: t.literal("GET"), path: t.literal("/plugins/privileges"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ remote: t.string, @@ -2802,6 +2868,7 @@ export type post_PluginPull = t.TypeOf; export const post_PluginPull = t.type({ method: t.literal("POST"), path: t.literal("/plugins/pull"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ remote: t.string, @@ -2819,6 +2886,7 @@ export type get_PluginInspect = t.TypeOf; export const get_PluginInspect = t.type({ method: t.literal("GET"), path: t.literal("/plugins/{name}/json"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ name: t.string, @@ -2831,6 +2899,7 @@ export type delete_PluginDelete = t.TypeOf; export const delete_PluginDelete = t.type({ method: t.literal("DELETE"), path: t.literal("/plugins/{name}"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ force: t.union([t.undefined, t.boolean]), @@ -2846,6 +2915,7 @@ export type post_PluginEnable = t.TypeOf; export const post_PluginEnable = t.type({ method: t.literal("POST"), path: t.literal("/plugins/{name}/enable"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ timeout: t.union([t.undefined, t.number]), @@ -2861,6 +2931,7 @@ export type post_PluginDisable = t.TypeOf; export const post_PluginDisable = t.type({ method: t.literal("POST"), path: t.literal("/plugins/{name}/disable"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ force: t.union([t.undefined, t.boolean]), @@ -2876,6 +2947,7 @@ export type post_PluginUpgrade = t.TypeOf; export const post_PluginUpgrade = t.type({ method: t.literal("POST"), path: t.literal("/plugins/{name}/upgrade"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ remote: t.string, @@ -2895,6 +2967,7 @@ export type post_PluginCreate = t.TypeOf; export const post_PluginCreate = t.type({ method: t.literal("POST"), path: t.literal("/plugins/create"), + requestFormat: t.literal("text"), parameters: t.type({ query: t.type({ name: t.string, @@ -2907,6 +2980,7 @@ export type post_PluginPush = t.TypeOf; export const post_PluginPush = t.type({ method: t.literal("POST"), path: t.literal("/plugins/{name}/push"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ name: t.string, @@ -2919,6 +2993,7 @@ export type post_PluginSet = t.TypeOf; export const post_PluginSet = t.type({ method: t.literal("POST"), path: t.literal("/plugins/{name}/set"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ name: t.string, @@ -2932,6 +3007,7 @@ export type get_NodeList = t.TypeOf; export const get_NodeList = t.type({ method: t.literal("GET"), path: t.literal("/nodes"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ filters: t.union([t.undefined, t.string]), @@ -2944,6 +3020,7 @@ export type get_NodeInspect = t.TypeOf; export const get_NodeInspect = t.type({ method: t.literal("GET"), path: t.literal("/nodes/{id}"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -2956,6 +3033,7 @@ export type delete_NodeDelete = t.TypeOf; export const delete_NodeDelete = t.type({ method: t.literal("DELETE"), path: t.literal("/nodes/{id}"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ force: t.union([t.undefined, t.boolean]), @@ -2971,6 +3049,7 @@ export type post_NodeUpdate = t.TypeOf; export const post_NodeUpdate = t.type({ method: t.literal("POST"), path: t.literal("/nodes/{id}/update"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ version: t.number, @@ -2987,6 +3066,7 @@ export type get_SwarmInspect = t.TypeOf; export const get_SwarmInspect = t.type({ method: t.literal("GET"), path: t.literal("/swarm"), + requestFormat: t.literal("json"), parameters: t.never, response: Swarm, }); @@ -2995,6 +3075,7 @@ export type post_SwarmInit = t.TypeOf; export const post_SwarmInit = t.type({ method: t.literal("POST"), path: t.literal("/swarm/init"), + requestFormat: t.literal("json"), parameters: t.type({ body: t.type({ ListenAddr: t.union([t.undefined, t.string]), @@ -3014,6 +3095,7 @@ export type post_SwarmJoin = t.TypeOf; export const post_SwarmJoin = t.type({ method: t.literal("POST"), path: t.literal("/swarm/join"), + requestFormat: t.literal("json"), parameters: t.type({ body: t.type({ ListenAddr: t.union([t.undefined, t.string]), @@ -3030,6 +3112,7 @@ export type post_SwarmLeave = t.TypeOf; export const post_SwarmLeave = t.type({ method: t.literal("POST"), path: t.literal("/swarm/leave"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ force: t.union([t.undefined, t.boolean]), @@ -3042,6 +3125,7 @@ export type post_SwarmUpdate = t.TypeOf; export const post_SwarmUpdate = t.type({ method: t.literal("POST"), path: t.literal("/swarm/update"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ version: t.number, @@ -3058,6 +3142,7 @@ export type get_SwarmUnlockkey = t.TypeOf; export const get_SwarmUnlockkey = t.type({ method: t.literal("GET"), path: t.literal("/swarm/unlockkey"), + requestFormat: t.literal("json"), parameters: t.never, response: t.type({ UnlockKey: t.union([t.undefined, t.string]), @@ -3068,6 +3153,7 @@ export type post_SwarmUnlock = t.TypeOf; export const post_SwarmUnlock = t.type({ method: t.literal("POST"), path: t.literal("/swarm/unlock"), + requestFormat: t.literal("json"), parameters: t.type({ body: t.type({ UnlockKey: t.union([t.undefined, t.string]), @@ -3080,6 +3166,7 @@ export type get_ServiceList = t.TypeOf; export const get_ServiceList = t.type({ method: t.literal("GET"), path: t.literal("/services"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ filters: t.union([t.undefined, t.string]), @@ -3093,6 +3180,7 @@ export type post_ServiceCreate = t.TypeOf; export const post_ServiceCreate = t.type({ method: t.literal("POST"), path: t.literal("/services/create"), + requestFormat: t.literal("json"), parameters: t.type({ header: t.type({ "X-Registry-Auth": t.union([t.undefined, t.string]), @@ -3109,6 +3197,7 @@ export type get_ServiceInspect = t.TypeOf; export const get_ServiceInspect = t.type({ method: t.literal("GET"), path: t.literal("/services/{id}"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ insertDefaults: t.union([t.undefined, t.boolean]), @@ -3124,6 +3213,7 @@ export type delete_ServiceDelete = t.TypeOf; export const delete_ServiceDelete = t.type({ method: t.literal("DELETE"), path: t.literal("/services/{id}"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -3136,6 +3226,7 @@ export type post_ServiceUpdate = t.TypeOf; export const post_ServiceUpdate = t.type({ method: t.literal("POST"), path: t.literal("/services/{id}/update"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ version: t.number, @@ -3157,6 +3248,7 @@ export type get_ServiceLogs = t.TypeOf; export const get_ServiceLogs = t.type({ method: t.literal("GET"), path: t.literal("/services/{id}/logs"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ details: t.union([t.undefined, t.boolean]), @@ -3178,6 +3270,7 @@ export type get_TaskList = t.TypeOf; export const get_TaskList = t.type({ method: t.literal("GET"), path: t.literal("/tasks"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ filters: t.union([t.undefined, t.string]), @@ -3190,6 +3283,7 @@ export type get_TaskInspect = t.TypeOf; export const get_TaskInspect = t.type({ method: t.literal("GET"), path: t.literal("/tasks/{id}"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -3202,6 +3296,7 @@ export type get_TaskLogs = t.TypeOf; export const get_TaskLogs = t.type({ method: t.literal("GET"), path: t.literal("/tasks/{id}/logs"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ details: t.union([t.undefined, t.boolean]), @@ -3223,6 +3318,7 @@ export type get_SecretList = t.TypeOf; export const get_SecretList = t.type({ method: t.literal("GET"), path: t.literal("/secrets"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ filters: t.union([t.undefined, t.string]), @@ -3235,6 +3331,7 @@ export type post_SecretCreate = t.TypeOf; export const post_SecretCreate = t.type({ method: t.literal("POST"), path: t.literal("/secrets/create"), + requestFormat: t.literal("json"), parameters: t.type({ body: t.intersection([SecretSpec, t.unknown]), }), @@ -3245,6 +3342,7 @@ export type get_SecretInspect = t.TypeOf; export const get_SecretInspect = t.type({ method: t.literal("GET"), path: t.literal("/secrets/{id}"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -3257,6 +3355,7 @@ export type delete_SecretDelete = t.TypeOf; export const delete_SecretDelete = t.type({ method: t.literal("DELETE"), path: t.literal("/secrets/{id}"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -3269,6 +3368,7 @@ export type post_SecretUpdate = t.TypeOf; export const post_SecretUpdate = t.type({ method: t.literal("POST"), path: t.literal("/secrets/{id}/update"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ version: t.number, @@ -3285,6 +3385,7 @@ export type get_ConfigList = t.TypeOf; export const get_ConfigList = t.type({ method: t.literal("GET"), path: t.literal("/configs"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ filters: t.union([t.undefined, t.string]), @@ -3297,6 +3398,7 @@ export type post_ConfigCreate = t.TypeOf; export const post_ConfigCreate = t.type({ method: t.literal("POST"), path: t.literal("/configs/create"), + requestFormat: t.literal("json"), parameters: t.type({ body: t.intersection([ConfigSpec, t.unknown]), }), @@ -3307,6 +3409,7 @@ export type get_ConfigInspect = t.TypeOf; export const get_ConfigInspect = t.type({ method: t.literal("GET"), path: t.literal("/configs/{id}"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -3319,6 +3422,7 @@ export type delete_ConfigDelete = t.TypeOf; export const delete_ConfigDelete = t.type({ method: t.literal("DELETE"), path: t.literal("/configs/{id}"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ id: t.string, @@ -3331,6 +3435,7 @@ export type post_ConfigUpdate = t.TypeOf; export const post_ConfigUpdate = t.type({ method: t.literal("POST"), path: t.literal("/configs/{id}/update"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ version: t.number, @@ -3347,6 +3452,7 @@ export type get_DistributionInspect = t.TypeOf; export const get_DistributionInspect = t.type({ method: t.literal("GET"), path: t.literal("/distribution/{name}/json"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ name: t.string, @@ -3359,6 +3465,7 @@ export type post_Session = t.TypeOf; export const post_Session = t.type({ method: t.literal("POST"), path: t.literal("/session"), + requestFormat: t.literal("json"), parameters: t.never, response: t.unknown, }); @@ -3509,6 +3616,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -3518,6 +3627,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/docker.openapi.typebox.ts b/packages/typed-openapi/tests/snapshots/docker.openapi.typebox.ts index 5541b60..a8e8ac3 100644 --- a/packages/typed-openapi/tests/snapshots/docker.openapi.typebox.ts +++ b/packages/typed-openapi/tests/snapshots/docker.openapi.typebox.ts @@ -1818,6 +1818,7 @@ export type get_ContainerList = Static; export const get_ContainerList = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/containers/json"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -1835,6 +1836,7 @@ export type post_ContainerCreate = Static; export const post_ContainerCreate = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/containers/create"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -1859,6 +1861,7 @@ export type get_ContainerInspect = Static; export const get_ContainerInspect = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/containers/{id}/json"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -1904,6 +1907,7 @@ export type get_ContainerTop = Static; export const get_ContainerTop = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/containers/{id}/top"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -1926,6 +1930,7 @@ export type get_ContainerLogs = Static; export const get_ContainerLogs = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/containers/{id}/logs"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -1949,6 +1954,7 @@ export type get_ContainerChanges = Static; export const get_ContainerChanges = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/containers/{id}/changes"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -1961,6 +1967,7 @@ export type get_ContainerExport = Static; export const get_ContainerExport = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/containers/{id}/export"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -1973,6 +1980,7 @@ export type get_ContainerStats = Static; export const get_ContainerStats = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/containers/{id}/stats"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -1991,6 +1999,7 @@ export type post_ContainerResize = Static; export const post_ContainerResize = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/containers/{id}/resize"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2009,6 +2018,7 @@ export type post_ContainerStart = Static; export const post_ContainerStart = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/containers/{id}/start"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2026,6 +2036,7 @@ export type post_ContainerStop = Static; export const post_ContainerStop = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/containers/{id}/stop"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2044,6 +2055,7 @@ export type post_ContainerRestart = Static; export const post_ContainerRestart = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/containers/{id}/restart"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2062,6 +2074,7 @@ export type post_ContainerKill = Static; export const post_ContainerKill = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/containers/{id}/kill"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2079,6 +2092,7 @@ export type post_ContainerUpdate = Static; export const post_ContainerUpdate = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/containers/{id}/update"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -2103,6 +2117,7 @@ export type post_ContainerRename = Static; export const post_ContainerRename = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/containers/{id}/rename"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Object({ name: Type.String(), @@ -2118,6 +2133,7 @@ export type post_ContainerPause = Static; export const post_ContainerPause = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/containers/{id}/pause"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -2130,6 +2146,7 @@ export type post_ContainerUnpause = Static; export const post_ContainerUnpause = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/containers/{id}/unpause"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -2142,6 +2159,7 @@ export type post_ContainerAttach = Static; export const post_ContainerAttach = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/containers/{id}/attach"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2164,6 +2182,7 @@ export type get_ContainerAttachWebsocket = Static; export const post_ContainerWait = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/containers/{id}/wait"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2203,6 +2223,7 @@ export type delete_ContainerDelete = Static; export const delete_ContainerDelete = Type.Object({ method: Type.Literal("DELETE"), path: Type.Literal("/containers/{id}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2222,6 +2243,7 @@ export type get_ContainerArchive = Static; export const get_ContainerArchive = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/containers/{id}/archive"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Object({ path: Type.String(), @@ -2237,6 +2259,7 @@ export type put_PutContainerArchive = Static; export const put_PutContainerArchive = Type.Object({ method: Type.Literal("PUT"), path: Type.Literal("/containers/{id}/archive"), + requestFormat: Type.Literal("binary"), parameters: Type.Object({ query: Type.Object({ path: Type.String(), @@ -2255,6 +2278,7 @@ export type head_ContainerArchiveInfo = Static export const head_ContainerArchiveInfo = Type.Object({ method: Type.Literal("HEAD"), path: Type.Literal("/containers/{id}/archive"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Object({ path: Type.String(), @@ -2270,6 +2294,7 @@ export type post_ContainerPrune = Static; export const post_ContainerPrune = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/containers/prune"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2289,6 +2314,7 @@ export type get_ImageList = Static; export const get_ImageList = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/images/json"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2306,6 +2332,7 @@ export type post_ImageBuild = Static; export const post_ImageBuild = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/build"), + requestFormat: Type.Literal("binary"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2350,6 +2377,7 @@ export type post_BuildPrune = Static; export const post_BuildPrune = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/build/prune"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2371,6 +2399,7 @@ export type post_ImageCreate = Static; export const post_ImageCreate = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/images/create"), + requestFormat: Type.Literal("text"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2397,6 +2426,7 @@ export type get_ImageInspect = Static; export const get_ImageInspect = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/images/{name}/json"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ name: Type.String(), @@ -2409,6 +2439,7 @@ export type get_ImageHistory = Static; export const get_ImageHistory = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/images/{name}/history"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ name: Type.String(), @@ -2430,6 +2461,7 @@ export type post_ImagePush = Static; export const post_ImagePush = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/images/{name}/push"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2450,6 +2482,7 @@ export type post_ImageTag = Static; export const post_ImageTag = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/images/{name}/tag"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2468,6 +2501,7 @@ export type delete_ImageDelete = Static; export const delete_ImageDelete = Type.Object({ method: Type.Literal("DELETE"), path: Type.Literal("/images/{name}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2486,6 +2520,7 @@ export type get_ImageSearch = Static; export const get_ImageSearch = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/images/search"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Object({ term: Type.String(), @@ -2510,6 +2545,7 @@ export type post_ImagePrune = Static; export const post_ImagePrune = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/images/prune"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2529,6 +2565,7 @@ export type post_SystemAuth = Static; export const post_SystemAuth = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/auth"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ body: AuthConfig, }), @@ -2539,6 +2576,7 @@ export type get_SystemInfo = Static; export const get_SystemInfo = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/info"), + requestFormat: Type.Literal("json"), parameters: Type.Never(), response: SystemInfo, }); @@ -2547,6 +2585,7 @@ export type get_SystemVersion = Static; export const get_SystemVersion = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/version"), + requestFormat: Type.Literal("json"), parameters: Type.Never(), response: SystemVersion, }); @@ -2555,6 +2594,7 @@ export type get_SystemPing = Static; export const get_SystemPing = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/_ping"), + requestFormat: Type.Literal("json"), parameters: Type.Never(), response: Type.Unknown(), }); @@ -2563,6 +2603,7 @@ export type head_SystemPingHead = Static; export const head_SystemPingHead = Type.Object({ method: Type.Literal("HEAD"), path: Type.Literal("/_ping"), + requestFormat: Type.Literal("json"), parameters: Type.Never(), response: Type.Unknown(), }); @@ -2571,6 +2612,7 @@ export type post_ImageCommit = Static; export const post_ImageCommit = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/commit"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2592,6 +2634,7 @@ export type get_SystemEvents = Static; export const get_SystemEvents = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/events"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2608,6 +2651,7 @@ export type get_SystemDataUsage = Static; export const get_SystemDataUsage = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/system/df"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2637,6 +2681,7 @@ export type get_ImageGet = Static; export const get_ImageGet = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/images/{name}/get"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ name: Type.String(), @@ -2649,6 +2694,7 @@ export type get_ImageGetAll = Static; export const get_ImageGetAll = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/images/get"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2663,6 +2709,7 @@ export type post_ImageLoad = Static; export const post_ImageLoad = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/images/load"), + requestFormat: Type.Literal("text"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2677,6 +2724,7 @@ export type post_ContainerExec = Static; export const post_ContainerExec = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/containers/{id}/exec"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -2704,6 +2752,7 @@ export type post_ExecStart = Static; export const post_ExecStart = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/exec/{id}/start"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -2723,6 +2772,7 @@ export type post_ExecResize = Static; export const post_ExecResize = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/exec/{id}/resize"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2741,6 +2791,7 @@ export type get_ExecInspect = Static; export const get_ExecInspect = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/exec/{id}/json"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -2767,6 +2818,7 @@ export type get_VolumeList = Static; export const get_VolumeList = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/volumes"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2781,6 +2833,7 @@ export type post_VolumeCreate = Static; export const post_VolumeCreate = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/volumes/create"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ body: VolumeCreateOptions, }), @@ -2791,6 +2844,7 @@ export type get_VolumeInspect = Static; export const get_VolumeInspect = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/volumes/{name}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ name: Type.String(), @@ -2803,6 +2857,7 @@ export type put_VolumeUpdate = Static; export const put_VolumeUpdate = Type.Object({ method: Type.Literal("PUT"), path: Type.Literal("/volumes/{name}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Object({ version: Type.Number(), @@ -2823,6 +2878,7 @@ export type delete_VolumeDelete = Static; export const delete_VolumeDelete = Type.Object({ method: Type.Literal("DELETE"), path: Type.Literal("/volumes/{name}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2840,6 +2896,7 @@ export type post_VolumePrune = Static; export const post_VolumePrune = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/volumes/prune"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2859,6 +2916,7 @@ export type get_NetworkList = Static; export const get_NetworkList = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/networks"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2873,6 +2931,7 @@ export type get_NetworkInspect = Static; export const get_NetworkInspect = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/networks/{id}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2891,6 +2950,7 @@ export type delete_NetworkDelete = Static; export const delete_NetworkDelete = Type.Object({ method: Type.Literal("DELETE"), path: Type.Literal("/networks/{id}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -2903,6 +2963,7 @@ export type post_NetworkCreate = Static; export const post_NetworkCreate = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/networks/create"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ body: Type.Object({ Name: Type.String(), @@ -2929,6 +2990,7 @@ export type post_NetworkConnect = Static; export const post_NetworkConnect = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/networks/{id}/connect"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -2947,6 +3009,7 @@ export type post_NetworkDisconnect = Static; export const post_NetworkDisconnect = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/networks/{id}/disconnect"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -2965,6 +3028,7 @@ export type post_NetworkPrune = Static; export const post_NetworkPrune = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/networks/prune"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2983,6 +3047,7 @@ export type get_PluginList = Static; export const get_PluginList = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/plugins"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -2997,6 +3062,7 @@ export type get_GetPluginPrivileges = Static; export const get_GetPluginPrivileges = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/plugins/privileges"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Object({ remote: Type.String(), @@ -3009,6 +3075,7 @@ export type post_PluginPull = Static; export const post_PluginPull = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/plugins/pull"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Object({ remote: Type.String(), @@ -3028,6 +3095,7 @@ export type get_PluginInspect = Static; export const get_PluginInspect = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/plugins/{name}/json"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ name: Type.String(), @@ -3040,6 +3108,7 @@ export type delete_PluginDelete = Static; export const delete_PluginDelete = Type.Object({ method: Type.Literal("DELETE"), path: Type.Literal("/plugins/{name}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -3057,6 +3126,7 @@ export type post_PluginEnable = Static; export const post_PluginEnable = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/plugins/{name}/enable"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -3074,6 +3144,7 @@ export type post_PluginDisable = Static; export const post_PluginDisable = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/plugins/{name}/disable"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -3091,6 +3162,7 @@ export type post_PluginUpgrade = Static; export const post_PluginUpgrade = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/plugins/{name}/upgrade"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Object({ remote: Type.String(), @@ -3112,6 +3184,7 @@ export type post_PluginCreate = Static; export const post_PluginCreate = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/plugins/create"), + requestFormat: Type.Literal("text"), parameters: Type.Object({ query: Type.Object({ name: Type.String(), @@ -3124,6 +3197,7 @@ export type post_PluginPush = Static; export const post_PluginPush = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/plugins/{name}/push"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ name: Type.String(), @@ -3136,6 +3210,7 @@ export type post_PluginSet = Static; export const post_PluginSet = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/plugins/{name}/set"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ name: Type.String(), @@ -3149,6 +3224,7 @@ export type get_NodeList = Static; export const get_NodeList = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/nodes"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -3163,6 +3239,7 @@ export type get_NodeInspect = Static; export const get_NodeInspect = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/nodes/{id}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -3175,6 +3252,7 @@ export type delete_NodeDelete = Static; export const delete_NodeDelete = Type.Object({ method: Type.Literal("DELETE"), path: Type.Literal("/nodes/{id}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -3192,6 +3270,7 @@ export type post_NodeUpdate = Static; export const post_NodeUpdate = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/nodes/{id}/update"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Object({ version: Type.Number(), @@ -3208,6 +3287,7 @@ export type get_SwarmInspect = Static; export const get_SwarmInspect = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/swarm"), + requestFormat: Type.Literal("json"), parameters: Type.Never(), response: Swarm, }); @@ -3216,6 +3296,7 @@ export type post_SwarmInit = Static; export const post_SwarmInit = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/swarm/init"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ body: Type.Partial( Type.Object({ @@ -3237,6 +3318,7 @@ export type post_SwarmJoin = Static; export const post_SwarmJoin = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/swarm/join"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ body: Type.Partial( Type.Object({ @@ -3255,6 +3337,7 @@ export type post_SwarmLeave = Static; export const post_SwarmLeave = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/swarm/leave"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -3269,6 +3352,7 @@ export type post_SwarmUpdate = Static; export const post_SwarmUpdate = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/swarm/update"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Object({ version: Type.Number(), @@ -3285,6 +3369,7 @@ export type get_SwarmUnlockkey = Static; export const get_SwarmUnlockkey = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/swarm/unlockkey"), + requestFormat: Type.Literal("json"), parameters: Type.Never(), response: Type.Partial( Type.Object({ @@ -3297,6 +3382,7 @@ export type post_SwarmUnlock = Static; export const post_SwarmUnlock = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/swarm/unlock"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ body: Type.Partial( Type.Object({ @@ -3311,6 +3397,7 @@ export type get_ServiceList = Static; export const get_ServiceList = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/services"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -3326,6 +3413,7 @@ export type post_ServiceCreate = Static; export const post_ServiceCreate = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/services/create"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ header: Type.Partial( Type.Object({ @@ -3346,6 +3434,7 @@ export type get_ServiceInspect = Static; export const get_ServiceInspect = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/services/{id}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -3363,6 +3452,7 @@ export type delete_ServiceDelete = Static; export const delete_ServiceDelete = Type.Object({ method: Type.Literal("DELETE"), path: Type.Literal("/services/{id}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -3375,6 +3465,7 @@ export type post_ServiceUpdate = Static; export const post_ServiceUpdate = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/services/{id}/update"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Object({ version: Type.Number(), @@ -3398,6 +3489,7 @@ export type get_ServiceLogs = Static; export const get_ServiceLogs = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/services/{id}/logs"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -3421,6 +3513,7 @@ export type get_TaskList = Static; export const get_TaskList = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/tasks"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -3435,6 +3528,7 @@ export type get_TaskInspect = Static; export const get_TaskInspect = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/tasks/{id}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -3447,6 +3541,7 @@ export type get_TaskLogs = Static; export const get_TaskLogs = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/tasks/{id}/logs"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -3470,6 +3565,7 @@ export type get_SecretList = Static; export const get_SecretList = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/secrets"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -3484,6 +3580,7 @@ export type post_SecretCreate = Static; export const post_SecretCreate = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/secrets/create"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ body: Type.Intersect([SecretSpec, Type.Unknown()]), }), @@ -3494,6 +3591,7 @@ export type get_SecretInspect = Static; export const get_SecretInspect = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/secrets/{id}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -3506,6 +3604,7 @@ export type delete_SecretDelete = Static; export const delete_SecretDelete = Type.Object({ method: Type.Literal("DELETE"), path: Type.Literal("/secrets/{id}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -3518,6 +3617,7 @@ export type post_SecretUpdate = Static; export const post_SecretUpdate = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/secrets/{id}/update"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Object({ version: Type.Number(), @@ -3534,6 +3634,7 @@ export type get_ConfigList = Static; export const get_ConfigList = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/configs"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -3548,6 +3649,7 @@ export type post_ConfigCreate = Static; export const post_ConfigCreate = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/configs/create"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ body: Type.Intersect([ConfigSpec, Type.Unknown()]), }), @@ -3558,6 +3660,7 @@ export type get_ConfigInspect = Static; export const get_ConfigInspect = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/configs/{id}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -3570,6 +3673,7 @@ export type delete_ConfigDelete = Static; export const delete_ConfigDelete = Type.Object({ method: Type.Literal("DELETE"), path: Type.Literal("/configs/{id}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ id: Type.String(), @@ -3582,6 +3686,7 @@ export type post_ConfigUpdate = Static; export const post_ConfigUpdate = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/configs/{id}/update"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Object({ version: Type.Number(), @@ -3598,6 +3703,7 @@ export type get_DistributionInspect = Static; export const get_DistributionInspect = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/distribution/{name}/json"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ name: Type.String(), @@ -3610,6 +3716,7 @@ export type post_Session = Static; export const post_Session = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/session"), + requestFormat: Type.Literal("json"), parameters: Type.Never(), response: Type.Unknown(), }); @@ -3760,6 +3867,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -3769,6 +3878,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/docker.openapi.valibot.ts b/packages/typed-openapi/tests/snapshots/docker.openapi.valibot.ts index 988aaf4..8c5b3ba 100644 --- a/packages/typed-openapi/tests/snapshots/docker.openapi.valibot.ts +++ b/packages/typed-openapi/tests/snapshots/docker.openapi.valibot.ts @@ -1650,6 +1650,7 @@ export type get_ContainerList = v.InferOutput; export const get_ContainerList = v.object({ method: v.literal("GET"), path: v.literal("/containers/json"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ all: v.optional(v.boolean()), @@ -1665,6 +1666,7 @@ export type post_ContainerCreate = v.InferOutput; export const post_ContainerCreate = v.object({ method: v.literal("POST"), path: v.literal("/containers/create"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ name: v.optional(v.string()), @@ -1685,6 +1687,7 @@ export type get_ContainerInspect = v.InferOutput; export const get_ContainerInspect = v.object({ method: v.literal("GET"), path: v.literal("/containers/{id}/json"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ size: v.optional(v.boolean()), @@ -1726,6 +1729,7 @@ export type get_ContainerTop = v.InferOutput; export const get_ContainerTop = v.object({ method: v.literal("GET"), path: v.literal("/containers/{id}/top"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ ps_args: v.optional(v.string()), @@ -1744,6 +1748,7 @@ export type get_ContainerLogs = v.InferOutput; export const get_ContainerLogs = v.object({ method: v.literal("GET"), path: v.literal("/containers/{id}/logs"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ follow: v.optional(v.boolean()), @@ -1765,6 +1770,7 @@ export type get_ContainerChanges = v.InferOutput; export const get_ContainerChanges = v.object({ method: v.literal("GET"), path: v.literal("/containers/{id}/changes"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -1777,6 +1783,7 @@ export type get_ContainerExport = v.InferOutput; export const get_ContainerExport = v.object({ method: v.literal("GET"), path: v.literal("/containers/{id}/export"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -1789,6 +1796,7 @@ export type get_ContainerStats = v.InferOutput; export const get_ContainerStats = v.object({ method: v.literal("GET"), path: v.literal("/containers/{id}/stats"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ stream: v.optional(v.boolean()), @@ -1805,6 +1813,7 @@ export type post_ContainerResize = v.InferOutput; export const post_ContainerResize = v.object({ method: v.literal("POST"), path: v.literal("/containers/{id}/resize"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ h: v.optional(v.number()), @@ -1821,6 +1830,7 @@ export type post_ContainerStart = v.InferOutput; export const post_ContainerStart = v.object({ method: v.literal("POST"), path: v.literal("/containers/{id}/start"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ detachKeys: v.optional(v.string()), @@ -1836,6 +1846,7 @@ export type post_ContainerStop = v.InferOutput; export const post_ContainerStop = v.object({ method: v.literal("POST"), path: v.literal("/containers/{id}/stop"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ signal: v.optional(v.string()), @@ -1852,6 +1863,7 @@ export type post_ContainerRestart = v.InferOutput; export const post_ContainerRestart = v.object({ method: v.literal("POST"), path: v.literal("/containers/{id}/restart"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ signal: v.optional(v.string()), @@ -1868,6 +1880,7 @@ export type post_ContainerKill = v.InferOutput; export const post_ContainerKill = v.object({ method: v.literal("POST"), path: v.literal("/containers/{id}/kill"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ signal: v.optional(v.string()), @@ -1883,6 +1896,7 @@ export type post_ContainerUpdate = v.InferOutput; export const post_ContainerUpdate = v.object({ method: v.literal("POST"), path: v.literal("/containers/{id}/update"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -1903,6 +1917,7 @@ export type post_ContainerRename = v.InferOutput; export const post_ContainerRename = v.object({ method: v.literal("POST"), path: v.literal("/containers/{id}/rename"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ name: v.string(), @@ -1918,6 +1933,7 @@ export type post_ContainerPause = v.InferOutput; export const post_ContainerPause = v.object({ method: v.literal("POST"), path: v.literal("/containers/{id}/pause"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -1930,6 +1946,7 @@ export type post_ContainerUnpause = v.InferOutput; export const post_ContainerUnpause = v.object({ method: v.literal("POST"), path: v.literal("/containers/{id}/unpause"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -1942,6 +1959,7 @@ export type post_ContainerAttach = v.InferOutput; export const post_ContainerAttach = v.object({ method: v.literal("POST"), path: v.literal("/containers/{id}/attach"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ detachKeys: v.optional(v.string()), @@ -1962,6 +1980,7 @@ export type get_ContainerAttachWebsocket = v.InferOutput; export const post_ContainerWait = v.object({ method: v.literal("POST"), path: v.literal("/containers/{id}/wait"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ condition: v.optional(v.union([v.literal("not-running"), v.literal("next-exit"), v.literal("removed")])), @@ -1997,6 +2017,7 @@ export type delete_ContainerDelete = v.InferOutput; export const get_ContainerArchive = v.object({ method: v.literal("GET"), path: v.literal("/containers/{id}/archive"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ path: v.string(), @@ -2029,6 +2051,7 @@ export type put_PutContainerArchive = v.InferOutput; export const post_ContainerPrune = v.object({ method: v.literal("POST"), path: v.literal("/containers/prune"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ filters: v.optional(v.string()), @@ -2077,6 +2102,7 @@ export type get_ImageList = v.InferOutput; export const get_ImageList = v.object({ method: v.literal("GET"), path: v.literal("/images/json"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ all: v.optional(v.boolean()), @@ -2092,6 +2118,7 @@ export type post_ImageBuild = v.InferOutput; export const post_ImageBuild = v.object({ method: v.literal("POST"), path: v.literal("/build"), + requestFormat: v.literal("binary"), parameters: v.object({ query: v.object({ dockerfile: v.optional(v.string()), @@ -2132,6 +2159,7 @@ export type post_BuildPrune = v.InferOutput; export const post_BuildPrune = v.object({ method: v.literal("POST"), path: v.literal("/build/prune"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ "keep-storage": v.optional(v.number()), @@ -2149,6 +2177,7 @@ export type post_ImageCreate = v.InferOutput; export const post_ImageCreate = v.object({ method: v.literal("POST"), path: v.literal("/images/create"), + requestFormat: v.literal("text"), parameters: v.object({ query: v.object({ fromImage: v.optional(v.string()), @@ -2171,6 +2200,7 @@ export type get_ImageInspect = v.InferOutput; export const get_ImageInspect = v.object({ method: v.literal("GET"), path: v.literal("/images/{name}/json"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ name: v.string(), @@ -2183,6 +2213,7 @@ export type get_ImageHistory = v.InferOutput; export const get_ImageHistory = v.object({ method: v.literal("GET"), path: v.literal("/images/{name}/history"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ name: v.string(), @@ -2204,6 +2235,7 @@ export type post_ImagePush = v.InferOutput; export const post_ImagePush = v.object({ method: v.literal("POST"), path: v.literal("/images/{name}/push"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ tag: v.optional(v.string()), @@ -2222,6 +2254,7 @@ export type post_ImageTag = v.InferOutput; export const post_ImageTag = v.object({ method: v.literal("POST"), path: v.literal("/images/{name}/tag"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ repo: v.optional(v.string()), @@ -2238,6 +2271,7 @@ export type delete_ImageDelete = v.InferOutput; export const delete_ImageDelete = v.object({ method: v.literal("DELETE"), path: v.literal("/images/{name}"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ force: v.optional(v.boolean()), @@ -2254,6 +2288,7 @@ export type get_ImageSearch = v.InferOutput; export const get_ImageSearch = v.object({ method: v.literal("GET"), path: v.literal("/images/search"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ term: v.string(), @@ -2276,6 +2311,7 @@ export type post_ImagePrune = v.InferOutput; export const post_ImagePrune = v.object({ method: v.literal("POST"), path: v.literal("/images/prune"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ filters: v.optional(v.string()), @@ -2291,6 +2327,7 @@ export type post_SystemAuth = v.InferOutput; export const post_SystemAuth = v.object({ method: v.literal("POST"), path: v.literal("/auth"), + requestFormat: v.literal("json"), parameters: v.object({ body: AuthConfig, }), @@ -2301,6 +2338,7 @@ export type get_SystemInfo = v.InferOutput; export const get_SystemInfo = v.object({ method: v.literal("GET"), path: v.literal("/info"), + requestFormat: v.literal("json"), parameters: v.never(), response: SystemInfo, }); @@ -2309,6 +2347,7 @@ export type get_SystemVersion = v.InferOutput; export const get_SystemVersion = v.object({ method: v.literal("GET"), path: v.literal("/version"), + requestFormat: v.literal("json"), parameters: v.never(), response: SystemVersion, }); @@ -2317,6 +2356,7 @@ export type get_SystemPing = v.InferOutput; export const get_SystemPing = v.object({ method: v.literal("GET"), path: v.literal("/_ping"), + requestFormat: v.literal("json"), parameters: v.never(), response: v.unknown(), }); @@ -2325,6 +2365,7 @@ export type head_SystemPingHead = v.InferOutput; export const head_SystemPingHead = v.object({ method: v.literal("HEAD"), path: v.literal("/_ping"), + requestFormat: v.literal("json"), parameters: v.never(), response: v.unknown(), }); @@ -2333,6 +2374,7 @@ export type post_ImageCommit = v.InferOutput; export const post_ImageCommit = v.object({ method: v.literal("POST"), path: v.literal("/commit"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ container: v.optional(v.string()), @@ -2352,6 +2394,7 @@ export type get_SystemEvents = v.InferOutput; export const get_SystemEvents = v.object({ method: v.literal("GET"), path: v.literal("/events"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ since: v.optional(v.string()), @@ -2366,6 +2409,7 @@ export type get_SystemDataUsage = v.InferOutput; export const get_SystemDataUsage = v.object({ method: v.literal("GET"), path: v.literal("/system/df"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ type: v.optional( @@ -2386,6 +2430,7 @@ export type get_ImageGet = v.InferOutput; export const get_ImageGet = v.object({ method: v.literal("GET"), path: v.literal("/images/{name}/get"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ name: v.string(), @@ -2398,6 +2443,7 @@ export type get_ImageGetAll = v.InferOutput; export const get_ImageGetAll = v.object({ method: v.literal("GET"), path: v.literal("/images/get"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ names: v.optional(v.array(v.string())), @@ -2410,6 +2456,7 @@ export type post_ImageLoad = v.InferOutput; export const post_ImageLoad = v.object({ method: v.literal("POST"), path: v.literal("/images/load"), + requestFormat: v.literal("text"), parameters: v.object({ query: v.object({ quiet: v.optional(v.boolean()), @@ -2422,6 +2469,7 @@ export type post_ContainerExec = v.InferOutput; export const post_ContainerExec = v.object({ method: v.literal("POST"), path: v.literal("/containers/{id}/exec"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -2447,6 +2495,7 @@ export type post_ExecStart = v.InferOutput; export const post_ExecStart = v.object({ method: v.literal("POST"), path: v.literal("/exec/{id}/start"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -2464,6 +2513,7 @@ export type post_ExecResize = v.InferOutput; export const post_ExecResize = v.object({ method: v.literal("POST"), path: v.literal("/exec/{id}/resize"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ h: v.optional(v.number()), @@ -2480,6 +2530,7 @@ export type get_ExecInspect = v.InferOutput; export const get_ExecInspect = v.object({ method: v.literal("GET"), path: v.literal("/exec/{id}/json"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -2504,6 +2555,7 @@ export type get_VolumeList = v.InferOutput; export const get_VolumeList = v.object({ method: v.literal("GET"), path: v.literal("/volumes"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ filters: v.optional(v.string()), @@ -2516,6 +2568,7 @@ export type post_VolumeCreate = v.InferOutput; export const post_VolumeCreate = v.object({ method: v.literal("POST"), path: v.literal("/volumes/create"), + requestFormat: v.literal("json"), parameters: v.object({ body: VolumeCreateOptions, }), @@ -2526,6 +2579,7 @@ export type get_VolumeInspect = v.InferOutput; export const get_VolumeInspect = v.object({ method: v.literal("GET"), path: v.literal("/volumes/{name}"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ name: v.string(), @@ -2538,6 +2592,7 @@ export type put_VolumeUpdate = v.InferOutput; export const put_VolumeUpdate = v.object({ method: v.literal("PUT"), path: v.literal("/volumes/{name}"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ version: v.number(), @@ -2556,6 +2611,7 @@ export type delete_VolumeDelete = v.InferOutput; export const delete_VolumeDelete = v.object({ method: v.literal("DELETE"), path: v.literal("/volumes/{name}"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ force: v.optional(v.boolean()), @@ -2571,6 +2627,7 @@ export type post_VolumePrune = v.InferOutput; export const post_VolumePrune = v.object({ method: v.literal("POST"), path: v.literal("/volumes/prune"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ filters: v.optional(v.string()), @@ -2586,6 +2643,7 @@ export type get_NetworkList = v.InferOutput; export const get_NetworkList = v.object({ method: v.literal("GET"), path: v.literal("/networks"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ filters: v.optional(v.string()), @@ -2598,6 +2656,7 @@ export type get_NetworkInspect = v.InferOutput; export const get_NetworkInspect = v.object({ method: v.literal("GET"), path: v.literal("/networks/{id}"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ verbose: v.optional(v.boolean()), @@ -2614,6 +2673,7 @@ export type delete_NetworkDelete = v.InferOutput; export const delete_NetworkDelete = v.object({ method: v.literal("DELETE"), path: v.literal("/networks/{id}"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -2626,6 +2686,7 @@ export type post_NetworkCreate = v.InferOutput; export const post_NetworkCreate = v.object({ method: v.literal("POST"), path: v.literal("/networks/create"), + requestFormat: v.literal("json"), parameters: v.object({ body: v.object({ Name: v.string(), @@ -2650,6 +2711,7 @@ export type post_NetworkConnect = v.InferOutput; export const post_NetworkConnect = v.object({ method: v.literal("POST"), path: v.literal("/networks/{id}/connect"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -2666,6 +2728,7 @@ export type post_NetworkDisconnect = v.InferOutput; export const post_NetworkPrune = v.object({ method: v.literal("POST"), path: v.literal("/networks/prune"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ filters: v.optional(v.string()), @@ -2696,6 +2760,7 @@ export type get_PluginList = v.InferOutput; export const get_PluginList = v.object({ method: v.literal("GET"), path: v.literal("/plugins"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ filters: v.optional(v.string()), @@ -2708,6 +2773,7 @@ export type get_GetPluginPrivileges = v.InferOutput; export const post_PluginPull = v.object({ method: v.literal("POST"), path: v.literal("/plugins/pull"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ remote: v.string(), @@ -2737,6 +2804,7 @@ export type get_PluginInspect = v.InferOutput; export const get_PluginInspect = v.object({ method: v.literal("GET"), path: v.literal("/plugins/{name}/json"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ name: v.string(), @@ -2749,6 +2817,7 @@ export type delete_PluginDelete = v.InferOutput; export const delete_PluginDelete = v.object({ method: v.literal("DELETE"), path: v.literal("/plugins/{name}"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ force: v.optional(v.boolean()), @@ -2764,6 +2833,7 @@ export type post_PluginEnable = v.InferOutput; export const post_PluginEnable = v.object({ method: v.literal("POST"), path: v.literal("/plugins/{name}/enable"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ timeout: v.optional(v.number()), @@ -2779,6 +2849,7 @@ export type post_PluginDisable = v.InferOutput; export const post_PluginDisable = v.object({ method: v.literal("POST"), path: v.literal("/plugins/{name}/disable"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ force: v.optional(v.boolean()), @@ -2794,6 +2865,7 @@ export type post_PluginUpgrade = v.InferOutput; export const post_PluginUpgrade = v.object({ method: v.literal("POST"), path: v.literal("/plugins/{name}/upgrade"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ remote: v.string(), @@ -2813,6 +2885,7 @@ export type post_PluginCreate = v.InferOutput; export const post_PluginCreate = v.object({ method: v.literal("POST"), path: v.literal("/plugins/create"), + requestFormat: v.literal("text"), parameters: v.object({ query: v.object({ name: v.string(), @@ -2825,6 +2898,7 @@ export type post_PluginPush = v.InferOutput; export const post_PluginPush = v.object({ method: v.literal("POST"), path: v.literal("/plugins/{name}/push"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ name: v.string(), @@ -2837,6 +2911,7 @@ export type post_PluginSet = v.InferOutput; export const post_PluginSet = v.object({ method: v.literal("POST"), path: v.literal("/plugins/{name}/set"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ name: v.string(), @@ -2850,6 +2925,7 @@ export type get_NodeList = v.InferOutput; export const get_NodeList = v.object({ method: v.literal("GET"), path: v.literal("/nodes"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ filters: v.optional(v.string()), @@ -2862,6 +2938,7 @@ export type get_NodeInspect = v.InferOutput; export const get_NodeInspect = v.object({ method: v.literal("GET"), path: v.literal("/nodes/{id}"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -2874,6 +2951,7 @@ export type delete_NodeDelete = v.InferOutput; export const delete_NodeDelete = v.object({ method: v.literal("DELETE"), path: v.literal("/nodes/{id}"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ force: v.optional(v.boolean()), @@ -2889,6 +2967,7 @@ export type post_NodeUpdate = v.InferOutput; export const post_NodeUpdate = v.object({ method: v.literal("POST"), path: v.literal("/nodes/{id}/update"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ version: v.number(), @@ -2905,6 +2984,7 @@ export type get_SwarmInspect = v.InferOutput; export const get_SwarmInspect = v.object({ method: v.literal("GET"), path: v.literal("/swarm"), + requestFormat: v.literal("json"), parameters: v.never(), response: Swarm, }); @@ -2913,6 +2993,7 @@ export type post_SwarmInit = v.InferOutput; export const post_SwarmInit = v.object({ method: v.literal("POST"), path: v.literal("/swarm/init"), + requestFormat: v.literal("json"), parameters: v.object({ body: v.object({ ListenAddr: v.optional(v.string()), @@ -2932,6 +3013,7 @@ export type post_SwarmJoin = v.InferOutput; export const post_SwarmJoin = v.object({ method: v.literal("POST"), path: v.literal("/swarm/join"), + requestFormat: v.literal("json"), parameters: v.object({ body: v.object({ ListenAddr: v.optional(v.string()), @@ -2948,6 +3030,7 @@ export type post_SwarmLeave = v.InferOutput; export const post_SwarmLeave = v.object({ method: v.literal("POST"), path: v.literal("/swarm/leave"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ force: v.optional(v.boolean()), @@ -2960,6 +3043,7 @@ export type post_SwarmUpdate = v.InferOutput; export const post_SwarmUpdate = v.object({ method: v.literal("POST"), path: v.literal("/swarm/update"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ version: v.number(), @@ -2976,6 +3060,7 @@ export type get_SwarmUnlockkey = v.InferOutput; export const get_SwarmUnlockkey = v.object({ method: v.literal("GET"), path: v.literal("/swarm/unlockkey"), + requestFormat: v.literal("json"), parameters: v.never(), response: v.object({ UnlockKey: v.optional(v.string()), @@ -2986,6 +3071,7 @@ export type post_SwarmUnlock = v.InferOutput; export const post_SwarmUnlock = v.object({ method: v.literal("POST"), path: v.literal("/swarm/unlock"), + requestFormat: v.literal("json"), parameters: v.object({ body: v.object({ UnlockKey: v.optional(v.string()), @@ -2998,6 +3084,7 @@ export type get_ServiceList = v.InferOutput; export const get_ServiceList = v.object({ method: v.literal("GET"), path: v.literal("/services"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ filters: v.optional(v.string()), @@ -3011,6 +3098,7 @@ export type post_ServiceCreate = v.InferOutput; export const post_ServiceCreate = v.object({ method: v.literal("POST"), path: v.literal("/services/create"), + requestFormat: v.literal("json"), parameters: v.object({ header: v.object({ "X-Registry-Auth": v.optional(v.string()), @@ -3027,6 +3115,7 @@ export type get_ServiceInspect = v.InferOutput; export const get_ServiceInspect = v.object({ method: v.literal("GET"), path: v.literal("/services/{id}"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ insertDefaults: v.optional(v.boolean()), @@ -3042,6 +3131,7 @@ export type delete_ServiceDelete = v.InferOutput; export const delete_ServiceDelete = v.object({ method: v.literal("DELETE"), path: v.literal("/services/{id}"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -3054,6 +3144,7 @@ export type post_ServiceUpdate = v.InferOutput; export const post_ServiceUpdate = v.object({ method: v.literal("POST"), path: v.literal("/services/{id}/update"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ version: v.number(), @@ -3075,6 +3166,7 @@ export type get_ServiceLogs = v.InferOutput; export const get_ServiceLogs = v.object({ method: v.literal("GET"), path: v.literal("/services/{id}/logs"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ details: v.optional(v.boolean()), @@ -3096,6 +3188,7 @@ export type get_TaskList = v.InferOutput; export const get_TaskList = v.object({ method: v.literal("GET"), path: v.literal("/tasks"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ filters: v.optional(v.string()), @@ -3108,6 +3201,7 @@ export type get_TaskInspect = v.InferOutput; export const get_TaskInspect = v.object({ method: v.literal("GET"), path: v.literal("/tasks/{id}"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -3120,6 +3214,7 @@ export type get_TaskLogs = v.InferOutput; export const get_TaskLogs = v.object({ method: v.literal("GET"), path: v.literal("/tasks/{id}/logs"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ details: v.optional(v.boolean()), @@ -3141,6 +3236,7 @@ export type get_SecretList = v.InferOutput; export const get_SecretList = v.object({ method: v.literal("GET"), path: v.literal("/secrets"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ filters: v.optional(v.string()), @@ -3153,6 +3249,7 @@ export type post_SecretCreate = v.InferOutput; export const post_SecretCreate = v.object({ method: v.literal("POST"), path: v.literal("/secrets/create"), + requestFormat: v.literal("json"), parameters: v.object({ body: v.intersect([SecretSpec, v.unknown()]), }), @@ -3163,6 +3260,7 @@ export type get_SecretInspect = v.InferOutput; export const get_SecretInspect = v.object({ method: v.literal("GET"), path: v.literal("/secrets/{id}"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -3175,6 +3273,7 @@ export type delete_SecretDelete = v.InferOutput; export const delete_SecretDelete = v.object({ method: v.literal("DELETE"), path: v.literal("/secrets/{id}"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -3187,6 +3286,7 @@ export type post_SecretUpdate = v.InferOutput; export const post_SecretUpdate = v.object({ method: v.literal("POST"), path: v.literal("/secrets/{id}/update"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ version: v.number(), @@ -3203,6 +3303,7 @@ export type get_ConfigList = v.InferOutput; export const get_ConfigList = v.object({ method: v.literal("GET"), path: v.literal("/configs"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ filters: v.optional(v.string()), @@ -3215,6 +3316,7 @@ export type post_ConfigCreate = v.InferOutput; export const post_ConfigCreate = v.object({ method: v.literal("POST"), path: v.literal("/configs/create"), + requestFormat: v.literal("json"), parameters: v.object({ body: v.intersect([ConfigSpec, v.unknown()]), }), @@ -3225,6 +3327,7 @@ export type get_ConfigInspect = v.InferOutput; export const get_ConfigInspect = v.object({ method: v.literal("GET"), path: v.literal("/configs/{id}"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -3237,6 +3340,7 @@ export type delete_ConfigDelete = v.InferOutput; export const delete_ConfigDelete = v.object({ method: v.literal("DELETE"), path: v.literal("/configs/{id}"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ id: v.string(), @@ -3249,6 +3353,7 @@ export type post_ConfigUpdate = v.InferOutput; export const post_ConfigUpdate = v.object({ method: v.literal("POST"), path: v.literal("/configs/{id}/update"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ version: v.number(), @@ -3265,6 +3370,7 @@ export type get_DistributionInspect = v.InferOutput; export const post_Session = v.object({ method: v.literal("POST"), path: v.literal("/session"), + requestFormat: v.literal("json"), parameters: v.never(), response: v.unknown(), }); @@ -3427,6 +3534,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -3436,6 +3545,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/docker.openapi.yup.ts b/packages/typed-openapi/tests/snapshots/docker.openapi.yup.ts index ff42d4d..1c8042a 100644 --- a/packages/typed-openapi/tests/snapshots/docker.openapi.yup.ts +++ b/packages/typed-openapi/tests/snapshots/docker.openapi.yup.ts @@ -1882,6 +1882,7 @@ export type get_ContainerList = typeof get_ContainerList; export const get_ContainerList = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/containers/json" => value === "/containers/json").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ all: y.boolean().required().optional(), @@ -1897,6 +1898,7 @@ export type post_ContainerCreate = typeof post_ContainerCreate; export const post_ContainerCreate = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/containers/create" => value === "/containers/create").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ name: y.string().required().optional(), @@ -1995,6 +1997,7 @@ export type get_ContainerInspect = typeof get_ContainerInspect; export const get_ContainerInspect = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/containers/{id}/json" => value === "/containers/{id}/json").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ size: y.boolean().required().optional(), @@ -2043,6 +2046,7 @@ export type get_ContainerTop = typeof get_ContainerTop; export const get_ContainerTop = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/containers/{id}/top" => value === "/containers/{id}/top").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ ps_args: y.string().required().optional(), @@ -2061,6 +2065,7 @@ export type get_ContainerLogs = typeof get_ContainerLogs; export const get_ContainerLogs = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/containers/{id}/logs" => value === "/containers/{id}/logs").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ follow: y.boolean().required().optional(), @@ -2082,6 +2087,7 @@ export type get_ContainerChanges = typeof get_ContainerChanges; export const get_ContainerChanges = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/containers/{id}/changes" => value === "/containers/{id}/changes").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -2094,6 +2100,7 @@ export type get_ContainerExport = typeof get_ContainerExport; export const get_ContainerExport = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/containers/{id}/export" => value === "/containers/{id}/export").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -2106,6 +2113,7 @@ export type get_ContainerStats = typeof get_ContainerStats; export const get_ContainerStats = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/containers/{id}/stats" => value === "/containers/{id}/stats").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ stream: y.boolean().required().optional(), @@ -2122,6 +2130,7 @@ export type post_ContainerResize = typeof post_ContainerResize; export const post_ContainerResize = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/containers/{id}/resize" => value === "/containers/{id}/resize").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ h: y.number().required().optional(), @@ -2138,6 +2147,7 @@ export type post_ContainerStart = typeof post_ContainerStart; export const post_ContainerStart = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/containers/{id}/start" => value === "/containers/{id}/start").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ detachKeys: y.string().required().optional(), @@ -2153,6 +2163,7 @@ export type post_ContainerStop = typeof post_ContainerStop; export const post_ContainerStop = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/containers/{id}/stop" => value === "/containers/{id}/stop").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ signal: y.string().required().optional(), @@ -2169,6 +2180,7 @@ export type post_ContainerRestart = typeof post_ContainerRestart; export const post_ContainerRestart = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/containers/{id}/restart" => value === "/containers/{id}/restart").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ signal: y.string().required().optional(), @@ -2185,6 +2197,7 @@ export type post_ContainerKill = typeof post_ContainerKill; export const post_ContainerKill = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/containers/{id}/kill" => value === "/containers/{id}/kill").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ signal: y.string().required().optional(), @@ -2200,6 +2213,7 @@ export type post_ContainerUpdate = typeof post_ContainerUpdate; export const post_ContainerUpdate = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/containers/{id}/update" => value === "/containers/{id}/update").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -2277,6 +2291,7 @@ export type post_ContainerRename = typeof post_ContainerRename; export const post_ContainerRename = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/containers/{id}/rename" => value === "/containers/{id}/rename").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ name: y.string().required(), @@ -2292,6 +2307,7 @@ export type post_ContainerPause = typeof post_ContainerPause; export const post_ContainerPause = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/containers/{id}/pause" => value === "/containers/{id}/pause").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -2304,6 +2320,7 @@ export type post_ContainerUnpause = typeof post_ContainerUnpause; export const post_ContainerUnpause = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/containers/{id}/unpause" => value === "/containers/{id}/unpause").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -2316,6 +2333,7 @@ export type post_ContainerAttach = typeof post_ContainerAttach; export const post_ContainerAttach = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/containers/{id}/attach" => value === "/containers/{id}/attach").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ detachKeys: y.string().required().optional(), @@ -2336,6 +2354,7 @@ export type get_ContainerAttachWebsocket = typeof get_ContainerAttachWebsocket; export const get_ContainerAttachWebsocket = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/containers/{id}/attach/ws" => value === "/containers/{id}/attach/ws").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ detachKeys: y.string().required().optional(), @@ -2356,6 +2375,7 @@ export type post_ContainerWait = typeof post_ContainerWait; export const post_ContainerWait = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/containers/{id}/wait" => value === "/containers/{id}/wait").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ condition: y.mixed().oneOf(["not-running", "next-exit", "removed"]).required().optional(), @@ -2371,6 +2391,7 @@ export type delete_ContainerDelete = typeof delete_ContainerDelete; export const delete_ContainerDelete = { method: y.mixed((value): value is "DELETE" => value === "DELETE").required(), path: y.mixed((value): value is "/containers/{id}" => value === "/containers/{id}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ v: y.boolean().required().optional(), @@ -2388,6 +2409,7 @@ export type get_ContainerArchive = typeof get_ContainerArchive; export const get_ContainerArchive = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/containers/{id}/archive" => value === "/containers/{id}/archive").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ path: y.string().required(), @@ -2403,6 +2425,7 @@ export type put_PutContainerArchive = typeof put_PutContainerArchive; export const put_PutContainerArchive = { method: y.mixed((value): value is "PUT" => value === "PUT").required(), path: y.mixed((value): value is "/containers/{id}/archive" => value === "/containers/{id}/archive").required(), + requestFormat: y.mixed((value): value is "binary" => value === "binary").required(), parameters: y.object({ query: y.object({ path: y.string().required(), @@ -2433,6 +2456,7 @@ export type head_ContainerArchiveInfo = typeof head_ContainerArchiveInfo; export const head_ContainerArchiveInfo = { method: y.mixed((value): value is "HEAD" => value === "HEAD").required(), path: y.mixed((value): value is "/containers/{id}/archive" => value === "/containers/{id}/archive").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ path: y.string().required(), @@ -2448,6 +2472,7 @@ export type post_ContainerPrune = typeof post_ContainerPrune; export const post_ContainerPrune = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/containers/prune" => value === "/containers/prune").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ filters: y.string().required().optional(), @@ -2463,6 +2488,7 @@ export type get_ImageList = typeof get_ImageList; export const get_ImageList = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/images/json" => value === "/images/json").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ all: y.boolean().required().optional(), @@ -2478,6 +2504,7 @@ export type post_ImageBuild = typeof post_ImageBuild; export const post_ImageBuild = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/build" => value === "/build").required(), + requestFormat: y.mixed((value): value is "binary" => value === "binary").required(), parameters: y.object({ query: y.object({ dockerfile: y.string().required().optional(), @@ -2521,6 +2548,7 @@ export type post_BuildPrune = typeof post_BuildPrune; export const post_BuildPrune = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/build/prune" => value === "/build/prune").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ "keep-storage": y.number().required().optional(), @@ -2538,6 +2566,7 @@ export type post_ImageCreate = typeof post_ImageCreate; export const post_ImageCreate = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/images/create" => value === "/images/create").required(), + requestFormat: y.mixed((value): value is "text" => value === "text").required(), parameters: y.object({ query: y.object({ fromImage: y.string().required().optional(), @@ -2560,6 +2589,7 @@ export type get_ImageInspect = typeof get_ImageInspect; export const get_ImageInspect = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/images/{name}/json" => value === "/images/{name}/json").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ name: y.string().required(), @@ -2572,6 +2602,7 @@ export type get_ImageHistory = typeof get_ImageHistory; export const get_ImageHistory = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/images/{name}/history" => value === "/images/{name}/history").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ name: y.string().required(), @@ -2593,6 +2624,7 @@ export type post_ImagePush = typeof post_ImagePush; export const post_ImagePush = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/images/{name}/push" => value === "/images/{name}/push").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ tag: y.string().required().optional(), @@ -2611,6 +2643,7 @@ export type post_ImageTag = typeof post_ImageTag; export const post_ImageTag = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/images/{name}/tag" => value === "/images/{name}/tag").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ repo: y.string().required().optional(), @@ -2627,6 +2660,7 @@ export type delete_ImageDelete = typeof delete_ImageDelete; export const delete_ImageDelete = { method: y.mixed((value): value is "DELETE" => value === "DELETE").required(), path: y.mixed((value): value is "/images/{name}" => value === "/images/{name}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ force: y.boolean().required().optional(), @@ -2643,6 +2677,7 @@ export type get_ImageSearch = typeof get_ImageSearch; export const get_ImageSearch = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/images/search" => value === "/images/search").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ term: y.string().required(), @@ -2677,6 +2712,7 @@ export type post_ImagePrune = typeof post_ImagePrune; export const post_ImagePrune = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/images/prune" => value === "/images/prune").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ filters: y.string().required().optional(), @@ -2692,6 +2728,7 @@ export type post_SystemAuth = typeof post_SystemAuth; export const post_SystemAuth = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/auth" => value === "/auth").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ body: AuthConfig, }), @@ -2702,6 +2739,7 @@ export type get_SystemInfo = typeof get_SystemInfo; export const get_SystemInfo = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/info" => value === "/info").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.mixed((value): value is never => false).required(), response: SystemInfo, }; @@ -2710,6 +2748,7 @@ export type get_SystemVersion = typeof get_SystemVersion; export const get_SystemVersion = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/version" => value === "/version").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.mixed((value): value is never => false).required(), response: SystemVersion, }; @@ -2718,6 +2757,7 @@ export type get_SystemPing = typeof get_SystemPing; export const get_SystemPing = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/_ping" => value === "/_ping").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.mixed((value): value is never => false).required(), response: y.mixed((value): value is any => true).required() as y.MixedSchema, }; @@ -2726,6 +2766,7 @@ export type head_SystemPingHead = typeof head_SystemPingHead; export const head_SystemPingHead = { method: y.mixed((value): value is "HEAD" => value === "HEAD").required(), path: y.mixed((value): value is "/_ping" => value === "/_ping").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.mixed((value): value is never => false).required(), response: y.mixed((value): value is any => true).required() as y.MixedSchema, }; @@ -2734,6 +2775,7 @@ export type post_ImageCommit = typeof post_ImageCommit; export const post_ImageCommit = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/commit" => value === "/commit").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ container: y.string().required().optional(), @@ -2753,6 +2795,7 @@ export type get_SystemEvents = typeof get_SystemEvents; export const get_SystemEvents = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/events" => value === "/events").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ since: y.string().required().optional(), @@ -2767,6 +2810,7 @@ export type get_SystemDataUsage = typeof get_SystemDataUsage; export const get_SystemDataUsage = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/system/df" => value === "/system/df").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ type: y.array(y.mixed().oneOf(["container", "image", "volume", "build-cache"]).required()).optional(), @@ -2785,6 +2829,7 @@ export type get_ImageGet = typeof get_ImageGet; export const get_ImageGet = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/images/{name}/get" => value === "/images/{name}/get").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ name: y.string().required(), @@ -2797,6 +2842,7 @@ export type get_ImageGetAll = typeof get_ImageGetAll; export const get_ImageGetAll = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/images/get" => value === "/images/get").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ names: y.array(y.string().required()).optional(), @@ -2809,6 +2855,7 @@ export type post_ImageLoad = typeof post_ImageLoad; export const post_ImageLoad = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/images/load" => value === "/images/load").required(), + requestFormat: y.mixed((value): value is "text" => value === "text").required(), parameters: y.object({ query: y.object({ quiet: y.boolean().required().optional(), @@ -2821,6 +2868,7 @@ export type post_ContainerExec = typeof post_ContainerExec; export const post_ContainerExec = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/containers/{id}/exec" => value === "/containers/{id}/exec").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -2853,6 +2901,7 @@ export type post_ExecStart = typeof post_ExecStart; export const post_ExecStart = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/exec/{id}/start" => value === "/exec/{id}/start").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -2877,6 +2926,7 @@ export type post_ExecResize = typeof post_ExecResize; export const post_ExecResize = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/exec/{id}/resize" => value === "/exec/{id}/resize").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ h: y.number().required().optional(), @@ -2893,6 +2943,7 @@ export type get_ExecInspect = typeof get_ExecInspect; export const get_ExecInspect = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/exec/{id}/json" => value === "/exec/{id}/json").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -2917,6 +2968,7 @@ export type get_VolumeList = typeof get_VolumeList; export const get_VolumeList = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/volumes" => value === "/volumes").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ filters: y.string().required().optional(), @@ -2929,6 +2981,7 @@ export type post_VolumeCreate = typeof post_VolumeCreate; export const post_VolumeCreate = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/volumes/create" => value === "/volumes/create").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ body: VolumeCreateOptions, }), @@ -2939,6 +2992,7 @@ export type get_VolumeInspect = typeof get_VolumeInspect; export const get_VolumeInspect = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/volumes/{name}" => value === "/volumes/{name}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ name: y.string().required(), @@ -2951,6 +3005,7 @@ export type put_VolumeUpdate = typeof put_VolumeUpdate; export const put_VolumeUpdate = { method: y.mixed((value): value is "PUT" => value === "PUT").required(), path: y.mixed((value): value is "/volumes/{name}" => value === "/volumes/{name}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ version: y.number().required(), @@ -2969,6 +3024,7 @@ export type delete_VolumeDelete = typeof delete_VolumeDelete; export const delete_VolumeDelete = { method: y.mixed((value): value is "DELETE" => value === "DELETE").required(), path: y.mixed((value): value is "/volumes/{name}" => value === "/volumes/{name}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ force: y.boolean().required().optional(), @@ -2984,6 +3040,7 @@ export type post_VolumePrune = typeof post_VolumePrune; export const post_VolumePrune = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/volumes/prune" => value === "/volumes/prune").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ filters: y.string().required().optional(), @@ -2999,6 +3056,7 @@ export type get_NetworkList = typeof get_NetworkList; export const get_NetworkList = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/networks" => value === "/networks").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ filters: y.string().required().optional(), @@ -3011,6 +3069,7 @@ export type get_NetworkInspect = typeof get_NetworkInspect; export const get_NetworkInspect = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/networks/{id}" => value === "/networks/{id}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ verbose: y.boolean().required().optional(), @@ -3027,6 +3086,7 @@ export type delete_NetworkDelete = typeof delete_NetworkDelete; export const delete_NetworkDelete = { method: y.mixed((value): value is "DELETE" => value === "DELETE").required(), path: y.mixed((value): value is "/networks/{id}" => value === "/networks/{id}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -3039,6 +3099,7 @@ export type post_NetworkCreate = typeof post_NetworkCreate; export const post_NetworkCreate = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/networks/create" => value === "/networks/create").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ body: y.object({ Name: y.string().required(), @@ -3123,6 +3184,7 @@ export type post_NetworkConnect = typeof post_NetworkConnect; export const post_NetworkConnect = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/networks/{id}/connect" => value === "/networks/{id}/connect").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -3139,6 +3201,7 @@ export type post_NetworkDisconnect = typeof post_NetworkDisconnect; export const post_NetworkDisconnect = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/networks/{id}/disconnect" => value === "/networks/{id}/disconnect").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -3155,6 +3218,7 @@ export type post_NetworkPrune = typeof post_NetworkPrune; export const post_NetworkPrune = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/networks/prune" => value === "/networks/prune").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ filters: y.string().required().optional(), @@ -3169,6 +3233,7 @@ export type get_PluginList = typeof get_PluginList; export const get_PluginList = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/plugins" => value === "/plugins").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ filters: y.string().required().optional(), @@ -3181,6 +3246,7 @@ export type get_GetPluginPrivileges = typeof get_GetPluginPrivileges; export const get_GetPluginPrivileges = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/plugins/privileges" => value === "/plugins/privileges").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ remote: y.string().required(), @@ -3193,6 +3259,7 @@ export type post_PluginPull = typeof post_PluginPull; export const post_PluginPull = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/plugins/pull" => value === "/plugins/pull").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ remote: y.string().required(), @@ -3216,6 +3283,7 @@ export type get_PluginInspect = typeof get_PluginInspect; export const get_PluginInspect = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/plugins/{name}/json" => value === "/plugins/{name}/json").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ name: y.string().required(), @@ -3228,6 +3296,7 @@ export type delete_PluginDelete = typeof delete_PluginDelete; export const delete_PluginDelete = { method: y.mixed((value): value is "DELETE" => value === "DELETE").required(), path: y.mixed((value): value is "/plugins/{name}" => value === "/plugins/{name}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ force: y.boolean().required().optional(), @@ -3243,6 +3312,7 @@ export type post_PluginEnable = typeof post_PluginEnable; export const post_PluginEnable = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/plugins/{name}/enable" => value === "/plugins/{name}/enable").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ timeout: y.number().required().optional(), @@ -3258,6 +3328,7 @@ export type post_PluginDisable = typeof post_PluginDisable; export const post_PluginDisable = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/plugins/{name}/disable" => value === "/plugins/{name}/disable").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ force: y.boolean().required().optional(), @@ -3273,6 +3344,7 @@ export type post_PluginUpgrade = typeof post_PluginUpgrade; export const post_PluginUpgrade = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/plugins/{name}/upgrade" => value === "/plugins/{name}/upgrade").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ remote: y.string().required(), @@ -3292,6 +3364,7 @@ export type post_PluginCreate = typeof post_PluginCreate; export const post_PluginCreate = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/plugins/create" => value === "/plugins/create").required(), + requestFormat: y.mixed((value): value is "text" => value === "text").required(), parameters: y.object({ query: y.object({ name: y.string().required(), @@ -3304,6 +3377,7 @@ export type post_PluginPush = typeof post_PluginPush; export const post_PluginPush = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/plugins/{name}/push" => value === "/plugins/{name}/push").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ name: y.string().required(), @@ -3316,6 +3390,7 @@ export type post_PluginSet = typeof post_PluginSet; export const post_PluginSet = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/plugins/{name}/set" => value === "/plugins/{name}/set").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ name: y.string().required(), @@ -3329,6 +3404,7 @@ export type get_NodeList = typeof get_NodeList; export const get_NodeList = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/nodes" => value === "/nodes").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ filters: y.string().required().optional(), @@ -3341,6 +3417,7 @@ export type get_NodeInspect = typeof get_NodeInspect; export const get_NodeInspect = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/nodes/{id}" => value === "/nodes/{id}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -3353,6 +3430,7 @@ export type delete_NodeDelete = typeof delete_NodeDelete; export const delete_NodeDelete = { method: y.mixed((value): value is "DELETE" => value === "DELETE").required(), path: y.mixed((value): value is "/nodes/{id}" => value === "/nodes/{id}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ force: y.boolean().required().optional(), @@ -3368,6 +3446,7 @@ export type post_NodeUpdate = typeof post_NodeUpdate; export const post_NodeUpdate = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/nodes/{id}/update" => value === "/nodes/{id}/update").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ version: y.number().required(), @@ -3384,6 +3463,7 @@ export type get_SwarmInspect = typeof get_SwarmInspect; export const get_SwarmInspect = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/swarm" => value === "/swarm").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.mixed((value): value is never => false).required(), response: Swarm, }; @@ -3392,6 +3472,7 @@ export type post_SwarmInit = typeof post_SwarmInit; export const post_SwarmInit = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/swarm/init" => value === "/swarm/init").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ body: y.object({ ListenAddr: y.string().required().optional(), @@ -3411,6 +3492,7 @@ export type post_SwarmJoin = typeof post_SwarmJoin; export const post_SwarmJoin = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/swarm/join" => value === "/swarm/join").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ body: y.object({ ListenAddr: y.string().required().optional(), @@ -3427,6 +3509,7 @@ export type post_SwarmLeave = typeof post_SwarmLeave; export const post_SwarmLeave = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/swarm/leave" => value === "/swarm/leave").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ force: y.boolean().required().optional(), @@ -3439,6 +3522,7 @@ export type post_SwarmUpdate = typeof post_SwarmUpdate; export const post_SwarmUpdate = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/swarm/update" => value === "/swarm/update").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ version: y.number().required(), @@ -3473,6 +3557,7 @@ export type get_SwarmUnlockkey = typeof get_SwarmUnlockkey; export const get_SwarmUnlockkey = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/swarm/unlockkey" => value === "/swarm/unlockkey").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.mixed((value): value is never => false).required(), response: y.object({ UnlockKey: y.string().required().optional(), @@ -3483,6 +3568,7 @@ export type post_SwarmUnlock = typeof post_SwarmUnlock; export const post_SwarmUnlock = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/swarm/unlock" => value === "/swarm/unlock").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ body: y.object({ UnlockKey: y.string().required().optional(), @@ -3495,6 +3581,7 @@ export type get_ServiceList = typeof get_ServiceList; export const get_ServiceList = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/services" => value === "/services").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ filters: y.string().required().optional(), @@ -3508,6 +3595,7 @@ export type post_ServiceCreate = typeof post_ServiceCreate; export const post_ServiceCreate = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/services/create" => value === "/services/create").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ header: y.object({ "X-Registry-Auth": y.string().required().optional(), @@ -3524,6 +3612,7 @@ export type get_ServiceInspect = typeof get_ServiceInspect; export const get_ServiceInspect = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/services/{id}" => value === "/services/{id}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ insertDefaults: y.boolean().required().optional(), @@ -3539,6 +3628,7 @@ export type delete_ServiceDelete = typeof delete_ServiceDelete; export const delete_ServiceDelete = { method: y.mixed((value): value is "DELETE" => value === "DELETE").required(), path: y.mixed((value): value is "/services/{id}" => value === "/services/{id}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -3551,6 +3641,7 @@ export type post_ServiceUpdate = typeof post_ServiceUpdate; export const post_ServiceUpdate = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/services/{id}/update" => value === "/services/{id}/update").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ version: y.number().required(), @@ -3585,6 +3676,7 @@ export type get_ServiceLogs = typeof get_ServiceLogs; export const get_ServiceLogs = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/services/{id}/logs" => value === "/services/{id}/logs").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ details: y.boolean().required().optional(), @@ -3606,6 +3698,7 @@ export type get_TaskList = typeof get_TaskList; export const get_TaskList = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/tasks" => value === "/tasks").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ filters: y.string().required().optional(), @@ -3618,6 +3711,7 @@ export type get_TaskInspect = typeof get_TaskInspect; export const get_TaskInspect = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/tasks/{id}" => value === "/tasks/{id}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -3630,6 +3724,7 @@ export type get_TaskLogs = typeof get_TaskLogs; export const get_TaskLogs = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/tasks/{id}/logs" => value === "/tasks/{id}/logs").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ details: y.boolean().required().optional(), @@ -3651,6 +3746,7 @@ export type get_SecretList = typeof get_SecretList; export const get_SecretList = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/secrets" => value === "/secrets").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ filters: y.string().required().optional(), @@ -3663,6 +3759,7 @@ export type post_SecretCreate = typeof post_SecretCreate; export const post_SecretCreate = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/secrets/create" => value === "/secrets/create").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ body: y.mixed(/* unsupported */), }), @@ -3673,6 +3770,7 @@ export type get_SecretInspect = typeof get_SecretInspect; export const get_SecretInspect = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/secrets/{id}" => value === "/secrets/{id}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -3685,6 +3783,7 @@ export type delete_SecretDelete = typeof delete_SecretDelete; export const delete_SecretDelete = { method: y.mixed((value): value is "DELETE" => value === "DELETE").required(), path: y.mixed((value): value is "/secrets/{id}" => value === "/secrets/{id}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -3697,6 +3796,7 @@ export type post_SecretUpdate = typeof post_SecretUpdate; export const post_SecretUpdate = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/secrets/{id}/update" => value === "/secrets/{id}/update").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ version: y.number().required(), @@ -3713,6 +3813,7 @@ export type get_ConfigList = typeof get_ConfigList; export const get_ConfigList = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/configs" => value === "/configs").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ filters: y.string().required().optional(), @@ -3725,6 +3826,7 @@ export type post_ConfigCreate = typeof post_ConfigCreate; export const post_ConfigCreate = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/configs/create" => value === "/configs/create").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ body: y.mixed(/* unsupported */), }), @@ -3735,6 +3837,7 @@ export type get_ConfigInspect = typeof get_ConfigInspect; export const get_ConfigInspect = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/configs/{id}" => value === "/configs/{id}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -3747,6 +3850,7 @@ export type delete_ConfigDelete = typeof delete_ConfigDelete; export const delete_ConfigDelete = { method: y.mixed((value): value is "DELETE" => value === "DELETE").required(), path: y.mixed((value): value is "/configs/{id}" => value === "/configs/{id}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ id: y.string().required(), @@ -3759,6 +3863,7 @@ export type post_ConfigUpdate = typeof post_ConfigUpdate; export const post_ConfigUpdate = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/configs/{id}/update" => value === "/configs/{id}/update").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ version: y.number().required(), @@ -3775,6 +3880,7 @@ export type get_DistributionInspect = typeof get_DistributionInspect; export const get_DistributionInspect = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/distribution/{name}/json" => value === "/distribution/{name}/json").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ name: y.string().required(), @@ -3787,6 +3893,7 @@ export type post_Session = typeof post_Session; export const post_Session = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/session" => value === "/session").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.mixed((value): value is never => false).required(), response: y.mixed((value): value is any => true).required() as y.MixedSchema, }; @@ -3934,6 +4041,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -3943,6 +4052,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/docker.openapi.zod.ts b/packages/typed-openapi/tests/snapshots/docker.openapi.zod.ts index c8cbdfe..67fa813 100644 --- a/packages/typed-openapi/tests/snapshots/docker.openapi.zod.ts +++ b/packages/typed-openapi/tests/snapshots/docker.openapi.zod.ts @@ -1639,6 +1639,7 @@ export type get_ContainerList = typeof get_ContainerList; export const get_ContainerList = { method: z.literal("GET"), path: z.literal("/containers/json"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ all: z.boolean().optional(), @@ -1654,6 +1655,7 @@ export type post_ContainerCreate = typeof post_ContainerCreate; export const post_ContainerCreate = { method: z.literal("POST"), path: z.literal("/containers/create"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ name: z.string().optional(), @@ -1674,6 +1676,7 @@ export type get_ContainerInspect = typeof get_ContainerInspect; export const get_ContainerInspect = { method: z.literal("GET"), path: z.literal("/containers/{id}/json"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ size: z.boolean().optional(), @@ -1715,6 +1718,7 @@ export type get_ContainerTop = typeof get_ContainerTop; export const get_ContainerTop = { method: z.literal("GET"), path: z.literal("/containers/{id}/top"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ ps_args: z.string().optional(), @@ -1733,6 +1737,7 @@ export type get_ContainerLogs = typeof get_ContainerLogs; export const get_ContainerLogs = { method: z.literal("GET"), path: z.literal("/containers/{id}/logs"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ follow: z.boolean().optional(), @@ -1754,6 +1759,7 @@ export type get_ContainerChanges = typeof get_ContainerChanges; export const get_ContainerChanges = { method: z.literal("GET"), path: z.literal("/containers/{id}/changes"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -1766,6 +1772,7 @@ export type get_ContainerExport = typeof get_ContainerExport; export const get_ContainerExport = { method: z.literal("GET"), path: z.literal("/containers/{id}/export"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -1778,6 +1785,7 @@ export type get_ContainerStats = typeof get_ContainerStats; export const get_ContainerStats = { method: z.literal("GET"), path: z.literal("/containers/{id}/stats"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ stream: z.boolean().optional(), @@ -1794,6 +1802,7 @@ export type post_ContainerResize = typeof post_ContainerResize; export const post_ContainerResize = { method: z.literal("POST"), path: z.literal("/containers/{id}/resize"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ h: z.number().optional(), @@ -1810,6 +1819,7 @@ export type post_ContainerStart = typeof post_ContainerStart; export const post_ContainerStart = { method: z.literal("POST"), path: z.literal("/containers/{id}/start"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ detachKeys: z.string().optional(), @@ -1825,6 +1835,7 @@ export type post_ContainerStop = typeof post_ContainerStop; export const post_ContainerStop = { method: z.literal("POST"), path: z.literal("/containers/{id}/stop"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ signal: z.string().optional(), @@ -1841,6 +1852,7 @@ export type post_ContainerRestart = typeof post_ContainerRestart; export const post_ContainerRestart = { method: z.literal("POST"), path: z.literal("/containers/{id}/restart"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ signal: z.string().optional(), @@ -1857,6 +1869,7 @@ export type post_ContainerKill = typeof post_ContainerKill; export const post_ContainerKill = { method: z.literal("POST"), path: z.literal("/containers/{id}/kill"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ signal: z.string().optional(), @@ -1872,6 +1885,7 @@ export type post_ContainerUpdate = typeof post_ContainerUpdate; export const post_ContainerUpdate = { method: z.literal("POST"), path: z.literal("/containers/{id}/update"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -1892,6 +1906,7 @@ export type post_ContainerRename = typeof post_ContainerRename; export const post_ContainerRename = { method: z.literal("POST"), path: z.literal("/containers/{id}/rename"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ name: z.string(), @@ -1907,6 +1922,7 @@ export type post_ContainerPause = typeof post_ContainerPause; export const post_ContainerPause = { method: z.literal("POST"), path: z.literal("/containers/{id}/pause"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -1919,6 +1935,7 @@ export type post_ContainerUnpause = typeof post_ContainerUnpause; export const post_ContainerUnpause = { method: z.literal("POST"), path: z.literal("/containers/{id}/unpause"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -1931,6 +1948,7 @@ export type post_ContainerAttach = typeof post_ContainerAttach; export const post_ContainerAttach = { method: z.literal("POST"), path: z.literal("/containers/{id}/attach"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ detachKeys: z.string().optional(), @@ -1951,6 +1969,7 @@ export type get_ContainerAttachWebsocket = typeof get_ContainerAttachWebsocket; export const get_ContainerAttachWebsocket = { method: z.literal("GET"), path: z.literal("/containers/{id}/attach/ws"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ detachKeys: z.string().optional(), @@ -1971,6 +1990,7 @@ export type post_ContainerWait = typeof post_ContainerWait; export const post_ContainerWait = { method: z.literal("POST"), path: z.literal("/containers/{id}/wait"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ condition: z.union([z.literal("not-running"), z.literal("next-exit"), z.literal("removed")]).optional(), @@ -1986,6 +2006,7 @@ export type delete_ContainerDelete = typeof delete_ContainerDelete; export const delete_ContainerDelete = { method: z.literal("DELETE"), path: z.literal("/containers/{id}"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ v: z.boolean().optional(), @@ -2003,6 +2024,7 @@ export type get_ContainerArchive = typeof get_ContainerArchive; export const get_ContainerArchive = { method: z.literal("GET"), path: z.literal("/containers/{id}/archive"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ path: z.string(), @@ -2018,6 +2040,7 @@ export type put_PutContainerArchive = typeof put_PutContainerArchive; export const put_PutContainerArchive = { method: z.literal("PUT"), path: z.literal("/containers/{id}/archive"), + requestFormat: z.literal("binary"), parameters: z.object({ query: z.object({ path: z.string(), @@ -2036,6 +2059,7 @@ export type head_ContainerArchiveInfo = typeof head_ContainerArchiveInfo; export const head_ContainerArchiveInfo = { method: z.literal("HEAD"), path: z.literal("/containers/{id}/archive"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ path: z.string(), @@ -2051,6 +2075,7 @@ export type post_ContainerPrune = typeof post_ContainerPrune; export const post_ContainerPrune = { method: z.literal("POST"), path: z.literal("/containers/prune"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ filters: z.string().optional(), @@ -2066,6 +2091,7 @@ export type get_ImageList = typeof get_ImageList; export const get_ImageList = { method: z.literal("GET"), path: z.literal("/images/json"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ all: z.boolean().optional(), @@ -2081,6 +2107,7 @@ export type post_ImageBuild = typeof post_ImageBuild; export const post_ImageBuild = { method: z.literal("POST"), path: z.literal("/build"), + requestFormat: z.literal("binary"), parameters: z.object({ query: z.object({ dockerfile: z.string().optional(), @@ -2121,6 +2148,7 @@ export type post_BuildPrune = typeof post_BuildPrune; export const post_BuildPrune = { method: z.literal("POST"), path: z.literal("/build/prune"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ "keep-storage": z.number().optional(), @@ -2138,6 +2166,7 @@ export type post_ImageCreate = typeof post_ImageCreate; export const post_ImageCreate = { method: z.literal("POST"), path: z.literal("/images/create"), + requestFormat: z.literal("text"), parameters: z.object({ query: z.object({ fromImage: z.string().optional(), @@ -2160,6 +2189,7 @@ export type get_ImageInspect = typeof get_ImageInspect; export const get_ImageInspect = { method: z.literal("GET"), path: z.literal("/images/{name}/json"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ name: z.string(), @@ -2172,6 +2202,7 @@ export type get_ImageHistory = typeof get_ImageHistory; export const get_ImageHistory = { method: z.literal("GET"), path: z.literal("/images/{name}/history"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ name: z.string(), @@ -2193,6 +2224,7 @@ export type post_ImagePush = typeof post_ImagePush; export const post_ImagePush = { method: z.literal("POST"), path: z.literal("/images/{name}/push"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ tag: z.string().optional(), @@ -2211,6 +2243,7 @@ export type post_ImageTag = typeof post_ImageTag; export const post_ImageTag = { method: z.literal("POST"), path: z.literal("/images/{name}/tag"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ repo: z.string().optional(), @@ -2227,6 +2260,7 @@ export type delete_ImageDelete = typeof delete_ImageDelete; export const delete_ImageDelete = { method: z.literal("DELETE"), path: z.literal("/images/{name}"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ force: z.boolean().optional(), @@ -2243,6 +2277,7 @@ export type get_ImageSearch = typeof get_ImageSearch; export const get_ImageSearch = { method: z.literal("GET"), path: z.literal("/images/search"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ term: z.string(), @@ -2265,6 +2300,7 @@ export type post_ImagePrune = typeof post_ImagePrune; export const post_ImagePrune = { method: z.literal("POST"), path: z.literal("/images/prune"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ filters: z.string().optional(), @@ -2280,6 +2316,7 @@ export type post_SystemAuth = typeof post_SystemAuth; export const post_SystemAuth = { method: z.literal("POST"), path: z.literal("/auth"), + requestFormat: z.literal("json"), parameters: z.object({ body: AuthConfig, }), @@ -2290,6 +2327,7 @@ export type get_SystemInfo = typeof get_SystemInfo; export const get_SystemInfo = { method: z.literal("GET"), path: z.literal("/info"), + requestFormat: z.literal("json"), parameters: z.never(), response: SystemInfo, }; @@ -2298,6 +2336,7 @@ export type get_SystemVersion = typeof get_SystemVersion; export const get_SystemVersion = { method: z.literal("GET"), path: z.literal("/version"), + requestFormat: z.literal("json"), parameters: z.never(), response: SystemVersion, }; @@ -2306,6 +2345,7 @@ export type get_SystemPing = typeof get_SystemPing; export const get_SystemPing = { method: z.literal("GET"), path: z.literal("/_ping"), + requestFormat: z.literal("json"), parameters: z.never(), response: z.unknown(), }; @@ -2314,6 +2354,7 @@ export type head_SystemPingHead = typeof head_SystemPingHead; export const head_SystemPingHead = { method: z.literal("HEAD"), path: z.literal("/_ping"), + requestFormat: z.literal("json"), parameters: z.never(), response: z.unknown(), }; @@ -2322,6 +2363,7 @@ export type post_ImageCommit = typeof post_ImageCommit; export const post_ImageCommit = { method: z.literal("POST"), path: z.literal("/commit"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ container: z.string().optional(), @@ -2341,6 +2383,7 @@ export type get_SystemEvents = typeof get_SystemEvents; export const get_SystemEvents = { method: z.literal("GET"), path: z.literal("/events"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ since: z.string().optional(), @@ -2355,6 +2398,7 @@ export type get_SystemDataUsage = typeof get_SystemDataUsage; export const get_SystemDataUsage = { method: z.literal("GET"), path: z.literal("/system/df"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ type: z @@ -2375,6 +2419,7 @@ export type get_ImageGet = typeof get_ImageGet; export const get_ImageGet = { method: z.literal("GET"), path: z.literal("/images/{name}/get"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ name: z.string(), @@ -2387,6 +2432,7 @@ export type get_ImageGetAll = typeof get_ImageGetAll; export const get_ImageGetAll = { method: z.literal("GET"), path: z.literal("/images/get"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ names: z.array(z.string()).optional(), @@ -2399,6 +2445,7 @@ export type post_ImageLoad = typeof post_ImageLoad; export const post_ImageLoad = { method: z.literal("POST"), path: z.literal("/images/load"), + requestFormat: z.literal("text"), parameters: z.object({ query: z.object({ quiet: z.boolean().optional(), @@ -2411,6 +2458,7 @@ export type post_ContainerExec = typeof post_ContainerExec; export const post_ContainerExec = { method: z.literal("POST"), path: z.literal("/containers/{id}/exec"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -2436,6 +2484,7 @@ export type post_ExecStart = typeof post_ExecStart; export const post_ExecStart = { method: z.literal("POST"), path: z.literal("/exec/{id}/start"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -2453,6 +2502,7 @@ export type post_ExecResize = typeof post_ExecResize; export const post_ExecResize = { method: z.literal("POST"), path: z.literal("/exec/{id}/resize"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ h: z.number().optional(), @@ -2469,6 +2519,7 @@ export type get_ExecInspect = typeof get_ExecInspect; export const get_ExecInspect = { method: z.literal("GET"), path: z.literal("/exec/{id}/json"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -2493,6 +2544,7 @@ export type get_VolumeList = typeof get_VolumeList; export const get_VolumeList = { method: z.literal("GET"), path: z.literal("/volumes"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ filters: z.string().optional(), @@ -2505,6 +2557,7 @@ export type post_VolumeCreate = typeof post_VolumeCreate; export const post_VolumeCreate = { method: z.literal("POST"), path: z.literal("/volumes/create"), + requestFormat: z.literal("json"), parameters: z.object({ body: VolumeCreateOptions, }), @@ -2515,6 +2568,7 @@ export type get_VolumeInspect = typeof get_VolumeInspect; export const get_VolumeInspect = { method: z.literal("GET"), path: z.literal("/volumes/{name}"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ name: z.string(), @@ -2527,6 +2581,7 @@ export type put_VolumeUpdate = typeof put_VolumeUpdate; export const put_VolumeUpdate = { method: z.literal("PUT"), path: z.literal("/volumes/{name}"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ version: z.number(), @@ -2545,6 +2600,7 @@ export type delete_VolumeDelete = typeof delete_VolumeDelete; export const delete_VolumeDelete = { method: z.literal("DELETE"), path: z.literal("/volumes/{name}"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ force: z.boolean().optional(), @@ -2560,6 +2616,7 @@ export type post_VolumePrune = typeof post_VolumePrune; export const post_VolumePrune = { method: z.literal("POST"), path: z.literal("/volumes/prune"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ filters: z.string().optional(), @@ -2575,6 +2632,7 @@ export type get_NetworkList = typeof get_NetworkList; export const get_NetworkList = { method: z.literal("GET"), path: z.literal("/networks"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ filters: z.string().optional(), @@ -2587,6 +2645,7 @@ export type get_NetworkInspect = typeof get_NetworkInspect; export const get_NetworkInspect = { method: z.literal("GET"), path: z.literal("/networks/{id}"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ verbose: z.boolean().optional(), @@ -2603,6 +2662,7 @@ export type delete_NetworkDelete = typeof delete_NetworkDelete; export const delete_NetworkDelete = { method: z.literal("DELETE"), path: z.literal("/networks/{id}"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -2615,6 +2675,7 @@ export type post_NetworkCreate = typeof post_NetworkCreate; export const post_NetworkCreate = { method: z.literal("POST"), path: z.literal("/networks/create"), + requestFormat: z.literal("json"), parameters: z.object({ body: z.object({ Name: z.string(), @@ -2639,6 +2700,7 @@ export type post_NetworkConnect = typeof post_NetworkConnect; export const post_NetworkConnect = { method: z.literal("POST"), path: z.literal("/networks/{id}/connect"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -2655,6 +2717,7 @@ export type post_NetworkDisconnect = typeof post_NetworkDisconnect; export const post_NetworkDisconnect = { method: z.literal("POST"), path: z.literal("/networks/{id}/disconnect"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -2671,6 +2734,7 @@ export type post_NetworkPrune = typeof post_NetworkPrune; export const post_NetworkPrune = { method: z.literal("POST"), path: z.literal("/networks/prune"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ filters: z.string().optional(), @@ -2685,6 +2749,7 @@ export type get_PluginList = typeof get_PluginList; export const get_PluginList = { method: z.literal("GET"), path: z.literal("/plugins"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ filters: z.string().optional(), @@ -2697,6 +2762,7 @@ export type get_GetPluginPrivileges = typeof get_GetPluginPrivileges; export const get_GetPluginPrivileges = { method: z.literal("GET"), path: z.literal("/plugins/privileges"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ remote: z.string(), @@ -2709,6 +2775,7 @@ export type post_PluginPull = typeof post_PluginPull; export const post_PluginPull = { method: z.literal("POST"), path: z.literal("/plugins/pull"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ remote: z.string(), @@ -2726,6 +2793,7 @@ export type get_PluginInspect = typeof get_PluginInspect; export const get_PluginInspect = { method: z.literal("GET"), path: z.literal("/plugins/{name}/json"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ name: z.string(), @@ -2738,6 +2806,7 @@ export type delete_PluginDelete = typeof delete_PluginDelete; export const delete_PluginDelete = { method: z.literal("DELETE"), path: z.literal("/plugins/{name}"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ force: z.boolean().optional(), @@ -2753,6 +2822,7 @@ export type post_PluginEnable = typeof post_PluginEnable; export const post_PluginEnable = { method: z.literal("POST"), path: z.literal("/plugins/{name}/enable"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ timeout: z.number().optional(), @@ -2768,6 +2838,7 @@ export type post_PluginDisable = typeof post_PluginDisable; export const post_PluginDisable = { method: z.literal("POST"), path: z.literal("/plugins/{name}/disable"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ force: z.boolean().optional(), @@ -2783,6 +2854,7 @@ export type post_PluginUpgrade = typeof post_PluginUpgrade; export const post_PluginUpgrade = { method: z.literal("POST"), path: z.literal("/plugins/{name}/upgrade"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ remote: z.string(), @@ -2802,6 +2874,7 @@ export type post_PluginCreate = typeof post_PluginCreate; export const post_PluginCreate = { method: z.literal("POST"), path: z.literal("/plugins/create"), + requestFormat: z.literal("text"), parameters: z.object({ query: z.object({ name: z.string(), @@ -2814,6 +2887,7 @@ export type post_PluginPush = typeof post_PluginPush; export const post_PluginPush = { method: z.literal("POST"), path: z.literal("/plugins/{name}/push"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ name: z.string(), @@ -2826,6 +2900,7 @@ export type post_PluginSet = typeof post_PluginSet; export const post_PluginSet = { method: z.literal("POST"), path: z.literal("/plugins/{name}/set"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ name: z.string(), @@ -2839,6 +2914,7 @@ export type get_NodeList = typeof get_NodeList; export const get_NodeList = { method: z.literal("GET"), path: z.literal("/nodes"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ filters: z.string().optional(), @@ -2851,6 +2927,7 @@ export type get_NodeInspect = typeof get_NodeInspect; export const get_NodeInspect = { method: z.literal("GET"), path: z.literal("/nodes/{id}"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -2863,6 +2940,7 @@ export type delete_NodeDelete = typeof delete_NodeDelete; export const delete_NodeDelete = { method: z.literal("DELETE"), path: z.literal("/nodes/{id}"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ force: z.boolean().optional(), @@ -2878,6 +2956,7 @@ export type post_NodeUpdate = typeof post_NodeUpdate; export const post_NodeUpdate = { method: z.literal("POST"), path: z.literal("/nodes/{id}/update"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ version: z.number(), @@ -2894,6 +2973,7 @@ export type get_SwarmInspect = typeof get_SwarmInspect; export const get_SwarmInspect = { method: z.literal("GET"), path: z.literal("/swarm"), + requestFormat: z.literal("json"), parameters: z.never(), response: Swarm, }; @@ -2902,6 +2982,7 @@ export type post_SwarmInit = typeof post_SwarmInit; export const post_SwarmInit = { method: z.literal("POST"), path: z.literal("/swarm/init"), + requestFormat: z.literal("json"), parameters: z.object({ body: z.object({ ListenAddr: z.string().optional(), @@ -2921,6 +3002,7 @@ export type post_SwarmJoin = typeof post_SwarmJoin; export const post_SwarmJoin = { method: z.literal("POST"), path: z.literal("/swarm/join"), + requestFormat: z.literal("json"), parameters: z.object({ body: z.object({ ListenAddr: z.string().optional(), @@ -2937,6 +3019,7 @@ export type post_SwarmLeave = typeof post_SwarmLeave; export const post_SwarmLeave = { method: z.literal("POST"), path: z.literal("/swarm/leave"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ force: z.boolean().optional(), @@ -2949,6 +3032,7 @@ export type post_SwarmUpdate = typeof post_SwarmUpdate; export const post_SwarmUpdate = { method: z.literal("POST"), path: z.literal("/swarm/update"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ version: z.number(), @@ -2965,6 +3049,7 @@ export type get_SwarmUnlockkey = typeof get_SwarmUnlockkey; export const get_SwarmUnlockkey = { method: z.literal("GET"), path: z.literal("/swarm/unlockkey"), + requestFormat: z.literal("json"), parameters: z.never(), response: z.object({ UnlockKey: z.string().optional(), @@ -2975,6 +3060,7 @@ export type post_SwarmUnlock = typeof post_SwarmUnlock; export const post_SwarmUnlock = { method: z.literal("POST"), path: z.literal("/swarm/unlock"), + requestFormat: z.literal("json"), parameters: z.object({ body: z.object({ UnlockKey: z.string().optional(), @@ -2987,6 +3073,7 @@ export type get_ServiceList = typeof get_ServiceList; export const get_ServiceList = { method: z.literal("GET"), path: z.literal("/services"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ filters: z.string().optional(), @@ -3000,6 +3087,7 @@ export type post_ServiceCreate = typeof post_ServiceCreate; export const post_ServiceCreate = { method: z.literal("POST"), path: z.literal("/services/create"), + requestFormat: z.literal("json"), parameters: z.object({ header: z.object({ "X-Registry-Auth": z.string().optional(), @@ -3016,6 +3104,7 @@ export type get_ServiceInspect = typeof get_ServiceInspect; export const get_ServiceInspect = { method: z.literal("GET"), path: z.literal("/services/{id}"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ insertDefaults: z.boolean().optional(), @@ -3031,6 +3120,7 @@ export type delete_ServiceDelete = typeof delete_ServiceDelete; export const delete_ServiceDelete = { method: z.literal("DELETE"), path: z.literal("/services/{id}"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -3043,6 +3133,7 @@ export type post_ServiceUpdate = typeof post_ServiceUpdate; export const post_ServiceUpdate = { method: z.literal("POST"), path: z.literal("/services/{id}/update"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ version: z.number(), @@ -3064,6 +3155,7 @@ export type get_ServiceLogs = typeof get_ServiceLogs; export const get_ServiceLogs = { method: z.literal("GET"), path: z.literal("/services/{id}/logs"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ details: z.boolean().optional(), @@ -3085,6 +3177,7 @@ export type get_TaskList = typeof get_TaskList; export const get_TaskList = { method: z.literal("GET"), path: z.literal("/tasks"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ filters: z.string().optional(), @@ -3097,6 +3190,7 @@ export type get_TaskInspect = typeof get_TaskInspect; export const get_TaskInspect = { method: z.literal("GET"), path: z.literal("/tasks/{id}"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -3109,6 +3203,7 @@ export type get_TaskLogs = typeof get_TaskLogs; export const get_TaskLogs = { method: z.literal("GET"), path: z.literal("/tasks/{id}/logs"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ details: z.boolean().optional(), @@ -3130,6 +3225,7 @@ export type get_SecretList = typeof get_SecretList; export const get_SecretList = { method: z.literal("GET"), path: z.literal("/secrets"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ filters: z.string().optional(), @@ -3142,6 +3238,7 @@ export type post_SecretCreate = typeof post_SecretCreate; export const post_SecretCreate = { method: z.literal("POST"), path: z.literal("/secrets/create"), + requestFormat: z.literal("json"), parameters: z.object({ body: z.intersection(SecretSpec, z.unknown()), }), @@ -3152,6 +3249,7 @@ export type get_SecretInspect = typeof get_SecretInspect; export const get_SecretInspect = { method: z.literal("GET"), path: z.literal("/secrets/{id}"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -3164,6 +3262,7 @@ export type delete_SecretDelete = typeof delete_SecretDelete; export const delete_SecretDelete = { method: z.literal("DELETE"), path: z.literal("/secrets/{id}"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -3176,6 +3275,7 @@ export type post_SecretUpdate = typeof post_SecretUpdate; export const post_SecretUpdate = { method: z.literal("POST"), path: z.literal("/secrets/{id}/update"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ version: z.number(), @@ -3192,6 +3292,7 @@ export type get_ConfigList = typeof get_ConfigList; export const get_ConfigList = { method: z.literal("GET"), path: z.literal("/configs"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ filters: z.string().optional(), @@ -3204,6 +3305,7 @@ export type post_ConfigCreate = typeof post_ConfigCreate; export const post_ConfigCreate = { method: z.literal("POST"), path: z.literal("/configs/create"), + requestFormat: z.literal("json"), parameters: z.object({ body: z.intersection(ConfigSpec, z.unknown()), }), @@ -3214,6 +3316,7 @@ export type get_ConfigInspect = typeof get_ConfigInspect; export const get_ConfigInspect = { method: z.literal("GET"), path: z.literal("/configs/{id}"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -3226,6 +3329,7 @@ export type delete_ConfigDelete = typeof delete_ConfigDelete; export const delete_ConfigDelete = { method: z.literal("DELETE"), path: z.literal("/configs/{id}"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ id: z.string(), @@ -3238,6 +3342,7 @@ export type post_ConfigUpdate = typeof post_ConfigUpdate; export const post_ConfigUpdate = { method: z.literal("POST"), path: z.literal("/configs/{id}/update"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ version: z.number(), @@ -3254,6 +3359,7 @@ export type get_DistributionInspect = typeof get_DistributionInspect; export const get_DistributionInspect = { method: z.literal("GET"), path: z.literal("/distribution/{name}/json"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ name: z.string(), @@ -3266,6 +3372,7 @@ export type post_Session = typeof post_Session; export const post_Session = { method: z.literal("POST"), path: z.literal("/session"), + requestFormat: z.literal("json"), parameters: z.never(), response: z.unknown(), }; @@ -3413,6 +3520,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -3422,6 +3531,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/long-operation-id.arktype.ts b/packages/typed-openapi/tests/snapshots/long-operation-id.arktype.ts index 748a4a9..db8ca8d 100644 --- a/packages/typed-openapi/tests/snapshots/long-operation-id.arktype.ts +++ b/packages/typed-openapi/tests/snapshots/long-operation-id.arktype.ts @@ -5,12 +5,14 @@ export const types = scope({ get_Get_users: { method: '"GET"', path: '"/users"', + requestFormat: '"json"', parameters: "never", response: "string[]", }, post_Very_very_very_very_very_very_very_very_very_very_long: { method: '"POST"', path: '"/users"', + requestFormat: '"json"', parameters: { body: { "username?": "string", @@ -61,6 +63,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -70,6 +74,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/long-operation-id.client.ts b/packages/typed-openapi/tests/snapshots/long-operation-id.client.ts index 12874ed..4ee2be9 100644 --- a/packages/typed-openapi/tests/snapshots/long-operation-id.client.ts +++ b/packages/typed-openapi/tests/snapshots/long-operation-id.client.ts @@ -9,12 +9,14 @@ export namespace Endpoints { export type get_Get_users = { method: "GET"; path: "/users"; + requestFormat: "json"; parameters: never; response: Array; }; export type post_Very_very_very_very_very_very_very_very_very_very_long = { method: "POST"; path: "/users"; + requestFormat: "json"; parameters: { body: Partial<{ username: string }>; }; @@ -53,6 +55,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -62,6 +66,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/long-operation-id.io-ts.ts b/packages/typed-openapi/tests/snapshots/long-operation-id.io-ts.ts index 9991d29..72e53b6 100644 --- a/packages/typed-openapi/tests/snapshots/long-operation-id.io-ts.ts +++ b/packages/typed-openapi/tests/snapshots/long-operation-id.io-ts.ts @@ -7,6 +7,7 @@ export type get_Get_users = t.TypeOf; export const get_Get_users = t.type({ method: t.literal("GET"), path: t.literal("/users"), + requestFormat: t.literal("json"), parameters: t.never, response: t.array(t.string), }); @@ -17,6 +18,7 @@ export type post_Very_very_very_very_very_very_very_very_very_very_long = t.Type export const post_Very_very_very_very_very_very_very_very_very_very_long = t.type({ method: t.literal("POST"), path: t.literal("/users"), + requestFormat: t.literal("json"), parameters: t.type({ body: t.type({ username: t.union([t.undefined, t.string]), @@ -57,6 +59,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -66,6 +70,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/long-operation-id.typebox.ts b/packages/typed-openapi/tests/snapshots/long-operation-id.typebox.ts index 6b4d912..43d546f 100644 --- a/packages/typed-openapi/tests/snapshots/long-operation-id.typebox.ts +++ b/packages/typed-openapi/tests/snapshots/long-operation-id.typebox.ts @@ -7,6 +7,7 @@ export type get_Get_users = Static; export const get_Get_users = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/users"), + requestFormat: Type.Literal("json"), parameters: Type.Never(), response: Type.Array(Type.String()), }); @@ -17,6 +18,7 @@ export type post_Very_very_very_very_very_very_very_very_very_very_long = Static export const post_Very_very_very_very_very_very_very_very_very_very_long = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/users"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ body: Type.Partial( Type.Object({ @@ -59,6 +61,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -68,6 +72,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/long-operation-id.valibot.ts b/packages/typed-openapi/tests/snapshots/long-operation-id.valibot.ts index 674025b..8f44307 100644 --- a/packages/typed-openapi/tests/snapshots/long-operation-id.valibot.ts +++ b/packages/typed-openapi/tests/snapshots/long-operation-id.valibot.ts @@ -7,6 +7,7 @@ export type get_Get_users = v.InferOutput; export const get_Get_users = v.object({ method: v.literal("GET"), path: v.literal("/users"), + requestFormat: v.literal("json"), parameters: v.never(), response: v.array(v.string()), }); @@ -17,6 +18,7 @@ export type post_Very_very_very_very_very_very_very_very_very_very_long = v.Infe export const post_Very_very_very_very_very_very_very_very_very_very_long = v.object({ method: v.literal("POST"), path: v.literal("/users"), + requestFormat: v.literal("json"), parameters: v.object({ body: v.object({ username: v.optional(v.string()), @@ -57,6 +59,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -66,6 +70,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/long-operation-id.yup.ts b/packages/typed-openapi/tests/snapshots/long-operation-id.yup.ts index 7151f42..ca961a0 100644 --- a/packages/typed-openapi/tests/snapshots/long-operation-id.yup.ts +++ b/packages/typed-openapi/tests/snapshots/long-operation-id.yup.ts @@ -4,6 +4,7 @@ export type get_Get_users = typeof get_Get_users; export const get_Get_users = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/users" => value === "/users").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.mixed((value): value is never => false).required(), response: y.array(y.string().required()), }; @@ -13,6 +14,7 @@ export type post_Very_very_very_very_very_very_very_very_very_very_long = export const post_Very_very_very_very_very_very_very_very_very_very_long = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/users" => value === "/users").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ body: y.object({ username: y.string().required().optional(), @@ -50,6 +52,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -59,6 +63,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/long-operation-id.zod.ts b/packages/typed-openapi/tests/snapshots/long-operation-id.zod.ts index 8fd0c1d..6a95782 100644 --- a/packages/typed-openapi/tests/snapshots/long-operation-id.zod.ts +++ b/packages/typed-openapi/tests/snapshots/long-operation-id.zod.ts @@ -4,6 +4,7 @@ export type get_Get_users = typeof get_Get_users; export const get_Get_users = { method: z.literal("GET"), path: z.literal("/users"), + requestFormat: z.literal("json"), parameters: z.never(), response: z.array(z.string()), }; @@ -13,6 +14,7 @@ export type post_Very_very_very_very_very_very_very_very_very_very_long = export const post_Very_very_very_very_very_very_very_very_very_very_long = { method: z.literal("POST"), path: z.literal("/users"), + requestFormat: z.literal("json"), parameters: z.object({ body: z.object({ username: z.string().optional(), @@ -50,6 +52,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -59,6 +63,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/petstore.arktype.ts b/packages/typed-openapi/tests/snapshots/petstore.arktype.ts index 04b3197..0d217e0 100644 --- a/packages/typed-openapi/tests/snapshots/petstore.arktype.ts +++ b/packages/typed-openapi/tests/snapshots/petstore.arktype.ts @@ -55,6 +55,7 @@ export const types = scope({ put_UpdatePet: { method: '"PUT"', path: '"/pet"', + requestFormat: '"json"', parameters: { body: "Pet", }, @@ -63,6 +64,7 @@ export const types = scope({ post_AddPet: { method: '"POST"', path: '"/pet"', + requestFormat: '"json"', parameters: { body: "Pet", }, @@ -71,6 +73,7 @@ export const types = scope({ get_FindPetsByStatus: { method: '"GET"', path: '"/pet/findByStatus"', + requestFormat: '"json"', parameters: { query: { "status?": '"available" | "pending" | "sold"', @@ -81,6 +84,7 @@ export const types = scope({ get_FindPetsByTags: { method: '"GET"', path: '"/pet/findByTags"', + requestFormat: '"json"', parameters: { query: { "tags?": "string[]", @@ -91,6 +95,7 @@ export const types = scope({ get_GetPetById: { method: '"GET"', path: '"/pet/{petId}"', + requestFormat: '"json"', parameters: { path: { petId: "number", @@ -101,6 +106,7 @@ export const types = scope({ post_UpdatePetWithForm: { method: '"POST"', path: '"/pet/{petId}"', + requestFormat: '"json"', parameters: { query: { "name?": "string", @@ -115,6 +121,7 @@ export const types = scope({ delete_DeletePet: { method: '"DELETE"', path: '"/pet/{petId}"', + requestFormat: '"json"', parameters: { path: { petId: "number", @@ -128,6 +135,7 @@ export const types = scope({ post_UploadFile: { method: '"POST"', path: '"/pet/{petId}/uploadImage"', + requestFormat: '"binary"', parameters: { query: { "additionalMetadata?": "string", @@ -142,12 +150,14 @@ export const types = scope({ get_GetInventory: { method: '"GET"', path: '"/store/inventory"', + requestFormat: '"json"', parameters: "never", response: "unknown", }, post_PlaceOrder: { method: '"POST"', path: '"/store/order"', + requestFormat: '"json"', parameters: { body: "Order", }, @@ -156,6 +166,7 @@ export const types = scope({ get_GetOrderById: { method: '"GET"', path: '"/store/order/{orderId}"', + requestFormat: '"json"', parameters: { path: { orderId: "number", @@ -166,6 +177,7 @@ export const types = scope({ delete_DeleteOrder: { method: '"DELETE"', path: '"/store/order/{orderId}"', + requestFormat: '"json"', parameters: { path: { orderId: "number", @@ -176,6 +188,7 @@ export const types = scope({ post_CreateUser: { method: '"POST"', path: '"/user"', + requestFormat: '"json"', parameters: { body: "User", }, @@ -184,6 +197,7 @@ export const types = scope({ post_CreateUsersWithListInput: { method: '"POST"', path: '"/user/createWithList"', + requestFormat: '"json"', parameters: { body: "User[]", }, @@ -192,6 +206,7 @@ export const types = scope({ get_LoginUser: { method: '"GET"', path: '"/user/login"', + requestFormat: '"json"', parameters: { query: { "username?": "string", @@ -203,12 +218,14 @@ export const types = scope({ get_LogoutUser: { method: '"GET"', path: '"/user/logout"', + requestFormat: '"json"', parameters: "never", response: "unknown", }, get_GetUserByName: { method: '"GET"', path: '"/user/{username}"', + requestFormat: '"json"', parameters: { path: { username: "string", @@ -219,6 +236,7 @@ export const types = scope({ put_UpdateUser: { method: '"PUT"', path: '"/user/{username}"', + requestFormat: '"json"', parameters: { path: { username: "string", @@ -230,6 +248,7 @@ export const types = scope({ delete_DeleteUser: { method: '"DELETE"', path: '"/user/{username}"', + requestFormat: '"json"', parameters: { path: { username: "string", @@ -351,6 +370,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -360,6 +381,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/petstore.client.ts b/packages/typed-openapi/tests/snapshots/petstore.client.ts index b746fa6..dff7e48 100644 --- a/packages/typed-openapi/tests/snapshots/petstore.client.ts +++ b/packages/typed-openapi/tests/snapshots/petstore.client.ts @@ -41,6 +41,7 @@ export namespace Endpoints { export type put_UpdatePet = { method: "PUT"; path: "/pet"; + requestFormat: "json"; parameters: { body: Schemas.Pet; }; @@ -49,6 +50,7 @@ export namespace Endpoints { export type post_AddPet = { method: "POST"; path: "/pet"; + requestFormat: "json"; parameters: { body: Schemas.Pet; }; @@ -57,6 +59,7 @@ export namespace Endpoints { export type get_FindPetsByStatus = { method: "GET"; path: "/pet/findByStatus"; + requestFormat: "json"; parameters: { query: Partial<{ status: "available" | "pending" | "sold" }>; }; @@ -65,6 +68,7 @@ export namespace Endpoints { export type get_FindPetsByTags = { method: "GET"; path: "/pet/findByTags"; + requestFormat: "json"; parameters: { query: Partial<{ tags: Array }>; }; @@ -73,6 +77,7 @@ export namespace Endpoints { export type get_GetPetById = { method: "GET"; path: "/pet/{petId}"; + requestFormat: "json"; parameters: { path: { petId: number }; }; @@ -81,6 +86,7 @@ export namespace Endpoints { export type post_UpdatePetWithForm = { method: "POST"; path: "/pet/{petId}"; + requestFormat: "json"; parameters: { query: Partial<{ name: string; status: string }>; path: { petId: number }; @@ -90,6 +96,7 @@ export namespace Endpoints { export type delete_DeletePet = { method: "DELETE"; path: "/pet/{petId}"; + requestFormat: "json"; parameters: { path: { petId: number }; header: Partial<{ api_key: string }>; @@ -99,6 +106,7 @@ export namespace Endpoints { export type post_UploadFile = { method: "POST"; path: "/pet/{petId}/uploadImage"; + requestFormat: "binary"; parameters: { query: Partial<{ additionalMetadata: string }>; path: { petId: number }; @@ -110,12 +118,14 @@ export namespace Endpoints { export type get_GetInventory = { method: "GET"; path: "/store/inventory"; + requestFormat: "json"; parameters: never; response: unknown; }; export type post_PlaceOrder = { method: "POST"; path: "/store/order"; + requestFormat: "json"; parameters: { body: Schemas.Order; }; @@ -124,6 +134,7 @@ export namespace Endpoints { export type get_GetOrderById = { method: "GET"; path: "/store/order/{orderId}"; + requestFormat: "json"; parameters: { path: { orderId: number }; }; @@ -132,6 +143,7 @@ export namespace Endpoints { export type delete_DeleteOrder = { method: "DELETE"; path: "/store/order/{orderId}"; + requestFormat: "json"; parameters: { path: { orderId: number }; }; @@ -140,6 +152,7 @@ export namespace Endpoints { export type post_CreateUser = { method: "POST"; path: "/user"; + requestFormat: "json"; parameters: { body: Schemas.User; }; @@ -148,6 +161,7 @@ export namespace Endpoints { export type post_CreateUsersWithListInput = { method: "POST"; path: "/user/createWithList"; + requestFormat: "json"; parameters: { body: Array; }; @@ -156,6 +170,7 @@ export namespace Endpoints { export type get_LoginUser = { method: "GET"; path: "/user/login"; + requestFormat: "json"; parameters: { query: Partial<{ username: string; password: string }>; }; @@ -164,12 +179,14 @@ export namespace Endpoints { export type get_LogoutUser = { method: "GET"; path: "/user/logout"; + requestFormat: "json"; parameters: never; response: unknown; }; export type get_GetUserByName = { method: "GET"; path: "/user/{username}"; + requestFormat: "json"; parameters: { path: { username: string }; }; @@ -178,6 +195,7 @@ export namespace Endpoints { export type put_UpdateUser = { method: "PUT"; path: "/user/{username}"; + requestFormat: "json"; parameters: { path: { username: string }; @@ -188,6 +206,7 @@ export namespace Endpoints { export type delete_DeleteUser = { method: "DELETE"; path: "/user/{username}"; + requestFormat: "json"; parameters: { path: { username: string }; }; @@ -249,6 +268,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -258,6 +279,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/petstore.io-ts.ts b/packages/typed-openapi/tests/snapshots/petstore.io-ts.ts index 8429522..83a4282 100644 --- a/packages/typed-openapi/tests/snapshots/petstore.io-ts.ts +++ b/packages/typed-openapi/tests/snapshots/petstore.io-ts.ts @@ -76,6 +76,7 @@ export type put_UpdatePet = t.TypeOf; export const put_UpdatePet = t.type({ method: t.literal("PUT"), path: t.literal("/pet"), + requestFormat: t.literal("json"), parameters: t.type({ body: Pet, }), @@ -86,6 +87,7 @@ export type post_AddPet = t.TypeOf; export const post_AddPet = t.type({ method: t.literal("POST"), path: t.literal("/pet"), + requestFormat: t.literal("json"), parameters: t.type({ body: Pet, }), @@ -96,6 +98,7 @@ export type get_FindPetsByStatus = t.TypeOf; export const get_FindPetsByStatus = t.type({ method: t.literal("GET"), path: t.literal("/pet/findByStatus"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ status: t.union([t.undefined, t.union([t.literal("available"), t.literal("pending"), t.literal("sold")])]), @@ -108,6 +111,7 @@ export type get_FindPetsByTags = t.TypeOf; export const get_FindPetsByTags = t.type({ method: t.literal("GET"), path: t.literal("/pet/findByTags"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ tags: t.union([t.undefined, t.array(t.string)]), @@ -120,6 +124,7 @@ export type get_GetPetById = t.TypeOf; export const get_GetPetById = t.type({ method: t.literal("GET"), path: t.literal("/pet/{petId}"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ petId: t.number, @@ -132,6 +137,7 @@ export type post_UpdatePetWithForm = t.TypeOf; export const post_UpdatePetWithForm = t.type({ method: t.literal("POST"), path: t.literal("/pet/{petId}"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ name: t.union([t.undefined, t.string]), @@ -148,6 +154,7 @@ export type delete_DeletePet = t.TypeOf; export const delete_DeletePet = t.type({ method: t.literal("DELETE"), path: t.literal("/pet/{petId}"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ petId: t.number, @@ -163,6 +170,7 @@ export type post_UploadFile = t.TypeOf; export const post_UploadFile = t.type({ method: t.literal("POST"), path: t.literal("/pet/{petId}/uploadImage"), + requestFormat: t.literal("binary"), parameters: t.type({ query: t.type({ additionalMetadata: t.union([t.undefined, t.string]), @@ -179,6 +187,7 @@ export type get_GetInventory = t.TypeOf; export const get_GetInventory = t.type({ method: t.literal("GET"), path: t.literal("/store/inventory"), + requestFormat: t.literal("json"), parameters: t.never, response: t.unknown, }); @@ -187,6 +196,7 @@ export type post_PlaceOrder = t.TypeOf; export const post_PlaceOrder = t.type({ method: t.literal("POST"), path: t.literal("/store/order"), + requestFormat: t.literal("json"), parameters: t.type({ body: Order, }), @@ -197,6 +207,7 @@ export type get_GetOrderById = t.TypeOf; export const get_GetOrderById = t.type({ method: t.literal("GET"), path: t.literal("/store/order/{orderId}"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ orderId: t.number, @@ -209,6 +220,7 @@ export type delete_DeleteOrder = t.TypeOf; export const delete_DeleteOrder = t.type({ method: t.literal("DELETE"), path: t.literal("/store/order/{orderId}"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ orderId: t.number, @@ -221,6 +233,7 @@ export type post_CreateUser = t.TypeOf; export const post_CreateUser = t.type({ method: t.literal("POST"), path: t.literal("/user"), + requestFormat: t.literal("json"), parameters: t.type({ body: User, }), @@ -231,6 +244,7 @@ export type post_CreateUsersWithListInput = t.TypeOf; export const get_LoginUser = t.type({ method: t.literal("GET"), path: t.literal("/user/login"), + requestFormat: t.literal("json"), parameters: t.type({ query: t.type({ username: t.union([t.undefined, t.string]), @@ -254,6 +269,7 @@ export type get_LogoutUser = t.TypeOf; export const get_LogoutUser = t.type({ method: t.literal("GET"), path: t.literal("/user/logout"), + requestFormat: t.literal("json"), parameters: t.never, response: t.unknown, }); @@ -262,6 +278,7 @@ export type get_GetUserByName = t.TypeOf; export const get_GetUserByName = t.type({ method: t.literal("GET"), path: t.literal("/user/{username}"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ username: t.string, @@ -274,6 +291,7 @@ export type put_UpdateUser = t.TypeOf; export const put_UpdateUser = t.type({ method: t.literal("PUT"), path: t.literal("/user/{username}"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ username: t.string, @@ -287,6 +305,7 @@ export type delete_DeleteUser = t.TypeOf; export const delete_DeleteUser = t.type({ method: t.literal("DELETE"), path: t.literal("/user/{username}"), + requestFormat: t.literal("json"), parameters: t.type({ path: t.type({ username: t.string, @@ -350,6 +369,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -359,6 +380,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/petstore.typebox.ts b/packages/typed-openapi/tests/snapshots/petstore.typebox.ts index 5a3d8f7..ca3b4e4 100644 --- a/packages/typed-openapi/tests/snapshots/petstore.typebox.ts +++ b/packages/typed-openapi/tests/snapshots/petstore.typebox.ts @@ -89,6 +89,7 @@ export type put_UpdatePet = Static; export const put_UpdatePet = Type.Object({ method: Type.Literal("PUT"), path: Type.Literal("/pet"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ body: Pet, }), @@ -99,6 +100,7 @@ export type post_AddPet = Static; export const post_AddPet = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/pet"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ body: Pet, }), @@ -109,6 +111,7 @@ export type get_FindPetsByStatus = Static; export const get_FindPetsByStatus = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/pet/findByStatus"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -123,6 +126,7 @@ export type get_FindPetsByTags = Static; export const get_FindPetsByTags = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/pet/findByTags"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -137,6 +141,7 @@ export type get_GetPetById = Static; export const get_GetPetById = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/pet/{petId}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ petId: Type.Number(), @@ -149,6 +154,7 @@ export type post_UpdatePetWithForm = Static; export const post_UpdatePetWithForm = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/pet/{petId}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -167,6 +173,7 @@ export type delete_DeletePet = Static; export const delete_DeletePet = Type.Object({ method: Type.Literal("DELETE"), path: Type.Literal("/pet/{petId}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ petId: Type.Number(), @@ -184,6 +191,7 @@ export type post_UploadFile = Static; export const post_UploadFile = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/pet/{petId}/uploadImage"), + requestFormat: Type.Literal("binary"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -202,6 +210,7 @@ export type get_GetInventory = Static; export const get_GetInventory = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/store/inventory"), + requestFormat: Type.Literal("json"), parameters: Type.Never(), response: Type.Unknown(), }); @@ -210,6 +219,7 @@ export type post_PlaceOrder = Static; export const post_PlaceOrder = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/store/order"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ body: Order, }), @@ -220,6 +230,7 @@ export type get_GetOrderById = Static; export const get_GetOrderById = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/store/order/{orderId}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ orderId: Type.Number(), @@ -232,6 +243,7 @@ export type delete_DeleteOrder = Static; export const delete_DeleteOrder = Type.Object({ method: Type.Literal("DELETE"), path: Type.Literal("/store/order/{orderId}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ orderId: Type.Number(), @@ -244,6 +256,7 @@ export type post_CreateUser = Static; export const post_CreateUser = Type.Object({ method: Type.Literal("POST"), path: Type.Literal("/user"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ body: User, }), @@ -254,6 +267,7 @@ export type post_CreateUsersWithListInput = Static; export const get_LoginUser = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/user/login"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ query: Type.Partial( Type.Object({ @@ -279,6 +294,7 @@ export type get_LogoutUser = Static; export const get_LogoutUser = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/user/logout"), + requestFormat: Type.Literal("json"), parameters: Type.Never(), response: Type.Unknown(), }); @@ -287,6 +303,7 @@ export type get_GetUserByName = Static; export const get_GetUserByName = Type.Object({ method: Type.Literal("GET"), path: Type.Literal("/user/{username}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ username: Type.String(), @@ -299,6 +316,7 @@ export type put_UpdateUser = Static; export const put_UpdateUser = Type.Object({ method: Type.Literal("PUT"), path: Type.Literal("/user/{username}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ username: Type.String(), @@ -312,6 +330,7 @@ export type delete_DeleteUser = Static; export const delete_DeleteUser = Type.Object({ method: Type.Literal("DELETE"), path: Type.Literal("/user/{username}"), + requestFormat: Type.Literal("json"), parameters: Type.Object({ path: Type.Object({ username: Type.String(), @@ -375,6 +394,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -384,6 +405,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/petstore.valibot.ts b/packages/typed-openapi/tests/snapshots/petstore.valibot.ts index 280c75a..9c19236 100644 --- a/packages/typed-openapi/tests/snapshots/petstore.valibot.ts +++ b/packages/typed-openapi/tests/snapshots/petstore.valibot.ts @@ -73,6 +73,7 @@ export type put_UpdatePet = v.InferOutput; export const put_UpdatePet = v.object({ method: v.literal("PUT"), path: v.literal("/pet"), + requestFormat: v.literal("json"), parameters: v.object({ body: Pet, }), @@ -83,6 +84,7 @@ export type post_AddPet = v.InferOutput; export const post_AddPet = v.object({ method: v.literal("POST"), path: v.literal("/pet"), + requestFormat: v.literal("json"), parameters: v.object({ body: Pet, }), @@ -93,6 +95,7 @@ export type get_FindPetsByStatus = v.InferOutput; export const get_FindPetsByStatus = v.object({ method: v.literal("GET"), path: v.literal("/pet/findByStatus"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ status: v.optional(v.union([v.literal("available"), v.literal("pending"), v.literal("sold")])), @@ -105,6 +108,7 @@ export type get_FindPetsByTags = v.InferOutput; export const get_FindPetsByTags = v.object({ method: v.literal("GET"), path: v.literal("/pet/findByTags"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ tags: v.optional(v.array(v.string())), @@ -117,6 +121,7 @@ export type get_GetPetById = v.InferOutput; export const get_GetPetById = v.object({ method: v.literal("GET"), path: v.literal("/pet/{petId}"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ petId: v.number(), @@ -129,6 +134,7 @@ export type post_UpdatePetWithForm = v.InferOutput; export const delete_DeletePet = v.object({ method: v.literal("DELETE"), path: v.literal("/pet/{petId}"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ petId: v.number(), @@ -160,6 +167,7 @@ export type post_UploadFile = v.InferOutput; export const post_UploadFile = v.object({ method: v.literal("POST"), path: v.literal("/pet/{petId}/uploadImage"), + requestFormat: v.literal("binary"), parameters: v.object({ query: v.object({ additionalMetadata: v.optional(v.string()), @@ -176,6 +184,7 @@ export type get_GetInventory = v.InferOutput; export const get_GetInventory = v.object({ method: v.literal("GET"), path: v.literal("/store/inventory"), + requestFormat: v.literal("json"), parameters: v.never(), response: v.unknown(), }); @@ -184,6 +193,7 @@ export type post_PlaceOrder = v.InferOutput; export const post_PlaceOrder = v.object({ method: v.literal("POST"), path: v.literal("/store/order"), + requestFormat: v.literal("json"), parameters: v.object({ body: Order, }), @@ -194,6 +204,7 @@ export type get_GetOrderById = v.InferOutput; export const get_GetOrderById = v.object({ method: v.literal("GET"), path: v.literal("/store/order/{orderId}"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ orderId: v.number(), @@ -206,6 +217,7 @@ export type delete_DeleteOrder = v.InferOutput; export const delete_DeleteOrder = v.object({ method: v.literal("DELETE"), path: v.literal("/store/order/{orderId}"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ orderId: v.number(), @@ -218,6 +230,7 @@ export type post_CreateUser = v.InferOutput; export const post_CreateUser = v.object({ method: v.literal("POST"), path: v.literal("/user"), + requestFormat: v.literal("json"), parameters: v.object({ body: User, }), @@ -228,6 +241,7 @@ export type post_CreateUsersWithListInput = v.InferOutput; export const get_LoginUser = v.object({ method: v.literal("GET"), path: v.literal("/user/login"), + requestFormat: v.literal("json"), parameters: v.object({ query: v.object({ username: v.optional(v.string()), @@ -251,6 +266,7 @@ export type get_LogoutUser = v.InferOutput; export const get_LogoutUser = v.object({ method: v.literal("GET"), path: v.literal("/user/logout"), + requestFormat: v.literal("json"), parameters: v.never(), response: v.unknown(), }); @@ -259,6 +275,7 @@ export type get_GetUserByName = v.InferOutput; export const get_GetUserByName = v.object({ method: v.literal("GET"), path: v.literal("/user/{username}"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ username: v.string(), @@ -271,6 +288,7 @@ export type put_UpdateUser = v.InferOutput; export const put_UpdateUser = v.object({ method: v.literal("PUT"), path: v.literal("/user/{username}"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ username: v.string(), @@ -284,6 +302,7 @@ export type delete_DeleteUser = v.InferOutput; export const delete_DeleteUser = v.object({ method: v.literal("DELETE"), path: v.literal("/user/{username}"), + requestFormat: v.literal("json"), parameters: v.object({ path: v.object({ username: v.string(), @@ -347,6 +366,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -356,6 +377,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/petstore.yup.ts b/packages/typed-openapi/tests/snapshots/petstore.yup.ts index b3be630..d59d54b 100644 --- a/packages/typed-openapi/tests/snapshots/petstore.yup.ts +++ b/packages/typed-openapi/tests/snapshots/petstore.yup.ts @@ -91,6 +91,7 @@ export type put_UpdatePet = typeof put_UpdatePet; export const put_UpdatePet = { method: y.mixed((value): value is "PUT" => value === "PUT").required(), path: y.mixed((value): value is "/pet" => value === "/pet").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ body: Pet, }), @@ -101,6 +102,7 @@ export type post_AddPet = typeof post_AddPet; export const post_AddPet = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/pet" => value === "/pet").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ body: Pet, }), @@ -111,6 +113,7 @@ export type get_FindPetsByStatus = typeof get_FindPetsByStatus; export const get_FindPetsByStatus = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/pet/findByStatus" => value === "/pet/findByStatus").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ status: y.mixed().oneOf(["available", "pending", "sold"]).required().optional(), @@ -123,6 +126,7 @@ export type get_FindPetsByTags = typeof get_FindPetsByTags; export const get_FindPetsByTags = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/pet/findByTags" => value === "/pet/findByTags").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ tags: y.array(y.string().required()).optional(), @@ -135,6 +139,7 @@ export type get_GetPetById = typeof get_GetPetById; export const get_GetPetById = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/pet/{petId}" => value === "/pet/{petId}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ petId: y.number().required(), @@ -147,6 +152,7 @@ export type post_UpdatePetWithForm = typeof post_UpdatePetWithForm; export const post_UpdatePetWithForm = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/pet/{petId}" => value === "/pet/{petId}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ name: y.string().required().optional(), @@ -163,6 +169,7 @@ export type delete_DeletePet = typeof delete_DeletePet; export const delete_DeletePet = { method: y.mixed((value): value is "DELETE" => value === "DELETE").required(), path: y.mixed((value): value is "/pet/{petId}" => value === "/pet/{petId}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ petId: y.number().required(), @@ -178,6 +185,7 @@ export type post_UploadFile = typeof post_UploadFile; export const post_UploadFile = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/pet/{petId}/uploadImage" => value === "/pet/{petId}/uploadImage").required(), + requestFormat: y.mixed((value): value is "binary" => value === "binary").required(), parameters: y.object({ query: y.object({ additionalMetadata: y.string().required().optional(), @@ -194,6 +202,7 @@ export type get_GetInventory = typeof get_GetInventory; export const get_GetInventory = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/store/inventory" => value === "/store/inventory").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.mixed((value): value is never => false).required(), response: y.mixed((value): value is any => true).required() as y.MixedSchema, }; @@ -202,6 +211,7 @@ export type post_PlaceOrder = typeof post_PlaceOrder; export const post_PlaceOrder = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/store/order" => value === "/store/order").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ body: Order, }), @@ -212,6 +222,7 @@ export type get_GetOrderById = typeof get_GetOrderById; export const get_GetOrderById = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/store/order/{orderId}" => value === "/store/order/{orderId}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ orderId: y.number().required(), @@ -224,6 +235,7 @@ export type delete_DeleteOrder = typeof delete_DeleteOrder; export const delete_DeleteOrder = { method: y.mixed((value): value is "DELETE" => value === "DELETE").required(), path: y.mixed((value): value is "/store/order/{orderId}" => value === "/store/order/{orderId}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ orderId: y.number().required(), @@ -236,6 +248,7 @@ export type post_CreateUser = typeof post_CreateUser; export const post_CreateUser = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/user" => value === "/user").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ body: User, }), @@ -246,6 +259,7 @@ export type post_CreateUsersWithListInput = typeof post_CreateUsersWithListInput export const post_CreateUsersWithListInput = { method: y.mixed((value): value is "POST" => value === "POST").required(), path: y.mixed((value): value is "/user/createWithList" => value === "/user/createWithList").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ body: y.array(User), }), @@ -256,6 +270,7 @@ export type get_LoginUser = typeof get_LoginUser; export const get_LoginUser = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/user/login" => value === "/user/login").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ query: y.object({ username: y.string().required().optional(), @@ -269,6 +284,7 @@ export type get_LogoutUser = typeof get_LogoutUser; export const get_LogoutUser = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/user/logout" => value === "/user/logout").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.mixed((value): value is never => false).required(), response: y.mixed((value): value is any => true).required() as y.MixedSchema, }; @@ -277,6 +293,7 @@ export type get_GetUserByName = typeof get_GetUserByName; export const get_GetUserByName = { method: y.mixed((value): value is "GET" => value === "GET").required(), path: y.mixed((value): value is "/user/{username}" => value === "/user/{username}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ username: y.string().required(), @@ -289,6 +306,7 @@ export type put_UpdateUser = typeof put_UpdateUser; export const put_UpdateUser = { method: y.mixed((value): value is "PUT" => value === "PUT").required(), path: y.mixed((value): value is "/user/{username}" => value === "/user/{username}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ username: y.string().required(), @@ -302,6 +320,7 @@ export type delete_DeleteUser = typeof delete_DeleteUser; export const delete_DeleteUser = { method: y.mixed((value): value is "DELETE" => value === "DELETE").required(), path: y.mixed((value): value is "/user/{username}" => value === "/user/{username}").required(), + requestFormat: y.mixed((value): value is "json" => value === "json").required(), parameters: y.object({ path: y.object({ username: y.string().required(), @@ -362,6 +381,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -371,6 +392,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string; diff --git a/packages/typed-openapi/tests/snapshots/petstore.zod.ts b/packages/typed-openapi/tests/snapshots/petstore.zod.ts index f65f917..54219f4 100644 --- a/packages/typed-openapi/tests/snapshots/petstore.zod.ts +++ b/packages/typed-openapi/tests/snapshots/petstore.zod.ts @@ -70,6 +70,7 @@ export type put_UpdatePet = typeof put_UpdatePet; export const put_UpdatePet = { method: z.literal("PUT"), path: z.literal("/pet"), + requestFormat: z.literal("json"), parameters: z.object({ body: Pet, }), @@ -80,6 +81,7 @@ export type post_AddPet = typeof post_AddPet; export const post_AddPet = { method: z.literal("POST"), path: z.literal("/pet"), + requestFormat: z.literal("json"), parameters: z.object({ body: Pet, }), @@ -90,6 +92,7 @@ export type get_FindPetsByStatus = typeof get_FindPetsByStatus; export const get_FindPetsByStatus = { method: z.literal("GET"), path: z.literal("/pet/findByStatus"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ status: z.union([z.literal("available"), z.literal("pending"), z.literal("sold")]).optional(), @@ -102,6 +105,7 @@ export type get_FindPetsByTags = typeof get_FindPetsByTags; export const get_FindPetsByTags = { method: z.literal("GET"), path: z.literal("/pet/findByTags"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ tags: z.array(z.string()).optional(), @@ -114,6 +118,7 @@ export type get_GetPetById = typeof get_GetPetById; export const get_GetPetById = { method: z.literal("GET"), path: z.literal("/pet/{petId}"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ petId: z.number(), @@ -126,6 +131,7 @@ export type post_UpdatePetWithForm = typeof post_UpdatePetWithForm; export const post_UpdatePetWithForm = { method: z.literal("POST"), path: z.literal("/pet/{petId}"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ name: z.string().optional(), @@ -142,6 +148,7 @@ export type delete_DeletePet = typeof delete_DeletePet; export const delete_DeletePet = { method: z.literal("DELETE"), path: z.literal("/pet/{petId}"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ petId: z.number(), @@ -157,6 +164,7 @@ export type post_UploadFile = typeof post_UploadFile; export const post_UploadFile = { method: z.literal("POST"), path: z.literal("/pet/{petId}/uploadImage"), + requestFormat: z.literal("binary"), parameters: z.object({ query: z.object({ additionalMetadata: z.string().optional(), @@ -173,6 +181,7 @@ export type get_GetInventory = typeof get_GetInventory; export const get_GetInventory = { method: z.literal("GET"), path: z.literal("/store/inventory"), + requestFormat: z.literal("json"), parameters: z.never(), response: z.unknown(), }; @@ -181,6 +190,7 @@ export type post_PlaceOrder = typeof post_PlaceOrder; export const post_PlaceOrder = { method: z.literal("POST"), path: z.literal("/store/order"), + requestFormat: z.literal("json"), parameters: z.object({ body: Order, }), @@ -191,6 +201,7 @@ export type get_GetOrderById = typeof get_GetOrderById; export const get_GetOrderById = { method: z.literal("GET"), path: z.literal("/store/order/{orderId}"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ orderId: z.number(), @@ -203,6 +214,7 @@ export type delete_DeleteOrder = typeof delete_DeleteOrder; export const delete_DeleteOrder = { method: z.literal("DELETE"), path: z.literal("/store/order/{orderId}"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ orderId: z.number(), @@ -215,6 +227,7 @@ export type post_CreateUser = typeof post_CreateUser; export const post_CreateUser = { method: z.literal("POST"), path: z.literal("/user"), + requestFormat: z.literal("json"), parameters: z.object({ body: User, }), @@ -225,6 +238,7 @@ export type post_CreateUsersWithListInput = typeof post_CreateUsersWithListInput export const post_CreateUsersWithListInput = { method: z.literal("POST"), path: z.literal("/user/createWithList"), + requestFormat: z.literal("json"), parameters: z.object({ body: z.array(User), }), @@ -235,6 +249,7 @@ export type get_LoginUser = typeof get_LoginUser; export const get_LoginUser = { method: z.literal("GET"), path: z.literal("/user/login"), + requestFormat: z.literal("json"), parameters: z.object({ query: z.object({ username: z.string().optional(), @@ -248,6 +263,7 @@ export type get_LogoutUser = typeof get_LogoutUser; export const get_LogoutUser = { method: z.literal("GET"), path: z.literal("/user/logout"), + requestFormat: z.literal("json"), parameters: z.never(), response: z.unknown(), }; @@ -256,6 +272,7 @@ export type get_GetUserByName = typeof get_GetUserByName; export const get_GetUserByName = { method: z.literal("GET"), path: z.literal("/user/{username}"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ username: z.string(), @@ -268,6 +285,7 @@ export type put_UpdateUser = typeof put_UpdateUser; export const put_UpdateUser = { method: z.literal("PUT"), path: z.literal("/user/{username}"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ username: z.string(), @@ -281,6 +299,7 @@ export type delete_DeleteUser = typeof delete_DeleteUser; export const delete_DeleteUser = { method: z.literal("DELETE"), path: z.literal("/user/{username}"), + requestFormat: z.literal("json"), parameters: z.object({ path: z.object({ username: z.string(), @@ -341,6 +360,8 @@ export type EndpointParameters = { export type MutationMethod = "post" | "put" | "patch" | "delete"; export type Method = "get" | "head" | MutationMethod; +type RequestFormat = "json" | "form-data" | "form-url" | "binary" | "text"; + export type DefaultEndpoint = { parameters?: EndpointParameters | undefined; response: unknown; @@ -350,6 +371,7 @@ export type Endpoint = { operationId: string; method: Method; path: string; + requestFormat: RequestFormat; parameters?: TConfig["parameters"]; meta: { alias: string;