Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

class-validator-jsonschema

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

class-validator-jsonschema - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

1

__tests__/index.test.ts

@@ -96,3 +96,2 @@ // tslint:disable:no-submodule-imports

},
required: [],
type: 'object'

@@ -99,0 +98,0 @@ },

4

__tests__/options.test.ts

@@ -91,3 +91,3 @@ import {

expect(defaultSchemas.User.required).toEqual(['id', 'email'])
expect(defaultSchemas.Post.required).toEqual([])
expect(defaultSchemas.Post).not.toHaveProperty('required')

@@ -98,4 +98,4 @@ const schemas = validationMetadatasToSchemas(metadata, {

expect(schemas.User.required).toEqual(['id'])
expect(schemas.Post.required).toEqual([])
expect(defaultSchemas.Post).not.toHaveProperty('required')
})
})

@@ -27,5 +27,8 @@ "use strict";

properties,
required: getRequiredPropNames(target, metas, options),
type: 'object'
};
const required = getRequiredPropNames(target, metas, options);
if (required.length > 0) {
definitionSchema.required = required;
}
return applyDecorators(definitionSchema, target, options, target.name);

@@ -83,2 +86,2 @@ })

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFDQSxxREFBaUQ7QUFFakQsNEJBQTJCO0FBRTNCLE1BQU0sS0FBSyxHQUFHLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQyw2QkFBNkIsQ0FBQyxDQUFBO0FBRTdELDZDQUFnRDtBQUNoRCwyREFBdUQ7QUFDdkQsdUNBQW9EO0FBRXBELDJDQUF5QztBQUFoQyxrQ0FBQSxVQUFVLENBQUE7QUFNbkIsc0NBQ0UsU0FBK0IsRUFDL0IsV0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0FBQztZQUM5RCxDQUFDLENBQUMsQ0FBQyxDQUFDLFVBQVUsQ0FBQyxHQUFHLENBQUMsSUFBSSxVQUFVLENBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQTtJQUNqRCxDQUFDLENBQUM7U0FDRCxJQUFJLEVBQUU7U0FDTixLQUFLLEVBQUUsQ0FBQTtBQUNaLENBQUMifQ==

@@ -9,2 +9,7 @@ # Changelog

## [1.1.3] - 2018-09-12
### Fixed
- Update `openapi3-ts` dependency to fix incorrect `SchemaObject.additionalProperties` type [#4](https://github.com/epiphone/class-validator-jsonschema/issues/4)
- Omit the `required` property in case of no required properties instead of an empty list: `required: []` [#5](https://github.com/epiphone/class-validator-jsonschema/issues/5)
## [1.1.2] - 2018-08-19

@@ -11,0 +16,0 @@ ### Fixed

{
"name": "class-validator-jsonschema",
"version": "1.1.2",
"version": "1.1.3",
"description": "Convert class-validator-decorated classes into JSON schema",

@@ -34,3 +34,3 @@ "keywords": [

"lodash": "^4.17.4",
"openapi3-ts": "^0.6.2",
"openapi3-ts": "^1.0.0",
"reflect-metadata": "^0.1.10",

@@ -37,0 +37,0 @@ "tslib": "^1.8.0"

@@ -41,8 +41,12 @@ // tslint:disable:no-submodule-imports ban-types

const definitionSchema = {
const definitionSchema: SchemaObject = {
properties,
required: getRequiredPropNames(target, metas, options),
type: 'object'
}
const required = getRequiredPropNames(target, metas, options)
if (required.length > 0) {
definitionSchema.required = required
}
return applyDecorators(definitionSchema, target, options, target.name)

@@ -49,0 +53,0 @@ })

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