forked from uc-cdis/peregrine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fixes and performance improvements (uc-cdis#5)
* chore(graphene) upgrade to 2.0.1 * chore(travis): Pull in Rudy's PR for codacy coverage * chore(swagger): Add swagger file
- Loading branch information
Showing
15 changed files
with
441 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
coverage: | ||
enabled: true | ||
exclude_paths: | ||
- 'tests/**' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,21 @@ | ||
## Peregrine | ||
Query interface to get insights into data in Gen3 Commons Edit | ||
Add topics | ||
# Peregrine | ||
|
||
[![Build Status](https://travis-ci.org/uc-cdis/peregrine.svg?branch=master)](https://travis-ci.org/uc-cdis/peregrine) | ||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/f6128183864d4e5da5093eb72a3c9c97)](https://www.codacy.com/app/uc-cdis/peregrine?utm_source=github.com&utm_medium=referral&utm_content=uc-cdis/peregrine&utm_campaign=Badge_Grade) | ||
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/f6128183864d4e5da5093eb72a3c9c97)](https://www.codacy.com/app/uc-cdis/peregrine?utm_source=github.com&utm_medium=referral&utm_content=uc-cdis/peregrine&utm_campaign=Badge_Coverage) | ||
|
||
Query interface to get insights into data in Gen3 Commons | ||
|
||
## Setup | ||
|
||
```bash | ||
# Install requirements. | ||
pip install -r requirements.txt | ||
``` | ||
|
||
## API Documentation | ||
|
||
[OpenAPI documentation available here.](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/uc-cdis/peregrine/master/openapis/swagger.yaml) | ||
|
||
YAML file for the OpenAPI documentation is found in the `openapi` folder (in | ||
the root directory); see the README in that folder for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,12 @@ lockfile==0.10.2 | |
coverage==3.7.1 | ||
mock==1.0.1 | ||
pytest-flask==0.8.1 | ||
pytest-cov==2.5.1 | ||
codacy-coverage | ||
moto==0.4.5 | ||
Sphinx==1.3.1 | ||
sphinxcontrib-httpdomain==1.3.0 | ||
-e git+https://[email protected]/NCI-GDC/signpost.git@c5d499936943e71eefe2ec4b3d4ced6ac48f35c0#egg=signpost | ||
-e git+https://[email protected]/NCI-GDC/signpost.git@c8e2aa5ff572c808cba9b522b64f7b497e79c524#egg=signpost | ||
-e git+https://[email protected]/uc-cdis/[email protected]#egg=cdisutilstest | ||
-e git+https://[email protected]/uc-cdis/[email protected]#egg=flask_postgres_session | ||
-e git+https://[email protected]/uc-cdis/sheepdog.git@53cb3a5d69d04a3daf0cdf00957151813fcccac4#egg=sheepdog | ||
-e git+https://[email protected]/uc-cdis/[email protected]#egg=storageclient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# TL;DR | ||
|
||
[Swagger](https://swagger.io/getting-started-with-swagger-i-what-is-swagger/) specification of Peregrine's REST API | ||
|
||
## Swagger Tools | ||
|
||
Use swagger's editor to update swagger.yaml and swagger.json using one of the following: | ||
* [online editor](https://editor.swagger.io/) | ||
* [Docker image](https://hub.docker.com/r/swaggerapi/swagger-editor/) - `docker run -d -p 80:8080 swaggerapi/swagger-editor` | ||
* or pull the editor code from [github](https://github.com/swagger-api/swagger-editor), and `npm start` an editor locally. | ||
|
||
Publish API documentation with the [swagger-ui](https://github.com/swagger-api/swagger-ui) - also easily launched with docker: `docker run -p 80:8080 -e SWAGGER_JSON=/foo/swagger.json -v /bar:/foo swaggerapi/swagger-ui` | ||
|
||
## OpenAPI Spec | ||
|
||
The swagger definition format has been open sourced as the OpenAPI Specification administered by the Linux Foundation. As of writing this the latest spec defining the structure and elements of a swagger.yaml file is [version 3](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
swagger: '2.0' | ||
info: | ||
title: Peregrine OpenAPI Specification | ||
version: 0.1.0 | ||
description: >- | ||
GraphQL search microservice for CDIS Gen 3 data commons. Code is available | ||
on [GitHub](https://github.com/uc-cdis/peregrine). | ||
termsOfService: 'http://cdis.uchicago.edu/terms/' | ||
contact: | ||
email: [email protected] | ||
license: | ||
name: Apache 2.0 | ||
url: 'http://www.apache.org/licenses/LICENSE-2.0.html' | ||
host: example.domain | ||
basePath: / | ||
tags: | ||
- name: graphql | ||
description: GraphQL Queries | ||
- name: system | ||
description: System endpoints | ||
schemes: | ||
- https | ||
paths: | ||
/graphql: | ||
post: | ||
tags: | ||
- graphql | ||
summary: Perform a GraphQL Query | ||
description: >- | ||
Perform a graphql query over the data commons given a query, variables, | ||
and name. | ||
consumes: | ||
- application/json | ||
produces: | ||
- application/json | ||
parameters: | ||
- in: body | ||
name: body | ||
description: The GraphQL query and parameters | ||
required: true | ||
schema: | ||
$ref: '#/definitions/QueryInputInfo' | ||
responses: | ||
'200': | ||
description: successful operation | ||
schema: | ||
$ref: '#/definitions/QueryOutputRef' | ||
'400': | ||
description: Invalid input | ||
'403': | ||
description: Invalid authorization token | ||
/getschema: | ||
get: | ||
tags: | ||
- graphql | ||
summary: Returns the data dictionary schema json | ||
description: >- | ||
The data dictionary for the data commons is internally converted from | ||
yaml files to json. This endpoint returns the json schema for the | ||
dictionary for use in generating queries. | ||
produces: | ||
- application/json | ||
responses: | ||
'200': | ||
description: successful operation | ||
schema: | ||
$ref: '#/definitions/SchemaOutputRef' | ||
/_version: | ||
get: | ||
tags: | ||
- system | ||
summary: Returns the version of Peregrine | ||
produces: | ||
- application/json | ||
responses: | ||
'200': | ||
description: successful operation | ||
schema: | ||
$ref: '#/definitions/VersionOutputRef' | ||
/_status: | ||
get: | ||
tags: | ||
- system | ||
summary: Returns if Peregrine is healthy or not | ||
description: >- | ||
Health check endpoint which checks if Peregrine can connect to its | ||
backing PostgreSQL datastore or not. | ||
produces: | ||
- application/text | ||
responses: | ||
'200': | ||
description: Healthy | ||
default: | ||
description: Unhealthy | ||
definitions: | ||
QueryInputInfo: | ||
type: object | ||
properties: | ||
query: | ||
type: string | ||
description: the text of the GraphQL query | ||
variables: | ||
type: string | ||
description: variables for the GraphQL query | ||
operationName: | ||
type: string | ||
description: the name of the operation | ||
example: | ||
query: '{ project {project_id} }' | ||
operationName: null | ||
variables: null | ||
QueryOutputRef: | ||
type: object | ||
properties: | ||
data: | ||
type: object | ||
description: the results of the GraphQL query | ||
SchemaOutputRef: | ||
type: object | ||
properties: | ||
data: | ||
type: object | ||
description: the json schema for the data dictionary | ||
VersionOutputRef: | ||
type: object | ||
properties: | ||
commit: | ||
type: string | ||
description: the current git commit hash for this version | ||
version: | ||
type: string | ||
description: the current git tag version | ||
dictionary: | ||
type: object | ||
description: the version information for the data dictionary | ||
properties: | ||
commit: | ||
type: string | ||
description: the current git commit hash for the dictionary | ||
version: | ||
type: string | ||
description: the current git tag version for the dictionary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.