Skip to content

apihub server and api/specs folder #270

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

Merged
merged 47 commits into from
Oct 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
2741834
Fixes typos in client after bad merge
Jul 6, 2018
9646035
Merge remote-tracking branch 'upstream/master'
Jul 6, 2018
c3ad81c
Merge remote-tracking branch 'upstream/master'
Jul 6, 2018
d7b91f7
Merge remote-tracking branch 'upstream/master'
Jul 10, 2018
a65aa8e
Merge remote-tracking branch 'upstream/master'
Jul 11, 2018
4edc12a
Merge remote-tracking branch 'upstream/master'
Jul 16, 2018
460bdea
Merge remote-tracking branch 'upstream/master'
Jul 16, 2018
408990d
Merge remote-tracking branch 'upstream/master'
Jul 18, 2018
ee1b91b
Merge remote-tracking branch 'upstream/master'
Jul 20, 2018
cf7b3f4
Merge remote-tracking branch 'upstream/master'
Aug 9, 2018
3f4eed8
Merge remote-tracking branch 'upstream/master'
Aug 22, 2018
14cbec2
Merge remote-tracking branch 'upstream/master'
Aug 23, 2018
b57188b
Merge remote-tracking branch 'upstream/master'
Sep 3, 2018
66e5cdc
Merge remote-tracking branch 'upstream/master'
Sep 4, 2018
31aeb8f
Merge remote-tracking branch 'upstream/master'
Sep 13, 2018
c0dbe36
Merge remote-tracking branch 'upstream/master'
Sep 18, 2018
81111e0
Merge remote-tracking branch 'upstream/master'
Sep 19, 2018
6b4c1bf
Merge remote-tracking branch 'upstream/master'
Sep 24, 2018
bbe7558
Merge remote-tracking branch 'upstream/master'
Sep 25, 2018
fd2befe
Merge remote-tracking branch 'upstream/master'
Oct 10, 2018
6b0dd8f
Merge remote-tracking branch 'upstream/master'
Oct 12, 2018
b706243
Merge remote-tracking branch 'upstream/master'
Oct 17, 2018
0bf32b8
Merge remote-tracking branch 'upstream/master'
Oct 17, 2018
d0664c9
Merge remote-tracking branch 'upstream/master'
Oct 19, 2018
5e895e0
Merge remote-tracking branch 'upstream/master'
Oct 19, 2018
a62cf90
servicelib: systematic app keys naming
Oct 19, 2018
0d635ec
Added test to validate and create specs from apihub
Oct 19, 2018
90eb8f4
Merge remote-tracking branch 'upstream/master'
Oct 19, 2018
5c90c34
Merge branch 'master' into tmp
Oct 19, 2018
3e76a61
Renamed apis -> api and added subfolder specs
Oct 19, 2018
6ae5757
Parametrized tests per file instead of having all files within a sing…
Oct 19, 2018
b452091
Assigned owners to api/
Oct 19, 2018
75efd1c
webserver API: copy (and fixes) from services/web/server/src/*/oas3
Oct 19, 2018
dc90291
Merge remote-tracking branch 'upstream/master'
Oct 19, 2018
938ee88
Merge branch 'master' into is241/webserver-api
Oct 19, 2018
e6e729d
Deletes file that should not have been versioned
Oct 20, 2018
152d2cc
Merge remote-tracking branch 'upstream/master'
pcrespov Oct 22, 2018
4628a6e
Merge remote-tracking branch 'upstream/master'
pcrespov Oct 23, 2018
9c49147
Merge remote-tracking branch 'upstream/master'
Oct 24, 2018
21aeab8
Merge branch 'master' of github.com:pcrespov/osparc-simcore
Oct 24, 2018
62eb5c5
Merge remote-tracking branch 'upstream/master'
Oct 26, 2018
0449547
Merge branch 'master' into is241/webserver-api
Oct 26, 2018
498553a
Cleanup utils
Oct 26, 2018
228bdaa
Fixes issues with individual openapi schemas
Oct 26, 2018
50085e4
Final cleanup
Oct 26, 2018
3f2bddf
Fixes apihub tests and minors
Oct 26, 2018
1e87211
Merge branch 'master' into is241/webserver-api
pcrespov Oct 26, 2018
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Order is important. The last matching pattern has the most precedence.

# files and folders recursively
/api/ @sanderegg, @pcrespov
/docs/ @pcrespov
/services/computation @mguidon
/services/dy* @sanderegg
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ matrix:
- pip3 install packages/director-sdk/python
- pushd services/web/server; pip3 install -r requirements/ci.txt; popd
- pushd services/storage; pip3 install -r requirements/dev.txt; popd
- pip3 install -r apis/tests/requirements.txt
- pip3 install -r api/tests/requirements.txt
- pip3 install -r services/apihub/tests/requirements.txt

before_script:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ before_test:
${DOCKER_COMPOSE} -f packages/simcore-sdk/tests/docker-compose.yml build

run_test:
pytest -v apis/tests
pytest -v api/tests
pytest -v services/apihub/tests
pytest --cov=pytest_docker -v packages/pytest_docker/tests
pytest --cov=s3wrapper -v packages/s3wrapper/tests
Expand Down
26 changes: 13 additions & 13 deletions apis/README.md → api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ The oSparc platform uses the following standards:
## Folder structure

```bash
/apis/ # base folder
/apis/director/ # service name folder (e.g. for director service)
/apis/director/v0/ # service version (v0 for development, then v1, v2... only major)
/apis/director/v0/openapi.yaml # openapi specifications in YAML
/apis/director/v0/schemas/ # schemas only used by the director API
/apis/director/v0/schemas/services.yaml # openapi encoded service only schema

/apis/shared/ # shared apis/schemas base folder
/apis/shared/schemas/ # sub folder for schemas
/apis/shared/schemas/health_check.yaml # openapi encoded shared schema
/apis/shared/schemas/node-meta.json # jsonschema encoded shared schema
/apis/shared/schemas/v1/error.yaml # openapi encoded shaared schema for version 1
/apis/shared/schemas/v2/error.yaml # openapi encoded shaared schema for version 2
/api/specs/ # base folder
/api/specs/director/ # service name folder (e.g. for director service)
/api/specs/director/v0/ # service version (v0 for development, then v1, v2... only major)
/api/specs/director/v0/openapi.yaml # openapi specifications in YAML
/api/specs/director/v0/schemas/ # schemas only used by the director API
/api/specs/director/v0/schemas/services.yaml # openapi encoded service only schema

/api/specs/shared/ # shared api/specs/schemas base folder
/api/specs/shared/schemas/ # sub folder for schemas
/api/specs/shared/schemas/health_check.yaml # openapi encoded shared schema
/api/specs/shared/schemas/node-meta.json # jsonschema encoded shared schema
/api/specs/shared/schemas/v1/error.yaml # openapi encoded shaared schema for version 1
/api/specs/shared/schemas/v2/error.yaml # openapi encoded shaared schema for version 2

/tests/ # python tests folder to check schemas validity
/tests/requirements.txt # requirements for python tests
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
$schema: http://json-schema.org/draft-07/schema#
$id: https://simcore.io/apis/shared/schemas/node-output-list-api-v0.0.1.yaml
$id: https://simcore.io/api/specs/shared/schemas/node-output-list-api-v0.0.1.yaml

title: node output list api
description: nodes using the list representation for the output
must be able to handle the following requests
type: object
required:
required:
# the validator does not appreciate when required is missing here... and
# sadly does not throw any meaningful error about it... so for now I put this...
- getItemList
Expand Down
74 changes: 74 additions & 0 deletions api/specs/webserver/v0/components/schemas/error.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
ErrorEnveloped:
# - notice that data is defaulted to null
#
type: object
required:
- data
- error
properties:
data:
nullable: true
default: null
error:
$ref: "#/ErrorType"



ErrorType:
# - Normally transmitted as a response from server to client
# - can exchage log messages between server and client. Possible applications:
# - e.g. client side can render a widget to display messages logged to 'user'
# - contains meta-information to allow client programatically understand the error. Possible applications:
# - e.g. metadata can serialize an exception in server that can be reproduced in client side
#
type: object
properties:
logs:
description: log messages
type: array
items:
$ref: './log_message.yaml#/LogMessageType'
errors:
description: errors metadata
type: array
items:
$ref: '#/ErrorItemType'
status:
description: HTTP error code
type: integer
example:
BadRequestError:
logs:
- message: 'Requested information is incomplete or malformed'
level: ERROR
- message: 'Invalid email and password'
level: ERROR
logger: USER
errors:
- code: "InvalidEmail"
message: "Email is malformed"
field: email
- code: "UnsavePassword"
message: "Password is not secure"
field: pasword
status: 400


ErrorItemType:
type: object
required:
- code
- message
properties:
code:
type: string
description: Typically the name of the exception that produced it otherwise some known error code
message:
type: string
description: Error message specific to this item
resource:
type: string
description: API resource affected by this error
field:
type: string
description: Specific field within the resource
36 changes: 36 additions & 0 deletions api/specs/webserver/v0/components/schemas/fake.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FakeEnveloped:
type: object
required:
- data
- error
properties:
data:
$ref: '#/FakeType'
nullable: true
default: null
error:
$ref: "./error.yaml#/ErrorType"
nullable: true
default: null

FakeType:
type: object
required:
- path_value
- query_value
- body_value
properties:
path_value:
type: string
query_value:
type: string
body_value:
type: object
additionalProperties:
type: string
example:
path_value: foo
query_value: bar
body_value:
key1: value1
key2: value2
32 changes: 32 additions & 0 deletions api/specs/webserver/v0/components/schemas/health_check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
HealthCheckEnveloped:
type: object
required:
- data
- error
properties:
data:
$ref: '#/HealthCheckType'
nullable: true
default: null
error:
$ref: "./error.yaml#/ErrorType"
nullable: true
default: null


HealthCheckType:
type: object
properties:
name:
type: string
status:
type: string
api_version:
type: string
version:
type: string
example:
name: 'simcore-director-service'
status: SERVICE_RUNNING
api_version: 0.1.0-dev+NJuzzD9S
version: 0.1.0-dev+N127Mfv9H
44 changes: 44 additions & 0 deletions api/specs/webserver/v0/components/schemas/log_message.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
LogMessageEnveloped:
type: object
required:
- data
- error
properties:
data:
$ref: "#/LogMessageType"
nullable: true
default: null
error:
$ref: "./error.yaml#/ErrorType"
nullable: true
default: null


LogMessageType:
# - logger can be use as a way for the client to filter messages.
# - E.g. logger naming can be hierarchical, and all including "*.user.*"
# are displayed as a flash message in the front-end
#
type: object
properties:
level:
description: log level
type: string
default: INFO
enum:
- DEBUG
- WARNING
- INFO
- ERROR
message:
description: log message. If logger is USER, then it MUST be human readable
type: string
logger:
description: name of the logger receiving this message
type: string
required:
- message
example:
message: 'Hi there, Mr user'
level: INFO
logger: user-logger
28 changes: 28 additions & 0 deletions api/specs/webserver/v0/components/schemas/login.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
LoginEnveloped:
type: object
required:
- data
- error
properties:
data:
$ref: '#/LoginFormType'
nullable: true
default: null
error:
$ref: "./error.yaml#/ErrorType"
nullable: true
default: null


LoginFormType:
type: object
properties:
email:
type: string
#FIXME: format: email
password:
type: string
#FIXME: format: password
example:
email: [email protected]
password: 'my secret'
36 changes: 36 additions & 0 deletions api/specs/webserver/v0/components/schemas/registration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
RegistrationEnveloped:
type: object
required:
- data
- error
properties:
data:
$ref: '#/RegistrationType'
nullable: true
default: null
error:
$ref: "./error.yaml#/ErrorType"
nullable: true
default: null


RegistrationType:
type: object
properties:
email:
type: string
#FIXME: 'error': {'logs': [], 'errors': [{'code': 'OpenAPISchemaError', 'message': 'Unsupported email format unmarshalling', 'resource': None, 'field': None}], 'status': 400}}
#format: email
password:
type: string
# TODO: File "/home/crespo/devp/osparc-simcore/.venv/lib/python3.6/site-packages/openapi_core/schema/schemas/models.py", line 182, in _unmarshal_string
# formatter = self.STRING_FORMAT_CAST_CALLABLE_GETTER[schema_format]
# KeyError: <SchemaFormat.PASSWORD: 'password'>
#format: password
confirm:
type: string
#format: password
example:
email: [email protected]
password: 'my secret'
confim: 'my secret'
Loading