@api-platform/api-doc-parser
Advanced tools
Comparing version 0.15.2 to 0.15.3
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var inflection_1 = require("inflection"); | ||
var tslib_1 = require("tslib"); | ||
var inflection_1 = tslib_1.__importDefault(require("inflection")); | ||
var getType = function (openApiType, format) { | ||
@@ -11,3 +12,3 @@ if (format) { | ||
default: | ||
return (0, inflection_1.camelize)(format.replace("-", "_"), true); | ||
return inflection_1.default.camelize(format.replace("-", "_"), true); | ||
} | ||
@@ -14,0 +15,0 @@ } |
@@ -7,3 +7,3 @@ "use strict"; | ||
var lodash_get_1 = tslib_1.__importDefault(require("lodash.get")); | ||
var inflection_1 = require("inflection"); | ||
var inflection_1 = tslib_1.__importDefault(require("inflection")); | ||
var Field_1 = require("../Field"); | ||
@@ -123,3 +123,3 @@ var Operation_1 = require("../Operation"); | ||
var splittedPath = (0, exports.removeTrailingSlash)(path).split("/"); | ||
var name = (0, inflection_1.pluralize)(splittedPath[splittedPath.length - 2]); | ||
var name = inflection_1.default.pluralize(splittedPath[splittedPath.length - 2]); | ||
var url = "".concat((0, exports.removeTrailingSlash)(serverUrl), "/").concat(name); | ||
@@ -130,3 +130,3 @@ var pathItem = document.paths[path]; | ||
} | ||
var title = (0, inflection_1.classify)(splittedPath[splittedPath.length - 2]); | ||
var title = inflection_1.default.classify(splittedPath[splittedPath.length - 2]); | ||
var showOperation = pathItem.get; | ||
@@ -192,4 +192,4 @@ var editOperation = pathItem.put || pathItem.patch; | ||
(_a = resource.fields) === null || _a === void 0 ? void 0 : _a.forEach(function (field) { | ||
var name = (0, inflection_1.camelize)(field.name).replace(/Ids?$/, ""); | ||
var guessedResource = resources.find(function (res) { return res.title === (0, inflection_1.classify)(name); }); | ||
var name = inflection_1.default.camelize(field.name).replace(/Ids?$/, ""); | ||
var guessedResource = resources.find(function (res) { return res.title === inflection_1.default.classify(name); }); | ||
if (!guessedResource) { | ||
@@ -196,0 +196,0 @@ return; |
@@ -6,3 +6,3 @@ "use strict"; | ||
var lodash_get_1 = tslib_1.__importDefault(require("lodash.get")); | ||
var inflection_1 = require("inflection"); | ||
var inflection_1 = tslib_1.__importDefault(require("inflection")); | ||
var Field_1 = require("../Field"); | ||
@@ -23,5 +23,5 @@ var Resource_1 = require("../Resource"); | ||
var splittedPath = (0, exports.removeTrailingSlash)(path).split("/"); | ||
var name = (0, inflection_1.pluralize)(splittedPath[splittedPath.length - 2]); | ||
var name = inflection_1.default.pluralize(splittedPath[splittedPath.length - 2]); | ||
var url = "".concat((0, exports.removeTrailingSlash)(entrypointUrl), "/").concat(name); | ||
var title = (0, inflection_1.classify)(splittedPath[splittedPath.length - 2]); | ||
var title = inflection_1.default.classify(splittedPath[splittedPath.length - 2]); | ||
if (!response.definitions) { | ||
@@ -28,0 +28,0 @@ throw new Error(); // @TODO |
@@ -1,2 +0,2 @@ | ||
import { camelize } from "inflection"; | ||
import inflection from "inflection"; | ||
const getType = (openApiType, format) => { | ||
@@ -9,3 +9,3 @@ if (format) { | ||
default: | ||
return camelize(format.replace("-", "_"), true); | ||
return inflection.camelize(format.replace("-", "_"), true); | ||
} | ||
@@ -12,0 +12,0 @@ } |
import { __awaiter } from "tslib"; | ||
import { parse as dereference } from "jsonref"; | ||
import get from "lodash.get"; | ||
import { camelize, classify, pluralize } from "inflection"; | ||
import inflection from "inflection"; | ||
import { Field } from "../Field"; | ||
@@ -111,3 +111,3 @@ import { Operation } from "../Operation"; | ||
const splittedPath = removeTrailingSlash(path).split("/"); | ||
const name = pluralize(splittedPath[splittedPath.length - 2]); | ||
const name = inflection.pluralize(splittedPath[splittedPath.length - 2]); | ||
const url = `${removeTrailingSlash(serverUrl)}/${name}`; | ||
@@ -118,3 +118,3 @@ const pathItem = document.paths[path]; | ||
} | ||
const title = classify(splittedPath[splittedPath.length - 2]); | ||
const title = inflection.classify(splittedPath[splittedPath.length - 2]); | ||
const showOperation = pathItem.get; | ||
@@ -185,4 +185,4 @@ const editOperation = pathItem.put || pathItem.patch; | ||
(_a = resource.fields) === null || _a === void 0 ? void 0 : _a.forEach((field) => { | ||
const name = camelize(field.name).replace(/Ids?$/, ""); | ||
const guessedResource = resources.find((res) => res.title === classify(name)); | ||
const name = inflection.camelize(field.name).replace(/Ids?$/, ""); | ||
const guessedResource = resources.find((res) => res.title === inflection.classify(name)); | ||
if (!guessedResource) { | ||
@@ -189,0 +189,0 @@ return; |
import get from "lodash.get"; | ||
import { classify, pluralize } from "inflection"; | ||
import inflection from "inflection"; | ||
import { Field } from "../Field"; | ||
@@ -17,5 +17,5 @@ import { Resource } from "../Resource"; | ||
const splittedPath = removeTrailingSlash(path).split("/"); | ||
const name = pluralize(splittedPath[splittedPath.length - 2]); | ||
const name = inflection.pluralize(splittedPath[splittedPath.length - 2]); | ||
const url = `${removeTrailingSlash(entrypointUrl)}/${name}`; | ||
const title = classify(splittedPath[splittedPath.length - 2]); | ||
const title = inflection.classify(splittedPath[splittedPath.length - 2]); | ||
if (!response.definitions) { | ||
@@ -22,0 +22,0 @@ throw new Error(); // @TODO |
{ | ||
"name": "@api-platform/api-doc-parser", | ||
"version": "0.15.2", | ||
"version": "0.15.3", | ||
"description": "Transform an API documentation (Hydra, OpenAPI, GraphQL) in an intermediate representation that can be used for various tasks such as creating smart API clients, scaffolding code or building administration interfaces.", | ||
@@ -19,3 +19,3 @@ "files": [ | ||
"@types/inflection": "^1.13.0", | ||
"@types/jest": "^27.0.0", | ||
"@types/jest": "^29.0.0", | ||
"@types/jsonld": "^1.5.0", | ||
@@ -30,5 +30,5 @@ "@types/lodash.get": "^4.4.0", | ||
"eslint-watch": "^8.0.0", | ||
"jest": "^28.0.0", | ||
"jest": "^29.0.0", | ||
"jest-fetch-mock": "^3.0.0", | ||
"openapi-types": "^11.0.0", | ||
"openapi-types": "^12.0.0", | ||
"prettier": "^2.2.0", | ||
@@ -41,4 +41,4 @@ "ts-jest": "^28.0.0", | ||
"inflection": "^1.13.0", | ||
"jsonld": "^5.2.0", | ||
"jsonref": "^7.0.0", | ||
"jsonld": "^8.1.0", | ||
"jsonref": "^8.0.0", | ||
"lodash.get": "^4.4.0", | ||
@@ -48,3 +48,3 @@ "tslib": "^2.0.0" | ||
"scripts": { | ||
"test": "jest", | ||
"test": "NODE_OPTIONS=--experimental-vm-modules jest", | ||
"lint": "esw --color src --ext .ts", | ||
@@ -66,4 +66,12 @@ "fix": "yarn lint --fix", | ||
], | ||
"extensionsToTreatAsEsm": [ | ||
".ts" | ||
], | ||
"transform": { | ||
"^.+\\.ts$": "ts-jest" | ||
}, | ||
"globals": { | ||
"ts-jest": { | ||
"useESM": true | ||
} | ||
} | ||
@@ -70,0 +78,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
import { camelize } from "inflection"; | ||
import inflection from "inflection"; | ||
import { FieldType } from "../Field"; | ||
@@ -11,3 +11,3 @@ | ||
default: | ||
return camelize(format.replace("-", "_"), true); | ||
return inflection.camelize(format.replace("-", "_"), true); | ||
} | ||
@@ -14,0 +14,0 @@ } |
import { OpenAPIV3 } from "openapi-types"; | ||
import { parse as dereference } from "jsonref"; | ||
import get from "lodash.get"; | ||
import { camelize, classify, pluralize } from "inflection"; | ||
import inflection from "inflection"; | ||
import { Field } from "../Field"; | ||
@@ -147,3 +147,3 @@ import { Operation, OperationType } from "../Operation"; | ||
const splittedPath = removeTrailingSlash(path).split("/"); | ||
const name = pluralize(splittedPath[splittedPath.length - 2]); | ||
const name = inflection.pluralize(splittedPath[splittedPath.length - 2]); | ||
const url = `${removeTrailingSlash(serverUrl)}/${name}`; | ||
@@ -155,3 +155,3 @@ const pathItem = document.paths[path]; | ||
const title = classify(splittedPath[splittedPath.length - 2]); | ||
const title = inflection.classify(splittedPath[splittedPath.length - 2]); | ||
@@ -242,6 +242,6 @@ const showOperation = pathItem.get; | ||
resource.fields?.forEach((field) => { | ||
const name = camelize(field.name).replace(/Ids?$/, ""); | ||
const name = inflection.camelize(field.name).replace(/Ids?$/, ""); | ||
const guessedResource = resources.find( | ||
(res) => res.title === classify(name) | ||
(res) => res.title === inflection.classify(name) | ||
); | ||
@@ -248,0 +248,0 @@ if (!guessedResource) { |
import { OpenAPIV2 } from "openapi-types"; | ||
import get from "lodash.get"; | ||
import { classify, pluralize } from "inflection"; | ||
import inflection from "inflection"; | ||
import { Field } from "../Field"; | ||
@@ -24,6 +24,6 @@ import { Resource } from "../Resource"; | ||
const splittedPath = removeTrailingSlash(path).split("/"); | ||
const name = pluralize(splittedPath[splittedPath.length - 2]); | ||
const name = inflection.pluralize(splittedPath[splittedPath.length - 2]); | ||
const url = `${removeTrailingSlash(entrypointUrl)}/${name}`; | ||
const title = classify(splittedPath[splittedPath.length - 2]); | ||
const title = inflection.classify(splittedPath[splittedPath.length - 2]); | ||
@@ -30,0 +30,0 @@ if (!response.definitions) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
383331
8328
+ Added@digitalbazaar/http-client@3.4.1(transitive)
+ Added@fastify/busboy@2.1.1(transitive)
+ Addeddata-uri-to-buffer@4.0.1(transitive)
+ Addedfetch-blob@3.2.0(transitive)
+ Addedformdata-polyfill@4.0.10(transitive)
+ Addedjsonld@8.3.2(transitive)
+ Addedjsonref@8.0.8(transitive)
+ Addedky@0.33.3(transitive)
+ Addedky-universal@0.11.0(transitive)
+ Addednode-domexception@1.0.0(transitive)
+ Addednode-fetch@3.3.2(transitive)
+ Addedundici@5.28.4(transitive)
+ Addedweb-streams-polyfill@3.3.3(transitive)
- Removed@digitalbazaar/http-client@1.2.0(transitive)
- Removeddata-uri-to-buffer@3.0.1(transitive)
- Removedesm@3.2.25(transitive)
- Removedfetch-blob@2.1.2(transitive)
- Removedjsonld@5.2.0(transitive)
- Removedjsonref@7.0.0(transitive)
- Removedky@0.25.1(transitive)
- Removedky-universal@0.8.2(transitive)
- Removednode-fetch@3.0.0-beta.9(transitive)
Updatedjsonld@^8.1.0
Updatedjsonref@^8.0.0