New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@trapi/swagger

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trapi/swagger - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

12

dist/config/utils/validator.js

@@ -11,3 +11,3 @@ "use strict";

const yup_1 = require("yup");
const utils_1 = require("@trapi/utils");
const metadata_utils_1 = require("@trapi/metadata-utils");
const specification_1 = require("../../specification");

@@ -21,3 +21,3 @@ let validatorInstance;

if (Object.prototype.toString.call(map) === '[object Object]') {
const directory = (0, utils_1.mapYupRuleForDictionary)(map, (0, yup_1.object)({
const directory = (0, metadata_utils_1.mapYupRuleForDictionary)(map, (0, yup_1.object)({
type: (0, yup_1.mixed)().oneOf(['apiKey', 'oauth2', 'http']),

@@ -76,6 +76,6 @@ description: (0, yup_1.string)().optional().default(undefined),

function extendSwaggerConfig(workingDir, conf) {
conf.version = conf.version || (0, utils_1.getPackageJsonStringValue)(workingDir, 'version', '0.0.1');
conf.name = conf.name || (0, utils_1.getPackageJsonStringValue)(workingDir, 'name');
conf.description = conf.description || (0, utils_1.getPackageJsonStringValue)(workingDir, 'description');
conf.license = conf.license || (0, utils_1.getPackageJsonStringValue)(workingDir, 'license', 'MIT');
conf.version = conf.version || (0, metadata_utils_1.getPackageJsonStringValue)(workingDir, 'version', '0.0.1');
conf.name = conf.name || (0, metadata_utils_1.getPackageJsonStringValue)(workingDir, 'name');
conf.description = conf.description || (0, metadata_utils_1.getPackageJsonStringValue)(workingDir, 'description');
conf.license = conf.license || (0, metadata_utils_1.getPackageJsonStringValue)(workingDir, 'license', 'MIT');
conf.outputFormat = specification_1.Specification.Specification[conf.outputFormat] || specification_1.Specification.Specification.VERSION_2;

@@ -82,0 +82,0 @@ return conf;

@@ -29,3 +29,3 @@ "use strict";

exports.AbstractSpecGenerator = void 0;
const utils_1 = require("@trapi/utils");
const metadata_utils_1 = require("@trapi/metadata-utils");
const metadata_1 = require("@trapi/metadata");

@@ -149,3 +149,3 @@ const path = __importStar(require("path"));

const swaggerType = this.getSwaggerType(type.members[typeIndex]);
const isRef = (0, utils_1.hasOwnProperty)(swaggerType, '$ref') && !!swaggerType.$ref;
const isRef = (0, metadata_utils_1.hasOwnProperty)(swaggerType, '$ref') && !!swaggerType.$ref;
if (isRef) {

@@ -152,0 +152,0 @@ return { type: 'object' };

@@ -13,3 +13,3 @@ "use strict";

const url_1 = require("url");
const utils_1 = require("@trapi/utils");
const metadata_utils_1 = require("@trapi/metadata-utils");
const metadata_1 = require("@trapi/metadata");

@@ -200,3 +200,3 @@ const abstract_1 = require("../abstract");

let fullPath = path_1.posix.join('/', (controller.path ? controller.path : ''), method.path);
fullPath = (0, utils_1.normalizePathParameters)(fullPath);
fullPath = (0, metadata_utils_1.normalizePathParameters)(fullPath);
paths[fullPath] = paths[fullPath] || {};

@@ -268,3 +268,3 @@ method.consumes = (0, lodash_1.union)(controller.consumes, method.consumes);

const parameterType = this.getSwaggerType(parameter.type);
if (((0, utils_1.hasOwnProperty)(parameterType, '$ref') && parameterType.$ref) || parameter.in === 'body') {
if (((0, metadata_utils_1.hasOwnProperty)(parameterType, '$ref') && parameterType.$ref) || parameter.in === 'body') {
swaggerParameter.schema = parameterType;

@@ -361,3 +361,3 @@ }

const swaggerType = this.getSwaggerType(property.type);
if (!(0, utils_1.hasOwnProperty)(swaggerType, '$ref') || !swaggerType.$ref) {
if (!(0, metadata_utils_1.hasOwnProperty)(swaggerType, '$ref') || !swaggerType.$ref) {
swaggerType.description = property.description;

@@ -364,0 +364,0 @@ }

@@ -11,5 +11,5 @@ "use strict";

const url_1 = require("url");
const utils_1 = require("@trapi/utils");
const metadata_utils_1 = require("@trapi/metadata-utils");
const metadata_1 = require("@trapi/metadata");
const utils_2 = require("../utils");
const utils_1 = require("../utils");
const abstract_1 = require("../abstract");

@@ -78,4 +78,4 @@ class Version3SpecGenerator extends abstract_1.AbstractSpecGenerator {

.forEach(method => {
let path = (0, utils_2.removeFinalCharacter)((0, utils_2.removeRepeatingCharacter)(`/${controller.path}/${method.path}`, '/'), '/');
path = (0, utils_1.normalizePathParameters)(path);
let path = (0, utils_1.removeFinalCharacter)((0, utils_1.removeRepeatingCharacter)(`/${controller.path}/${method.path}`, '/'), '/');
path = (0, metadata_utils_1.normalizePathParameters)(path);
paths[path] = paths[path] || {};

@@ -229,3 +229,3 @@ this.buildMethod(controller.name, method, paths[path]);

}
if ((0, utils_1.hasOwnProperty)(parameterType, '$ref') &&
if ((0, metadata_utils_1.hasOwnProperty)(parameterType, '$ref') &&
parameterType.$ref) {

@@ -232,0 +232,0 @@ parameter.schema = parameterType;

@@ -9,3 +9,3 @@ {

"license": "MIT",
"version": "0.2.0",
"version": "0.2.1",
"description": "Generate Swagger files from a decorator APIs.",

@@ -43,4 +43,4 @@ "keywords": [

"dependencies": {
"@trapi/metadata": "^0.1.0",
"@trapi/utils": "^0.0.2",
"@trapi/metadata": "^0.1.1",
"@trapi/metadata-utils": "^0.0.3",
"typescript": "^4.4.3",

@@ -61,3 +61,3 @@ "yamljs": "^0.3.0"

"engineStrict": true,
"gitHead": "f931516f93b31fa0fc3c04926713a6cc91680f39"
"gitHead": "4355a7f0d19c3df26929981011a621e7f70590e6"
}

@@ -836,2 +836,4 @@ # @trapi/swagger 🚀

It was originally a fork of the [typescript-rest-swagger](https://github.com/thiagobustamante/typescript-rest-swagger) project.
Parts of this package **@trapi/swagger** code rest on a continued fork repository ([typescript-swagger](https://github.com/Tada5hi/typescript-swagger)) of the
[typescript-rest-swagger](https://github.com/thiagobustamante/typescript-rest-swagger) library of [thiagobustamante](https://github.com/thiagobustamante)
and was also inspired by the [tsoa](https://github.com/lukeautry/tsoa) library of [lukeatury](https://github.com/lukeautry).

@@ -9,3 +9,3 @@ /*

import {array, boolean, lazy, mixed, object, SchemaOf, string} from "yup";
import {mapYupRuleForDictionary, getPackageJsonStringValue} from "@trapi/utils";
import {mapYupRuleForDictionary, getPackageJsonStringValue} from "@trapi/metadata-utils";
import {Specification} from "../../specification";

@@ -12,0 +12,0 @@

@@ -8,3 +8,3 @@ /*

import {hasOwnProperty} from "@trapi/utils";
import {hasOwnProperty} from "@trapi/metadata-utils";
import {GeneratorOutput, Property, Resolver} from "@trapi/metadata";

@@ -11,0 +11,0 @@

@@ -12,3 +12,3 @@ /*

import {hasOwnProperty, normalizePathParameters} from "@trapi/utils";
import {hasOwnProperty, normalizePathParameters} from "@trapi/metadata-utils";
import {Method, Parameter, Property, Response, Resolver} from "@trapi/metadata";

@@ -20,3 +20,2 @@

export class Version2SpecGenerator extends AbstractSpecGenerator<SpecificationV2.Spec, SpecificationV2.Schema> {

@@ -23,0 +22,0 @@ public getSwaggerSpec(): SpecificationV2.Spec {

@@ -9,3 +9,3 @@ /*

import {URL} from "url";
import {hasOwnProperty, normalizePathParameters} from "@trapi/utils";
import {hasOwnProperty, normalizePathParameters} from "@trapi/metadata-utils";
import {Method, Parameter, Property, Resolver, Response} from "@trapi/metadata";

@@ -12,0 +12,0 @@ import {Specification} from "../type";

@@ -5,3 +5,3 @@ {

"paths": {
"@trapi/utils": ["./packages/trapi-utils/src"],
"@trapi-metadata/utils": ["./packages/trapi-metadata-utils/src"],
"@trapi/metadata": ["./packages/trapi-metadata/src"]

@@ -8,0 +8,0 @@ }

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc