@openapi-codegen/typescript
Advanced tools
Comparing version 7.0.1 to 8.0.0
@@ -5,4 +5,4 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const case_1 = require("case"); | ||
const typescript_1 = tslib_1.__importStar(require("typescript")); | ||
const camelizedPathParams_1 = require("./camelizedPathParams"); | ||
/** | ||
@@ -35,3 +35,3 @@ * Create the declaration of the fetcher function. | ||
typescript_1.factory.createObjectLiteralExpression([ | ||
typescript_1.factory.createPropertyAssignment(typescript_1.factory.createIdentifier("url"), typescript_1.factory.createStringLiteral(camelizedPathParams(url))), | ||
typescript_1.factory.createPropertyAssignment(typescript_1.factory.createIdentifier("url"), typescript_1.factory.createStringLiteral((0, camelizedPathParams_1.camelizedPathParams)(url))), | ||
typescript_1.factory.createPropertyAssignment(typescript_1.factory.createIdentifier("method"), typescript_1.factory.createStringLiteral(verb)), | ||
@@ -52,9 +52,2 @@ ...(variablesType.kind !== typescript_1.default.SyntaxKind.VoidKeyword | ||
exports.createOperationFetcherFnNodes = createOperationFetcherFnNodes; | ||
/** | ||
* Transform url params case to camel. | ||
* | ||
* @example | ||
* `pet/{pet_id}` -> `pet/{petId}` | ||
*/ | ||
const camelizedPathParams = (url) => url.replace(/\{[\w\d\-_.]*\}/g, (match) => `{${(0, case_1.camel)(match)}}`); | ||
//# sourceMappingURL=createOperationFetcherFnNodes.js.map |
@@ -7,2 +7,3 @@ "use strict"; | ||
const typescript_1 = tslib_1.__importStar(require("typescript")); | ||
const camelizedPathParams_1 = require("./camelizedPathParams"); | ||
/** | ||
@@ -45,3 +46,3 @@ * Create the declaration of the react-router queries. | ||
typescript_1.factory.createObjectLiteralExpression([ | ||
typescript_1.factory.createPropertyAssignment(typescript_1.factory.createIdentifier("path"), typescript_1.factory.createStringLiteral(url)), | ||
typescript_1.factory.createPropertyAssignment(typescript_1.factory.createIdentifier("path"), typescript_1.factory.createStringLiteral((0, camelizedPathParams_1.camelizedPathParams)(url))), | ||
typescript_1.factory.createPropertyAssignment(typescript_1.factory.createIdentifier("operationId"), typescript_1.factory.createStringLiteral(operation.operationId)), | ||
@@ -48,0 +49,0 @@ typescript_1.factory.createShorthandPropertyAssignment(typescript_1.factory.createIdentifier("variables"), undefined), |
@@ -19,2 +19,3 @@ "use strict"; | ||
const createNamespaceImport_1 = require("../core/createNamespaceImport"); | ||
const camelizedPathParams_1 = require("../core/camelizedPathParams"); | ||
const generateReactQueryComponents = async (context, config) => { | ||
@@ -88,3 +89,3 @@ const sourceFile = typescript_1.default.createSourceFile("index.ts", "", typescript_1.default.ScriptTarget.Latest); | ||
keyManagerItems.push(typescript_1.factory.createTypeLiteralNode([ | ||
typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier("path"), undefined, typescript_1.factory.createLiteralTypeNode(typescript_1.factory.createStringLiteral(route))), | ||
typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier("path"), undefined, typescript_1.factory.createLiteralTypeNode(typescript_1.factory.createStringLiteral((0, camelizedPathParams_1.camelizedPathParams)(route)))), | ||
typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier("operationId"), undefined, typescript_1.factory.createLiteralTypeNode(typescript_1.factory.createStringLiteral(operationId))), | ||
@@ -220,3 +221,3 @@ typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier("variables"), undefined, variablesType), | ||
typescript_1.factory.createObjectLiteralExpression([ | ||
typescript_1.factory.createPropertyAssignment("path", typescript_1.factory.createStringLiteral(url)), | ||
typescript_1.factory.createPropertyAssignment("path", typescript_1.factory.createStringLiteral((0, camelizedPathParams_1.camelizedPathParams)(url))), | ||
typescript_1.factory.createPropertyAssignment("operationId", typescript_1.factory.createStringLiteral(operationId)), | ||
@@ -223,0 +224,0 @@ typescript_1.factory.createShorthandPropertyAssignment(typescript_1.factory.createIdentifier("variables")), |
@@ -20,2 +20,3 @@ "use strict"; | ||
const createNamespaceImport_1 = require("../core/createNamespaceImport"); | ||
const camelizedPathParams_1 = require("../core/camelizedPathParams"); | ||
const generateReactQueryFunctions = async (context, config) => { | ||
@@ -89,3 +90,3 @@ const sourceFile = typescript_1.default.createSourceFile("index.ts", "", typescript_1.default.ScriptTarget.Latest); | ||
keyManagerItems.push(typescript_1.factory.createTypeLiteralNode([ | ||
typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier("path"), undefined, typescript_1.factory.createLiteralTypeNode(typescript_1.factory.createStringLiteral(route))), | ||
typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier("path"), undefined, typescript_1.factory.createLiteralTypeNode(typescript_1.factory.createStringLiteral((0, camelizedPathParams_1.camelizedPathParams)(route)))), | ||
typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier("operationId"), undefined, typescript_1.factory.createLiteralTypeNode(typescript_1.factory.createStringLiteral(operationId))), | ||
@@ -92,0 +93,0 @@ typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier("variables"), undefined, variablesType), |
{ | ||
"name": "@openapi-codegen/typescript", | ||
"version": "7.0.1", | ||
"version": "8.0.0", | ||
"description": "OpenAPI Codegen typescript generators", | ||
@@ -44,3 +44,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "138a808be699cc65383708744e72ffe26b85b9eb" | ||
"gitHead": "02402c0abfd24df2429890ba68308313bce78035" | ||
} |
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
239269
108
2920