小编not*_*der的帖子

有没有办法使用对象引用从 Postgres 生成 OpenAPI/Swagger 定义?

我有一个使用supabase/postgres(t) 的rest api,它生成它自己的OpenAPI/Swagger 定义。问题是这仅包含 id 字段,但不包含对其他表的实际引用。

因此,当使用 openapi-generator 生成客户端时,类仅包含外键,而不包含实际的对象引用。

有没有办法生成带有引用的 openapi 定义,以便我可以带有引用生成我的类?

{
  "swagger": "2.0",
  "info": {
    "description": "standard public schema",
    "title": "PostgREST API",
    "version": "9.0.0.20220211 (pre-release) (dcf7ade)"
  },
  "host": "localhost:3000",
  "basePath": "/",
  "schemes": [
    "http"
  ],
  "consumes": [
    "application/json",
    "application/vnd.pgrst.object+json",
    "text/csv"
  ],
  "produces": [
    "application/json",
    "application/vnd.pgrst.object+json",
    "text/csv"
  ],
  "paths": {
    "/": {
      "get": {
        "tags": [
          "Introspection"
        ],
        "summary": "OpenAPI description (this document)",
        "produces": [
          "application/openapi+json",
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/hallo": …
Run Code Online (Sandbox Code Playgroud)

postgresql swagger postgrest openapi-generator supabase

8
推荐指数
0
解决办法
1612
查看次数