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

Spec file and validation edits and additions #31

Merged
merged 2 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 importers/test/test_djornl_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

At the present time, this just ensures that the files are parsed correctly;
it does not check data loading into the db.

These tests run within the re_api docker image.
"""
import json
import unittest
Expand Down
4 changes: 2 additions & 2 deletions relation_engine_server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ Example response:
Get the schema for a specific data source

```sh
GET "{root_url}/api/v1/specs/data_source?name=ncbi_taxonomy"
GET "{root_url}/api/v1/specs/data_sources?name=ncbi_taxonomy"
```

Example response:
Expand Down Expand Up @@ -338,7 +338,7 @@ Example response:
Get the schema for a specific stored query

```sh
GET "{root_url}/api/v1/specs/stored_query?name=ncbi_fetch_taxon"
GET "{root_url}/api/v1/specs/stored_queries?name=ncbi_fetch_taxon"
```

Example response:
Expand Down
9 changes: 9 additions & 0 deletions relation_engine_server/test/data/json_validation/fruit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$schema: "http://json-schema.org/draft-07/schema#"
name: fruit
type: string
oneOf:
- const: peach
- const: plum
- const: dragonfruit
- const: strawberry
- const: pear
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$schema: "http://json-schema.org/draft-07/schema#"
name: fruits_array
definitions:
fruits:
type: array
items:
$ref: fruit.yaml
default: []
uniqueItems: true
examples:
- ['peach', 'plum']
- ['strawberry']
- []
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"description": "A type of dried fruit",
"type": "string",
"format": "date"
},
"fruits": {
"type": "array",
"items": {
"$ref": "fruit.yaml"
},
"default": [],
"uniqueItems": "true"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,13 @@ properties:
description: A type of dried fruit
type: string
format: date
fruits:
type: array
items:
$ref: fruit.yaml
default: []
uniqueItems: true
examples:
- ['peach', 'plum']
- ['strawberry']
- []
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: valid_uri
distance: 3
home_page: "http://json-validation.com:5000/this/is/valid"
home_page: http://json-validation.com:5000/this/is/valid
20 changes: 17 additions & 3 deletions relation_engine_server/test/spec_release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,27 @@

`sample_spec_release`, and the corresponding archive, `spec.tar.gz`, contain a set of sample schema files suitable for use in tests.

To create a new version of `spec.tar.gz`, you will need to exec into the `re_api` docker image to ensure that the new archive and its contents have the appropriate file owner and permissions (all files must have owner and group `root`/`root`).
To create a new version of `spec.tar.gz`, you will need to open a shell into the `re_api` docker image and create the new archive there to ensure that the new archive and its contents have the appropriate file owner and permissions (all files must have owner and group `root`/`root`).

Example commands:
Ensure that you have mounted your current working directory as `/app` in the docker `re_api` image by uncommenting the lines in `docker-compose.yaml`:

``` yaml
re_api:
( ... )
# uncomment to mount local directories
volumes:
- ${PWD}:/app
```

Run `make shell` to start up the docker container, and then get the ID of the current `re_api` image. Exec into the `re_api` image via the Docker Desktop client or the command line:

``` sh
$ docker exec -it relation_engine_re_api_run_1234567890 sh
# # in the docker image
```

Example commands for updating `spec.tar.gz`:

``` sh
# cd relation_engine_server/test/spec_release
# # ... perform any edits ...
# tar -czvf new_spec.tar.gz sample_spec_release/
Expand Down
2 changes: 1 addition & 1 deletion relation_engine_server/test/test_api_v1.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Simple integration tests on the API itself.

We make actual ajax requests to the running docker container.
These tests run within the re_api docker image, and require access to the ArangoDB, auth, and workspace images.
"""
import unittest
import requests
Expand Down
Loading