Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure correct OpenAPI 3.1.0 spec. #646

Merged
merged 30 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
54ffcf8
Added Python and Ruby spec validators.
dblock Oct 25, 2024
92e711e
Add empty descriptions where missing and remove descriptions next to …
dblock Nov 4, 2024
fffaae3
Replaced the validator compatible with OpenAPI 3.1.
dblock Nov 4, 2024
63051b4
Fixed incorrect style.
dblock Nov 4, 2024
2dafa40
Added missing require.
dblock Nov 4, 2024
5736735
Fix: schema null is not supported.
dblock Nov 4, 2024
8c42278
Removed unused required property.
dblock Nov 4, 2024
c0ea5ff
Fix: added missing schema.
dblock Nov 4, 2024
d8ffd3f
Fix: removed incorrect defaults.
dblock Nov 4, 2024
2b63431
Fix: added missing required.
dblock Nov 4, 2024
beb6eeb
Fix: removed incorrect required.
dblock Nov 4, 2024
fc4730c
Removed incorrect externalDocs.
dblock Nov 4, 2024
04716ca
Document the ruby spec validator.
dblock Nov 4, 2024
7bf5b00
Fix: removed redundant content types.
dblock Nov 4, 2024
a4b83f5
Improve displaying of errors.
dblock Nov 4, 2024
6610faa
Normalize keys to be compatible with OpenAPI 3.1.
dblock Nov 4, 2024
5485529
Removed superseeded operations that have unresolved parameters.
dblock Nov 4, 2024
f3759a1
Fix: don't reduce error payload, allows to verify schema.
dblock Nov 5, 2024
732fde0
Fix: flow framework schema tests.
dblock Nov 5, 2024
4abc6be
Fix: if no decision is made there's no weight ranking.
dblock Nov 5, 2024
bc24479
Fix: wrap indexing errors.
dblock Nov 5, 2024
52783ee
Added verbose logging of the story being evaluated.
dblock Nov 5, 2024
635e180
Fix: security API test error responses.
dblock Nov 5, 2024
7b0c299
Fix: duration ref.
dblock Nov 5, 2024
0a15d96
Fix typo in property.
dblock Nov 5, 2024
8e3e4c5
Fix superseeded operation parameters.
dblock Nov 5, 2024
acf7788
Fix: neural search error response.
dblock Nov 5, 2024
50c3258
Normalize fields.
dblock Nov 5, 2024
d1a1bac
Re-added default values into the schema.
dblock Nov 5, 2024
359e6f8
Disallowed characters are replaced with ___.
dblock Nov 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cspell
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ geotile
gsub
Gsub
haasephonetik
hashcode
heteroscedastic
hnsw
homoscedastic
Expand Down Expand Up @@ -134,6 +135,7 @@ Oversample
performanceanalyzer
permissionsinfo
pipefail
pipenv
preconfigure
preconfigured
prefilter
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/validate-spec-py.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Validate Spec (Python)

on: [pull_request,push]

jobs:
validate-spec-py:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Build
run: npm ci && npm run merge

- name: Set Up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Dependencies
working-directory: tools/src/validate-spec-py
run: |
pip install --user pipenv
pipenv install

- name: Validate Spec
working-directory: tools/src/validate-spec-py
run: |
pipenv run python validate.py ../../../build/opensearch-openapi.yaml
30 changes: 30 additions & 0 deletions .github/workflows/validate-spec-ruby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Validate Spec (Ruby)

on: [pull_request, push]

jobs:
validate-spec-ruby:
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/tools/src/validate-spec-ruby/Gemfile
steps:
- name: Checkout the repo
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Build
run: npm ci && npm run merge

- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true

- name: Validate Spec
working-directory: tools/src/validate-spec-ruby
run: |
bundle exec ruby validate.rb ../../../build/opensearch-openapi.yaml
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

### Added
- Added API specs for query groups lifecycle APIs ([#649](https://github.com/opensearch-project/opensearch-api-specification/pull/649))
- Added Python and Ruby spec validators ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Added verbose output of the story being evaluated ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))

### Removed
- Removed unsupported `_common.mapping:SourceField`'s `mode` field and associated `_common.mapping:SourceFieldMode` enum ([#652](https://github.com/opensearch-project/opensearch-api-specification/pull/652))

