@@ -42,8 +42,7 @@
|
||||
"@effect/platform-node": "^0.104.1",
|
||||
"openapi-to-effect": "^0.9.3",
|
||||
"tsx": "^4.21.0",
|
||||
"undici": "^7.19.0",
|
||||
"yaml": "^2.8.2"
|
||||
"undici": "^7.19.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@effect/platform": "^0.94.2",
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { FetchHttpClient, FileSystem, HttpClient, Path } from "@effect/platform"
|
||||
import { BunContext, BunRuntime } from "@effect/platform-bun"
|
||||
import { Effect, pipe } from "effect"
|
||||
import { Effect } from "effect"
|
||||
import { run } from "openapi-to-effect"
|
||||
import * as YAML from "yaml"
|
||||
|
||||
|
||||
const versions = ["v1.53"]
|
||||
@@ -13,8 +12,8 @@ const downloadDockerOpenApiSpec = Effect.fn("downloadDockerOpenApiSpec")(functio
|
||||
const fs = yield* FileSystem.FileSystem
|
||||
const outputFilePath = yield* fs.makeTempFileScoped()
|
||||
|
||||
const response = yield* client.get(`https://docs.docker.com/reference/api/engine/version/${ version }.yaml`)
|
||||
const json = pipe(yield* response.text, YAML.parse, JSON.stringify)
|
||||
const response = yield* client.get(`https://converter.swagger.io/api/convert?url=https://docs.docker.com/reference/api/engine/version/${ version }.yaml`)
|
||||
const json = JSON.stringify({ ...(yield* response.json) as object, openapi: "3.1.0" })
|
||||
yield* fs.writeFileString(outputFilePath, json)
|
||||
|
||||
return outputFilePath
|
||||
|
||||
Reference in New Issue
Block a user