jdomenechb/json-dereferencer

PHP类,用于将JSON引用替换为其目标

此包的官方仓库似乎已不存在,因此该包已被冻结。

v0.1 2019-03-15 13:29 UTC

This package is auto-updated.

Last update: 2023-01-26 21:58:40 UTC


README

本项目提供了一个接口和PHP类的实现,用于将JSON引用替换为其目标。

功能

目前,它只支持以根元素 # 开头的 $ref 路径。

示例

输入

  {
    "responses": {
      "200": {
        "description": "The response",
        "schema": {
          "$ref": "#/components/schemas/user" 
        }
      }
    },
    "components": {
      "schemas": {
        "user": {
          "type": "string",
          "format": "email"
        }
      }
    }
  }

输出

  {
    "responses": {
      "200": {
        "description": "The response",
        "schema": {
          "type": "string",
          "format": "email"
        }
      }
    },
    "components": {
      "schemas": {
        "user": {
          "type": "string",
          "format": "email"
        }
      }
    }
  }