I am basically a one-person developer at my workplace, there may be some my-way coding etc. Any advice/recommendation is super welcome even during the talk :]
などを定義可能 • APIの設計、ドキュメント生成、コード生成、テストの自動化などが容易になる original answer: https://chatgpt.com/share/67ac5f40-5e10-8007-9093-12a278a33f63 • Standard format for describing RESTful API specifications • API endpoints, request/response formats, authentication methods, etc. can be defined in JSON or YAML format • Facilitates API design, document generation, code generation, test automation, etc.
github.com/openapi-ts/openapi-typescript • スキーマファイルをもとにTypeScriptの型・fetchクライアントの生成が可能なライ ブラリ • Library that can generate TypeScript type and fetch clients based on schema files OpenAPI TS OpenAPI fetch Schemas into types スキーマファイルを型に変換 ✓ Gen fetch client from schemas fetchクライアントをスキーマファイルから生成 ✓
not written well, it is necessary to generate a client for each fetch. • C#のシングルトンサービス(一つのインスタンスを使いまわす)パター ンのようにクライアントを使いまわしたかった • I wanted to use the client like the singleton service (use one instance of a service) pattern in C#
createClient from "openapi-fetch"; import type { paths } from "./my-openapi-3-schema"; const client = createClient<paths>({ baseUrl: "https://myapi.dev/v1/" }); const {data} = await client.GET("/blogposts/{post_id}", { params: { path: { post_id: "123" }, … https://github.com/openapi-ts/openapi-typescript/tree/main/packages/openapi-fetch ⚠ If we follow this instruction, we have to define the client every time…
about • TSで動かせ、かつスキーマファイルから自動生成可能なWeb APIサー バーが見つからない • I couldn’t find any Web API server frameworks that can be automatically generated from the schema files and can run on TS ◦ Express + JSのサーバーのみopenapi-generatorで生成可能? ◦ Only Express + JS server can be generated with openapi-generator? ◦ ほかに便利なライブラリってありますか? ◦ Any other useful libraries?