@kubb/swagger
Advanced tools
Comparing version 0.0.0-canary-20240304192744 to 0.0.0-canary-20240304201505
@@ -1,5 +0,3 @@ | ||
import swagger2openapi from 'swagger2openapi'; | ||
import { isRef } from 'oas/types'; | ||
// src/utils/convertSwagger2ToOpenApi.ts | ||
import swagger2openapi from "swagger2openapi"; | ||
function convertSwagger2ToOpenApi(document) { | ||
@@ -22,2 +20,5 @@ const options = { anchors: true }; | ||
} | ||
// src/utils/isReference.ts | ||
import { isRef } from "oas/types"; | ||
function isReference(obj) { | ||
@@ -62,4 +63,8 @@ return !!obj && isRef(obj); | ||
export { convertSwagger2ToOpenApi, getSchemas, isOpenApiV3Document, isReference }; | ||
//# sourceMappingURL=out.js.map | ||
export { | ||
convertSwagger2ToOpenApi, | ||
isOpenApiV3Document, | ||
isReference, | ||
getSchemas | ||
}; | ||
//# sourceMappingURL=chunk-GN3UNKNN.js.map |
@@ -24,4 +24,8 @@ var __accessCheck = (obj, member, msg) => { | ||
export { __privateAdd, __privateGet, __privateMethod, __privateSet }; | ||
//# sourceMappingURL=out.js.map | ||
export { | ||
__privateGet, | ||
__privateAdd, | ||
__privateSet, | ||
__privateMethod | ||
}; | ||
//# sourceMappingURL=chunk-Z4BLTVTB.js.map |
@@ -21,2 +21,3 @@ import Oas from 'oas'; | ||
type UseOperationFileProps = { | ||
extName?: KubbFile.Extname; | ||
pluginKey?: Plugin['key']; | ||
@@ -23,0 +24,0 @@ }; |
@@ -1,4 +0,5 @@ | ||
import './chunk-Z4BLTVTB.js'; | ||
import { useApp, usePlugin, usePluginManager, useFile } from '@kubb/react'; | ||
import "./chunk-Z4BLTVTB.js"; | ||
// src/hooks/useOas.ts | ||
import { useApp } from "@kubb/react"; | ||
function useOas() { | ||
@@ -8,4 +9,7 @@ const { meta } = useApp(); | ||
} | ||
// src/hooks/useOperation.ts | ||
import { useApp as useApp2, useFile, usePlugin, usePluginManager } from "@kubb/react"; | ||
function useOperation() { | ||
const { meta } = useApp(); | ||
const { meta } = useApp2(); | ||
return meta.operation; | ||
@@ -26,3 +30,4 @@ } | ||
const name = useOperationName({ type: "file", pluginKey }); | ||
const file = useFile({ name, pluginKey, options: { type: "file", pluginKey, tag } }); | ||
const extName = props.extName || ".ts"; | ||
const file = useFile({ name, extName, pluginKey, options: { type: "file", pluginKey, tag } }); | ||
return { | ||
@@ -38,9 +43,16 @@ ...file, | ||
} | ||
// src/hooks/useSchemas.ts | ||
import { useApp as useApp3 } from "@kubb/react"; | ||
function useSchemas() { | ||
const { meta } = useApp(); | ||
const { meta } = useApp3(); | ||
return meta.schemas; | ||
} | ||
export { useOas, useOperation, useOperationFile, useOperationName, useSchemas }; | ||
//# sourceMappingURL=out.js.map | ||
export { | ||
useOas, | ||
useOperation, | ||
useOperationFile, | ||
useOperationName, | ||
useSchemas | ||
}; | ||
//# sourceMappingURL=hooks.js.map |
@@ -1,12 +0,13 @@ | ||
import { getSchemas, isReference, isOpenApiV3Document, convertSwagger2ToOpenApi } from './chunk-GN3UNKNN.js'; | ||
import { __privateAdd, __privateSet, __privateGet, __privateMethod } from './chunk-Z4BLTVTB.js'; | ||
import path, { resolve } from 'path'; | ||
import { URLPath } from '@kubb/core/utils'; | ||
import SwaggerParser from '@apidevtools/swagger-parser'; | ||
import yaml from 'js-yaml'; | ||
import Oas from 'oas'; | ||
import OASNormalize from 'oas-normalize'; | ||
import { createPlugin, Generator } from '@kubb/core'; | ||
import transformers, { camelCase } from '@kubb/core/transformers'; | ||
import { findSchemaDefinition } from 'oas/utils'; | ||
import { | ||
convertSwagger2ToOpenApi, | ||
getSchemas, | ||
isOpenApiV3Document, | ||
isReference | ||
} from "./chunk-GN3UNKNN.js"; | ||
import { | ||
__privateAdd, | ||
__privateGet, | ||
__privateMethod, | ||
__privateSet | ||
} from "./chunk-Z4BLTVTB.js"; | ||
@@ -51,2 +52,10 @@ // src/OasBuilder.ts | ||
_context = new WeakMap(); | ||
// src/OasManager.ts | ||
import { resolve } from "path"; | ||
import { URLPath } from "@kubb/core/utils"; | ||
import SwaggerParser from "@apidevtools/swagger-parser"; | ||
import yaml from "js-yaml"; | ||
import Oas from "oas"; | ||
import OASNormalize from "oas-normalize"; | ||
var _options2, _oas; | ||
@@ -100,2 +109,7 @@ var _OasManager = class _OasManager { | ||
var OasManager = _OasManager; | ||
// src/OperationGenerator.ts | ||
import { Generator } from "@kubb/core"; | ||
import transformers from "@kubb/core/transformers"; | ||
import { findSchemaDefinition } from "oas/utils"; | ||
var _getOptions, getOptions_fn, _getParametersSchema, getParametersSchema_fn, _getResponseSchema, getResponseSchema_fn, _getRequestSchema, getRequestSchema_fn, _methods, methods_get; | ||
@@ -391,2 +405,7 @@ var OperationGenerator = class extends Generator { | ||
}; | ||
// src/plugin.ts | ||
import path from "path"; | ||
import { createPlugin } from "@kubb/core"; | ||
import { camelCase } from "@kubb/core/transformers"; | ||
var pluginName = "swagger"; | ||
@@ -477,5 +496,11 @@ var pluginKey = [pluginName]; | ||
}); | ||
export { OasBuilder, OasManager, OperationGenerator, definePlugin as default, definePlugin, pluginKey, pluginName }; | ||
//# sourceMappingURL=out.js.map | ||
export { | ||
OasBuilder, | ||
OasManager, | ||
OperationGenerator, | ||
definePlugin as default, | ||
definePlugin, | ||
pluginKey, | ||
pluginName | ||
}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,3 +0,1 @@ | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=oas.js.map |
@@ -1,11 +0,12 @@ | ||
export { convertSwagger2ToOpenApi, getSchemas, isOpenApiV3Document, isReference } from './chunk-GN3UNKNN.js'; | ||
import './chunk-Z4BLTVTB.js'; | ||
import transformers from '@kubb/core/transformers'; | ||
import { URLPath, renderTemplate, FunctionParams } from '@kubb/core/utils'; | ||
import { resolve } from 'path'; | ||
import { FileManager } from '@kubb/core'; | ||
import { getRelativePath } from '@kubb/core/fs'; | ||
import { LogLevel } from '@kubb/core/logger'; | ||
import { isSchema } from 'oas/types'; | ||
import { | ||
convertSwagger2ToOpenApi, | ||
getSchemas, | ||
isOpenApiV3Document, | ||
isReference | ||
} from "./chunk-GN3UNKNN.js"; | ||
import "./chunk-Z4BLTVTB.js"; | ||
// src/utils/getComments.ts | ||
import transformers from "@kubb/core/transformers"; | ||
import { URLPath } from "@kubb/core/utils"; | ||
function getComments(operation) { | ||
@@ -19,2 +20,10 @@ return [ | ||
} | ||
// src/utils/getGroupedByTagFiles.ts | ||
import { resolve } from "path"; | ||
import { FileManager } from "@kubb/core"; | ||
import { getRelativePath } from "@kubb/core/fs"; | ||
import { LogLevel } from "@kubb/core/logger"; | ||
import transformers2 from "@kubb/core/transformers"; | ||
import { renderTemplate } from "@kubb/core/utils"; | ||
async function getGroupedByTagFiles({ | ||
@@ -44,3 +53,3 @@ logger, | ||
} | ||
const tag = file.meta?.tag && transformers.camelCase(file.meta.tag); | ||
const tag = file.meta?.tag && transformers2.camelCase(file.meta.tag); | ||
const tagPath = getRelativePath(resolve(root, output.path), resolve(root, renderTemplate(template, { tag }))); | ||
@@ -62,2 +71,6 @@ const tagName = renderTemplate(exportAs, { tag }); | ||
// src/utils/getParams.ts | ||
import transformers3 from "@kubb/core/transformers"; | ||
import { FunctionParams } from "@kubb/core/utils"; | ||
// src/utils/isParameterObject.ts | ||
@@ -74,3 +87,3 @@ function isParameterObject(obj) { | ||
if (asObject) { | ||
const nameText = getASTParams(operationSchema).map((item) => item.name ? transformers.camelCase(item.name) : item.name).join(", "); | ||
const nameText = getASTParams(operationSchema).map((item) => item.name ? transformers3.camelCase(item.name) : item.name).join(", "); | ||
return [ | ||
@@ -116,2 +129,5 @@ { | ||
} | ||
// src/utils/isJSONSchema.ts | ||
import { isSchema } from "oas/types"; | ||
function isJSONSchema(obj) { | ||
@@ -139,5 +155,18 @@ return !!obj && isSchema(obj); | ||
} | ||
export { getASTParams, getComments, getGroupedByTagFiles, getParams, getSchemaFactory, isJSONSchema, isOpenApiV3_1Document, isParameterObject, isRequired, refsSorter }; | ||
//# sourceMappingURL=out.js.map | ||
export { | ||
convertSwagger2ToOpenApi, | ||
getASTParams, | ||
getComments, | ||
getGroupedByTagFiles, | ||
getParams, | ||
getSchemaFactory, | ||
getSchemas, | ||
isJSONSchema, | ||
isOpenApiV3Document, | ||
isOpenApiV3_1Document, | ||
isParameterObject, | ||
isReference, | ||
isRequired, | ||
refsSorter | ||
}; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@kubb/swagger", | ||
"version": "0.0.0-canary-20240304192744", | ||
"version": "0.0.0-canary-20240304201505", | ||
"description": "Generator swagger", | ||
@@ -75,4 +75,4 @@ "keywords": [ | ||
"swagger2openapi": "^7.0.8", | ||
"@kubb/core": "0.0.0-canary-20240304192744", | ||
"@kubb/react": "0.0.0-canary-20240304192744" | ||
"@kubb/core": "0.0.0-canary-20240304201505", | ||
"@kubb/react": "0.0.0-canary-20240304201505" | ||
}, | ||
@@ -91,3 +91,3 @@ "devDependencies": { | ||
"peerDependencies": { | ||
"@kubb/react": "0.0.0-canary-20240304192744" | ||
"@kubb/react": "0.0.0-canary-20240304201505" | ||
}, | ||
@@ -94,0 +94,0 @@ "packageManager": "pnpm@8.3.0", |
@@ -35,2 +35,3 @@ import { useApp, useFile, usePlugin, usePluginManager } from '@kubb/react' | ||
type UseOperationFileProps = { | ||
extName?: KubbFile.Extname | ||
pluginKey?: Plugin['key'] | ||
@@ -47,3 +48,4 @@ } | ||
const name = useOperationName({ type: 'file', pluginKey }) | ||
const file = useFile<ResolvePathOptions>({ name, pluginKey, options: { type: 'file', pluginKey, tag } }) | ||
const extName = props.extName || '.ts' | ||
const file = useFile<ResolvePathOptions>({ name, extName, pluginKey, options: { type: 'file', pluginKey, tag } }) | ||
@@ -50,0 +52,0 @@ return { |
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
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
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
237161
2897
+ Added@kubb/core@0.0.0-canary-20240304201505(transitive)
+ Added@kubb/parser@0.0.0-canary-20240304201505(transitive)
+ Added@kubb/react@0.0.0-canary-20240304201505(transitive)
+ Added@kubb/types@0.0.0-canary-20240304201505(transitive)
- Removed@kubb/core@0.0.0-canary-20240304192744(transitive)
- Removed@kubb/parser@0.0.0-canary-20240304192744(transitive)
- Removed@kubb/react@0.0.0-canary-20240304192744(transitive)
- Removed@kubb/types@0.0.0-canary-20240304192744(transitive)