diff --git a/CHANGELOG.md b/CHANGELOG.md index 6601c2635..ae75afaab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added workflow to determine API changes ([#297](https://github.com/opensearch-project/opensearch-api-specification/pull/297)) - Added link checking ([#269](https://github.com/opensearch-project/opensearch-api-specification/pull/269)) - Added API coverage ([#210](https://github.com/opensearch-project/opensearch-api-specification/pull/210)) +- Added license headers to TypeScript code ([#311](https://github.com/opensearch-project/opensearch-api-specification/pull/311)) ### Changed diff --git a/eslint.config.mjs b/eslint.config.mjs index 9e13e3c1a..53e6a18c3 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -2,6 +2,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { FlatCompat } from '@eslint/eslintrc' import pluginJs from '@eslint/js' +import licenseHeader from 'eslint-plugin-license-header' // mimic CommonJS variables -- not needed if using CommonJS const _filename = fileURLToPath(import.meta.url) @@ -13,6 +14,9 @@ export default [ ...compat.extends('standard-with-typescript'), { files: ['**/*.{js,ts}'], + plugins: { + 'license-header': licenseHeader + }, rules: { '@typescript-eslint/consistent-indexed-object-style': 'error', '@typescript-eslint/consistent-type-assertions': 'error', @@ -51,7 +55,20 @@ export default [ 'array-callback-return': 'off', 'new-cap': 'off', 'no-return-assign': 'error', - 'object-shorthand': 'error' + 'object-shorthand': 'error', + 'license-header/header': [ + 'error', + [ + '/*', + '* Copyright OpenSearch Contributors', + '* SPDX-License-Identifier: Apache-2.0', + '*', + '* The OpenSearch Contributors require contributions made to', + '* this file be licensed under the Apache-2.0 license or a', + '* compatible open source license.', + '*/' + ] + ] } } ] diff --git a/jest.config.js b/jest.config.js index 272fc8594..24da6a51e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { preset: 'ts-jest', diff --git a/package-lock.json b/package-lock.json index f4b1b6149..d404636d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,6 +30,7 @@ "eslint": "^8.57.0", "eslint-config-standard-with-typescript": "^43.0.1", "eslint-plugin-import": "^2.29.1", + "eslint-plugin-license-header": "^0.6.1", "eslint-plugin-n": "^16.6.2", "eslint-plugin-promise": "^6.1.1", "globals": "^15.0.0", @@ -3403,6 +3404,15 @@ "node": ">=0.10.0" } }, + "node_modules/eslint-plugin-license-header": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-license-header/-/eslint-plugin-license-header-0.6.1.tgz", + "integrity": "sha512-9aIz8q3OaMr1/uQmCGCWySjTs5nEXUJexNegz/8lluNcZbEl82Ag1Vyr1Hu3oIveRW1NbXDPs6nu4zu9mbrmWA==", + "dev": true, + "dependencies": { + "requireindex": "^1.2.0" + } + }, "node_modules/eslint-plugin-n": { "version": "16.6.2", "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-16.6.2.tgz", @@ -6591,6 +6601,15 @@ "node": ">=0.10.0" } }, + "node_modules/requireindex": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.2.0.tgz", + "integrity": "sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==", + "dev": true, + "engines": { + "node": ">=0.10.5" + } + }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", diff --git a/package.json b/package.json index 0c14289ab..6e953726a 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "eslint": "^8.57.0", "eslint-config-standard-with-typescript": "^43.0.1", "eslint-plugin-import": "^2.29.1", + "eslint-plugin-license-header": "^0.6.1", "eslint-plugin-n": "^16.6.2", "eslint-plugin-promise": "^6.1.1", "globals": "^15.0.0", diff --git a/tools/helpers.ts b/tools/helpers.ts index 276d7f9f3..49b7218f1 100644 --- a/tools/helpers.ts +++ b/tools/helpers.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import fs from 'fs' import path from 'path' import YAML from 'yaml' diff --git a/tools/src/Logger.ts b/tools/src/Logger.ts index 165deda19..3585f1ecb 100644 --- a/tools/src/Logger.ts +++ b/tools/src/Logger.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + export enum LogLevel { error = 1, warn = 2, diff --git a/tools/src/coverage/CoverageCalculator.ts b/tools/src/coverage/CoverageCalculator.ts index 9662e35e3..090e0ecb1 100644 --- a/tools/src/coverage/CoverageCalculator.ts +++ b/tools/src/coverage/CoverageCalculator.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type OpenAPIV3 } from 'openapi-types' import { HTTP_METHODS, read_yaml, write_json } from '../../helpers' diff --git a/tools/src/coverage/coverage.ts b/tools/src/coverage/coverage.ts index 8acd80d6e..5b5dede7e 100644 --- a/tools/src/coverage/coverage.ts +++ b/tools/src/coverage/coverage.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { Command, Option } from '@commander-js/extra-typings' import CoverageCalculator from './CoverageCalculator' import { resolve } from 'path' diff --git a/tools/src/dump-cluster-spec/dump-cluster-spec.ts b/tools/src/dump-cluster-spec/dump-cluster-spec.ts index 1d3de6bae..bb7bd96de 100644 --- a/tools/src/dump-cluster-spec/dump-cluster-spec.ts +++ b/tools/src/dump-cluster-spec/dump-cluster-spec.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { Command, Option } from '@commander-js/extra-typings' import { resolve } from 'path' import axios from 'axios' diff --git a/tools/src/linter/InlineObjectSchemaValidator.ts b/tools/src/linter/InlineObjectSchemaValidator.ts index 892c9af6a..460832f6f 100644 --- a/tools/src/linter/InlineObjectSchemaValidator.ts +++ b/tools/src/linter/InlineObjectSchemaValidator.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import type NamespacesFolder from './components/NamespacesFolder' import type SchemasFolder from './components/SchemasFolder' import { type ValidationError } from 'types' diff --git a/tools/src/linter/SchemaRefsValidator.ts b/tools/src/linter/SchemaRefsValidator.ts index ae5af24fb..f39ec20e0 100644 --- a/tools/src/linter/SchemaRefsValidator.ts +++ b/tools/src/linter/SchemaRefsValidator.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import type NamespacesFolder from './components/NamespacesFolder' import type SchemasFolder from './components/SchemasFolder' import { type ValidationError } from 'types' diff --git a/tools/src/linter/SchemasValidator.ts b/tools/src/linter/SchemasValidator.ts index 21ca3630a..2550d7f89 100644 --- a/tools/src/linter/SchemasValidator.ts +++ b/tools/src/linter/SchemasValidator.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import AJV from 'ajv' import addFormats from 'ajv-formats' import OpenApiMerger from '../merger/OpenApiMerger' diff --git a/tools/src/linter/SpecValidator.ts b/tools/src/linter/SpecValidator.ts index 51ccf2a27..f953b1efc 100644 --- a/tools/src/linter/SpecValidator.ts +++ b/tools/src/linter/SpecValidator.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import SchemasFolder from './components/SchemasFolder' import NamespacesFolder from './components/NamespacesFolder' import { type ValidationError } from 'types' diff --git a/tools/src/linter/components/InfoFile.ts b/tools/src/linter/components/InfoFile.ts index 791beda41..02608724c 100644 --- a/tools/src/linter/components/InfoFile.ts +++ b/tools/src/linter/components/InfoFile.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import FileValidator from './base/FileValidator' export default class InfoFile extends FileValidator { diff --git a/tools/src/linter/components/NamespaceFile.ts b/tools/src/linter/components/NamespaceFile.ts index 8bfe67f17..c6f5799ff 100644 --- a/tools/src/linter/components/NamespaceFile.ts +++ b/tools/src/linter/components/NamespaceFile.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type OpenAPIV3 } from 'openapi-types' import { type OperationSpec, type ValidationError } from 'types' import OperationGroup from './OperationGroup' diff --git a/tools/src/linter/components/NamespacesFolder.ts b/tools/src/linter/components/NamespacesFolder.ts index a1c10003c..d7ebf4371 100644 --- a/tools/src/linter/components/NamespacesFolder.ts +++ b/tools/src/linter/components/NamespacesFolder.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import NamespaceFile from './NamespaceFile' import { type ValidationError } from 'types' import FolderValidator from './base/FolderValidator' diff --git a/tools/src/linter/components/Operation.ts b/tools/src/linter/components/Operation.ts index 99a93c3c1..44c734272 100644 --- a/tools/src/linter/components/Operation.ts +++ b/tools/src/linter/components/Operation.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type OperationSpec, type ValidationError } from 'types' import _ from 'lodash' import ValidatorBase from './base/ValidatorBase' diff --git a/tools/src/linter/components/OperationGroup.ts b/tools/src/linter/components/OperationGroup.ts index f99cb9ab3..5daa6adce 100644 --- a/tools/src/linter/components/OperationGroup.ts +++ b/tools/src/linter/components/OperationGroup.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import type Operation from './Operation' import { type ValidationError } from 'types' import ValidatorBase from './base/ValidatorBase' diff --git a/tools/src/linter/components/Schema.ts b/tools/src/linter/components/Schema.ts index d132f86e3..9178950a0 100644 --- a/tools/src/linter/components/Schema.ts +++ b/tools/src/linter/components/Schema.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import ValidatorBase from './base/ValidatorBase' import { type OpenAPIV3 } from 'openapi-types' import { type ValidationError } from 'types' diff --git a/tools/src/linter/components/SchemaFile.ts b/tools/src/linter/components/SchemaFile.ts index 8fa364b13..4adae3472 100644 --- a/tools/src/linter/components/SchemaFile.ts +++ b/tools/src/linter/components/SchemaFile.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import FileValidator from './base/FileValidator' import { type ValidationError } from 'types' import Schema from './Schema' diff --git a/tools/src/linter/components/SchemasFolder.ts b/tools/src/linter/components/SchemasFolder.ts index d6d30fd6a..a44cc3add 100644 --- a/tools/src/linter/components/SchemasFolder.ts +++ b/tools/src/linter/components/SchemasFolder.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import SchemaFile from './SchemaFile' import FolderValidator from './base/FolderValidator' import { type ValidationError } from 'types' diff --git a/tools/src/linter/components/SupersededOperationsFile.ts b/tools/src/linter/components/SupersededOperationsFile.ts index 3591ede8e..47b34fe9f 100644 --- a/tools/src/linter/components/SupersededOperationsFile.ts +++ b/tools/src/linter/components/SupersededOperationsFile.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import FileValidator from './base/FileValidator' export default class SupersededOperationsFile extends FileValidator { diff --git a/tools/src/linter/components/base/FileValidator.ts b/tools/src/linter/components/base/FileValidator.ts index 6941458ba..2ed0aa128 100644 --- a/tools/src/linter/components/base/FileValidator.ts +++ b/tools/src/linter/components/base/FileValidator.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import ValidatorBase from './ValidatorBase' import { type ValidationError } from 'types' import { type OpenAPIV3 } from 'openapi-types' diff --git a/tools/src/linter/components/base/FolderValidator.ts b/tools/src/linter/components/base/FolderValidator.ts index 8a63644dc..0c7aa47fb 100644 --- a/tools/src/linter/components/base/FolderValidator.ts +++ b/tools/src/linter/components/base/FolderValidator.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import fs from 'fs' import ValidatorBase from './ValidatorBase' import type FileValidator from './FileValidator' diff --git a/tools/src/linter/components/base/ValidatorBase.ts b/tools/src/linter/components/base/ValidatorBase.ts index 3790218bf..d92df8256 100644 --- a/tools/src/linter/components/base/ValidatorBase.ts +++ b/tools/src/linter/components/base/ValidatorBase.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type ValidationError } from 'types' export default class ValidatorBase { file: string diff --git a/tools/src/linter/lint.ts b/tools/src/linter/lint.ts index 6b30fa1d8..f6ddcf5dd 100644 --- a/tools/src/linter/lint.ts +++ b/tools/src/linter/lint.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { Command, Option } from '@commander-js/extra-typings' import SpecValidator from './SpecValidator' import { resolve } from 'path' diff --git a/tools/src/linter/utils/SpecificationVisitor.ts b/tools/src/linter/utils/SpecificationVisitor.ts index d94731a73..b97a636e4 100644 --- a/tools/src/linter/utils/SpecificationVisitor.ts +++ b/tools/src/linter/utils/SpecificationVisitor.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { is_array_schema, is_ref, type KeysMatching, type MaybeRef, type SpecificationContext } from './index' import { OpenAPIV3 } from 'openapi-types' diff --git a/tools/src/linter/utils/index.ts b/tools/src/linter/utils/index.ts index db451638f..2a9c67996 100644 --- a/tools/src/linter/utils/index.ts +++ b/tools/src/linter/utils/index.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type OpenAPIV3 } from 'openapi-types' import { type ValidationError } from 'types' diff --git a/tools/src/merger/GlobalParamsGenerator.ts b/tools/src/merger/GlobalParamsGenerator.ts index d883e0812..8077db00f 100644 --- a/tools/src/merger/GlobalParamsGenerator.ts +++ b/tools/src/merger/GlobalParamsGenerator.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type OpenAPIV3 } from 'openapi-types' import _ from 'lodash' import { read_yaml } from '../../helpers' diff --git a/tools/src/merger/OpenApiMerger.ts b/tools/src/merger/OpenApiMerger.ts index a541293d7..4cded34bb 100644 --- a/tools/src/merger/OpenApiMerger.ts +++ b/tools/src/merger/OpenApiMerger.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type OpenAPIV3 } from 'openapi-types' import fs from 'fs' import _ from 'lodash' diff --git a/tools/src/merger/OpenDistro.ts b/tools/src/merger/OpenDistro.ts index b3d1d431d..f7081ce06 100644 --- a/tools/src/merger/OpenDistro.ts +++ b/tools/src/merger/OpenDistro.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type HttpVerb, type OperationPath, type SupersededOperationMap } from 'types' import { read_yaml, write_yaml } from '../../helpers' diff --git a/tools/src/merger/SupersededOpsGenerator.ts b/tools/src/merger/SupersededOpsGenerator.ts index 39570aaf0..57b8c91c8 100644 --- a/tools/src/merger/SupersededOpsGenerator.ts +++ b/tools/src/merger/SupersededOpsGenerator.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type OperationSpec, type SupersededOperationMap } from 'types' import _ from 'lodash' import { read_yaml } from '../../helpers' diff --git a/tools/src/merger/merge.ts b/tools/src/merger/merge.ts index c38f29c97..470a274fe 100644 --- a/tools/src/merger/merge.ts +++ b/tools/src/merger/merge.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { Command, Option } from '@commander-js/extra-typings' import OpenApiMerger from './OpenApiMerger' import { resolve } from 'path' diff --git a/tools/src/tester/Ansi.ts b/tools/src/tester/Ansi.ts index 64e47192a..cbc9b3d40 100644 --- a/tools/src/tester/Ansi.ts +++ b/tools/src/tester/Ansi.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + export function b (text: string): string { return `\x1b[1m${text}\x1b[0m` } export function i (text: string): string { return `\x1b[3m${text}\x1b[0m` } diff --git a/tools/src/tester/ChapterEvaluator.ts b/tools/src/tester/ChapterEvaluator.ts index 03b3c6497..1b2161170 100644 --- a/tools/src/tester/ChapterEvaluator.ts +++ b/tools/src/tester/ChapterEvaluator.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type Chapter, type ActualResponse } from './types/story.types' import { type ChapterEvaluation, type Evaluation, Result } from './types/eval.types' import { type ParsedOperation } from './types/spec.types' diff --git a/tools/src/tester/ChapterReader.ts b/tools/src/tester/ChapterReader.ts index f8a962709..445508328 100644 --- a/tools/src/tester/ChapterReader.ts +++ b/tools/src/tester/ChapterReader.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import axios from 'axios' import { type ChapterRequest, type ActualResponse, type Parameter } from './types/story.types' import { Agent } from 'https' diff --git a/tools/src/tester/ResultsDisplayer.ts b/tools/src/tester/ResultsDisplayer.ts index 7a0d04f47..cb79fcaa9 100644 --- a/tools/src/tester/ResultsDisplayer.ts +++ b/tools/src/tester/ResultsDisplayer.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type ChapterEvaluation, type Evaluation, Result, type StoryEvaluation } from './types/eval.types' import { overall_result } from './helpers' import * as ansi from './Ansi' diff --git a/tools/src/tester/SchemaValidator.ts b/tools/src/tester/SchemaValidator.ts index 4f9c91896..73db0ad3d 100644 --- a/tools/src/tester/SchemaValidator.ts +++ b/tools/src/tester/SchemaValidator.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import AJV from 'ajv' import addFormats from 'ajv-formats' import { type OpenAPIV3 } from 'openapi-types' diff --git a/tools/src/tester/SharedResources.ts b/tools/src/tester/SharedResources.ts index c03a3fb13..cf56dc87e 100644 --- a/tools/src/tester/SharedResources.ts +++ b/tools/src/tester/SharedResources.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import type ChapterReader from './ChapterReader' import type SchemaValidator from './SchemaValidator' import type SpecParser from './SpecParser' diff --git a/tools/src/tester/SpecParser.ts b/tools/src/tester/SpecParser.ts index ecc171f8e..3ee4ba875 100644 --- a/tools/src/tester/SpecParser.ts +++ b/tools/src/tester/SpecParser.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type OpenAPIV3 } from 'openapi-types' import { resolve_ref } from '../../helpers' import { type Chapter } from './types/story.types' diff --git a/tools/src/tester/StoryEvaluator.ts b/tools/src/tester/StoryEvaluator.ts index 7c049125c..68cf97bcf 100644 --- a/tools/src/tester/StoryEvaluator.ts +++ b/tools/src/tester/StoryEvaluator.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type Chapter, type Story, type SupplementalChapter } from './types/story.types' import { type ChapterEvaluation, Result, type StoryEvaluation } from './types/eval.types' import ChapterEvaluator from './ChapterEvaluator' diff --git a/tools/src/tester/TestsRunner.ts b/tools/src/tester/TestsRunner.ts index a5ba0689f..e9a1a7e18 100644 --- a/tools/src/tester/TestsRunner.ts +++ b/tools/src/tester/TestsRunner.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type OpenAPIV3 } from 'openapi-types' import SpecParser from './SpecParser' import ChapterReader from './ChapterReader' diff --git a/tools/src/tester/_generate_story_types.ts b/tools/src/tester/_generate_story_types.ts index dc497d288..98e9ed1f6 100644 --- a/tools/src/tester/_generate_story_types.ts +++ b/tools/src/tester/_generate_story_types.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import * as js2ts from 'json-schema-to-typescript' import fs from 'fs' import { read_yaml } from '../../helpers' diff --git a/tools/src/tester/helpers.ts b/tools/src/tester/helpers.ts index 1c5e78257..4dd7abe66 100644 --- a/tools/src/tester/helpers.ts +++ b/tools/src/tester/helpers.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type Evaluation, Result } from './types/eval.types' export function overall_result (evaluations: Evaluation[]): Result { diff --git a/tools/src/tester/start.ts b/tools/src/tester/start.ts index 7cbe9a2ab..83b10f34c 100644 --- a/tools/src/tester/start.ts +++ b/tools/src/tester/start.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import OpenApiMerger from '../merger/OpenApiMerger' import { LogLevel } from '../Logger' import TestsRunner from './TestsRunner' diff --git a/tools/src/tester/types/eval.types.ts b/tools/src/tester/types/eval.types.ts index 95f9e7af7..5e4f798cc 100644 --- a/tools/src/tester/types/eval.types.ts +++ b/tools/src/tester/types/eval.types.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + export type LibraryEvaluation = StoryEvaluation[] export interface StoryEvaluation { diff --git a/tools/src/tester/types/spec.types.ts b/tools/src/tester/types/spec.types.ts index 6a34db327..06689a9eb 100644 --- a/tools/src/tester/types/spec.types.ts +++ b/tools/src/tester/types/spec.types.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type OpenAPIV3 } from 'openapi-types' export type ParsedOperation = OpenAPIV3.OperationObject & { diff --git a/tools/src/types.ts b/tools/src/types.ts index 083a05f72..a9497dbcb 100644 --- a/tools/src/types.ts +++ b/tools/src/types.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { type OpenAPIV3 } from 'openapi-types' export interface OperationSpec extends OpenAPIV3.OperationObject { diff --git a/tools/tests/linter/InfoFile.test.ts b/tools/tests/linter/InfoFile.test.ts index e93f2ea0e..5ae09cbfd 100644 --- a/tools/tests/linter/InfoFile.test.ts +++ b/tools/tests/linter/InfoFile.test.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import InfoFile from 'linter/components/InfoFile' test('validate()', () => { diff --git a/tools/tests/linter/InlineObjectSchemaValidator.test.ts b/tools/tests/linter/InlineObjectSchemaValidator.test.ts index 6cff2d2c1..8efeea258 100644 --- a/tools/tests/linter/InlineObjectSchemaValidator.test.ts +++ b/tools/tests/linter/InlineObjectSchemaValidator.test.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import SchemasFolder from 'linter/components/SchemasFolder' import NamespacesFolder from 'linter/components/NamespacesFolder' import InlineObjectSchemaValidator from 'linter/InlineObjectSchemaValidator' diff --git a/tools/tests/linter/NamespaceFile.test.ts b/tools/tests/linter/NamespaceFile.test.ts index 51fe30339..16513288c 100644 --- a/tools/tests/linter/NamespaceFile.test.ts +++ b/tools/tests/linter/NamespaceFile.test.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { mocked_namespace_file, namespace_file } from './factories/namespace_file' test('constructor()', () => { diff --git a/tools/tests/linter/NamespacesFolder.test.ts b/tools/tests/linter/NamespacesFolder.test.ts index 08b1ac854..677aa5996 100644 --- a/tools/tests/linter/NamespacesFolder.test.ts +++ b/tools/tests/linter/NamespacesFolder.test.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import NamespacesFolder from 'linter/components/NamespacesFolder' test('validate() - When there invalid files', () => { diff --git a/tools/tests/linter/Operation.test.ts b/tools/tests/linter/Operation.test.ts index f7426a29d..93a7c0e3e 100644 --- a/tools/tests/linter/Operation.test.ts +++ b/tools/tests/linter/Operation.test.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { mocked_operation, operation } from './factories/operation' test('validate_group()', () => { diff --git a/tools/tests/linter/OperationGroup.test.ts b/tools/tests/linter/OperationGroup.test.ts index 564cab7b5..9ad7c1f65 100644 --- a/tools/tests/linter/OperationGroup.test.ts +++ b/tools/tests/linter/OperationGroup.test.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { mocked_operation_group, operation_group } from './factories/operation_group' test('validate_description()', () => { diff --git a/tools/tests/linter/Schema.test.ts b/tools/tests/linter/Schema.test.ts index 60319b128..d52492247 100644 --- a/tools/tests/linter/Schema.test.ts +++ b/tools/tests/linter/Schema.test.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { schema } from './factories/schema' test('validate_name()', () => { diff --git a/tools/tests/linter/SchemaFile.test.ts b/tools/tests/linter/SchemaFile.test.ts index ad6b9d897..2d6e0c40c 100644 --- a/tools/tests/linter/SchemaFile.test.ts +++ b/tools/tests/linter/SchemaFile.test.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { mocked_schema_file, schema_file } from './factories/schema_file' test('validate_category()', () => { diff --git a/tools/tests/linter/SchemaRefsValidator.test.ts b/tools/tests/linter/SchemaRefsValidator.test.ts index 7cae50ad1..997e4af6a 100644 --- a/tools/tests/linter/SchemaRefsValidator.test.ts +++ b/tools/tests/linter/SchemaRefsValidator.test.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import SchemasFolder from 'linter/components/SchemasFolder' import NamespacesFolder from 'linter/components/NamespacesFolder' import SchemaRefsValidator from 'linter/SchemaRefsValidator' diff --git a/tools/tests/linter/SchemasValidator.test.ts b/tools/tests/linter/SchemasValidator.test.ts index cbd16a998..4713dc539 100644 --- a/tools/tests/linter/SchemasValidator.test.ts +++ b/tools/tests/linter/SchemasValidator.test.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import SchemasValidator from '../../src/linter/SchemasValidator' test('validate() - named_schemas', () => { diff --git a/tools/tests/linter/SpecValidator.test.ts b/tools/tests/linter/SpecValidator.test.ts index 7658ee860..b62b13234 100644 --- a/tools/tests/linter/SpecValidator.test.ts +++ b/tools/tests/linter/SpecValidator.test.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import SpecValidator from 'linter/SpecValidator' test('validate()', () => { diff --git a/tools/tests/linter/SupersededOperationsFile.test.ts b/tools/tests/linter/SupersededOperationsFile.test.ts index 5c97edfff..13102d45c 100644 --- a/tools/tests/linter/SupersededOperationsFile.test.ts +++ b/tools/tests/linter/SupersededOperationsFile.test.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import SupersededOperationsFile from 'linter/components/SupersededOperationsFile' test('validate()', () => { diff --git a/tools/tests/linter/factories/namespace_file.ts b/tools/tests/linter/factories/namespace_file.ts index 7c130de4d..f38ea0e35 100644 --- a/tools/tests/linter/factories/namespace_file.ts +++ b/tools/tests/linter/factories/namespace_file.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import NamespaceFile from 'linter/components/NamespaceFile' import { type OpenAPIV3 } from 'openapi-types' import { mocked_operation_group } from './operation_group' diff --git a/tools/tests/linter/factories/operation.ts b/tools/tests/linter/factories/operation.ts index 208dd1e86..d2ee7f883 100644 --- a/tools/tests/linter/factories/operation.ts +++ b/tools/tests/linter/factories/operation.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import Operation from 'linter/components/Operation' import { type OperationSpec } from 'types' diff --git a/tools/tests/linter/factories/operation_group.ts b/tools/tests/linter/factories/operation_group.ts index 7a8cd6c1b..1e5fa04c6 100644 --- a/tools/tests/linter/factories/operation_group.ts +++ b/tools/tests/linter/factories/operation_group.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import OperationGroup from 'linter/components/OperationGroup' import { operation, mocked_operation } from './operation' diff --git a/tools/tests/linter/factories/schema.ts b/tools/tests/linter/factories/schema.ts index bdaec547c..b9e8de772 100644 --- a/tools/tests/linter/factories/schema.ts +++ b/tools/tests/linter/factories/schema.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import Schema from 'linter/components/Schema' import { type OpenAPIV3 } from 'openapi-types' diff --git a/tools/tests/linter/factories/schema_file.ts b/tools/tests/linter/factories/schema_file.ts index b19c9724f..8c0a0bb4e 100644 --- a/tools/tests/linter/factories/schema_file.ts +++ b/tools/tests/linter/factories/schema_file.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { mocked_schema } from './schema' import SchemaFile from 'linter/components/SchemaFile' diff --git a/tools/tests/merger/OpenApiMerger.test.ts b/tools/tests/merger/OpenApiMerger.test.ts index 33146327f..00e4ed4ba 100644 --- a/tools/tests/merger/OpenApiMerger.test.ts +++ b/tools/tests/merger/OpenApiMerger.test.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import OpenApiMerger from 'merger/OpenApiMerger' import fs from 'fs' import { LogLevel } from '../../src/Logger' diff --git a/tools/tests/tester/ansi.test.ts b/tools/tests/tester/ansi.test.ts index aa163444b..0d7d37c14 100644 --- a/tools/tests/tester/ansi.test.ts +++ b/tools/tests/tester/ansi.test.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import * as ansi from '../../src/tester/Ansi' test('b', async () => { diff --git a/tools/tests/tester/start.test.ts b/tools/tests/tester/start.test.ts index 3d7a81ba0..2f0f569c9 100644 --- a/tools/tests/tester/start.test.ts +++ b/tools/tests/tester/start.test.ts @@ -1,3 +1,12 @@ +/* +* Copyright OpenSearch Contributors +* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + import { spawnSync } from 'child_process' import * as ansi from '../../src/tester/Ansi'