Skip to content

Commit

Permalink
second solution suggestion
Browse files Browse the repository at this point in the history
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
  • Loading branch information
shirady committed Mar 6, 2024
1 parent 9377127 commit def84b7
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/manage_nsfs/nsfs_schema_utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* Copyright (C) 2023 NooBaa */
'use strict';

const _ = require('lodash');
const RpcError = require('../rpc/rpc_error');
const { default: Ajv } = require('ajv');
const ajv = new Ajv({ verbose: true, allErrors: true });
Expand All @@ -21,6 +22,12 @@ const bucket_schema = require('../server/system_services/schemas/nsfs_bucket_sch
const account_schema = require('../server/system_services/schemas/nsfs_account_schema');
const nsfs_config_schema = require('../server/system_services/schemas/nsfs_config_schema');

_.each(common_api.definitions, schema => {
schema_utils.strictify(schema, {
additionalProperties: false
});
});

schema_utils.strictify(bucket_schema, {
additionalProperties: false
});
Expand All @@ -32,19 +39,6 @@ schema_utils.strictify(account_schema, {
// NOTE - DO NOT strictify nsfs_config_schema
// we might want to use it in the future for adding additional properties

// objects under schema that using ref (with object underneath) - needs to be strictify as well
schema_utils.strictify(common_api.definitions.bucket_policy, {
additionalProperties: false
});

schema_utils.strictify(common_api.definitions.bucket_encryption, {
additionalProperties: false
});

schema_utils.strictify(common_api.definitions.bucket_website, {
additionalProperties: false
});

/**
* validate_account_schema validates an account object against the NC NSFS account schema
* @param {object} account
Expand Down

0 comments on commit def84b7

Please sign in to comment.