-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'opensearch-project:main' into remove/default
- Loading branch information
Showing
8 changed files
with
3,426 additions
and
477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ jobs: | |
node-version: 20.10.0 | ||
- run: npm install | ||
- run: npm run test | ||
- run: npm run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,34 @@ | ||
# OpenSearch OpenAPI Tools | ||
|
||
This folder contains tools for the repo: | ||
- Merger: merges multiple OpenAPI files into one | ||
- Linter: validates files in the spec folder | ||
|
||
- [Merger](./merger/): merges multiple OpenAPI files into one | ||
- [Linter](./linter/): validates files in the spec folder | ||
|
||
## Setup | ||
|
||
1. Install [Node.js](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs) | ||
2. Run `npm install` in the `tools` folder | ||
|
||
## Merger | ||
|
||
The merger tool merges the multi-file OpenSearch spec into a single file for programmatic use. It takes 2 parameters: | ||
- The path to the root folder of the multi-file spec | ||
- The path to the output file | ||
|
||
- the path to the root folder of the multi-file spec | ||
- the path to the output file | ||
|
||
Example: | ||
|
||
```bash | ||
npm run merge -- ../spec ../build/opensearch-openapi.latest.yaml | ||
``` | ||
|
||
## Linter | ||
|
||
The linter tool validates the OpenSearch spec files in the `spec` folder: | ||
|
||
```bash | ||
npm run lint | ||
npm run lint:spec | ||
``` | ||
|
||
It will print out all the errors and warnings in the spec files. This tool in still in development, and it will be integrated into the CI/CD pipeline and run automatically with every PR. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import path from 'path' | ||
import { fileURLToPath } from 'url' | ||
import { FlatCompat } from '@eslint/eslintrc' | ||
import pluginJs from '@eslint/js' | ||
|
||
// mimic CommonJS variables -- not needed if using CommonJS | ||
const _filename = fileURLToPath(import.meta.url) | ||
const _dirname = path.dirname(_filename) | ||
const compat = new FlatCompat({ baseDirectory: _dirname, recommendedConfig: pluginJs.configs.recommended }) | ||
|
||
export default [ | ||
pluginJs.configs.recommended, | ||
...compat.extends('standard-with-typescript'), | ||
{ | ||
files: ['**/*.{js,ts}'], | ||
ignores: [ | ||
'**/eslint.config.mjs' | ||
], | ||
rules: { | ||
'@typescript-eslint/array-type': 'warn', | ||
'@typescript-eslint/block-spacing': 'warn', | ||
'@typescript-eslint/comma-dangle': 'warn', | ||
'@typescript-eslint/comma-spacing': 'warn', | ||
'@typescript-eslint/consistent-indexed-object-style': 'warn', | ||
'@typescript-eslint/consistent-type-assertions': 'warn', | ||
'@typescript-eslint/consistent-type-imports': 'warn', | ||
'@typescript-eslint/dot-notation': 'warn', | ||
'@typescript-eslint/explicit-function-return-type': 'warn', | ||
'@typescript-eslint/indent': 'warn', | ||
'@typescript-eslint/keyword-spacing': 'warn', | ||
'@typescript-eslint/lines-between-class-members': 'warn', | ||
'@typescript-eslint/member-delimiter-style': 'warn', | ||
'@typescript-eslint/naming-convention': 'warn', | ||
'@typescript-eslint/no-confusing-void-expression': 'warn', | ||
'@typescript-eslint/no-dynamic-delete': 'warn', | ||
'@typescript-eslint/no-invalid-void-type': 'warn', | ||
'@typescript-eslint/no-non-null-assertion': 'warn', | ||
'@typescript-eslint/no-unnecessary-type-assertion': 'warn', | ||
'@typescript-eslint/no-unsafe-argument': 'warn', | ||
'@typescript-eslint/no-unused-vars': 'warn', | ||
'@typescript-eslint/object-curly-spacing': 'warn', | ||
'@typescript-eslint/prefer-nullish-coalescing': 'warn', | ||
'@typescript-eslint/quotes': 'warn', | ||
'@typescript-eslint/require-array-sort-compare': 'warn', | ||
'@typescript-eslint/semi': 'warn', | ||
'@typescript-eslint/space-before-blocks': 'warn', | ||
'@typescript-eslint/space-before-function-paren': 'warn', | ||
'@typescript-eslint/space-infix-ops': 'warn', | ||
'@typescript-eslint/strict-boolean-expressions': 'warn', | ||
'@typescript-eslint/type-annotation-spacing': 'warn', | ||
'array-bracket-spacing': 'warn', | ||
'array-callback-return': 'warn', | ||
curly: 'warn', | ||
'eol-last': 'warn', | ||
eqeqeq: 'warn', | ||
'new-cap': 'warn', | ||
'no-multi-spaces': 'warn', | ||
'no-multiple-empty-lines': 'warn', | ||
'no-return-assign': 'warn', | ||
'no-useless-return': 'warn', | ||
'object-curly-newline': 'warn', | ||
'object-property-newline': 'warn', | ||
'object-shorthand': 'warn', | ||
'quote-props': 'warn', | ||
'space-in-parens': 'warn' | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
}; | ||
testEnvironment: 'node' | ||
} |
Oops, something went wrong.