Skip to content

Commit

Permalink
feat: adding @NoAdditionalPropertiesAllowed() decorator (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
artursudnik committed Oct 19, 2023
1 parent a1f7929 commit bbc8897
Show file tree
Hide file tree
Showing 4 changed files with 729 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@

import { ArrayMaxSize, ArrayMinSize, IsArray, IsNotEmpty, IsObject } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
import { IsAllowedFieldJsonPathKey, IsTopLevelFieldJsonPath, IsValidJsonSchema } from '../../../validators';
import {
IsAllowedFieldJsonPathKey,
IsTopLevelFieldJsonPath,
IsValidJsonSchema,
NoAdditionalPropertiesAllowed
} from '../../../validators';

export const exampleFieldFilter = {
$schema: 'http://json-schema.org/draft-07/schema#',
Expand Down Expand Up @@ -61,6 +66,7 @@ export class FieldDto {
path: string[];

@IsValidJsonSchema()
@NoAdditionalPropertiesAllowed()
@IsObject()
@IsNotEmpty()
@ApiProperty({ example: JSON.stringify(exampleFieldFilter) })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ export * from './is-valid-json-schema';
export * from './is-top-level-field-json-path';
export * from './is-allowed-field-json-path-key';
export * from './is-valid-constraints-fields-paths';
export * from './no-additional-properties-allowed';
Loading

0 comments on commit bbc8897

Please sign in to comment.