Skip to content

Commit

Permalink
Revert to using applicaiton/json.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <dblock@amazon.com>
  • Loading branch information
dblock committed May 10, 2024
1 parent 6949816 commit 4c3fda9
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
15 changes: 15 additions & 0 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- [Global Parameters](#global-parameters)
- [OpenAPI Extensions](#openapi-extensions)
- [Tools](#tools)
- [Merger](#merger)
- [Linter](#linter)
- [Validator](#validator)

# Developer Guide

Expand Down Expand Up @@ -127,3 +130,15 @@ The spec merger "builds", aka combines all `.yaml` files in a spec folder into a
### Linter

The spec linter that validates every `.yaml` file in the `./spec` folder to assure that they follow the guidelines we have set. Check out the [Linter README](tools/README.md#spec-linter) for more information on how to run it locally. Make sure to run the linter before submitting a PR.

### Validator

The project uses [dredd](https://dredd.org) to test the spec against a live instance OpenSearch. See [test.yml](.github/workflows/test.yml) for details.

To run locally, start OpenSearch, generate the spec and run `dredd`.

```bash
docker run -d -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" -e "OPENSEARCH_INITIAL_ADMIN_PASSWORD=InitialAdminPassword1" opensearchproject/opensearch:latest
npm run merge -- ../spec ../build/opensearch-openapi.yaml
npm run dredd -- --user "admin:InitialAdminPassword1" ../build/opensearch-openapi.yaml https://localhost:9200
```
2 changes: 1 addition & 1 deletion min/namespaces/_core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ components:
info@200:
description: ''
content:
application/json; charset=UTF-8:
application/json:
schema:
type: object
properties:
Expand Down
5 changes: 5 additions & 0 deletions tools/dredd/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ hooks.beforeAll(function (transactions) {
// disable TLS verification, https://github.com/apiaryio/dredd/issues/913#issuecomment-381419699
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0
})

hooks.beforeEach(function (transactions) {
// the spec is application/json without a charset, see https://github.com/opensearch-project/opensearch-api-specification/pull/287
transactions.expected.headers['Content-Type'] += '; charset=UTF-8'
})
4 changes: 2 additions & 2 deletions tools/test/merger/fixtures/expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ components:
responses:
adopt@200:
description: ''
application/json; charset=utf-8:
application/json:
schema:
type: object
indices.create@200:
description: ''
application/json; charset=utf-8:
application/json:
schema:
type: object
schemas:
Expand Down
2 changes: 1 addition & 1 deletion tools/test/merger/fixtures/spec/namespaces/indices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ components:
responses:
indices.create@200:
description: ''
application/json; charset=utf-8:
application/json:
schema:
type: object
2 changes: 1 addition & 1 deletion tools/test/merger/fixtures/spec/namespaces/shelter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ components:
responses:
adopt@200:
description: ''
application/json; charset=utf-8:
application/json:
schema:
type: object

0 comments on commit 4c3fda9

Please sign in to comment.