### Fixed
- Spec passes OpenAPI 3.1.0 validations ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Disallowed characters (`::`, `@`, and `:`) in key names are replaced with `___` on merge ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Added missing `required` to `path` parameters ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Added missing `schema` parent to response types ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Removed invalid `externalDocs` from `flow_framework.create/update::query.use_case` ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Fixed incorrect `style` in `indices.get_mapping::query.index` ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Removed invalid `required` from `ppl` responses ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Added schema for security API error responses ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))

## [0.1.0] - 2024-10-25

### Added
Expand Down
30 changes: 28 additions & 2 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
- [Comment on PR](#comment-on-pr)
- [Test Tools (Unit)](#test-tools-unit)
- [Test Tools (Integration)](#test-tools-integration)
- [Validate Spec](#validate-spec)
- [Validate Spec (Lint)](#validate-spec-lint)
- [Validate Spec (Python)](#validate-spec-python)
- [Validate Spec (Ruby)](#validate-spec-ruby)
<!-- TOC -->

# Developer Guide
Expand Down Expand Up @@ -375,6 +377,30 @@ This workflow runs on PRs to invoke the [tools' unit tests](tools/tests), upload

This workflow runs on PRs to invoke the [tools' integration tests](tools/tests) that require a running instance of OpenSearch to ensure there are no breakages in behavior.

### [Validate Spec](.github/workflows/validate-spec.yml)
### [Validate Spec (Lint)](.github/workflows/validate-spec-lint.yml)

This workflow runs on PRs to invoke the [spec linter](#spec-linter) and ensure the multi-file spec is correct and follows the design guidelines.

### [Validate Spec (Python)](.github/workflows/validate-spec-py.yml)

This workflow runs on PRs to invoke the [Python openapi-spec-validator](https://pypi.org/project/openapi-spec-validator/) to ensure that the resulting spec can be loaded by Python tools.

You can run the validator locally as follows after installing [pipenv](https://pipenv.pypa.io/en/latest/installation.html).

```
cd tools/src/validate-spec-py
pipenv install
npm run merge ; pipenv run python validate.py ../../../build/opensearch-openapi.yaml
```

### [Validate Spec (Ruby)](.github/workflows/validate-spec-ruby.yml)

This workflow runs on PRs to invoke the Ruby [Json Schemer](https://github.com/davishmcclurg/json_schemer/) to ensure that the resulting spec can be loaded by Ruby tools.

You can run the validator locally as follows.

```
cd tools/src/validate-spec-ruby
bundle install
npm run merge ; bundle exec ruby validate.rb ../../../build/opensearch-openapi.yaml
```
6 changes: 3 additions & 3 deletions spec/_global_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ components:
description: Whether to pretty format the returned JSON response.
schema:
type: boolean
default: false
default: false
human:
name: human
in: query
description: Whether to return human readable values for statistics.
schema:
type: boolean
default: true
default: true
error_trace:
name: error_trace
in: query
description: Whether to include the stack trace of returned errors.
schema:
type: boolean
default: false
default: false
source:
name: source
in: query
Expand Down
30 changes: 15 additions & 15 deletions spec/_superseded_operations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ $schema: ./json_schemas/_superseded_operations.schema.yaml
- GET
- PUT
/_opendistro/_ism/policies/{policyID}:
superseded_by: /_plugins/_ism/policies/{policyID}
superseded_by: /_plugins/_ism/policies/{policy_id}
operations:
- GET
- HEAD
Expand Down Expand Up @@ -240,7 +240,7 @@ $schema: ./json_schemas/_superseded_operations.schema.yaml
operations:
- GET
/_opendistro/_knn/{nodeId}/stats/{stat}:
superseded_by: /_plugins/_knn/{nodeId}/stats/{stat}
superseded_by: /_plugins/_knn/{node_id}/stats/{stat}
operations:
- GET
/_opendistro/_performanceanalyzer/_agent/{redirectEndpoint}:
Expand Down Expand Up @@ -354,22 +354,22 @@ $schema: ./json_schemas/_superseded_operations.schema.yaml
- GET
- PUT
/_opendistro/_rollup/jobs/{rollupID}:
superseded_by: /_plugins/_rollup/jobs/{rollupID}
superseded_by: /_plugins/_rollup/jobs/{id}
operations:
- GET
- HEAD
- PUT
- DELETE
/_opendistro/_rollup/jobs/{rollupID}/_explain:
superseded_by: /_plugins/_rollup/jobs/{rollupID}/_explain
superseded_by: /_plugins/_rollup/jobs/{id}/_explain
operations:
- GET
/_opendistro/_rollup/jobs/{rollupID}/_start:
superseded_by: /_plugins/_rollup/jobs/{rollupID}/_start
superseded_by: /_plugins/_rollup/jobs/{id}/_start
operations:
- POST
/_opendistro/_rollup/jobs/{rollupID}/_stop:
superseded_by: /_plugins/_rollup/jobs/{rollupID}/_stop
superseded_by: /_plugins/_rollup/jobs/{id}/_stop
operations:
- POST
/_opendistro/_security/api/_upgrade_check/:
Expand Down Expand Up @@ -401,7 +401,7 @@ $schema: ./json_schemas/_superseded_operations.schema.yaml
- GET
- PATCH
/_opendistro/_security/api/actiongroups/{name}:
superseded_by: /_plugins/_security/api/actiongroups/{name}
superseded_by: /_plugins/_security/api/actiongroups/{action_group}
operations:
- GET
- PUT
Expand Down Expand Up @@ -433,14 +433,14 @@ $schema: ./json_schemas/_superseded_operations.schema.yaml
- GET
- PATCH
/_opendistro/_security/api/internalusers/{name}:
superseded_by: /_plugins/_security/api/internalusers/{name}
superseded_by: /_plugins/_security/api/internalusers/{username}
operations:
- GET
- PUT
- PATCH
- DELETE
/_opendistro/_security/api/internalusers/{name}/authtoken:
superseded_by: /_plugins/_security/api/internalusers/{name}/authtoken
superseded_by: /_plugins/_security/api/internalusers/{username}/authtoken
operations:
- POST
/_opendistro/_security/api/migrate:
Expand All @@ -457,7 +457,7 @@ $schema: ./json_schemas/_superseded_operations.schema.yaml
- GET
- PATCH
/_opendistro/_security/api/roles/{name}:
superseded_by: /_plugins/_security/api/roles/{name}
superseded_by: /_plugins/_security/api/roles/{role}
operations:
- GET
- PUT
Expand All @@ -469,7 +469,7 @@ $schema: ./json_schemas/_superseded_operations.schema.yaml
- GET
- PATCH
/_opendistro/_security/api/rolesmapping/{name}:
superseded_by: /_plugins/_security/api/rolesmapping/{name}
superseded_by: /_plugins/_security/api/rolesmapping/{role}
operations:
- GET
- PUT
Expand Down Expand Up @@ -519,7 +519,7 @@ $schema: ./json_schemas/_superseded_operations.schema.yaml
- GET
- PATCH
/_opendistro/_security/api/tenants/{name}:
superseded_by: /_plugins/_security/api/tenants/{name}
superseded_by: /_plugins/_security/api/tenants/{tenant}
operations:
- GET
- PUT
Expand All @@ -529,14 +529,14 @@ $schema: ./json_schemas/_superseded_operations.schema.yaml
superseded_by: /_plugins/_security/api/user
operations:
- GET
/_opendistro/_security/api/user/{name}:
superseded_by: /_plugins/_security/api/user/{name}
/_opendistro/_security/api/user/{username}:
superseded_by: /_plugins/_security/api/user/{username}
operations:
- GET
- PUT
- DELETE
/_opendistro/_security/api/user/{name}/authtoken:
superseded_by: /_plugins/_security/api/user/{name}/authtoken
superseded_by: /_plugins/_security/api/user/{username}/authtoken
operations:
- POST
/_opendistro/_security/api/validate:
Expand Down
2 changes: 2 additions & 0 deletions spec/namespaces/asynchronous_search.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ components:
in: path
schema:
type: string
required: true
asynchronous_search.delete::path.id:
name: id
in: path
schema:
type: string
required: true
requestBodies:
asynchronous_search.search:
content:
Expand Down
Loading
Loading