diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..fa35994d3 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,27 @@ +name: Validate Spec + +on: + push: + branches: ['**'] + paths: + - 'spec/**' + - 'tools/linter/**' + pull_request: + branches: ['**'] + paths: + - 'spec/**' + - 'tools/linter/**' + +jobs: + lint-spec: + runs-on: ubuntu-latest + defaults: + run: + working-directory: tools + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 20.10.0 + - run: npm install + - run: npm run lint -- ../spec diff --git a/spec/namespaces/_core.yaml b/spec/namespaces/_core.yaml index 8e679969a..f20320723 100644 --- a/spec/namespaces/_core.yaml +++ b/spec/namespaces/_core.yaml @@ -56,6 +56,8 @@ paths: x-operation-group: bulk x-version-added: '1.0' description: Allows to perform multiple index/update/delete operations in a single request. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/document-apis/bulk/ parameters: - $ref: '#/components/parameters/bulk::query.wait_for_active_shards' - $ref: '#/components/parameters/bulk::query.refresh' @@ -78,6 +80,8 @@ paths: x-operation-group: count x-version-added: '1.0' description: Returns number of documents matching a query. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/count/ parameters: - $ref: '#/components/parameters/count::query.ignore_unavailable' - $ref: '#/components/parameters/count::query.ignore_throttled' @@ -163,6 +167,8 @@ paths: x-operation-group: field_caps x-version-added: '1.0' description: Returns the information about the capabilities of fields among multiple indices. + externalDocs: + url: https://opensearch.org/docs/latest/field-types/supported-field-types/alias/#using-aliases-in-field-capabilities-api-operations parameters: - $ref: '#/components/parameters/field_caps::query.fields' - $ref: '#/components/parameters/field_caps::query.ignore_unavailable' @@ -201,6 +207,8 @@ paths: x-operation-group: mget x-version-added: '1.0' description: Allows to get multiple documents in one request. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/document-apis/multi-get/ parameters: - $ref: '#/components/parameters/mget::query.stored_fields' - $ref: '#/components/parameters/mget::query.preference' @@ -241,6 +249,8 @@ paths: x-operation-group: msearch x-version-added: '1.0' description: Allows to execute several search operations in one request. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/multi-search/ parameters: - $ref: '#/components/parameters/msearch::query.search_type' - $ref: '#/components/parameters/msearch::query.max_concurrent_searches' @@ -278,6 +288,8 @@ paths: x-operation-group: msearch_template x-version-added: '1.0' description: Allows to execute several search template operations in one request. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/search-template/ parameters: - $ref: '#/components/parameters/msearch_template::query.search_type' - $ref: '#/components/parameters/msearch_template::query.typed_keys' @@ -320,6 +332,8 @@ paths: x-operation-group: mtermvectors x-version-added: '1.0' description: Returns multiple termvectors in one request. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/mtermvectors::query.ids' - $ref: '#/components/parameters/mtermvectors::query.term_statistics' @@ -361,6 +375,8 @@ paths: x-operation-group: rank_eval x-version-added: '1.0' description: Allows to evaluate the quality of ranked search results over a set of typical search queries. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/rank-eval/ parameters: - $ref: '#/components/parameters/rank_eval::query.ignore_unavailable' - $ref: '#/components/parameters/rank_eval::query.allow_no_indices' @@ -429,6 +445,8 @@ paths: x-operation-group: render_search_template x-version-added: '1.0' description: Allows to use the Mustache language to pre-render a search definition. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/search-template/ parameters: [] requestBody: $ref: '#/components/requestBodies/render_search_template' @@ -441,6 +459,8 @@ paths: x-operation-group: render_search_template x-version-added: '1.0' description: Allows to use the Mustache language to pre-render a search definition. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/search-template/ parameters: - $ref: '#/components/parameters/render_search_template::path.id' requestBody: @@ -453,6 +473,8 @@ paths: x-operation-group: render_search_template x-version-added: '1.0' description: Allows to use the Mustache language to pre-render a search definition. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/search-template/ parameters: - $ref: '#/components/parameters/render_search_template::path.id' requestBody: @@ -503,6 +525,8 @@ paths: x-operation-group: scripts_painless_execute x-version-added: '1.0' description: Allows an arbitrary script to be executed and a result to be returned. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/script-apis/exec-script/ parameters: [] requestBody: $ref: '#/components/requestBodies/scripts_painless_execute' @@ -544,6 +568,8 @@ paths: x-operation-group: put_script x-version-added: '1.0' description: Creates or updates a script. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/script-apis/create-stored-script/ parameters: - $ref: '#/components/parameters/put_script::path.id' - $ref: '#/components/parameters/put_script::query.timeout' @@ -577,6 +603,8 @@ paths: x-operation-group: put_script x-version-added: '1.0' description: Creates or updates a script. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/script-apis/create-stored-script/ parameters: - $ref: '#/components/parameters/put_script::path.id' - $ref: '#/components/parameters/put_script::path.context' @@ -593,6 +621,8 @@ paths: x-operation-group: put_script x-version-added: '1.0' description: Creates or updates a script. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/script-apis/create-stored-script/ parameters: - $ref: '#/components/parameters/put_script::path.id' - $ref: '#/components/parameters/put_script::path.context' @@ -667,6 +697,8 @@ paths: x-operation-group: search x-version-added: '1.0' description: Returns results matching a query. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/search/ parameters: - $ref: '#/components/parameters/search::query.analyzer' - $ref: '#/components/parameters/search::query.analyze_wildcard' @@ -786,6 +818,8 @@ paths: x-operation-group: scroll x-version-added: '1.0' description: Allows to retrieve a large numbers of results from a single search request. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/scroll/#path-and-http-methods parameters: - $ref: '#/components/parameters/scroll::query.scroll' - $ref: '#/components/parameters/scroll::query.scroll_id' @@ -804,6 +838,8 @@ paths: x-version-added: '1.0' x-version-deprecated: '1.0' description: Explicitly clears the search context for a scroll. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/scroll/ parameters: - $ref: '#/components/parameters/clear_scroll::path.scroll_id' requestBody: @@ -819,6 +855,8 @@ paths: x-version-added: '1.0' x-version-deprecated: '1.0' description: Allows to retrieve a large numbers of results from a single search request. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/scroll/#path-and-http-methods parameters: - $ref: '#/components/parameters/scroll::path.scroll_id' - $ref: '#/components/parameters/scroll::query.scroll' @@ -837,6 +875,8 @@ paths: x-version-added: '1.0' x-version-deprecated: '1.0' description: Allows to retrieve a large numbers of results from a single search request. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/scroll/#path-and-http-methods parameters: - $ref: '#/components/parameters/scroll::path.scroll_id' - $ref: '#/components/parameters/scroll::query.scroll' @@ -879,6 +919,8 @@ paths: x-operation-group: search_template x-version-added: '1.0' description: Allows to use the Mustache language to pre-render a search definition. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/search-template/ parameters: - $ref: '#/components/parameters/search_template::query.ignore_unavailable' - $ref: '#/components/parameters/search_template::query.ignore_throttled' @@ -921,6 +963,8 @@ paths: x-operation-group: search_shards x-version-added: '1.0' description: Returns information about the indices and shards that a search request would be executed against. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/search_shards::query.preference' - $ref: '#/components/parameters/search_shards::query.routing' @@ -951,6 +995,8 @@ paths: x-operation-group: bulk x-version-added: '1.0' description: Allows to perform multiple index/update/delete operations in a single request. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/document-apis/bulk/ parameters: - $ref: '#/components/parameters/bulk::path.index' - $ref: '#/components/parameters/bulk::query.wait_for_active_shards' @@ -973,6 +1019,8 @@ paths: x-operation-group: bulk x-version-added: '1.0' description: Allows to perform multiple index/update/delete operations in a single request. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/document-apis/bulk/ parameters: - $ref: '#/components/parameters/bulk::path.index' - $ref: '#/components/parameters/bulk::query.wait_for_active_shards' @@ -996,6 +1044,8 @@ paths: x-operation-group: count x-version-added: '1.0' description: Returns number of documents matching a query. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/count/ parameters: - $ref: '#/components/parameters/count::path.index' - $ref: '#/components/parameters/count::query.ignore_unavailable' @@ -1022,6 +1072,8 @@ paths: x-operation-group: count x-version-added: '1.0' description: Returns number of documents matching a query. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/count/ parameters: - $ref: '#/components/parameters/count::path.index' - $ref: '#/components/parameters/count::query.ignore_unavailable' @@ -1052,6 +1104,8 @@ paths: Creates a new document in the index. Returns a 409 response when a document with a same ID already exists in the index. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/document-apis/index-document/ parameters: - $ref: '#/components/parameters/create::path.id' - $ref: '#/components/parameters/create::path.index' @@ -1239,6 +1293,8 @@ paths: x-operation-group: index x-version-added: '1.0' description: Creates or updates a document in an index. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/document-apis/index-document/ parameters: - $ref: '#/components/parameters/index::path.id' - $ref: '#/components/parameters/index::path.index' @@ -1263,6 +1319,8 @@ paths: x-operation-group: index x-version-added: '1.0' description: Creates or updates a document in an index. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/document-apis/index-document/ parameters: - $ref: '#/components/parameters/index::path.id' - $ref: '#/components/parameters/index::path.index' @@ -1315,6 +1373,8 @@ paths: x-operation-group: explain x-version-added: '1.0' description: Returns information about why a specific matches (or doesn't match) a query. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/explain/ parameters: - $ref: '#/components/parameters/explain::path.id' - $ref: '#/components/parameters/explain::path.index' @@ -1341,6 +1401,8 @@ paths: x-operation-group: field_caps x-version-added: '1.0' description: Returns the information about the capabilities of fields among multiple indices. + externalDocs: + url: https://opensearch.org/docs/latest/field-types/supported-field-types/alias/#using-aliases-in-field-capabilities-api-operations parameters: - $ref: '#/components/parameters/field_caps::path.index' - $ref: '#/components/parameters/field_caps::query.fields' @@ -1358,6 +1420,8 @@ paths: x-operation-group: field_caps x-version-added: '1.0' description: Returns the information about the capabilities of fields among multiple indices. + externalDocs: + url: https://opensearch.org/docs/latest/field-types/supported-field-types/alias/#using-aliases-in-field-capabilities-api-operations parameters: - $ref: '#/components/parameters/field_caps::path.index' - $ref: '#/components/parameters/field_caps::query.fields' @@ -1376,6 +1440,8 @@ paths: x-operation-group: mget x-version-added: '1.0' description: Allows to get multiple documents in one request. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/document-apis/multi-get/ parameters: - $ref: '#/components/parameters/mget::path.index' - $ref: '#/components/parameters/mget::query.stored_fields' @@ -1396,6 +1462,8 @@ paths: x-operation-group: mget x-version-added: '1.0' description: Allows to get multiple documents in one request. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/document-apis/multi-get/ parameters: - $ref: '#/components/parameters/mget::path.index' - $ref: '#/components/parameters/mget::query.stored_fields' @@ -1417,6 +1485,8 @@ paths: x-operation-group: msearch x-version-added: '1.0' description: Allows to execute several search operations in one request. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/multi-search/ parameters: - $ref: '#/components/parameters/msearch::path.index' - $ref: '#/components/parameters/msearch::query.search_type' @@ -1436,6 +1506,8 @@ paths: x-operation-group: msearch x-version-added: '1.0' description: Allows to execute several search operations in one request. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/multi-search/ parameters: - $ref: '#/components/parameters/msearch::path.index' - $ref: '#/components/parameters/msearch::query.search_type' @@ -1456,6 +1528,8 @@ paths: x-operation-group: msearch_template x-version-added: '1.0' description: Allows to execute several search template operations in one request. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/search-template/ parameters: - $ref: '#/components/parameters/msearch_template::path.index' - $ref: '#/components/parameters/msearch_template::query.search_type' @@ -1473,6 +1547,8 @@ paths: x-operation-group: msearch_template x-version-added: '1.0' description: Allows to execute several search template operations in one request. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/search-template/ parameters: - $ref: '#/components/parameters/msearch_template::path.index' - $ref: '#/components/parameters/msearch_template::query.search_type' @@ -1491,6 +1567,8 @@ paths: x-operation-group: mtermvectors x-version-added: '1.0' description: Returns multiple termvectors in one request. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/mtermvectors::path.index' - $ref: '#/components/parameters/mtermvectors::query.ids' @@ -1515,6 +1593,8 @@ paths: x-operation-group: mtermvectors x-version-added: '1.0' description: Returns multiple termvectors in one request. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/mtermvectors::path.index' - $ref: '#/components/parameters/mtermvectors::query.ids' @@ -1540,6 +1620,8 @@ paths: x-operation-group: rank_eval x-version-added: '1.0' description: Allows to evaluate the quality of ranked search results over a set of typical search queries. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/rank-eval/ parameters: - $ref: '#/components/parameters/rank_eval::path.index' - $ref: '#/components/parameters/rank_eval::query.ignore_unavailable' @@ -1556,6 +1638,8 @@ paths: x-operation-group: rank_eval x-version-added: '1.0' description: Allows to evaluate the quality of ranked search results over a set of typical search queries. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/rank-eval/ parameters: - $ref: '#/components/parameters/rank_eval::path.index' - $ref: '#/components/parameters/rank_eval::query.ignore_unavailable' @@ -1573,6 +1657,8 @@ paths: x-operation-group: search x-version-added: '1.0' description: Returns results matching a query. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/search/ parameters: - $ref: '#/components/parameters/search::path.index' - $ref: '#/components/parameters/search::query.analyzer' @@ -1629,6 +1715,8 @@ paths: x-operation-group: search x-version-added: '1.0' description: Returns results matching a query. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/search/ parameters: - $ref: '#/components/parameters/search::path.index' - $ref: '#/components/parameters/search::query.analyzer' @@ -1704,6 +1792,8 @@ paths: x-operation-group: search_template x-version-added: '1.0' description: Allows to use the Mustache language to pre-render a search definition. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/search-template/ parameters: - $ref: '#/components/parameters/search_template::path.index' - $ref: '#/components/parameters/search_template::query.ignore_unavailable' @@ -1729,6 +1819,8 @@ paths: x-operation-group: search_template x-version-added: '1.0' description: Allows to use the Mustache language to pre-render a search definition. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/search-template/ parameters: - $ref: '#/components/parameters/search_template::path.index' - $ref: '#/components/parameters/search_template::query.ignore_unavailable' @@ -1755,6 +1847,8 @@ paths: x-operation-group: search_shards x-version-added: '1.0' description: Returns information about the indices and shards that a search request would be executed against. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/search_shards::path.index' - $ref: '#/components/parameters/search_shards::query.preference' @@ -1771,6 +1865,8 @@ paths: x-operation-group: search_shards x-version-added: '1.0' description: Returns information about the indices and shards that a search request would be executed against. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/search_shards::path.index' - $ref: '#/components/parameters/search_shards::query.preference' @@ -1858,6 +1954,8 @@ paths: x-operation-group: termvectors x-version-added: '1.0' description: Returns information and statistics about terms in the fields of a particular document. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/termvectors::path.index' - $ref: '#/components/parameters/termvectors::query.term_statistics' @@ -1882,6 +1980,8 @@ paths: x-operation-group: termvectors x-version-added: '1.0' description: Returns information and statistics about terms in the fields of a particular document. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/termvectors::path.index' - $ref: '#/components/parameters/termvectors::path.id' @@ -1906,6 +2006,8 @@ paths: x-operation-group: termvectors x-version-added: '1.0' description: Returns information and statistics about terms in the fields of a particular document. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/termvectors::path.index' - $ref: '#/components/parameters/termvectors::path.id' diff --git a/spec/namespaces/cat.yaml b/spec/namespaces/cat.yaml index fa57a6aa4..552b32cbc 100644 --- a/spec/namespaces/cat.yaml +++ b/spec/namespaces/cat.yaml @@ -43,6 +43,8 @@ paths: x-operation-group: cat.aliases x-version-added: '1.0' description: Shows information about currently configured aliases to indices including filter and routing infos. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cat/cat-aliases/ parameters: - $ref: '#/components/parameters/cat.aliases::path.name' - $ref: '#/components/parameters/cat.aliases::query.format' @@ -82,6 +84,8 @@ paths: x-operation-group: cat.allocation x-version-added: '1.0' description: Provides a snapshot of how many shards are allocated to each data node and how much disk space they are using. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cat/cat-allocation/ parameters: - $ref: '#/components/parameters/cat.allocation::path.node_id' - $ref: '#/components/parameters/cat.allocation::query.format' @@ -139,6 +143,8 @@ paths: x-operation-group: cat.count x-version-added: '1.0' description: Provides quick access to the document count of the entire cluster, or individual indices. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cat/cat-count/ parameters: - $ref: '#/components/parameters/cat.count::path.index' - $ref: '#/components/parameters/cat.count::query.format' @@ -174,6 +180,8 @@ paths: x-operation-group: cat.fielddata x-version-added: '1.0' description: Shows how much heap memory is currently being used by fielddata on every data node in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cat/cat-field-data/ parameters: - $ref: '#/components/parameters/cat.fielddata::path.fields' - $ref: '#/components/parameters/cat.fielddata::query.format' @@ -237,6 +245,8 @@ paths: x-operation-group: cat.indices x-version-added: '1.0' description: 'Returns information about indices: number of primaries and replicas, document counts, disk size, ...' + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cat/cat-indices/ parameters: - $ref: '#/components/parameters/cat.indices::path.index' - $ref: '#/components/parameters/cat.indices::query.format' @@ -429,6 +439,8 @@ paths: x-operation-group: cat.recovery x-version-added: '1.0' description: Returns information about index shard recoveries, both on-going completed. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cat/cat-plugins/ parameters: - $ref: '#/components/parameters/cat.recovery::path.index' - $ref: '#/components/parameters/cat.recovery::query.format' @@ -499,6 +511,8 @@ paths: x-operation-group: cat.segment_replication x-version-added: 2.6.0 description: Returns information about both on-going and latest completed Segment Replication events. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cat/cat-segment-replication/ parameters: - $ref: '#/components/parameters/cat.segment_replication::path.index' - $ref: '#/components/parameters/cat.segment_replication::query.format' @@ -547,6 +561,8 @@ paths: x-operation-group: cat.segments x-version-added: '1.0' description: Provides low-level information about the segments in the shards of an index. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cat/cat-segments/ parameters: - $ref: '#/components/parameters/cat.segments::path.index' - $ref: '#/components/parameters/cat.segments::query.format' @@ -588,6 +604,8 @@ paths: x-operation-group: cat.shards x-version-added: '1.0' description: Provides a detailed view of shard allocation on nodes. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cat/cat-shards/ parameters: - $ref: '#/components/parameters/cat.shards::path.index' - $ref: '#/components/parameters/cat.shards::query.format' @@ -630,6 +648,8 @@ paths: x-operation-group: cat.snapshots x-version-added: '1.0' description: Returns all snapshots in a specific repository. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cat/cat-snapshots/ parameters: - $ref: '#/components/parameters/cat.snapshots::path.repository' - $ref: '#/components/parameters/cat.snapshots::query.format' @@ -692,6 +712,8 @@ paths: x-operation-group: cat.templates x-version-added: '1.0' description: Returns information about existing templates. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cat/cat-templates/ parameters: - $ref: '#/components/parameters/cat.templates::path.name' - $ref: '#/components/parameters/cat.templates::query.format' @@ -736,6 +758,8 @@ paths: description: |- Returns cluster-wide thread pool statistics per node. By default the active, queue and rejected statistics are returned for all thread pools. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cat/cat-thread-pool/ parameters: - $ref: '#/components/parameters/cat.thread_pool::path.thread_pool_patterns' - $ref: '#/components/parameters/cat.thread_pool::query.format' diff --git a/spec/namespaces/cluster.yaml b/spec/namespaces/cluster.yaml index a04d55adb..3de22a116 100644 --- a/spec/namespaces/cluster.yaml +++ b/spec/namespaces/cluster.yaml @@ -25,6 +25,8 @@ paths: x-operation-group: cluster.allocation_explain x-version-added: '1.0' description: Provides explanations for shard allocations in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-allocation/ parameters: - $ref: '#/components/parameters/cluster.allocation_explain::query.include_yes_decisions' - $ref: '#/components/parameters/cluster.allocation_explain::query.include_disk_info' @@ -102,6 +104,8 @@ paths: x-operation-group: cluster.health x-version-added: '1.0' description: Returns basic information about the health of the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-health/ parameters: - $ref: '#/components/parameters/cluster.health::path.index' - $ref: '#/components/parameters/cluster.health::query.expand_wildcards' @@ -255,6 +259,8 @@ paths: x-operation-group: cluster.state x-version-added: '1.0' description: Returns a comprehensive information about the state of the cluster. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/cluster.state::path.metric' - $ref: '#/components/parameters/cluster.state::query.local' @@ -275,6 +281,8 @@ paths: x-operation-group: cluster.state x-version-added: '1.0' description: Returns a comprehensive information about the state of the cluster. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/cluster.state::path.index' - $ref: '#/components/parameters/cluster.state::path.metric' @@ -310,6 +318,8 @@ paths: x-operation-group: cluster.stats x-version-added: '1.0' description: Returns high-level overview of cluster statistics. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-stats/ parameters: - $ref: '#/components/parameters/cluster.stats::path.node_id' - $ref: '#/components/parameters/cluster.stats::query.flat_settings' @@ -380,6 +390,8 @@ paths: x-operation-group: cluster.get_component_template x-version-added: '1.0' description: Returns one or more component templates. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/cluster.get_component_template::path.name' - $ref: '#/components/parameters/cluster.get_component_template::query.master_timeout' @@ -408,6 +420,8 @@ paths: x-operation-group: cluster.put_component_template x-version-added: '1.0' description: Creates or updates a component template. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/index-templates/#use-component-templates-to-create-an-index-template parameters: - $ref: '#/components/parameters/cluster.put_component_template::path.name' - $ref: '#/components/parameters/cluster.put_component_template::query.create' diff --git a/spec/namespaces/indices.yaml b/spec/namespaces/indices.yaml index e37c1a538..5c4ebdd6c 100644 --- a/spec/namespaces/indices.yaml +++ b/spec/namespaces/indices.yaml @@ -26,6 +26,8 @@ paths: x-operation-group: indices.get_alias x-version-added: '1.0' description: Returns an alias. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/index-alias/ parameters: - $ref: '#/components/parameters/indices.get_alias::path.name' - $ref: '#/components/parameters/indices.get_alias::query.ignore_unavailable' @@ -88,6 +90,8 @@ paths: x-operation-group: indices.analyze x-version-added: '1.0' description: Performs the analysis process on a text and return the tokens breakdown of the text. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/analyze-apis/perform-text-analysis/ parameters: - $ref: '#/components/parameters/indices.analyze::query.index' requestBody: @@ -157,6 +161,8 @@ paths: x-operation-group: indices.get_data_stream x-version-added: '1.0' description: Returns data streams. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/data-streams/ parameters: - $ref: '#/components/parameters/indices.get_data_stream::path.name' responses: @@ -182,6 +188,8 @@ paths: x-operation-group: indices.data_streams_stats x-version-added: '1.0' description: Provides statistics on operations happening in a data stream. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/data-streams/ parameters: - $ref: '#/components/parameters/indices.data_streams_stats::path.name' responses: @@ -193,6 +201,8 @@ paths: x-operation-group: indices.flush x-version-added: '1.0' description: Performs the flush operation on one or more indices. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.flush::query.force' - $ref: '#/components/parameters/indices.flush::query.wait_if_ongoing' @@ -278,6 +288,8 @@ paths: x-operation-group: indices.simulate_template x-version-added: '1.0' description: Simulate resolving the given template name or body. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.simulate_template::path.name' - $ref: '#/components/parameters/indices.simulate_template::query.create' @@ -329,6 +341,8 @@ paths: x-operation-group: indices.get_index_template x-version-added: '1.0' description: Returns an index template. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/index-templates/ parameters: - $ref: '#/components/parameters/indices.get_index_template::path.name' - $ref: '#/components/parameters/indices.get_index_template::query.flat_settings' @@ -359,6 +373,8 @@ paths: x-operation-group: indices.put_index_template x-version-added: '1.0' description: Creates or updates an index template. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/index-templates/ parameters: - $ref: '#/components/parameters/indices.put_index_template::path.name' - $ref: '#/components/parameters/indices.put_index_template::query.create' @@ -444,6 +460,8 @@ paths: x-operation-group: indices.refresh x-version-added: '1.0' description: Performs the refresh operation in one or more indices. + externalDocs: + url: https://opensearch.org/docs/latest/tuning-your-cluster/availability-and-recovery/remote-store/index/#refresh-level-and-request-level-durability parameters: - $ref: '#/components/parameters/indices.refresh::query.ignore_unavailable' - $ref: '#/components/parameters/indices.refresh::query.allow_no_indices' @@ -542,6 +560,8 @@ paths: x-operation-group: indices.get_settings x-version-added: '1.0' description: Returns settings for one or more indices. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/index-apis/get-settings/ parameters: - $ref: '#/components/parameters/indices.get_settings::path.name' - $ref: '#/components/parameters/indices.get_settings::query.master_timeout' @@ -598,6 +618,8 @@ paths: x-operation-group: indices.stats x-version-added: '1.0' description: Provides statistics on operations happening in an index. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.stats::path.metric' - $ref: '#/components/parameters/indices.stats::query.completion_fields' @@ -649,6 +671,8 @@ paths: x-operation-group: indices.get_template x-version-added: '1.0' description: Returns an index template. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.get_template::path.name' - $ref: '#/components/parameters/indices.get_template::query.flat_settings' @@ -679,6 +703,8 @@ paths: x-operation-group: indices.put_template x-version-added: '1.0' description: Creates or updates an index template. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/index-templates/ parameters: - $ref: '#/components/parameters/indices.put_template::path.name' - $ref: '#/components/parameters/indices.put_template::query.order' @@ -770,6 +796,8 @@ paths: x-operation-group: indices.validate_query x-version-added: '1.0' description: Allows a user to validate a potentially expensive query without executing it. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.validate_query::query.explain' - $ref: '#/components/parameters/indices.validate_query::query.ignore_unavailable' @@ -818,6 +846,8 @@ paths: description: |- Updates an alias to point to a new index when the existing index is considered to be too large or too old. + externalDocs: + url: https://opensearch.org/docs/latest/dashboards/im-dashboards/rollover/ parameters: - $ref: '#/components/parameters/indices.rollover::path.alias' - $ref: '#/components/parameters/indices.rollover::path.new_index' @@ -912,6 +942,8 @@ paths: x-operation-group: indices.get_alias x-version-added: '1.0' description: Returns an alias. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/index-alias/ parameters: - $ref: '#/components/parameters/indices.get_alias::path.index' - $ref: '#/components/parameters/indices.get_alias::query.ignore_unavailable' @@ -943,6 +975,8 @@ paths: x-operation-group: indices.get_alias x-version-added: '1.0' description: Returns an alias. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/index-alias/ parameters: - $ref: '#/components/parameters/indices.get_alias::path.index' - $ref: '#/components/parameters/indices.get_alias::path.name' @@ -958,6 +992,8 @@ paths: x-operation-group: indices.exists_alias x-version-added: '1.0' description: Returns information about whether a particular alias exists. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.exists_alias::path.index' - $ref: '#/components/parameters/indices.exists_alias::path.name' @@ -973,6 +1009,8 @@ paths: x-operation-group: indices.put_alias x-version-added: '1.0' description: Creates or updates an alias. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/index-alias/#create-aliases parameters: - $ref: '#/components/parameters/indices.put_alias::path.index' - $ref: '#/components/parameters/indices.put_alias::path.name' @@ -1008,6 +1046,8 @@ paths: x-operation-group: indices.delete_alias x-version-added: '1.0' description: Deletes an alias. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/index-alias/#delete-aliases parameters: - $ref: '#/components/parameters/indices.delete_alias::path.index' - $ref: '#/components/parameters/indices.delete_alias::path.name' @@ -1022,6 +1062,8 @@ paths: x-operation-group: indices.put_alias x-version-added: '1.0' description: Creates or updates an alias. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/index-alias/#create-aliases parameters: - $ref: '#/components/parameters/indices.put_alias::path.index' - $ref: '#/components/parameters/indices.put_alias::path.name' @@ -1038,6 +1080,8 @@ paths: x-operation-group: indices.put_alias x-version-added: '1.0' description: Creates or updates an alias. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/index-alias/#create-aliases parameters: - $ref: '#/components/parameters/indices.put_alias::path.index' - $ref: '#/components/parameters/indices.put_alias::path.name' @@ -1055,6 +1099,8 @@ paths: x-operation-group: indices.analyze x-version-added: '1.0' description: Performs the analysis process on a text and return the tokens breakdown of the text. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/analyze-apis/perform-text-analysis/ parameters: - $ref: '#/components/parameters/indices.analyze::path.index' - $ref: '#/components/parameters/indices.analyze::query.index' @@ -1068,6 +1114,8 @@ paths: x-operation-group: indices.analyze x-version-added: '1.0' description: Performs the analysis process on a text and return the tokens breakdown of the text. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/analyze-apis/perform-text-analysis/ parameters: - $ref: '#/components/parameters/indices.analyze::path.index' - $ref: '#/components/parameters/indices.analyze::query.index' @@ -1102,6 +1150,8 @@ paths: x-operation-group: indices.clear_cache x-version-added: '1.0' description: Clears all or specific caches for one or more indices. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/index-apis/clear-index-cache/ parameters: - $ref: '#/components/parameters/indices.clear_cache::path.index' - $ref: '#/components/parameters/indices.clear_cache::query.fielddata' @@ -1121,6 +1171,8 @@ paths: x-operation-group: indices.clone x-version-added: '1.0' description: Clones an index. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/index-apis/clone/ parameters: - $ref: '#/components/parameters/indices.clone::path.index' - $ref: '#/components/parameters/indices.clone::path.target' @@ -1182,6 +1234,8 @@ paths: x-operation-group: indices.flush x-version-added: '1.0' description: Performs the flush operation on one or more indices. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.flush::path.index' - $ref: '#/components/parameters/indices.flush::query.force' @@ -1197,6 +1251,8 @@ paths: x-operation-group: indices.flush x-version-added: '1.0' description: Performs the flush operation on one or more indices. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.flush::path.index' - $ref: '#/components/parameters/indices.flush::query.force' @@ -1213,6 +1269,8 @@ paths: x-operation-group: indices.forcemerge x-version-added: '1.0' description: Performs the force merge operation on one or more indices. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.forcemerge::path.index' - $ref: '#/components/parameters/indices.forcemerge::query.flush' @@ -1232,6 +1290,8 @@ paths: x-operation-group: indices.get_mapping x-version-added: '1.0' description: Returns mappings for one or more indices. + externalDocs: + url: https://opensearch.org/docs/latest/field-types/index/#get-a-mapping parameters: - $ref: '#/components/parameters/indices.get_mapping::path.index' - $ref: '#/components/parameters/indices.get_mapping::query.ignore_unavailable' @@ -1248,6 +1308,8 @@ paths: x-operation-group: indices.put_mapping x-version-added: '1.0' description: Updates the index mappings. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/index-apis/put-mapping/ parameters: - $ref: '#/components/parameters/indices.put_mapping::path.index' - $ref: '#/components/parameters/indices.put_mapping::query.timeout' @@ -1289,6 +1351,8 @@ paths: x-operation-group: indices.get_field_mapping x-version-added: '1.0' description: Returns mapping for one or more fields. + externalDocs: + url: https://opensearch.org/docs/latest/field-types/index/ parameters: - $ref: '#/components/parameters/indices.get_field_mapping::path.index' - $ref: '#/components/parameters/indices.get_field_mapping::path.fields' @@ -1328,6 +1392,8 @@ paths: x-operation-group: indices.recovery x-version-added: '1.0' description: Returns information about ongoing index shard recoveries. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.recovery::path.index' - $ref: '#/components/parameters/indices.recovery::query.detailed' @@ -1341,6 +1407,8 @@ paths: x-operation-group: indices.refresh x-version-added: '1.0' description: Performs the refresh operation in one or more indices. + externalDocs: + url: https://opensearch.org/docs/latest/tuning-your-cluster/availability-and-recovery/remote-store/index/#refresh-level-and-request-level-durability parameters: - $ref: '#/components/parameters/indices.refresh::path.index' - $ref: '#/components/parameters/indices.refresh::query.ignore_unavailable' @@ -1354,6 +1422,8 @@ paths: x-operation-group: indices.refresh x-version-added: '1.0' description: Performs the refresh operation in one or more indices. + externalDocs: + url: https://opensearch.org/docs/latest/tuning-your-cluster/availability-and-recovery/remote-store/index/#refresh-level-and-request-level-durability parameters: - $ref: '#/components/parameters/indices.refresh::path.index' - $ref: '#/components/parameters/indices.refresh::query.ignore_unavailable' @@ -1368,6 +1438,8 @@ paths: x-operation-group: indices.segments x-version-added: '1.0' description: Provides low-level information about segments in a Lucene index. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.segments::path.index' - $ref: '#/components/parameters/indices.segments::query.ignore_unavailable' @@ -1383,6 +1455,8 @@ paths: x-operation-group: indices.get_settings x-version-added: '1.0' description: Returns settings for one or more indices. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/index-apis/get-settings/ parameters: - $ref: '#/components/parameters/indices.get_settings::path.index' - $ref: '#/components/parameters/indices.get_settings::query.master_timeout' @@ -1401,6 +1475,8 @@ paths: x-operation-group: indices.put_settings x-version-added: '1.0' description: Updates the index settings. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/index-apis/update-settings/ parameters: - $ref: '#/components/parameters/indices.put_settings::path.index' - $ref: '#/components/parameters/indices.put_settings::query.master_timeout' @@ -1422,6 +1498,8 @@ paths: x-operation-group: indices.get_settings x-version-added: '1.0' description: Returns settings for one or more indices. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/index-apis/get-settings/ parameters: - $ref: '#/components/parameters/indices.get_settings::path.index' - $ref: '#/components/parameters/indices.get_settings::path.name' @@ -1442,6 +1520,8 @@ paths: x-operation-group: indices.shard_stores x-version-added: '1.0' description: Provides store information for shard copies of indices. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.shard_stores::path.index' - $ref: '#/components/parameters/indices.shard_stores::query.status' @@ -1457,6 +1537,8 @@ paths: x-operation-group: indices.shrink x-version-added: '1.0' description: Allow to shrink an existing index into a new index with fewer primary shards. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/index-apis/shrink-index/ parameters: - $ref: '#/components/parameters/indices.shrink::path.index' - $ref: '#/components/parameters/indices.shrink::path.target' @@ -1500,6 +1582,8 @@ paths: x-operation-group: indices.split x-version-added: '1.0' description: Allows you to split an existing index into a new index with more primary shards. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/index-apis/split/ parameters: - $ref: '#/components/parameters/indices.split::path.index' - $ref: '#/components/parameters/indices.split::path.target' @@ -1543,6 +1627,8 @@ paths: x-operation-group: indices.stats x-version-added: '1.0' description: Provides statistics on operations happening in an index. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.stats::path.index' - $ref: '#/components/parameters/indices.stats::query.completion_fields' @@ -1563,6 +1649,8 @@ paths: x-operation-group: indices.stats x-version-added: '1.0' description: Provides statistics on operations happening in an index. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.stats::path.index' - $ref: '#/components/parameters/indices.stats::path.metric' @@ -1584,6 +1672,8 @@ paths: x-operation-group: indices.get_upgrade x-version-added: '1.0' description: The _upgrade API is no longer useful and will be removed. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.get_upgrade::path.index' - $ref: '#/components/parameters/indices.get_upgrade::query.ignore_unavailable' @@ -1597,6 +1687,8 @@ paths: x-operation-group: indices.upgrade x-version-added: '1.0' description: The _upgrade API is no longer useful and will be removed. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.upgrade::path.index' - $ref: '#/components/parameters/indices.upgrade::query.allow_no_indices' @@ -1613,6 +1705,8 @@ paths: x-operation-group: indices.validate_query x-version-added: '1.0' description: Allows a user to validate a potentially expensive query without executing it. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.validate_query::path.index' - $ref: '#/components/parameters/indices.validate_query::query.explain' @@ -1637,6 +1731,8 @@ paths: x-operation-group: indices.validate_query x-version-added: '1.0' description: Allows a user to validate a potentially expensive query without executing it. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.validate_query::path.index' - $ref: '#/components/parameters/indices.validate_query::query.explain' @@ -2201,7 +2297,15 @@ components: content: application/json: schema: - $ref: '../schemas/indices.forcemerge._types.yaml#/components/schemas/ForceMergeResponseBody' + allOf: + - $ref: '../schemas/_common.yaml#/components/schemas/ShardsOperationResponseBase' + - type: object + properties: + task: + description: |- + task contains a task id returned when wait_for_completion=false, + you can use the task_id to get the status of the task at _tasks/ + type: string indices.get@200: description: '' content: diff --git a/spec/namespaces/ingest.yaml b/spec/namespaces/ingest.yaml index 2048e73cc..ebd6e94b0 100644 --- a/spec/namespaces/ingest.yaml +++ b/spec/namespaces/ingest.yaml @@ -38,6 +38,8 @@ paths: x-operation-group: ingest.simulate x-version-added: '1.0' description: Allows to simulate a pipeline with example documents. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/ingest-apis/simulate-ingest/ parameters: - $ref: '#/components/parameters/ingest.simulate::query.verbose' requestBody: @@ -66,6 +68,8 @@ paths: x-operation-group: ingest.get_pipeline x-version-added: '1.0' description: Returns a pipeline. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/ingest-apis/get-ingest/ parameters: - $ref: '#/components/parameters/ingest.get_pipeline::path.id' - $ref: '#/components/parameters/ingest.get_pipeline::query.master_timeout' @@ -96,6 +100,8 @@ paths: x-operation-group: ingest.simulate x-version-added: '1.0' description: Allows to simulate a pipeline with example documents. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/ingest-apis/simulate-ingest/ parameters: - $ref: '#/components/parameters/ingest.simulate::path.id' - $ref: '#/components/parameters/ingest.simulate::query.verbose' @@ -109,6 +115,8 @@ paths: x-operation-group: ingest.simulate x-version-added: '1.0' description: Allows to simulate a pipeline with example documents. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/ingest-apis/simulate-ingest/ parameters: - $ref: '#/components/parameters/ingest.simulate::path.id' - $ref: '#/components/parameters/ingest.simulate::query.verbose' diff --git a/spec/namespaces/knn.yaml b/spec/namespaces/knn.yaml index f8ca5d3dd..f0ab87112 100644 --- a/spec/namespaces/knn.yaml +++ b/spec/namespaces/knn.yaml @@ -55,6 +55,8 @@ paths: - $ref: '#/components/parameters/knn.search_models::query.max_concurrent_shard_requests' - $ref: '#/components/parameters/knn.search_models::query.pre_filter_shard_size' - $ref: '#/components/parameters/knn.search_models::query.rest_total_hits_as_int' + requestBody: + $ref: '#/components/requestBodies/knn.search_models' responses: '200': $ref: '#/components/responses/knn.search_models@200' @@ -63,6 +65,8 @@ paths: x-operation-group: knn.search_models x-version-added: '1.0' description: Use an OpenSearch query to search for models in the index. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/knn/api/#search-model parameters: - $ref: '#/components/parameters/knn.search_models::query.analyzer' - $ref: '#/components/parameters/knn.search_models::query.analyze_wildcard' @@ -157,6 +161,8 @@ paths: x-operation-group: knn.train_model x-version-added: '1.0' description: Create and train a model that can be used for initializing k-NN native library indexes during indexing. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/knn/api/#train-model parameters: - $ref: '#/components/parameters/knn.train_model::path.model_id' - $ref: '#/components/parameters/knn.train_model::query.preference' @@ -184,6 +190,8 @@ paths: x-operation-group: knn.stats x-version-added: '1.0' description: Provides information about the current status of the k-NN plugin. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/knn/api/#stats parameters: - $ref: '#/components/parameters/knn.stats::path.stat' - $ref: '#/components/parameters/knn.stats::query.timeout' @@ -195,7 +203,7 @@ paths: operationId: knn.warmup.0 x-operation-group: knn.warmup x-version-added: '1.0' - description: Preloads native library files into memory, reducing initial search latency for specified indexes + description: Preloads native library files into memory, reducing initial search latency for specified indexes. externalDocs: url: https://opensearch.org/docs/latest/search-plugins/knn/api/#warmup-operation parameters: @@ -209,6 +217,8 @@ paths: x-operation-group: knn.stats x-version-added: '1.0' description: Provides information about the current status of the k-NN plugin. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/knn/api/#stats parameters: - $ref: '#/components/parameters/knn.stats::path.node_id' - $ref: '#/components/parameters/knn.stats::query.timeout' @@ -221,6 +231,8 @@ paths: x-operation-group: knn.stats x-version-added: '1.0' description: Provides information about the current status of the k-NN plugin. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/knn/api/#stats parameters: - $ref: '#/components/parameters/knn.stats::path.node_id' - $ref: '#/components/parameters/knn.stats::path.stat' diff --git a/spec/namespaces/nodes.yaml b/spec/namespaces/nodes.yaml index 69ac4503b..ccffa85de 100644 --- a/spec/namespaces/nodes.yaml +++ b/spec/namespaces/nodes.yaml @@ -36,6 +36,8 @@ paths: x-version-added: '1.0' x-version-deprecated: '1.0' description: Returns information about hot threads on each node in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/ parameters: - $ref: '#/components/parameters/nodes.hot_threads::query.interval' - $ref: '#/components/parameters/nodes.hot_threads::query.snapshots' @@ -56,6 +58,8 @@ paths: x-version-added: '1.0' x-version-deprecated: '1.0' description: Returns information about hot threads on each node in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/ parameters: - $ref: '#/components/parameters/nodes.hot_threads::path.node_id' - $ref: '#/components/parameters/nodes.hot_threads::query.interval' @@ -77,6 +81,8 @@ paths: x-version-added: '1.0' x-version-deprecated: '1.0' description: Returns information about hot threads on each node in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/ parameters: - $ref: '#/components/parameters/nodes.hot_threads::path.node_id' - $ref: '#/components/parameters/nodes.hot_threads::query.interval' @@ -108,6 +114,8 @@ paths: x-operation-group: nodes.hot_threads x-version-added: '1.0' description: Returns information about hot threads on each node in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/ parameters: - $ref: '#/components/parameters/nodes.hot_threads::query.interval' - $ref: '#/components/parameters/nodes.hot_threads::query.snapshots' @@ -128,6 +136,8 @@ paths: x-version-added: '1.0' x-version-deprecated: '1.0' description: Returns information about hot threads on each node in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/ parameters: - $ref: '#/components/parameters/nodes.hot_threads::query.interval' - $ref: '#/components/parameters/nodes.hot_threads::query.snapshots' @@ -179,6 +189,8 @@ paths: x-operation-group: nodes.stats x-version-added: '1.0' description: Returns statistical information about nodes in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-usage/ parameters: - $ref: '#/components/parameters/nodes.stats::path.metric' - $ref: '#/components/parameters/nodes.stats::query.completion_fields' @@ -198,6 +210,8 @@ paths: x-operation-group: nodes.stats x-version-added: '1.0' description: Returns statistical information about nodes in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-usage/ parameters: - $ref: '#/components/parameters/nodes.stats::path.metric' - $ref: '#/components/parameters/nodes.stats::path.index_metric' @@ -231,6 +245,8 @@ paths: x-operation-group: nodes.usage x-version-added: '1.0' description: Returns low-level information about REST actions usage on nodes. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/nodes.usage::path.metric' - $ref: '#/components/parameters/nodes.usage::query.timeout' @@ -243,6 +259,8 @@ paths: x-operation-group: nodes.info x-version-added: '1.0' description: Returns information about nodes in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-info/ parameters: - $ref: '#/components/parameters/nodes.info::path.node_id' - $ref: '#/components/parameters/nodes.info::query.flat_settings' @@ -256,6 +274,8 @@ paths: x-operation-group: nodes.hot_threads x-version-added: '1.0' description: Returns information about hot threads on each node in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/ parameters: - $ref: '#/components/parameters/nodes.hot_threads::path.node_id' - $ref: '#/components/parameters/nodes.hot_threads::query.interval' @@ -277,6 +297,8 @@ paths: x-version-added: '1.0' x-version-deprecated: '1.0' description: Returns information about hot threads on each node in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/ parameters: - $ref: '#/components/parameters/nodes.hot_threads::path.node_id' - $ref: '#/components/parameters/nodes.hot_threads::query.interval' @@ -294,6 +316,8 @@ paths: x-operation-group: nodes.reload_secure_settings x-version-added: '1.0' description: Reloads secure settings. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-reload-secure/ parameters: - $ref: '#/components/parameters/nodes.reload_secure_settings::path.node_id' - $ref: '#/components/parameters/nodes.reload_secure_settings::query.timeout' @@ -308,6 +332,8 @@ paths: x-operation-group: nodes.stats x-version-added: '1.0' description: Returns statistical information about nodes in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-usage/ parameters: - $ref: '#/components/parameters/nodes.stats::path.node_id' - $ref: '#/components/parameters/nodes.stats::query.completion_fields' @@ -327,6 +353,8 @@ paths: x-operation-group: nodes.stats x-version-added: '1.0' description: Returns statistical information about nodes in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-usage/ parameters: - $ref: '#/components/parameters/nodes.stats::path.metric' - $ref: '#/components/parameters/nodes.stats::path.node_id' @@ -347,6 +375,8 @@ paths: x-operation-group: nodes.stats x-version-added: '1.0' description: Returns statistical information about nodes in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-usage/ parameters: - $ref: '#/components/parameters/nodes.stats::path.metric' - $ref: '#/components/parameters/nodes.stats::path.index_metric' @@ -368,6 +398,8 @@ paths: x-operation-group: nodes.usage x-version-added: '1.0' description: Returns low-level information about REST actions usage on nodes. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/nodes.usage::path.node_id' - $ref: '#/components/parameters/nodes.usage::query.timeout' @@ -380,6 +412,8 @@ paths: x-operation-group: nodes.usage x-version-added: '1.0' description: Returns low-level information about REST actions usage on nodes. + externalDocs: + url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/nodes.usage::path.metric' - $ref: '#/components/parameters/nodes.usage::path.node_id' @@ -393,6 +427,8 @@ paths: x-operation-group: nodes.info x-version-added: '1.0' description: Returns information about nodes in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-info/ parameters: - $ref: '#/components/parameters/nodes.info::path.node_id' - $ref: '#/components/parameters/nodes.info::path.metric' diff --git a/spec/namespaces/security.yaml b/spec/namespaces/security.yaml index 6df210adb..06a4d6bab 100644 --- a/spec/namespaces/security.yaml +++ b/spec/namespaces/security.yaml @@ -231,7 +231,7 @@ paths: operationId: security.get_distinguished_names.0 x-operation-group: security.get_distinguished_names x-version-added: '1.0' - description: Retrieves all distinguished names in the allow list. + description: Retrieves distinguished names. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-distinguished-names responses: @@ -266,7 +266,9 @@ paths: operationId: security.get_distinguished_names.1 x-operation-group: security.get_distinguished_names x-version-added: '1.0' - description: Retrieve distinguished names of a specified cluster. + description: Retrieves distinguished names. + externalDocs: + url: https://opensearch.org/docs/latest/security/access-control/api/#get-distinguished-names parameters: - $ref: '#/components/parameters/security.get_distinguished_names::path.cluster_name' responses: @@ -607,7 +609,7 @@ components: content: application/json: schema: - $ref: '../schemas/security._common.yaml#/components/schemas/Action_Group' + $ref: '../schemas/security._common.yaml#/components/schemas/ActionGroup' required: true security.create_role: content: diff --git a/spec/namespaces/snapshot.yaml b/spec/namespaces/snapshot.yaml index bdbe4115e..6adb93040 100644 --- a/spec/namespaces/snapshot.yaml +++ b/spec/namespaces/snapshot.yaml @@ -55,6 +55,8 @@ paths: x-operation-group: snapshot.get_repository x-version-added: '1.0' description: Returns information about a repository. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/snapshots/get-snapshot-repository/ parameters: - $ref: '#/components/parameters/snapshot.get_repository::path.repository' - $ref: '#/components/parameters/snapshot.get_repository::query.master_timeout' @@ -68,6 +70,8 @@ paths: x-operation-group: snapshot.create_repository x-version-added: '1.0' description: Creates a repository. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/snapshots/create-repository/ parameters: - $ref: '#/components/parameters/snapshot.create_repository::path.repository' - $ref: '#/components/parameters/snapshot.create_repository::query.master_timeout' @@ -119,6 +123,8 @@ paths: x-operation-group: snapshot.status x-version-added: '1.0' description: Returns information about the status of a snapshot. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/snapshots/get-snapshot-status/ parameters: - $ref: '#/components/parameters/snapshot.status::path.repository' - $ref: '#/components/parameters/snapshot.status::query.master_timeout' @@ -181,6 +187,8 @@ paths: x-operation-group: snapshot.create x-version-added: '1.0' description: Creates a snapshot in a repository. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/snapshots/create-snapshot/ parameters: - $ref: '#/components/parameters/snapshot.create::path.repository' - $ref: '#/components/parameters/snapshot.create::path.snapshot' @@ -254,6 +262,8 @@ paths: x-operation-group: snapshot.status x-version-added: '1.0' description: Returns information about the status of a snapshot. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/snapshots/get-snapshot-status/ parameters: - $ref: '#/components/parameters/snapshot.status::path.repository' - $ref: '#/components/parameters/snapshot.status::path.snapshot' diff --git a/spec/namespaces/tasks.yaml b/spec/namespaces/tasks.yaml index 3c56c1993..d3c542df4 100644 --- a/spec/namespaces/tasks.yaml +++ b/spec/namespaces/tasks.yaml @@ -60,6 +60,8 @@ paths: x-operation-group: tasks.cancel x-version-added: '1.0' description: Cancels a task, if it can be cancelled through an API. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/tasks/#task-canceling parameters: - $ref: '#/components/parameters/tasks.cancel::path.task_id' - $ref: '#/components/parameters/tasks.cancel::query.nodes' diff --git a/spec/schemas/indices.forcemerge._types.yaml b/spec/schemas/indices.forcemerge._types.yaml deleted file mode 100644 index feb71e3c6..000000000 --- a/spec/schemas/indices.forcemerge._types.yaml +++ /dev/null @@ -1,18 +0,0 @@ -openapi: 3.1.0 -info: - title: Schemas of indices.forcemerge._types category - description: Schemas of indices.forcemerge._types category - version: 1.0.0 -paths: {} -components: - schemas: - ForceMergeResponseBody: - allOf: - - $ref: '_common.yaml#/components/schemas/ShardsOperationResponseBase' - - type: object - properties: - task: - description: |- - task contains a task id returned when wait_for_completion=false, - you can use the task_id to get the status of the task at _tasks/ - type: string diff --git a/spec/schemas/security._common.yaml b/spec/schemas/security._common.yaml index 6fc1ead42..00fc5dfc9 100644 --- a/spec/schemas/security._common.yaml +++ b/spec/schemas/security._common.yaml @@ -105,8 +105,8 @@ components: ActionGroupsMap: type: object additionalProperties: - $ref: '#/components/schemas/Action_Group' - Action_Group: + $ref: '#/components/schemas/ActionGroup' + ActionGroup: type: object properties: reserved: diff --git a/tools/linter/PathRefsValidator.ts b/tools/linter/PathRefsValidator.ts index 6ec200d11..7875bf208 100644 --- a/tools/linter/PathRefsValidator.ts +++ b/tools/linter/PathRefsValidator.ts @@ -51,7 +51,7 @@ export default class PathRefsValidator { if(!available.has(path)) return { file: this.root_file.file, location: `Path: ${path}`, - message: `Unresolved path reference: Path ${path} does not exist in namespace file ${ref_file}`, + message: `Unresolved path reference: Path ${path} does not exist in namespace file ${ref_file}.`, }; }).filter((e) => e) as ValidationError[]; }); diff --git a/tools/linter/SchemaRefsValidator.ts b/tools/linter/SchemaRefsValidator.ts index d036b1af2..20da2d269 100644 --- a/tools/linter/SchemaRefsValidator.ts +++ b/tools/linter/SchemaRefsValidator.ts @@ -37,7 +37,7 @@ export default class SchemaRefsValidator { const search = (obj: Record, ref_file: string) => { const ref = obj.$ref; if(ref) { - const file = ref.startsWith('#') ? ref_file : ref.split('#')[0].replace("./", "schemas/"); + const file = ref.startsWith('#') ? ref_file : `schemas/${ref.split('#')[0]}`; const name = ref.split('/').pop(); if(!this.referenced_schemas[file]) this.referenced_schemas[file] = new Set(); this.referenced_schemas[file].add(name); diff --git a/tools/linter/components/NamespaceFile.ts b/tools/linter/components/NamespaceFile.ts index 1316e172e..7a3b95476 100644 --- a/tools/linter/components/NamespaceFile.ts +++ b/tools/linter/components/NamespaceFile.ts @@ -60,7 +60,7 @@ export default class NamespaceFile extends FileValidator { validate_name(name = this.namespace): ValidationError | void { if(name === '_core') return; if(!name.match(NAME_REGEX)) - return this.error(`Invalid namespace name '${name}'. Must match regex: ${NAME_REGEX.source}`, 'File Name'); + return this.error(`Invalid namespace name '${name}'. Must match regex: /${NAME_REGEX.source}/.`, 'File Name'); return; } @@ -94,6 +94,10 @@ export default class NamespaceFile extends FileValidator { return this.error( `Parameter component '${name}' must be named '${expected}' since it is a ${p.in} parameter named '${p.name}'.`, `#/components/parameters/#${name}`); + if(!p.name.match(/^[a-z0-9._]+$/)) + return this.error( + `Invalid parameter name '${p.name}'. A parameter's name can only contain lower-cased alphanumerics, underscores, and periods.`, + `#/components/parameters/#${name}`); }).filter((e) => e) as ValidationError[]; } } \ No newline at end of file diff --git a/tools/linter/components/NamespacesFolder.ts b/tools/linter/components/NamespacesFolder.ts index 52bb94d5c..a8b18c400 100644 --- a/tools/linter/components/NamespacesFolder.ts +++ b/tools/linter/components/NamespacesFolder.ts @@ -22,7 +22,7 @@ export default class NamespacesFolder extends FolderValidator { } return Object.entries(paths).map(([path, namespaces]) => { if(namespaces.length > 1) - return this.error(`Duplicate path '${path}' found in namespaces: ${namespaces.sort().join(', ')}`); + return this.error(`Duplicate path '${path}' found in namespaces: ${namespaces.sort().join(', ')}.`); }).filter((e) => e) as ValidationError[]; } } \ No newline at end of file diff --git a/tools/linter/components/Operation.ts b/tools/linter/components/Operation.ts index f4e036ecf..1be04bf12 100644 --- a/tools/linter/components/Operation.ts +++ b/tools/linter/components/Operation.ts @@ -41,7 +41,7 @@ export default class Operation extends ValidatorBase { if(!this.group || this.group === '') return this.error(`Missing x-operation-group property`); if(!this.group.match(GROUP_REGEX)) - return this.error(`Invalid x-operation-group '${this.group}'. Must match regex: ${GROUP_REGEX.source}`); + return this.error(`Invalid x-operation-group '${this.group}'. Must match regex: /${GROUP_REGEX.source}/.`); } validate_namespace(): ValidationError | void { @@ -49,25 +49,27 @@ export default class Operation extends ValidatorBase { if(expected_namespace === '_core' && this.namespace === undefined) return; if(expected_namespace === '_core' && this.namespace === '_core') - return this.error(`Invalid x-operation-group '${this.group}'. '_core' namespace must be omitted in x-operation-group`); + return this.error(`Invalid x-operation-group '${this.group}'. '_core' namespace must be omitted in x-operation-group.`); if(this.namespace === expected_namespace ) return; return this.error(`Invalid x-operation-group '${this.group}'. '${this.namespace}' namespace detected. ` + - `Only '${expected_namespace}' namespace is allowed in this file`); + `Only '${expected_namespace}' namespace is allowed in this file.`); } validate_description(): ValidationError | void { const description = this.spec.description; if(!description || description === '') - return this.error(`Missing description property`); + return this.error(`Missing description property.`); + if(!description.endsWith('.')) + return this.error(`Description must end with a period.`); } validate_operationId(): ValidationError | void { const id = this.spec.operationId; if(!id || id === '') - return this.error(`Missing operationId property`); + return this.error(`Missing operationId property.`); if(!id.match(new RegExp(`^${this.group_regex}\\.[0-9]+$`))) - return this.error(`Invalid operationId '${id}'. Must be in {x-operation-group}.{number} format`); + return this.error(`Invalid operationId '${id}'. Must be in {x-operation-group}.{number} format.`); } validate_requestBody(): ValidationError | void { @@ -75,16 +77,16 @@ export default class Operation extends ValidatorBase { if(!body) return; const expected = `#/components/requestBodies/${this.group}`; if(body.$ref !== expected) - return this.error(`The requestBody must be a reference object to '${expected}'`); + return this.error(`The requestBody must be a reference object to '${expected}'.`); } validate_responses(): ValidationError[] { const responses = this.spec.responses; - if(!responses || _.keys(responses).length == 0) return [this.error(`Missing responses property`)]; + if(!responses || _.keys(responses).length == 0) return [this.error(`Missing responses property.`)]; return _.entries(responses).map(([code, response]) => { const expected = `#/components/responses/${this.group}@${code}`; if(response.$ref && response.$ref !== expected) - return this.error(`The ${code} response must be a reference object to '${expected}'`); + return this.error(`The ${code} response must be a reference object to '${expected}'.`); return; }).filter((error) => error) as ValidationError[]; } @@ -95,7 +97,7 @@ export default class Operation extends ValidatorBase { const regex = new RegExp(`^#/components/parameters/${this.group_regex}::((path)|(query))\\.[a-z0-9_.]+$`); for(const parameter of parameters){ if(!parameter.$ref.match(regex)) - return this.error(`Every parameter must be a reference object to '#/components/parameters/{x-operation-group}::{path|query}.{parameter_name}'`); + return this.error(`Every parameter must be a reference object to '#/components/parameters/{x-operation-group}::{path|query}.{parameter_name}'.`); } } @@ -103,7 +105,7 @@ export default class Operation extends ValidatorBase { const path_params = this.path_params(); const expected = this.path.match(/{[a-z0-9_]+}/g)?.map(p => p.slice(1, -1)) || []; if(path_params.sort().join(', ') !== expected.sort().join(', ')) - return this.error(`Path parameters must match the parameters in the path: {${expected.join('}, {')}}`); + return this.error(`Path parameters must match the parameters in the path: {${expected.join('}, {')}}.`); } path_params(): string[] { diff --git a/tools/linter/components/RootFile.ts b/tools/linter/components/RootFile.ts index 94f583b62..5718ce3d4 100644 --- a/tools/linter/components/RootFile.ts +++ b/tools/linter/components/RootFile.ts @@ -14,7 +14,7 @@ export default class RootFile extends FileValidator { validate_paths(): ValidationError[] { return Object.entries(this.spec().paths).map(([path, spec]) => { if(!spec?.$ref) - return this.error(`Every path must be a reference object to a path in a namespace file`, `Path: ${path}`); + return this.error(`Every path must be a reference object to a path in a namespace file.`, `Path: ${path}`); }).filter((e) => e) as ValidationError[]; } } \ No newline at end of file diff --git a/tools/linter/components/SchemaFile.ts b/tools/linter/components/SchemaFile.ts index 27ed265a8..2d989365a 100644 --- a/tools/linter/components/SchemaFile.ts +++ b/tools/linter/components/SchemaFile.ts @@ -34,9 +34,9 @@ export default class SchemaFile extends FileValidator { validate_category(category = this.category): ValidationError | void { if(category === '_common') return; if(!category.match(CATEGORY_REGEX)) - return this.error(`Invalid category name '${category}'. Must match regex: ${CATEGORY_REGEX.source}`, 'File Name'); + return this.error(`Invalid category name '${category}'. Must match regex: /${CATEGORY_REGEX.source}/.`, 'File Name'); const name = category.split('.')[1]; if(name !== '_common' && !name.match(NAME_REGEX)) - return this.error(`Invalid category name '${category}'. '${name}' does not match regex: ${NAME_REGEX.source}`, 'File Name'); + return this.error(`Invalid category name '${category}'. '${name}' does not match regex: /${NAME_REGEX.source}/.`, 'File Name'); } } \ No newline at end of file diff --git a/tools/linter/lint.ts b/tools/linter/lint.ts index 1ebb87597..f137b23a0 100644 --- a/tools/linter/lint.ts +++ b/tools/linter/lint.ts @@ -1,7 +1,16 @@ import SpecValidator from "./SpecValidator"; -const validator = new SpecValidator('../spec'); +const root_folder = process.argv[2] || '../spec'; +const validator = new SpecValidator(root_folder); const errors = validator.validate(); -errors.forEach(e => console.error(e)); -console.log('\nTotal errors:', errors.length) \ No newline at end of file + +if(errors.length === 0) { + console.log('No errors found.'); + process.exit(0); +} else { + console.log('Errors found:\n'); + errors.forEach(e => console.error(e)); + console.log('\nTotal errors:', errors.length) + process.exit(1); +} \ No newline at end of file diff --git a/tools/merger/merge.ts b/tools/merger/merge.ts index 72f340c13..98758cb34 100644 --- a/tools/merger/merge.ts +++ b/tools/merger/merge.ts @@ -1,11 +1,7 @@ import OpenApiMerger from "./OpenApiMerger"; -async function main() { - const root_path: string = process.argv[2]; // '../spec/opensearch-openapi.yaml' - const output_path: string = process.argv[3]; // '../build/opensearch-openapi.yaml' - const merger = new OpenApiMerger(root_path); - merger.merge(output_path); -} - -main(); \ No newline at end of file +const root_path: string = process.argv[2] || '../spec/opensearch-openapi.yaml' +const output_path: string = process.argv[3] || '../opensearch-openapi.yaml' +const merger = new OpenApiMerger(root_path); +merger.merge(output_path); \ No newline at end of file diff --git a/tools/test/linter/NamespaceFile.test.ts b/tools/test/linter/NamespaceFile.test.ts index f3cc8fc7c..88e47f6a5 100644 --- a/tools/test/linter/NamespaceFile.test.ts +++ b/tools/test/linter/NamespaceFile.test.ts @@ -16,7 +16,7 @@ test('validate_name()', () => { expect(ns_file.validate_name('_cat')).toEqual({ file: 'namespaces/indices.yaml', location: 'File Name', - message: `Invalid namespace name '_cat'. Must match regex: ^[a-z]+[a-z_]*[a-z]+$` + message: `Invalid namespace name '_cat'. Must match regex: /^[a-z]+[a-z_]*[a-z]+$/.` }); }); @@ -68,9 +68,14 @@ test('validate_parameter_refs()', () => { const validator = namespace_file('invalid_components.yaml'); expect(validator.validate_parameter_refs()).toEqual([ { - "file": `namespaces/invalid_components.yaml`, - "location": `#/components/parameters/#indices.create::query.h`, - "message": `Parameter component 'indices.create::query.h' must be named 'indices.create::query.v' since it is a query parameter named 'v'.` + file: "namespaces/invalid_components.yaml", + location: "#/components/parameters/#indices.create::query.ExpandWildcards", + message: "Invalid parameter name 'ExpandWildcards'. A parameter's name can only contain lower-cased alphanumerics, underscores, and periods." + }, + { + file: "namespaces/invalid_components.yaml", + location: "#/components/parameters/#indices.create::query.h", + message: "Parameter component 'indices.create::query.h' must be named 'indices.create::query.v' since it is a query parameter named 'v'." } ]); }); diff --git a/tools/test/linter/NamespacesFolder.test.ts b/tools/test/linter/NamespacesFolder.test.ts index a715ddc3d..9563988aa 100644 --- a/tools/test/linter/NamespacesFolder.test.ts +++ b/tools/test/linter/NamespacesFolder.test.ts @@ -11,22 +11,22 @@ test('validate()', () => { { file: "namespaces/invalid_spec.yaml", location: "Operation: GET /{index}/_doc/{id}", - message: "Missing description property" + message: "Missing description property." }, { file: "namespaces/invalid_spec.yaml", location: "Operation: GET /{index}/_doc/{id}", - message: "Every parameter must be a reference object to '#/components/parameters/{x-operation-group}::{path|query}.{parameter_name}'" + message: "Every parameter must be a reference object to '#/components/parameters/{x-operation-group}::{path|query}.{parameter_name}'." }, { file: "namespaces/invalid_spec.yaml", location: "Operation: GET /{index}/_doc/{id}", - message: "Path parameters must match the parameters in the path: {id}, {index}" + message: "Path parameters must match the parameters in the path: {id}, {index}." }, { file: "namespaces/invalid_spec.yaml", location: "Operation: GET /{index}/_doc/{id}", - message: "The 200 response must be a reference object to '#/components/responses/invalid_spec.fetch@200'" + message: "The 200 response must be a reference object to '#/components/responses/invalid_spec.fetch@200'." }, { file: "namespaces/invalid_yaml.yaml", @@ -36,12 +36,12 @@ test('validate()', () => { { file: "namespaces/", location: "Folder", - message: "Duplicate path '/{index}' found in namespaces: dup_path_a, dup_path_c" + message: "Duplicate path '/{index}' found in namespaces: dup_path_a, dup_path_c." }, { file: "namespaces/", location: "Folder", - message: "Duplicate path '/{index}/_rollover' found in namespaces: dup_path_a, dup_path_b, dup_path_c" + message: "Duplicate path '/{index}/_rollover' found in namespaces: dup_path_a, dup_path_b, dup_path_c." } ]); }); diff --git a/tools/test/linter/Operation.test.ts b/tools/test/linter/Operation.test.ts index 13c0752a8..43fce1229 100644 --- a/tools/test/linter/Operation.test.ts +++ b/tools/test/linter/Operation.test.ts @@ -10,11 +10,11 @@ test('validate_group()', () => { const invalid_group = operation({'x-operation-group': 'indices_'}); expect(invalid_group.validate_group()) - .toEqual(invalid_group.error(`Invalid x-operation-group 'indices_'. Must match regex: ^([a-z]+[a-z_]*[a-z]+\\.)?([a-z]+[a-z_]*[a-z]+)$`)); + .toEqual(invalid_group.error(`Invalid x-operation-group 'indices_'. Must match regex: /^([a-z]+[a-z_]*[a-z]+\\.)?([a-z]+[a-z_]*[a-z]+)$/.`)); const invalid_action = operation({'x-operation-group': 'indices.create.index'}); expect(invalid_action.validate_group()) - .toEqual(invalid_action.error(`Invalid x-operation-group 'indices.create.index'. Must match regex: ^([a-z]+[a-z_]*[a-z]+\\.)?([a-z]+[a-z_]*[a-z]+)$`)); + .toEqual(invalid_action.error(`Invalid x-operation-group 'indices.create.index'. Must match regex: /^([a-z]+[a-z_]*[a-z]+\\.)?([a-z]+[a-z_]*[a-z]+)$/.`)); const valid_group = operation({'x-operation-group': 'indices.create'}); expect(valid_group.validate_group()) @@ -32,21 +32,21 @@ test('validate_namespace()', () => { const non_omitted_core = operation({'x-operation-group': '_core.search'}, '_core.yaml'); expect(non_omitted_core.validate_namespace()) - .toEqual(non_omitted_core.error(`Invalid x-operation-group '_core.search'. '_core' namespace must be omitted in x-operation-group`)); + .toEqual(non_omitted_core.error(`Invalid x-operation-group '_core.search'. '_core' namespace must be omitted in x-operation-group.`)); const unmatched_namespace = operation({'x-operation-group': 'indices.create'}, 'cat.yaml'); expect(unmatched_namespace.validate_namespace()) - .toEqual(unmatched_namespace.error(`Invalid x-operation-group 'indices.create'. 'indices' namespace detected. Only 'cat' namespace is allowed in this file`)); + .toEqual(unmatched_namespace.error(`Invalid x-operation-group 'indices.create'. 'indices' namespace detected. Only 'cat' namespace is allowed in this file.`)); }); test('validate_operationId()', () => { const no_id = operation({'x-operation-group': 'indices.create'}); expect(no_id.validate_operationId()) - .toEqual(no_id.error(`Missing operationId property`)); + .toEqual(no_id.error(`Missing operationId property.`)); const invalid_id = operation({'x-operation-group': 'indices.create', operationId: 'create_index'}); expect(invalid_id.validate_operationId()) - .toEqual(invalid_id.error(`Invalid operationId 'create_index'. Must be in {x-operation-group}.{number} format`)); + .toEqual(invalid_id.error(`Invalid operationId 'create_index'. Must be in {x-operation-group}.{number} format.`)); const valid_id = operation({'x-operation-group': 'indices.create', operationId: 'indices.create.1'}); expect(valid_id.validate_operationId()) @@ -56,9 +56,13 @@ test('validate_operationId()', () => { test('validate_description()', () => { const no_description = operation({'x-operation-group': 'indices.create'}); expect(no_description.validate_description()) - .toEqual(no_description.error(`Missing description property`)); + .toEqual(no_description.error(`Missing description property.`)); - const valid_description = operation({'x-operation-group': 'indices.create', description: 'This is a description'}); + const invalid_description = operation({'x-operation-group': 'indices.create', description: 'This is a description without a period'}); + expect(invalid_description.validate_description()) + .toEqual(invalid_description.error(`Description must end with a period.`)); + + const valid_description = operation({'x-operation-group': 'indices.create', description: 'This is a description with a period.'}); expect(valid_description.validate_description()) .toBeUndefined(); }); @@ -74,12 +78,12 @@ test('validate_requestBody()', () => { const invalid_body = operation({'x-operation-group': 'indices.create', requestBody: {$ref: '#/components/requestBodies/indices.create.1'}}); expect(invalid_body.validate_requestBody()) - .toEqual(invalid_body.error(`The requestBody must be a reference object to '#/components/requestBodies/indices.create'`)); + .toEqual(invalid_body.error(`The requestBody must be a reference object to '#/components/requestBodies/indices.create'.`)); }); test('validate_response()', () => { const no_responses = operation({responses: {}}); - expect(no_responses.validate_responses()).toEqual([no_responses.error(`Missing responses property`)]); + expect(no_responses.validate_responses()).toEqual([no_responses.error(`Missing responses property.`)]); const invalid_responses = operation({'x-operation-group': 'cat.info', responses: { '200': {$ref: '#/components/responses/cat.info'}, @@ -87,8 +91,8 @@ test('validate_response()', () => { '400': {$ref: '#/components/responses/cat.info:bad_request'}, }}); expect(invalid_responses.validate_responses()).toEqual([ - invalid_responses.error(`The 200 response must be a reference object to '#/components/responses/cat.info@200'`), - invalid_responses.error(`The 400 response must be a reference object to '#/components/responses/cat.info@400'`),]); + invalid_responses.error(`The 200 response must be a reference object to '#/components/responses/cat.info@200'.`), + invalid_responses.error(`The 400 response must be a reference object to '#/components/responses/cat.info@400'.`),]); const valid_responses = operation({'x-operation-group': 'cat.info', responses: {'200': {$ref: '#/components/responses/cat.info@200'}}}); expect(valid_responses.validate_responses()) @@ -110,13 +114,13 @@ test('validate_parameters()', () => { {$ref: '#/components/parameters/indices.create::query:pretty'}, ]}); expect(invalid_parameters.validate_parameters()) - .toEqual(invalid_parameters.error(`Every parameter must be a reference object to '#/components/parameters/{x-operation-group}::{path|query}.{parameter_name}'`)); + .toEqual(invalid_parameters.error(`Every parameter must be a reference object to '#/components/parameters/{x-operation-group}::{path|query}.{parameter_name}'.`)); }); test('validate_path_parameters()', () => { const invalid_path_params = operation({parameters: [{$ref: '#/components/parameters/indices.create::path.index'}]}); expect(invalid_path_params.validate_path_parameters()) - .toEqual(invalid_path_params.error(`Path parameters must match the parameters in the path: {abc_xyz}, {index}`)); + .toEqual(invalid_path_params.error(`Path parameters must match the parameters in the path: {abc_xyz}, {index}.`)); const valid_path_params = operation({parameters: [ {$ref: '#/components/parameters/indices.create::path.index'}, diff --git a/tools/test/linter/PathRefsValidator.test.ts b/tools/test/linter/PathRefsValidator.test.ts index 44fea59ac..527782e3e 100644 --- a/tools/test/linter/PathRefsValidator.test.ts +++ b/tools/test/linter/PathRefsValidator.test.ts @@ -11,7 +11,7 @@ test('validate()', () => { { file: "opensearch-openapi.yaml", location: "Path: /{index}", - message: "Unresolved path reference: Path /{index} does not exist in namespace file namespaces/indices.yaml" + message: "Unresolved path reference: Path /{index} does not exist in namespace file namespaces/indices.yaml." }, { file: "opensearch-openapi.yaml", diff --git a/tools/test/linter/RootFile.test.ts b/tools/test/linter/RootFile.test.ts index 70b612f5f..89749b20f 100644 --- a/tools/test/linter/RootFile.test.ts +++ b/tools/test/linter/RootFile.test.ts @@ -6,12 +6,12 @@ test('validate()', () => { { file: "root.yaml", location: "Path: /", - message: "Every path must be a reference object to a path in a namespace file" + message: "Every path must be a reference object to a path in a namespace file." }, { file: "root.yaml", location: "Path: /{index}", - message: "Every path must be a reference object to a path in a namespace file" + message: "Every path must be a reference object to a path in a namespace file." } ]); }); \ No newline at end of file diff --git a/tools/test/linter/SchemaFile.test.ts b/tools/test/linter/SchemaFile.test.ts index e09c64fd3..06eb0ffbe 100644 --- a/tools/test/linter/SchemaFile.test.ts +++ b/tools/test/linter/SchemaFile.test.ts @@ -10,12 +10,12 @@ test('validate_category()', () => { expect(validator.validate_category('cat._invalid_name')).toEqual({ file: "schemas/_common.empty.yaml", location: "File Name", - message: "Invalid category name 'cat._invalid_name'. '_invalid_name' does not match regex: ^[a-z]+[a-z_]*[a-z]+$" + message: "Invalid category name 'cat._invalid_name'. '_invalid_name' does not match regex: /^[a-z]+[a-z_]*[a-z]+$/." }); expect(validator.validate_category('invalid_regex')).toEqual({ file: "schemas/_common.empty.yaml", location: "File Name", - message: "Invalid category name 'invalid_regex'. Must match regex: ^[a-z_]+\\.[a-z_]+$" + message: "Invalid category name 'invalid_regex'. Must match regex: /^[a-z_]+\\.[a-z_]+$/." }); }); diff --git a/tools/test/linter/fixtures/file_validators/namespaces/invalid_components.yaml b/tools/test/linter/fixtures/file_validators/namespaces/invalid_components.yaml index 068ef090a..4923d42aa 100644 --- a/tools/test/linter/fixtures/file_validators/namespaces/invalid_components.yaml +++ b/tools/test/linter/fixtures/file_validators/namespaces/invalid_components.yaml @@ -6,6 +6,7 @@ paths: $ref: '#/components/responses/indices.create@200' parameters: - $ref: '#/components/parameters/indices.create::path.index' + - $ref: '#/components/parameters/indices.create::query.ExpandWildcards' - $ref: '#/components/parameters/indices.create::query.pretty' components: @@ -15,6 +16,9 @@ components: indices.create::path.index: name: index in: path + indices.create::query.ExpandWildcards: + name: ExpandWildcards + in: query indices.create::query.h: name: v in: query \ No newline at end of file diff --git a/tools/test/linter/fixtures/folder_validators/namespaces/cat.yaml b/tools/test/linter/fixtures/folder_validators/namespaces/cat.yaml index a4a55fc5e..b6c637735 100644 --- a/tools/test/linter/fixtures/folder_validators/namespaces/cat.yaml +++ b/tools/test/linter/fixtures/folder_validators/namespaces/cat.yaml @@ -3,7 +3,7 @@ paths: get: x-operation-group: cat.aliases operationId: cat.aliases.0 - description: 'CAT aliases' + description: 'CAT aliases.' responses: '200': $ref: '#/components/responses/cat.aliases@200' diff --git a/tools/test/linter/fixtures/schema_refs_validator/schemas/others.yaml b/tools/test/linter/fixtures/schema_refs_validator/schemas/others.yaml index 9647aa810..0375fb956 100644 --- a/tools/test/linter/fixtures/schema_refs_validator/schemas/others.yaml +++ b/tools/test/linter/fixtures/schema_refs_validator/schemas/others.yaml @@ -1,4 +1,4 @@ components: schemas: Mammal: - $ref: './animals.yaml#/components/schemas/Mammal' \ No newline at end of file + $ref: 'animals.yaml#/components/schemas/Mammal' \ No newline at end of file