Skip to content

Latest commit

 

History

History
104 lines (94 loc) · 1.56 KB

namespace.md

File metadata and controls

104 lines (94 loc) · 1.56 KB

命名空间

1.1简单

export namespace Param {
  export interface A {
    name: string;
  }
}

结果:

{
  "additionalProperties": false,
  "properties": {
    "name": {
      "type": "string",
    },
  },
  "required": [
    "name",
  ],
  "type": "object",
}

1.2复杂

import { Param, Param_1 } from './common';
import * as Type from './common';

export interface Namespace_4 {
  other1: Param.C.D.E.F.GetBaseDetailResponse;
  other2: Param_1.A;
  other3: Param_1.Label;
}

结果:

{
  "additionalProperties": false,
  "definitions": {
    "Param.C.D.E.F.GetBaseDetailResponse": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
        },
      },
      "required": [
        "id",
      ],
      "type": "object",
    },
    "Param_1.A": {
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
        },
      },
      "required": [
        "name",
      ],
      "type": "object",
    },
    "Param_1.Label": {
      "enum": [
        1,
        2,
        3,
      ],
      "type": "number",
    },
  },
  "properties": {
    "other1": {
      "$ref": "#/definitions/Param.C.D.E.F.GetBaseDetailResponse",
    },
    "other2": {
      "$ref": "#/definitions/Param_1.A",
    },
    "other3": {
      "$ref": "#/definitions/Param_1.Label",
    },
  },
  "required": [
    "other1",
    "other2",
    "other3",
  ],
  "type": "object",
}