@spec2ts/openapi 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import * as ts from "typescript";
2
- import type { SchemaObject, ReferenceObject, PathItemObject, OperationObject, ParameterObject, ContentObject } from "openapi3-ts/oas30";
2
+ import type { SchemaObject, ReferenceObject, PathItemObject, OperationObject, ParameterObject, ContentObject } from "openapi3-ts/oas31";
3
3
  import { ParserContext, ParsedReference } from "@spec2ts/jsonschema/lib/core-parser";
4
4
  import type { ParseOpenApiOptions } from "./openapi-parser";
5
5
  export interface ParseOpenApiResult {
@@ -1,4 +1,4 @@
1
- import type { OpenAPIObject } from "openapi3-ts/oas30";
1
+ import type { OpenAPIObject } from "openapi3-ts/oas31";
2
2
  import { ParserOptions } from "@spec2ts/jsonschema/lib/core-parser";
3
3
  import { ParseOpenApiResult } from "./core-parser";
4
4
  export { ParseOpenApiResult };
@@ -6,7 +6,7 @@ const json_schema_ref_parser_1 = require("@apidevtools/json-schema-ref-parser");
6
6
  const core_parser_1 = require("@spec2ts/jsonschema/lib/core-parser");
7
7
  const core_parser_2 = require("./core-parser");
8
8
  async function parseOpenApiFile(file, options = {}) {
9
- const schema = await (0, json_schema_ref_parser_1.parse)(file);
9
+ const schema = await json_schema_ref_parser_1.default.parse(file);
10
10
  return parseOpenApi(schema, {
11
11
  cwd: path.resolve(path.dirname(file)) + "/",
12
12
  ...options
@@ -14,12 +14,13 @@ async function parseOpenApiFile(file, options = {}) {
14
14
  }
15
15
  exports.parseOpenApiFile = parseOpenApiFile;
16
16
  async function parseOpenApi(spec, options = {}) {
17
+ var _a;
17
18
  if (!options.parseReference) {
18
19
  options.parseReference = core_parser_2.parseReference;
19
20
  }
20
21
  const context = await (0, core_parser_1.createContext)(spec, options);
21
22
  const result = (0, core_parser_2.createOpenApiResult)();
22
- Object.entries(spec.paths).forEach(([path, item]) => {
23
+ Object.entries((_a = spec.paths) !== null && _a !== void 0 ? _a : {}).forEach(([path, item]) => {
23
24
  (0, core_parser_2.parsePathItem)(path, item, context, result);
24
25
  });
25
26
  (0, core_parser_2.addToOpenApiResult)(result, "models", context.aliases);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spec2ts/openapi",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Utility to convert OpenAPI v3 specifications to Typescript using TypeScript native compiler",
5
5
  "author": "Touchify <dev@touchify.co>",
6
6
  "license": "MIT",
@@ -39,8 +39,8 @@
39
39
  "prepublishOnly": "npm test && npm run build"
40
40
  },
41
41
  "dependencies": {
42
- "@spec2ts/core": "^3.0.0",
43
- "@spec2ts/jsonschema": "^3.0.0",
42
+ "@spec2ts/core": "^3.0.1",
43
+ "@spec2ts/jsonschema": "^3.0.2",
44
44
  "openapi3-ts": "^4.1.2",
45
45
  "yargs": "^17.7.2"
46
46
  },
@@ -65,5 +65,5 @@
65
65
  "spec2ts",
66
66
  "share"
67
67
  ],
68
- "gitHead": "4a0c2fc9068a9ca8cc0d8924c4b1998528b48052"
68
+ "gitHead": "b81a6210adc1d1a0c978187d253ff0c16e42c6d4"
69
69
  }