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

@tsed/schema

Package Overview
Dependencies
Maintainers
5
Versions
849
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsed/schema - npm Package Compare versions

Comparing version 6.1.5 to 6.2.0

11

lib/decorators/operations/in.d.ts
import { Type } from "@tsed/core";
import { JsonSchemaObject } from "../../domain";
import { JsonParameterTypes } from "../../domain/JsonParameterTypes";

@@ -26,2 +27,12 @@ export interface InChainedDecorators {

Required(required?: boolean): this;
/**
* Add pattern constraint. Only available for OPENAPI.
* @param pattern
*/
Pattern(pattern: string | RegExp): this;
/**
* Add custom schema.
* @param schema
*/
Schema(schema: Partial<JsonSchemaObject>): this;
}

@@ -28,0 +39,0 @@ /**

13

lib/decorators/operations/in.js

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

const jsonParameter = new domain_1.JsonParameter();
const types = {};
const schema = {};
const decorator = (target, propertyKey, index) => {

@@ -44,3 +44,3 @@ const store = domain_1.JsonEntityStore.from(target, propertyKey, index);

store.operation.addParameter(-1, jsonParameter);
jsonParameter.schema(domain_1.JsonSchema.from({ type: types.type }));
jsonParameter.schema(domain_1.JsonSchema.from(schema));
break;

@@ -52,3 +52,3 @@ default:

decorator.Type = (type) => {
types.type = type;
schema.type = type;
return decorator;

@@ -68,2 +68,9 @@ };

};
decorator.Pattern = (pattern) => {
return decorator.Schema({ pattern: pattern.toString() });
};
decorator.Schema = (_schema) => {
Object.assign(schema, _schema);
return decorator;
};
return decorator;

@@ -70,0 +77,0 @@ }

@@ -46,27 +46,28 @@ "use strict";

parameter.required = parameter.required || this.get("in") === "path";
if (!jsonSchema.$ref && (this.get("in") === "path" || Object.keys(jsonSchema).length === 1)) {
parameter.type = jsonSchema.type;
}
else if (options.specType === SpecTypes_1.SpecTypes.SWAGGER && this.get("in") === "query") {
if (jsonSchema.$ref) {
return this.refToParameters(parameter, options, schemas);
if (options.specType === SpecTypes_1.SpecTypes.SWAGGER) {
if (!jsonSchema.$ref && Object.keys(jsonSchema).length === 1) {
parameter.type = jsonSchema.type;
return parameter;
}
if (jsonSchema.type === "array") {
if (this.get("in") === "query") {
if (jsonSchema.$ref) {
return this.refToParameters(parameter, options, schemas);
}
if (jsonSchema.type === "array") {
return {
...parameter,
type: "array",
collectionFormat: "multi",
items: {
type: "string"
}
};
}
return {
...parameter,
type: "array",
collectionFormat: "multi",
items: {
type: "string"
}
...jsonSchema
};
}
return {
...parameter,
...jsonSchema
};
}
else {
parameter.schema = jsonSchema;
}
parameter.schema = jsonSchema;
return parameter;

@@ -73,0 +74,0 @@ }

{
"name": "@tsed/schema",
"version": "6.1.5",
"version": "6.2.0",
"description": "JsonSchema module for Ts.ED Framework",

@@ -18,4 +18,4 @@ "main": "./lib/index.js",

"dependencies": {
"@tsed/core": "6.1.5",
"@tsed/openspec": "6.1.5",
"@tsed/core": "6.2.0",
"@tsed/openspec": "6.2.0",
"change-case": "4.1.1",

@@ -22,0 +22,0 @@ "tslib": "2.0.1"

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